blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33c13a0f8280bb26761d433d9e8fd6c16524ad72 | 426be981352881138c26492c0cdc1107a9c0afa4 | /x-ees-mirp/src/quote_datatype_level1.h | 0fcf6688577a9678125083f8d09e327f268f11e3 | [] | no_license | OverfittingStudyRoom/x-trader | 491910f7284913330c4afac767c3c00893a9b9ba | 247d1043bbb98ee7d53b5de447904ebde186093c | refs/heads/master | 2023-03-31T13:01:38.097797 | 2020-03-12T12:29:37 | 2020-03-12T12:29:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,408 | h | quote_datatype_level1.h | #pragma once
#include "ThostFtdcMdApi.h"
#ifndef DLL_PUBLIC
#define DLL_PUBLIC __attribute__ ((visibility("default")))
#endif
#include <string>
#pragma pack(push)
#pragma pack(8)
///深度市场行情(一档行情结构)
struct DLL_PUBLIC CDepthMarketDataField
{
///交易日
char TradingDay[9];
///结算组代码
char SettlementGroupID[9];
///结算编号
int SettlementID;
///最新价
double LastPrice;
///昨结算
double PreSettlementPrice;
///昨收盘
double PreClosePrice;
///昨持仓量
double PreOpenInterest;
///今开盘
double OpenPrice;
///最高价
double HighestPrice;
///最低价
double LowestPrice;
///数量
int Volume;
///成交金额
double Turnover;
///持仓量
double OpenInterest;
///今收盘
double ClosePrice;
///今结算
double SettlementPrice;
///涨停板价
double UpperLimitPrice;
///跌停板价
double LowerLimitPrice;
///昨虚实度
double PreDelta;
///今虚实度
double CurrDelta;
///最后修改时间
char UpdateTime[9];
///最后修改毫秒
int UpdateMillisec;
///合约代码
char InstrumentID[31];
///申买价一
double BidPrice1;
///申买量一
int BidVolume1;
///申卖价一
double AskPrice1;
///申卖量一
int AskVolume1;
///申买价二
double BidPrice2;
///申买量二
int BidVolume2;
///申卖价二
double AskPrice2;
///申卖量二
int AskVolume2;
///申买价三
double BidPrice3;
///申买量三
int BidVolume3;
///申卖价三
double AskPrice3;
///申卖量三
int AskVolume3;
///申买价四
double BidPrice4;
///申买量四
int BidVolume4;
///申卖价四
double AskPrice4;
///申卖量四
int AskVolume4;
///申买价五
double BidPrice5;
///申买量五
int BidVolume5;
///申卖价五
double AskPrice5;
///申卖量五
int AskVolume5;
///业务发生日期
char ActionDay[9];
// HH:MM:SS.mmm
std::string GetQuoteTime() const
{
char buf[64];
sprintf(buf, "%s.%03d", UpdateTime, UpdateMillisec);
return std::string(buf);
}
};
#pragma pack(pop)
class ShfeLev2Formater
{
public:
/*
* 对source指定的行情数据进行格式化后存储到dest
*/
static char* Format(CThostFtdcDepthMarketDataField&source,char *dest)
{
sprintf (dest,
"CThostFtdcDepthMarketDataField "
"InstrumentID:%s; "
"UpdateTime[9]:%s; "
"UpdateMillisec:%d; "
"TradingDay:%s; "
"LastPrice:%f; "
"PreSettlementPrice:%f; "
"PreClosePrice:%f; "
"PreOpenInterest:%f; "
"OpenPrice:%f; "
"HighestPrice:%f; "
"LowestPrice:%f; "
"Volume:%d; "
"Turnover:%f; "
"OpenInterest:%f; "
"ClosePrice:%f; "
"SettlementPrice:%f; "
"UpperLimitPrice:%f; "
"LowerLimitPrice:%f; "
"PreDelta:%f; "
"CurrDelta:%f; "
"BidPrice1:%f; "
"BidVolume1:%d; "
"AskPrice1:%f; "
"AskVolume1:%d; "
"BidPrice2:%f; "
"BidVolume2:%d; "
"AskPrice2:%f; "
"AskVolume2:%d; "
"BidPrice3:%f; "
"BidVolume3:%d; "
"AskPrice3:%f; "
"AskVolume3:%d; "
"BidPrice4:%f; "
"BidVolume4:%d; "
"AskPrice4:%f; "
"AskVolume4:%d; "
"BidPrice5:%f; "
"BidVolume5:%d; "
"AskPrice5:%f; "
"AskVolume5:%d; "
"ActionDay:%s;",
source.InstrumentID,
source.UpdateTime,
source.UpdateMillisec,
source.TradingDay,
source.LastPrice,
source.PreSettlementPrice,
source. PreClosePrice,
source.PreOpenInterest,
source.OpenPrice,
source. HighestPrice,
source. LowestPrice,
source.Volume,
source.Turnover,
source.OpenInterest,
source.ClosePrice,
source.SettlementPrice,
source.UpperLimitPrice,
source.LowerLimitPrice,
source.PreDelta,
source.CurrDelta,
source.BidPrice1,
source.BidVolume1,
source.AskPrice1,
source.AskVolume1,
source.BidPrice2,
source.BidVolume2,
source.AskPrice2,
source.AskVolume2,
source.BidPrice3,
source.BidVolume3,
source.AskPrice3,
source.AskVolume3,
source.BidPrice4,
source.BidVolume4,
source.AskPrice4,
source.AskVolume4,
source.BidPrice5,
source.BidVolume5,
source.AskPrice5,
source.AskVolume5,
source.ActionDay);
return dest;
}
/*
* 对source指定的行情数据进行格式化后存储到dest
*/
static char* Format(CDepthMarketDataField &source, char *dest)
{
sprintf (dest,
"CDepthMarketDataField "
"InstrumentID:%s; "
"UpdateTime[9]:%s; "
"UpdateMillisec:%d; "
"TradingDay:%s; "
"LastPrice:%f; "
"PreSettlementPrice:%f; "
"PreClosePrice:%f; "
"PreOpenInterest:%f; "
"OpenPrice:%f; "
"HighestPrice:%f; "
"LowestPrice:%f; "
"Volume:%d; "
"Turnover:%f; "
"OpenInterest:%f; "
"ClosePrice:%f; "
"SettlementPrice:%f; "
"UpperLimitPrice:%f; "
"LowerLimitPrice:%f; "
"PreDelta:%f; "
"CurrDelta:%f; "
"BidPrice1:%f; "
"BidVolume1:%d; "
"AskPrice1:%f; "
"AskVolume1:%d; "
"BidPrice2:%f; "
"BidVolume2:%d; "
"AskPrice2:%f; "
"AskVolume2:%d; "
"BidPrice3:%f; "
"BidVolume3:%d; "
"AskPrice3:%f; "
"AskVolume3:%d; "
"BidPrice4:%f; "
"BidVolume4:%d; "
"AskPrice4:%f; "
"AskVolume4:%d; "
"BidPrice5:%f; "
"BidVolume5:%d; "
"AskPrice5:%f; "
"AskVolume5:%d; "
"ActionDay:%s;",
source.InstrumentID,
source.UpdateTime,
source.UpdateMillisec,
source.TradingDay,
source.LastPrice,
source.PreSettlementPrice,
source. PreClosePrice,
source.PreOpenInterest,
source.OpenPrice,
source. HighestPrice,
source. LowestPrice,
source.Volume,
source.Turnover,
source.OpenInterest,
source.ClosePrice,
source.SettlementPrice,
source.UpperLimitPrice,
source.LowerLimitPrice,
source.PreDelta,
source.CurrDelta,
source.BidPrice1,
source.BidVolume1,
source.AskPrice1,
source.AskVolume1,
source.BidPrice2,
source.BidVolume2,
source.AskPrice2,
source.AskVolume2,
source.BidPrice3,
source.BidVolume3,
source.AskPrice3,
source.AskVolume3,
source.BidPrice4,
source.BidVolume4,
source.AskPrice4,
source.AskVolume4,
source.BidPrice5,
source.BidVolume5,
source.AskPrice5,
source.AskVolume5,
source.ActionDay);
return dest;
}
};
|
060328a720cd6ad37099696d2aabd8e65d7a977b | 793c8848753f530aab28076a4077deac815af5ac | /src/dskphone/uilogic/settinguilogic/src/statuscontroller.cpp | af4bdac201a233a97bbc5ba1c86950e7d78d0a6d | [] | no_license | Parantido/sipphone | 4c1b9b18a7a6e478514fe0aadb79335e734bc016 | f402efb088bb42900867608cc9ccf15d9b946d7d | refs/heads/master | 2021-09-10T20:12:36.553640 | 2018-03-30T12:44:13 | 2018-03-30T12:44:13 | 263,628,242 | 1 | 0 | null | 2020-05-13T12:49:19 | 2020-05-13T12:49:18 | null | UTF-8 | C++ | false | false | 6,766 | cpp | statuscontroller.cpp | #include "statuscontroller.h"
#include "account/include/modaccount.h"
#include "settinguilogic/include/common.h"
#include "devicelib/networkserver.h"
#include "ETLLib.hpp"
//////////////////////////////////////////////////////////////////////////
// Class CStatusController.
CStatusController * CStatusController::m_pStatusController = NULL;
CStatusController * CStatusController::GetInstance()
{
// Instantiates the singleton instance if not exists.
if (NULL == m_pStatusController)
{
m_pStatusController = new CStatusController();
}
return m_pStatusController;
}
void CStatusController::ReleaseInstance()
{
// Release the singleton instance if exists.
if (NULL != m_pStatusController)
{
delete m_pStatusController;
m_pStatusController = NULL;
}
}
bool CStatusController::GetPhoneStatusData(PhoneStatusData * pData) const
{
if (NULL == pData)
{
return false;
}
// Call model's method.
pData->m_strModel = GetModel();
pData->m_strProductId = GetProductId();
#if IF_MAC_SEPARATE_BY_COLON
pData->m_strMac = netGetMACText(':');
#else
pData->m_strMac = netGetMACText('-');
#endif
pData->m_strHardWare = GetHardWare();
pData->m_strFirmWare = GetFirmware();
#ifdef IF_SUPPORT_WIFI
pData->m_strWifiMac = configParser_GetConfigString(kszWifiAdapterMac);
#endif
#ifdef IF_SUPPORT_BLUETOOTH
pData->m_strBluetoothMac = configParser_GetConfigString(kszBluetoothAdapterMac);
#endif
return true;
}
bool CStatusController::GetPhoneNetworkStatus(PhoneNetworkStatusData * pNetworkData) const
{
if (IPAM_IPV6 == netGetNetworkMode())
{
return GetPhoneIPv6NetworkStatus(pNetworkData);
}
else
{
return GetPhoneIPv4NetworkStatus(pNetworkData);
}
}
// Get phone network status.
// | pNetworkData | is the network status data retrieved.
// Returns true if retrieved successfully, otherwise returns false.
bool CStatusController::GetPhoneIPv4NetworkStatus(PhoneNetworkStatusData * pNetworkData) const
{
if (NULL == pNetworkData)
{
return false;
}
// Get phone network status.
switch (netGetNetworkType())
{
case WPT_DHCP:
pNetworkData->m_iWanType = WAN_DHCP;
break;
case WPT_PPPOE:
pNetworkData->m_iWanType = WAN_PPPOE;
break;
case WPT_STATIC_IP:
pNetworkData->m_iWanType = WAN_STATIC;
break;
default:
pNetworkData->m_iWanType = WAN_TYPE_NONE;
break;
}
yl::string strTmp;
strTmp.clear();
netGetLocalIPv4(strTmp);
pNetworkData->m_strWanIP = strTmp;
strTmp.clear();
netGetWanNetmaskIPv4(strTmp);
pNetworkData->m_strWanMask = strTmp;
strTmp.clear();
netGetWanGatewayIPv4(strTmp);
pNetworkData->m_strGateway = strTmp;
strTmp.clear();
netGetWanPrimaryDNSIPv4(strTmp);
pNetworkData->m_strDnsPrimary = strTmp;
strTmp.clear();
netGetWanSecondaryDNSIPv4(strTmp);
pNetworkData->m_strDnsSecond = strTmp;
#ifdef IF_SUPPORT_WIFI
pNetworkData->m_strWifiMac = configParser_GetConfigString(kszWifiAdapterMac);
#endif
return true;
}
bool CStatusController::GetPhoneIPv6NetworkStatus(PhoneNetworkStatusData * pNetworkData) const
{
if (NULL == pNetworkData)
{
return false;
}
// Get phone network status.
switch (netGetIPv6Type())
{
case W6PT_INVALID:
case W6PT_DHCP:
pNetworkData->m_iWanType = WAN_DHCP;
break;
case W6PT_Static_IP:
pNetworkData->m_iWanType = WAN_STATIC;
break;
default:
// 从网络读取-1,网络处暂没有处理默认值,所以,-1时也设置为DHCP
// Bug: http://10.2.1.199/Bug.php?BugID=45202
pNetworkData->m_iWanType = WAN_TYPE_NONE;
//pNetworkData->m_eWanType = WAN_TYPE_NONE;
break;
}
yl::string strIPv6StatusInfo;
yl::string strPrefix;
yl::string strTmp;
strTmp.clear();
netGetWanPrefixIPv6(strPrefix);
pNetworkData->m_strPrefix = strPrefix;
strTmp.clear();
netGetLocalIPv6(strTmp);
strIPv6StatusInfo = strTmp + "/" + strPrefix;
pNetworkData->m_strWanIP = strIPv6StatusInfo;
pNetworkData->m_strWanMask = "";
strTmp.clear();
netGetWanGatewayIPv6(strTmp);
strIPv6StatusInfo = strTmp + "/" + strPrefix;
pNetworkData->m_strGateway = strIPv6StatusInfo;
strTmp.clear();
netGetWanPrimaryDNSIPv6(strTmp);
pNetworkData->m_strDnsPrimary = strTmp;
strTmp.clear();
netGetWanSecondaryDNSIPv6(strTmp);
pNetworkData->m_strDnsSecond = strTmp;
#ifdef IF_SUPPORT_WIFI
pNetworkData->m_strWifiMac = configParser_GetConfigString(kszWifiAdapterMac);
#endif
return true;
}
bool CStatusController::GetPhoneAccountStatus(AccountStatusListData * pData)
{
if (pData == NULL)
{
return false;
}
// 从Account模块获取账号列表.
AccountStatusData stASD;
int iAccountNum = acc_AccountNum();
for (int i = 0; i < iAccountNum; i++)
{
stASD.Reset();
int nAccountId = i;
//http://10.2.1.199/Bug.php?BugID=99826 统一通过接口acc_GetAccountShowText获取显示
stASD.m_strAccountName = acc_GetAccountShowText(nAccountId);
stASD.m_nStatus = (int)acc_GetState(nAccountId);
stASD.m_nID = nAccountId;
pData->m_listStatus.push_back(stASD);
}
return true;
}
//////////////////////////////////////////////////////////////////////////
const yl::string CStatusController::GetModel() const
{
yl::string strModel;
char bufProductName[512] = { 0 };
sys_replace_wildcards((char*)configParser_GetConfigString(kszProductName).c_str(), 0,
bufProductName, sizeof(bufProductName) / sizeof(char));
strModel = bufProductName;
return strModel;
}
const yl::string CStatusController::GetHardWare() const
{
// Read phone hardware value.
return devicelib_GetHardwareVersion();
}
const yl::string CStatusController::GetFirmware() const
{
// Read phone firmware value.
char szFirmware[32] = { 0 };
yl::string strFirmware = "";
#ifndef WIN32
if (0 == sys_get_sw_version(szFirmware, 32))
#endif
{
strFirmware = szFirmware;
}
return strFirmware;
}
const yl::string CStatusController::GetProductId() const
{
// Read phone product Id.
char buf[128];
sys_get_rom_info(SYS_ROM_INFO_PACKED_TIME, buf, 128);
yl::string strProductId(buf);
strProductId.replace("-", "");
strProductId.replace(":", "");
strProductId.replace(" ", "");
strProductId = commonAPI_TrimString(strProductId, "CST");
return strProductId;
}
CStatusController::CStatusController()
{
}
CStatusController::~CStatusController()
{
}
|
8a1aac66d218fbda4b6920e179f29e639649c645 | 63034bc825d4c0b3a1ea6acb825f79f01b01a32f | /ndb/command/command_server.cc | 975607b1bb40b1fc2e0c3c0036014ce94d8b056f | [] | no_license | hpplinux/ndb | 4285d7186ad6464dca16afb36dd93bfe2ac8224e | 21bb6c0ce6ac5669dfc5f52a84d66334402c0ba5 | refs/heads/master | 2021-01-13T03:18:45.822888 | 2016-07-18T08:16:35 | 2016-07-18T08:16:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,056 | cc | command_server.cc | #include "ndb/ndb.h"
namespace ndb {
// PING
Response CommandPING(const Request& request) {
return Response::PONG();
}
// ECHO message
Response CommandECHO(const Request& request) {
return Response::Bulk(request.args(1));
}
// INFO section [name]
Response CommandINFO(const Request& request) {
auto name = request.args(1).c_str();
Stats stats;
if (strcasecmp(name, "engine") == 0) {
if (request.argc() == 2) {
stats = ndb->engine->GetStats();
} else {
auto ns = NDB_TRY_GETNS(request.args(2));
stats = ns->GetStats();
}
} else if (strcasecmp(name, "backup") == 0) {
stats = ndb->engine->GetBackup()->GetStats();
} else if (strcasecmp(name, "server") == 0) {
stats = ndb->server->GetStats();
} else if (strcasecmp(name, "replica") == 0) {
stats = ndb->replica->GetStats();
} else if (strcasecmp(name, "command") == 0) {
if (request.argc() == 2) {
stats = ndb->command->GetStats();
} else {
auto cmd = stoupper(request.args(2));
stats = ndb->command->GetStats(cmd);
}
} else if (strcasecmp(name, "nsstats") == 0) {
if (request.argc() == 2) {
stats = nsstats.GetStats();
} else {
stats = nsstats.GetStats(request.args(2));
}
} else {
return Response::InvalidArgument();
}
std::string info;
info.append("# ");
info.append(name);
info.append("\r\n");
info.append(stats.Print());
return Response::Bulk(info);
}
// BACKUP backup
Response CommandBACKUP(const Request& request) {
auto dbname = request.args(1).c_str();
auto backup = ndb->engine->GetBackup();
if (strcasecmp(dbname, "STOP") == 0) {
backup->Stop();
return Response::OK();
}
return backup->Create(dbname);
}
// COMPACT namespace begin end
Response CommandCOMPACT(const Request& request) {
auto ns = NDB_TRY_GETNS(request.args(1));
Slice begin, end;
if (request.argc() >= 3) begin = request.args(2);
if (request.argc() >= 4) end = request.args(3);
return ns->CompactRange(begin, end);
}
// SLOWLOG [LEN|GET] [count]
Response CommandSLOWLOG(const Request& request) {
auto slowlogs = ndb->command->GetSlowlogs();
auto name = request.args(1).c_str();
if (strcasecmp(name, "LEN") == 0) {
return Response::Int(slowlogs.size());
}
if (strcasecmp(name, "GET") == 0) {
uint64_t count = slowlogs.size();
if (request.argc() == 3) {
if (!ParseUint64(request.args(2), &count)) {
return Response::InvalidArgument();
}
if (count > slowlogs.size()) count = slowlogs.size();
}
auto res = Response::Size(count);
for (auto it = slowlogs.begin(); it != slowlogs.end(); it++, count--) {
if (count <= 0) break;
res.AppendSize(4);
res.AppendInt(it->id);
res.AppendInt(it->timestamp);
res.AppendInt(it->usecs);
res.AppendBulks(it->request.args());
}
return res;
}
return Response::InvalidArgument();
}
// SHUTDOWN
Response CommandSHUTDOWN(const Request& request) {
kill(getpid(), SIGQUIT);
return Response::OK();
}
} // namespace ndb
|
b771c16c151b71a78793f92232a709cb300f64b8 | ccabc8d03043e9ce55259a7cd3503139aac3e272 | /protocol/game.pb.cc | edb5fb0b5fbfcc784509d59e9c07c0a7da3a7c42 | [] | no_license | lw000/nanomsg_libevent_demo | adedc7f415d2dcd73481667f8a797166604f31bb | 7c93cd9e1d5d339d1498192db70a0f8562666b6c | refs/heads/master | 2021-01-23T20:00:09.214262 | 2017-11-17T14:00:39 | 2017-11-17T14:00:39 | 102,843,053 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | true | 2,837 | cc | game.pb.cc | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: game.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "game.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace msg {
namespace {
} // namespace
void protobuf_AssignDesc_game_2eproto() GOOGLE_ATTRIBUTE_COLD;
void protobuf_AssignDesc_game_2eproto() {
protobuf_AddDesc_game_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"game.proto");
GOOGLE_CHECK(file != NULL);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_game_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
}
} // namespace
void protobuf_ShutdownFile_game_2eproto() {
}
void protobuf_InitDefaults_game_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_InitDefaults_game_2eproto_once_);
void protobuf_InitDefaults_game_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_InitDefaults_game_2eproto_once_,
&protobuf_InitDefaults_game_2eproto_impl);
}
void protobuf_AddDesc_game_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
protobuf_InitDefaults_game_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\ngame.proto\022\003msgb\006proto3", 25);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"game.proto", &protobuf_RegisterTypes);
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_game_2eproto);
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_game_2eproto_once_);
void protobuf_AddDesc_game_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_game_2eproto_once_,
&protobuf_AddDesc_game_2eproto_impl);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_game_2eproto {
StaticDescriptorInitializer_game_2eproto() {
protobuf_AddDesc_game_2eproto();
}
} static_descriptor_initializer_game_2eproto_;
// @@protoc_insertion_point(namespace_scope)
} // namespace msg
// @@protoc_insertion_point(global_scope)
|
b1043c1a972f59db0e5803b3ecdbabc084485d65 | 1a2190b96ca17719d2b41a5fbcac6043cf9f08e4 | /HackerRank/Week of Code - 27/zero-move-nim.cpp | 53bcf4400da9feda6643f6c1d2ed99d348369feb | [] | no_license | eliasm2/problem-solving | 13c1abbf397bb41683fccb3490b0113c36ce9010 | 15becf49315b5defb8c1267e0c43ce1579dcae1a | refs/heads/master | 2020-09-07T07:12:17.112311 | 2018-07-20T17:27:43 | 2018-07-20T17:27:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 452 | cpp | zero-move-nim.cpp | #include <bits/stdc++.h>
typedef long long int64;
typedef unsigned long long uint64;
using namespace std;
int main(int argc, char* argv[]) {
ios::sync_with_stdio(false);
int g;
cin >> g;
while (g--) {
int n; cin >> n;
int p, xr = 0;
for (int i = 0; i < n; ++i) {
cin >> p;
if (p & 1) {
p++;
} else {
p--;
}
xr ^= p;
}
cout << (xr ? "W" : "L") << "\n";
}
return 0;
}
|
b6505f0c4002cca0262bd7e5e919bb72df12a2c8 | 0bb99bb47f5f4d009d8edfc41954488cd0ccc1e5 | /Modeling and Simulation/RandomNumbersAndDistibutions/RandomNumbersAndDistibutions/Generator.cpp | 913ce3aaef8f2bb6abff744f70fcbc8104062ee0 | [] | no_license | AlinCioabla/University-Projects | 28645c0f14ffd2f8cc2f00198d425e17820dd93e | 54ca10a20f23464c77951a8d087ee1d7f7d585f2 | refs/heads/master | 2021-10-11T01:31:10.409500 | 2019-01-20T21:07:24 | 2019-01-20T21:07:24 | 112,228,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | cpp | Generator.cpp | #include "stdafx.h"
#include "Generator.h"
unsigned int Generator::NumberOfDigits(const unsigned long long int aNumber)
{
if (!aNumber)
return 1;
auto temp = aNumber;
auto numberOfDigits = 0;
while (temp)
{
temp /= 10;
numberOfDigits++;
}
return numberOfDigits;
}
float Generator::SubUnitar(const long long int aNumber)
{
return aNumber / pow(10, NumberOfDigits(aNumber));
} |
8b21c0b0949170479330ab3c5133ece68ffc679e | d61e718eb470faef3f422280f825127729cac901 | /Template/Template of Other Teams/lbn/cpp/4.4.2.3.cpp | 8f5ac7593824a00fb0df1127c46d3e75790cf198 | [] | no_license | sjtu-imperishable-night/code-library | 737e871ad5287fd52a596902b32f07ce56563a78 | 0818f507c76b534f9144ed9b64bc138c37b30c5e | refs/heads/master | 2020-06-24T15:43:25.051083 | 2020-04-27T11:43:26 | 2020-04-27T11:43:26 | 199,004,542 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 199 | cpp | 4.4.2.3.cpp | void dp(int l,int r,int _l,int _r){
if(l>r)return;
int md=l+r>>1,u=_l;
for(int i=_l;i<=min(_r,md);i++)
if(g[i-1]+get(i,md)<f[md])f[md]=g[i-1]+get(i,md),u=i;
dp(l,md-1,_l,u);dp(md+1,r,u,_r);
}
|
c3c68da218bfb55ca53b3b226842c4b034e2113b | c66535a970695d664cf37de7161dc4706fad23b6 | /src/LSST/M1M3/SS/FPGA/SimulatedFPGA.cpp | 721dc959229b4ed60765ef75ddf60631c26f5e40 | [
"MIT"
] | permissive | lsst-ts/ts_m1m3support | 842d031d2d351b3875075404ad9d7a6253ab4350 | ec5993611d2606fc692515671a56e4f842e3f79e | refs/heads/main | 2023-08-31T03:47:18.574773 | 2023-07-26T18:57:49 | 2023-07-26T18:57:49 | 146,036,332 | 0 | 3 | null | 2023-09-10T20:52:24 | 2018-08-24T20:22:00 | C++ | UTF-8 | C++ | false | false | 52,523 | cpp | SimulatedFPGA.cpp | /*
* This file is part of LSST M1M3 support system package.
*
* Developed for the Vera C. Rubin Telescope and Site System.
* This product includes software developed by the LSST Project
* (https://www.lsst.org).
* See the COPYRIGHT file at the top-level directory of this distribution
* for details of code ownership.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <cstdlib>
#include <cstring>
#include <thread>
#include <unistd.h>
#include <spdlog/spdlog.h>
#include <SAL_MTM1M3C.h>
#include <SAL_MTMountC.h>
#include <AirSupplyStatus.h>
#include <AccelerometerSettings.h>
#include <CRC.h>
#include <ForceActuatorSettings.h>
#include <FPGAAddresses.h>
#include <M1M3SSPublisher.h>
#include <SettingReader.h>
#include <SimulatedFPGA.h>
#include <Timestamp.h>
#include <Units.h>
using namespace LSST::M1M3::SS;
using namespace LSST::M1M3::SS::FPGAAddresses;
using namespace std::chrono_literals;
// simulate 1 degree per second (there are 50 loops runs per second)
const float MOUNT_SIMULATION_STEP = 1 / 50.0;
// Gyroscope simulated velocity change. Same time unit as MOUNT_SIMULATION_STEP. Reach roughly max +-6
// deg/sec.
const float GYRO_SIMULATE_STEP = D2RAD / 375.0;
// Accelerometers simulated acceleration change. Same time unit as MOUNT_SIMULATION_STEP. Reach roughly +-6
// deg/sec.
const float ACCEL_SIMULATED_STEP = D2RAD / 374.0;
// Mount data are valid for 20 seconds in simulation, before simulated mount movement takes over
#define MOUNT_VALIDITY 20s
/**
* Return data writen to modbus. The data are right shifted by 1 to allow for
* signaling data end. See FPGA code for details.
*/
uint8_t _readModbus(uint16_t data) { return (data >> 1) & 0xFF; }
// HP encoder limits
int32_t _HPEncoderLow[HP_COUNT] = {-10, -102, -43, -56, -78, 45};
int32_t _HPEncoderHigh[HP_COUNT] = {65432, 66435, 60324, 67543, 61345, 63245};
double LSST::M1M3::SS::getRndPM1() { return static_cast<double>(rand()) / (RAND_MAX / 2.0) - 1.0; }
SimulatedFPGA::SimulatedFPGA() {
SPDLOG_INFO("SimulatedFPGA: SimulatedFPGA()");
_lastRequest = -1;
memset(&supportFPGAData, 0, sizeof(SupportFPGAData));
_mountElevationValidTo = chrono::steady_clock::now();
_simulatingToHorizon = true;
supportFPGAData.DigitalInputStates =
0x0001 | 0x0002 | 0x0008 | DigitalOutputs::AirCommandOutputOn | 0x0040 | 0x0080;
supportFPGAData.GyroRawX = 0;
supportFPGAData.GyroRawY = 0;
supportFPGAData.GyroRawZ = 0;
_mgrMTMount = SAL_MTMount();
_mgrMTMount.salTelemetrySub(const_cast<char*>("MTMount_elevation"));
_monitorMountElevationThread = std::thread(&SimulatedFPGA::_monitorElevation, this);
_hardpointActuatorData = M1M3SSPublisher::instance().getHardpointActuatorData();
_hardpointActuatorData->encoder[0] = 15137;
_hardpointActuatorData->encoder[1] = 20079;
_hardpointActuatorData->encoder[2] = 26384;
_hardpointActuatorData->encoder[3] = 27424;
_hardpointActuatorData->encoder[4] = 17560;
_hardpointActuatorData->encoder[5] = 23546;
_sendResponse = true;
_nextClock = std::chrono::steady_clock::now();
_lastAirOpen = _nextClock;
}
SimulatedFPGA::~SimulatedFPGA() {
_exitThread = true;
_monitorMountElevationThread.join();
_mgrMTMount.salShutdown();
}
void SimulatedFPGA::initialize() { SPDLOG_DEBUG("SimulatedFPGA: initialize()"); }
void SimulatedFPGA::open() { SPDLOG_DEBUG("SimulatedFPGA: open()"); }
void SimulatedFPGA::close() { SPDLOG_DEBUG("SimulatedFPGA: close()"); }
void SimulatedFPGA::finalize() { SPDLOG_DEBUG("SimulatedFPGA: finalize()"); }
void SimulatedFPGA::waitForOuterLoopClock(uint32_t timeout) {
std::this_thread::sleep_until(_nextClock);
_nextClock += std::chrono::milliseconds(20);
}
void SimulatedFPGA::ackOuterLoopClock() {}
void SimulatedFPGA::waitForPPS(uint32_t timeout) { std::this_thread::sleep_for(std::chrono::seconds(1)); }
void SimulatedFPGA::ackPPS() {}
void SimulatedFPGA::waitForModbusIRQ(int32_t subnet, uint32_t timeout) {}
void SimulatedFPGA::ackModbusIRQ(int32_t subnet) {}
void SimulatedFPGA::pullTelemetry() {
SPDLOG_TRACE("SimulatedFPGA: pullTelemetry()");
uint64_t timestamp = Timestamp::toRaw(M1M3SSPublisher::instance().getTimestamp());
supportFPGAData.Reserved = 0;
supportFPGAData.InclinometerTxBytes = 0;
supportFPGAData.InclinometerRxBytes = 0;
supportFPGAData.InclinometerTxFrames = 0;
supportFPGAData.InclinometerRxFrames = 0;
supportFPGAData.InclinometerErrorTimestamp = 0;
supportFPGAData.InclinometerErrorCode = 0;
supportFPGAData.InclinometerSampleTimestamp = timestamp;
// Inclinometer raw value is measured as (negative) zenith angle (0 = zenith, -90 = horizon).
// Converts elevation to zenith angle and adds random 1/200th deg (=18 arcsec) noise.
// Also simulates gyroscope values
{
std::lock_guard<std::mutex> lock_g(_elevationReadWriteLock);
supportFPGAData.InclinometerAngleRaw =
(int32_t)((_mountElevation - 90.0) * 1000.0) + (getRndPM1() * 5.0);
switch (M1M3SSPublisher::instance().getEventDetailedState()->detailedState) {
case MTM1M3::MTM1M3_shared_DetailedStates_ActiveEngineeringState:
if (chrono::steady_clock::now() > _mountElevationValidTo) {
if (_mountSimulatedMovementFirstPass) {
SPDLOG_INFO("Starting to simulate mirror movement");
_mountSimulatedMovementFirstPass = false;
if (ForceActuatorSettings::instance().useGyroscope == true) {
double gyroRatio = (_mountElevation - 45.0) / 90.0;
supportFPGAData.GyroRawX = -12 * gyroRatio * D2RAD;
supportFPGAData.GyroRawY = -12 * gyroRatio * D2RAD;
supportFPGAData.GyroRawZ = 12 * gyroRatio * D2RAD;
}
}
if (_simulatingToHorizon) {
_mountElevation -= MOUNT_SIMULATION_STEP;
if (ForceActuatorSettings::instance().useGyroscope == true) {
supportFPGAData.GyroRawX += GYRO_SIMULATE_STEP;
supportFPGAData.GyroRawY += GYRO_SIMULATE_STEP;
supportFPGAData.GyroRawZ -= GYRO_SIMULATE_STEP;
}
if (_mountElevation < 0.1) {
_simulatingToHorizon = false;
}
} else {
_mountElevation += MOUNT_SIMULATION_STEP;
if (ForceActuatorSettings::instance().useGyroscope == true) {
supportFPGAData.GyroRawX -= GYRO_SIMULATE_STEP;
supportFPGAData.GyroRawY -= GYRO_SIMULATE_STEP;
supportFPGAData.GyroRawZ += GYRO_SIMULATE_STEP;
}
if (_mountElevation > 90.5) {
_simulatingToHorizon = true;
}
}
} else {
if (_mountSimulatedMovementFirstPass == false) {
SPDLOG_INFO("Using simulated elevation from TMA");
if (ForceActuatorSettings::instance().useGyroscope == true) {
supportFPGAData.GyroRawX = 0;
supportFPGAData.GyroRawY = 0;
supportFPGAData.GyroRawZ = 0;
}
_mountSimulatedMovementFirstPass = true;
}
}
break;
case MTM1M3::MTM1M3_shared_DetailedStates_ParkedEngineeringState:
_mountElevation = 90.0;
_simulatingToHorizon = true;
_mountSimulatedMovementFirstPass = true;
break;
}
}
supportFPGAData.DisplacementTxBytes = 0;
supportFPGAData.DisplacementRxBytes = 0;
supportFPGAData.DisplacementTxFrames = 0;
supportFPGAData.DisplacementRxFrames = 0;
supportFPGAData.DisplacementErrorTimestamp = 0;
supportFPGAData.DisplacementErrorCode = 0;
supportFPGAData.DisplacementSampleTimestamp = timestamp;
supportFPGAData.DisplacementRaw1 = (int32_t)(getRndPM1() + 10) * 1000.0;
supportFPGAData.DisplacementRaw2 = (int32_t)(getRndPM1() + 20) * 1000.0;
supportFPGAData.DisplacementRaw3 = (int32_t)(getRndPM1() + 30) * 1000.0;
supportFPGAData.DisplacementRaw4 = (int32_t)(getRndPM1() + 40) * 1000.0;
supportFPGAData.DisplacementRaw5 = (int32_t)(getRndPM1() + 50) * 1000.0;
supportFPGAData.DisplacementRaw6 = (int32_t)(getRndPM1() + 60) * 1000.0;
supportFPGAData.DisplacementRaw7 = (int32_t)(getRndPM1() + 70) * 1000.0;
supportFPGAData.DisplacementRaw8 = (int32_t)(getRndPM1() + 80) * 1000.0;
supportFPGAData.AccelerometerSampleCount++;
supportFPGAData.AccelerometerSampleTimestamp = timestamp;
auto& accelerometerSettings = AccelerometerSettings::instance();
for (int i = 0; i < 8; i++) {
supportFPGAData.AccelerometerRaw[i] =
(getRndPM1() * 0.001 - accelerometerSettings.accelerometerOffset[i]) /
(accelerometerSettings.sensitivity[i] * accelerometerSettings.scalar[i]) +
accelerometerSettings.bias[i];
}
supportFPGAData.GyroTxBytes = 0;
supportFPGAData.GyroRxBytes = 0;
supportFPGAData.GyroTxFrames = 0;
supportFPGAData.GyroRxFrames = 0;
supportFPGAData.GyroErrorTimestamp = 0;
supportFPGAData.GyroErrorCode = 0;
supportFPGAData.GyroSampleTimestamp = timestamp;
supportFPGAData.GyroRawX += getRndPM1() * 0.001;
supportFPGAData.GyroRawY += getRndPM1() * 0.001;
supportFPGAData.GyroRawZ += getRndPM1() * 0.001;
supportFPGAData.GyroStatus = 0x7F;
supportFPGAData.GyroSequenceNumber++;
if (supportFPGAData.GyroSequenceNumber > 127) {
supportFPGAData.GyroSequenceNumber = 0;
}
supportFPGAData.GyroTemperature = 24 + int(getRndPM1() * 2);
supportFPGAData.GyroBITTimestamp = timestamp;
supportFPGAData.GyroBIT0 = 0x7F;
supportFPGAData.GyroBIT1 = 0x7F;
supportFPGAData.GyroBIT2 = 0x7F;
supportFPGAData.GyroBIT3 = 0x7F;
supportFPGAData.GyroBIT4 = 0x7F;
supportFPGAData.GyroBIT5 = 0x7F;
supportFPGAData.GyroBIT6 = 0x7F;
supportFPGAData.GyroBIT7 = 0x7F;
supportFPGAData.DigitalInputSampleCount++;
supportFPGAData.DigitalInputTimestamp = timestamp;
supportFPGAData.DigitalOutputSampleCount++;
supportFPGAData.DigitalOutputTimestamp = timestamp;
// supportFPGAData.DigitalOutputStates = 0;
supportFPGAData.PowerSupplySampleCount++;
supportFPGAData.PowerSupplyTimestamp = timestamp;
// supportFPGAData.PowerSupplyStates = 0;
}
void SimulatedFPGA::pullHealthAndStatus() {}
uint8_t _broadCastCounter() {
return static_cast<uint8_t>(M1M3SSPublisher::instance().getOuterLoopData()->broadcastCounter) << 4;
}
template <class t>
void setBit(t& value, uint32_t bit, bool on) {
value = (value & ~bit) | (on ? bit : 0);
}
void SimulatedFPGA::writeCommandFIFO(uint16_t* data, size_t length, uint32_t timeoutInMs) {
for (size_t i = 0; i < length;) {
uint16_t signal = data[i++];
uint16_t dataLength = 0;
uint16_t subnet = 0;
std::queue<uint16_t>* response = 0;
switch (signal) {
case FPGAAddresses::AccelerometerAx:
case FPGAAddresses::AccelerometerAz:
case FPGAAddresses::AccelerometerBy:
case FPGAAddresses::AccelerometerBz:
case FPGAAddresses::AccelerometerCx:
case FPGAAddresses::AccelerometerCz:
case FPGAAddresses::AccelerometerDy:
case FPGAAddresses::AccelerometerDz:
break;
case FPGAAddresses::ModbusSubnetATx:
subnet = 1;
response = &_subnetAResponse;
dataLength = data[i++];
break;
case FPGAAddresses::ModbusSubnetBTx:
subnet = 2;
response = &_subnetBResponse;
dataLength = data[i++];
break;
case FPGAAddresses::ModbusSubnetCTx:
subnet = 3;
response = &_subnetCResponse;
dataLength = data[i++];
break;
case FPGAAddresses::ModbusSubnetDTx:
subnet = 4;
response = &_subnetDResponse;
dataLength = data[i++];
break;
case FPGAAddresses::ModbusSubnetARx:
case FPGAAddresses::ModbusSubnetBRx:
case FPGAAddresses::ModbusSubnetCRx:
case FPGAAddresses::ModbusSubnetDRx:
break;
case FPGAAddresses::ModbusSubnetETx:
subnet = 5;
response = &_subnetEResponse;
dataLength = data[i++];
break;
case FPGAAddresses::GyroTx: {
int size = data[i++]; // Read Tx Size
i += size; // Read All Tx Data
break;
}
case FPGAAddresses::ModbusSubnetERx:
case FPGAAddresses::GyroRx:
break;
case FPGAAddresses::ILCPowerInterlockStatus:
case FPGAAddresses::FanCoilerHeaterInterlockStatus:
case FPGAAddresses::AirSupplyInterlockStatus:
case FPGAAddresses::CabinetDoorInterlockStatus:
case FPGAAddresses::TMAMotionStopInterlockStatus:
case FPGAAddresses::GISHeartbeatInterlockStatus:
case FPGAAddresses::AirSupplyValveOpen:
case FPGAAddresses::AirSupplyValveClosed:
case FPGAAddresses::MirrorCellLightsOn:
case FPGAAddresses::HeartbeatToSafetyController: {
int state = data[i++];
setBit(supportFPGAData.DigitalOutputStates, DigitalOutputs::HeartbeatOutputState, state);
break;
}
case FPGAAddresses::AirSupplyValveControl: {
int state = data[i++];
setBit(supportFPGAData.DigitalOutputStates, DigitalOutputs::AirCommandOutputOn, state);
setBit(supportFPGAData.DigitalInputStates, DigitalInputs::AirValveOpened, !state);
setBit(supportFPGAData.DigitalInputStates, DigitalInputs::AirValveClosed, state);
if (state == true) {
_lastAirOpen = std::chrono::steady_clock::now();
}
break;
}
case FPGAAddresses::MirrorCellLightControl: {
int state = data[i++];
setBit(supportFPGAData.DigitalOutputStates, DigitalOutputs::CellLightsOutputOn, state);
setBit(supportFPGAData.DigitalInputStates, DigitalInputs::CellLightsOn, !state);
break;
}
case FPGAAddresses::DCAuxPowerNetworkAOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::AuxA, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCAuxPowerNetworkBOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::AuxB, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCAuxPowerNetworkCOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::AuxC, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCAuxPowerNetworkDOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::AuxD, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCPowerNetworkAOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::A, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCPowerNetworkBOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::B, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCPowerNetworkCOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::C, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::DCPowerNetworkDOn: {
int state = data[i++];
setBit(supportFPGAData.PowerSupplyStates, PowerSupply::D, state);
// TODO: Set Power Supply Currents
break;
}
case FPGAAddresses::Displacement:
case FPGAAddresses::Inclinometer:
case FPGAAddresses::ModbusSoftwareTrigger:
case FPGAAddresses::Telemetry:
case FPGAAddresses::Timestamp:
break;
default:
break;
}
if (response != 0) {
bool stepMotorBroadcast = false;
++i; // Read Software Trigger
// Response length is prepended at request
uint64_t rawTimestamp = Timestamp::toRaw(M1M3SSPublisher::instance().getTimestamp());
response->push((uint16_t)(rawTimestamp));
response->push((uint16_t)(rawTimestamp >> 16));
response->push((uint16_t)(rawTimestamp >> 32));
response->push((uint16_t)(rawTimestamp >> 48)); // Write Global Timestamp
size_t endIndex = i - 1 + dataLength - 1;
// The first -1 is for the software trigger
// The second -1 is for the trigger
while (i < endIndex) {
_sendResponse = true;
uint8_t address = _readModbus(data[i++]); // Read Address
uint8_t function = _readModbus(data[i++]); // Read Function Code
if (address == 248 && function == 66) {
stepMotorBroadcast = true;
}
if (address == 248 || address == 249) {
// This is a broadcast, no response, just read until 0xA000
while ((data[i] & 0xF000) != 0x2000) {
++i;
}
i--; // Shift to CRC for the remainder of the time
// However broadcasts are followed by a timestamp
// so only shift 1
} else if (address == 0 && function == 0) {
// This is a special nop, read until 0xF000 != 0
while (data[i] == 0) {
++i;
}
i -= 4; // Shift to CRC for the rest of the parsing to work
} else if (subnet >= 1 && subnet <= 4) {
// if bus is turned off, don't send any response
if ((supportFPGAData.PowerSupplyStates & 0x10) == 0x00) {
_sendResponse = false;
}
ForceActuatorApplicationSettings* forceActuatorApplicationSettings =
SettingReader::instance().getForceActuatorApplicationSettings();
int zIndex = -1;
for (int j = 0; j < FA_COUNT; ++j) {
if (forceActuatorApplicationSettings->Table[j].Subnet == subnet &&
forceActuatorApplicationSettings->Table[j].Address == address) {
zIndex = j;
break;
}
}
int pIndex = zIndex;
int sIndex = forceActuatorApplicationSettings->ZIndexToSecondaryCylinderIndex[zIndex];
switch (function) {
case 17: // Report Server Id
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 12); // Write Message Length
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, signal);
_writeModbus(response, address); // Write ILC Unique Id
_writeModbus(response, 0); // TODO: Write ILC Application Type
_writeModbus(response, 0); // TODO: Write Network Node Type
_writeModbus(response, 0); // TODO: Write ILC Selected Options
_writeModbus(response, 0); // TODO: Write Network Node Options
_writeModbus(response, 99); // TODO: Write Major Revision
_writeModbus(response, 99); // TODO: Write Minor Revision
// TODO: Write Firmware Name
_writeModbusCRC(response);
break;
case 18: // Report Server Status
_writeModbus(response, address);
_writeModbus(response, function);
_writeModbus(response, 0); // TODO: Write ILC State
_writeModbus16(response, 0); // TODO: Write ILC Status
_writeModbus16(response, 0); // TODO: Write ILC Faults
_writeModbusCRC(response);
break;
case 65: { // Change ILC Mode
++i; // Read Reserved Byte
uint8_t newMode = _readModbus(data[i++]); // Read New Mode
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 0); // Write Reserved Byte
_writeModbus(response, newMode); // Write ILC State
_writeModbusCRC(response);
break;
}
case 73: // Set Boost Valve DCA Gains
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
i += 4; // Read Primary Cylinder DCA Gain
i += 4; // Read Secondary Cylinder DCA Gain
_writeModbusCRC(response);
break;
case 74: { // Read Boost Valve DCA Gains
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusFloat(response, 1.0); // Write Primary Cylinder DCA Gain
_writeModbusFloat(response, 1.2); // Write Secondary Cylinder DCA Gain
_writeModbusCRC(response);
break;
}
case 75: { // Force Demand
++i; // Read Slew Flag
uint8_t word1 = _readModbus(data[i++]);
uint8_t word2 = _readModbus(data[i++]);
uint8_t word3 = _readModbus(data[i++]);
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, _broadCastCounter()); // Write ILC Status
float force = (((float)((static_cast<uint32_t>(word1) << 16) |
(static_cast<uint32_t>(word2) << 8) | word3)) /
1000.0) +
(getRndPM1() * 0.5);
_writeModbusFloat(response, force); // Write Primary Cylinder Force
if (address > 16) {
word1 = _readModbus(data[i++]);
word2 = _readModbus(data[i++]);
word3 = _readModbus(data[i++]);
force = (((float)((static_cast<uint32_t>(word1) << 16) |
(static_cast<uint32_t>(word2) << 8) | word3)) /
1000.0) +
(getRndPM1() * 0.5);
_writeModbusFloat(response, force); // Write Secondary Cylinder Force
}
_writeModbusCRC(response);
break;
}
case 76: { // Force And Status
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, _broadCastCounter()); // Write ILC Status
float force = (((float)M1M3SSPublisher::instance()
.getAppliedCylinderForces()
->primaryCylinderForces[pIndex]) /
1000.0) +
(getRndPM1() * 0.5); // Update to Primary Cylinder Force
//
// simulate following error in disabled state
if (M1M3SSPublisher::instance().getEventDetailedState()->detailedState ==
MTM1M3::MTM1M3_shared_DetailedStates_DisabledState &&
subnet == 4 && address == 17) {
force = 505;
}
// uncomment to simulate follow up error
// if (subnet == 1 && address == 17 && force > 500) force = 200;
_writeModbusFloat(response, force); // Write Primary Cylinder Force
if (address > 16) {
force = (((float)M1M3SSPublisher::instance()
.getAppliedCylinderForces()
->secondaryCylinderForces[sIndex]) /
1000.0) +
(getRndPM1() * 0.5); // Update to Secondary Cylinder Force
_writeModbusFloat(response, force); // Write Secondary Cylinder Force
}
_writeModbusCRC(response);
break;
}
case 80: { // ADC Scan Rate
uint8_t scanRate = _readModbus(data[i++]);
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, scanRate); // Write ADC Scan Rate
_writeModbusCRC(response);
break;
}
case 81: // ADC Channel Offset and Sensitivity
++i; // Read ADC Channel
i += 4; // Read Offset
i += 4; // Read Sensitivity
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusCRC(response);
break;
case 107: // Reset
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusCRC(response);
break;
case 110: { // Read Calibration
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
for (int j = 0; j < 24; ++j) {
_writeModbusFloat(response, 0.0); // Write Calibration Data
}
_writeModbusCRC(response);
break;
}
case 119: { // Read DCA Pressure Values
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
for (int j = 0; j < 4; ++j) {
_writeModbusFloat(response, _getAirPressure()); // Write DCA Pressure
}
_writeModbusCRC(response);
break;
}
case 120: // Read DCA Id
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus32(response, 0x01);
_writeModbus(response, signal);
_writeModbus(response, address); // Write DCA Unique Id
_writeModbus(response, 0); // TODO: Write DCA Firmware Type
_writeModbus(response, 99); // TODO: Write Major Revision
_writeModbus(response, 99); // TODO: Write Minor Revision
_writeModbusCRC(response);
break;
case 121: // Read DCA Status
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 0x00);
_writeModbus(response, 0x00); // TODO: Write DCA Status
_writeModbusCRC(response);
break;
default:
break;
}
} else if (subnet == 5 && address >= 1 && address <= 6) {
// if bus is turned off, don't send any response
if ((supportFPGAData.PowerSupplyStates & 0x10) == 0x00) {
_sendResponse = false;
}
auto fillHPStatus = [address, function, &response, this](int steps) {
int index = address - 1;
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
uint8_t status =
(_hardpointActuatorData->encoder[index] < _HPEncoderLow[index] ? 0x08
: 0x00) |
(_hardpointActuatorData->encoder[index] > _HPEncoderHigh[index] ? 0x04
: 0x00);
_writeModbus(response, _broadCastCounter() | status); // Write ILC Status
// Number of steps issued / 4 + current encoder
// The encoder is also inverted after being received to match axis direction
// So we have to also invert the encoder here to counteract that
if (steps < 4 && steps > 0) {
steps = 4;
} else if (steps > -4 && steps < 0) {
steps = -4;
}
int32_t encoder =
-(M1M3SSPublisher::instance().getHardpointActuatorData()->encoder[index]) +
HardpointActuatorSettings::instance().getEncoderOffset(index) - steps / 4;
_writeModbus32(response, encoder); // Write Encoder
_writeModbusFloat(response, getRndPM1() * 8.0); // Write Measured Force
_writeModbusCRC(response);
};
switch (function) {
case 17: // Report Server Id
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 12); // Write Message Length
_writeModbus32(response, 0x00);
_writeModbus(response, signal);
_writeModbus(response, address); // Write ILC Unique Id
_writeModbus(response, 0); // TODO: Write ILC Application Type
_writeModbus(response, 0); // TODO: Write Network Node Type
_writeModbus(response, 0); // TODO: Write ILC Selected Options
_writeModbus(response, 0); // TODO: Write Network Node Options
_writeModbus(response, 99); // TODO: Write Major Revision
_writeModbus(response, 99); // TODO: Write Minor Revision
// TODO: Write Firmware Name
_writeModbusCRC(response);
break;
case 18: // Report Server Status
_writeModbus(response, address);
_writeModbus(response, function);
_writeModbus(response, 0); // TODO: Write ILC State
_writeHP_ILCStatus(response, address - 1);
_writeModbus16(response, 0); // TODO: Write ILC Faults
_writeModbusCRC(response);
break;
case 65: { // Change ILC Mode
++i; // Read Reserved Byte
uint8_t newMode = _readModbus(data[i++]); // Read New Mode
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 0); // Write Reserved Byte
_writeModbus(response, newMode); // Write ILC State
_writeModbusCRC(response);
break;
}
case 66: { // Step Motor
fillHPStatus(data[i++]);
break;
}
case 67: { // Force And Status
int steps = 0;
if (stepMotorBroadcast) {
steps = M1M3SSPublisher::instance()
.getHardpointActuatorData()
->stepsCommanded[address - 1];
}
fillHPStatus(steps);
break;
}
case 80: { // ADC Scan Rate
uint8_t scanRate = _readModbus(data[i++]);
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, scanRate); // Write ADC Scan Rate
_writeModbusCRC(response);
break;
}
case 81: // ADC Channel Offset and Sensitivity
++i; // Read ADC Channel
i += 4; // Read Offset
i += 4; // Read Sensitivity
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusCRC(response);
break;
case 107: // Reset
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusCRC(response);
break;
case 110: { // Read Calibration
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
for (int j = 0; j < 24; ++j) {
_writeModbusFloat(response, 0.0); // Write Calibration Data
}
_writeModbusCRC(response);
break;
}
default:
break;
}
} else if (subnet == 5 && address >= 84 && address <= 89) {
switch (function) {
case 17: // Report Server Id
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 12); // Write Message Length
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, 0x00);
_writeModbus(response, signal);
_writeModbus(response, address); // Write ILC Unique Id
_writeModbus(response, 0); // TODO: Write ILC Application Type
_writeModbus(response, 0); // TODO: Write Network Node Type
_writeModbus(response, 0); // TODO: Write ILC Selected Options
_writeModbus(response, 0); // TODO: Write Network Node Options
_writeModbus(response, 99); // TODO: Write Major Revision
_writeModbus(response, 99); // TODO: Write Minor Revision
// TODO: Write Firmware Name
_writeModbusCRC(response);
break;
case 18: // Report Server Status
_writeModbus(response, address);
_writeModbus(response, function);
_writeModbus(response, 0); // TODO: Write ILC State
_writeModbus16(response, 0); // TODO: Write ILC Status
_writeModbus16(response, 0); // TODO: Write ILC Faults
_writeModbusCRC(response);
break;
case 65: { // Change ILC Mode
++i; // Read Reserved Byte
uint8_t newMode = _readModbus(data[i++]); // Read New Mode
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 0); // Write Reserved Byte
_writeModbus(response, newMode); // Write ILC State
_writeModbusCRC(response);
break;
}
case 107: // Reset
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbusCRC(response);
break;
case 119: { // Read DCA Pressure Values
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
for (int j = 0; j < 4; ++j) {
_writeModbusFloat(response, _getAirPressure()); // Write DCA Pressure
}
_writeModbusCRC(response);
break;
}
case 120: // Read DCA Id
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus32(response, 0x01);
_writeModbus(response, signal);
_writeModbus(response, address); // Write DCA Unique Id
_writeModbus(response, 0); // TODO: Write DCA Firmware Type
_writeModbus(response, 99); // TODO: Write Major Revision
_writeModbus(response, 99); // TODO: Write Minor Revision
_writeModbusCRC(response);
break;
case 121: // Read DCA Status
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
_writeModbus(response, 0x00);
_writeModbus(response, 0x00); // TODO: Write DCA Status
_writeModbusCRC(response);
break;
case 122: // Report LVDT
_writeModbus(response, address); // Write Address
_writeModbus(response, function); // Write Function
for (int j = 0; j < 2; ++j) {
_writeModbusFloat(response, 0.0); // Write LVDT
}
_writeModbusCRC(response);
break;
default:
break;
}
}
i += 2; // Read CRC
++i; // Read End of Frame
++i; // Read Wait for Rx or Delay
}
++i; // Read Write Trigger IRQ
}
}
}
void SimulatedFPGA::writeRequestFIFO(uint16_t* data, size_t length, uint32_t timeoutInMs) {
int signal = data[0];
std::queue<uint16_t>* modbusResponse = 0;
switch (signal) {
case FPGAAddresses::AccelerometerAx:
case FPGAAddresses::AccelerometerAz:
case FPGAAddresses::AccelerometerBy:
case FPGAAddresses::AccelerometerBz:
case FPGAAddresses::AccelerometerCx:
case FPGAAddresses::AccelerometerCz:
case FPGAAddresses::AccelerometerDy:
case FPGAAddresses::AccelerometerDz:
case FPGAAddresses::ModbusSubnetATx:
case FPGAAddresses::ModbusSubnetBTx:
case FPGAAddresses::ModbusSubnetCTx:
case FPGAAddresses::ModbusSubnetDTx:
case FPGAAddresses::ModbusSubnetARx:
modbusResponse = &_subnetAResponse;
break;
case FPGAAddresses::ModbusSubnetBRx:
modbusResponse = &_subnetBResponse;
break;
case FPGAAddresses::ModbusSubnetCRx:
modbusResponse = &_subnetCResponse;
break;
case FPGAAddresses::ModbusSubnetDRx:
modbusResponse = &_subnetDResponse;
break;
case FPGAAddresses::ModbusSubnetETx:
case FPGAAddresses::GyroTx:
case FPGAAddresses::ModbusSubnetERx:
modbusResponse = &_subnetEResponse;
break;
case FPGAAddresses::GyroRx:
case FPGAAddresses::ILCPowerInterlockStatus:
case FPGAAddresses::FanCoilerHeaterInterlockStatus:
case FPGAAddresses::AirSupplyInterlockStatus:
case FPGAAddresses::CabinetDoorInterlockStatus:
case FPGAAddresses::TMAMotionStopInterlockStatus:
case FPGAAddresses::GISHeartbeatInterlockStatus:
case FPGAAddresses::AirSupplyValveOpen:
case FPGAAddresses::AirSupplyValveClosed:
case FPGAAddresses::MirrorCellLightsOn:
case FPGAAddresses::HeartbeatToSafetyController:
case FPGAAddresses::AirSupplyValveControl:
case FPGAAddresses::MirrorCellLightControl:
case FPGAAddresses::DCAuxPowerNetworkAOn:
case FPGAAddresses::DCAuxPowerNetworkBOn:
case FPGAAddresses::DCAuxPowerNetworkCOn:
case FPGAAddresses::DCAuxPowerNetworkDOn:
case FPGAAddresses::DCPowerNetworkAOn:
case FPGAAddresses::DCPowerNetworkBOn:
case FPGAAddresses::DCPowerNetworkCOn:
case FPGAAddresses::DCPowerNetworkDOn:
case FPGAAddresses::Displacement:
case FPGAAddresses::Inclinometer:
case FPGAAddresses::ModbusSoftwareTrigger:
case FPGAAddresses::Telemetry:
case FPGAAddresses::Timestamp:
break;
default:
break;
}
if (modbusResponse != 0) {
_u16Response.push((uint16_t)modbusResponse->size());
while (modbusResponse->size() > 0) {
_u16Response.push(modbusResponse->front());
modbusResponse->pop();
}
}
}
void SimulatedFPGA::writeTimestampFIFO(uint64_t timestamp) {}
void SimulatedFPGA::readU8ResponseFIFO(uint8_t* data, size_t length, uint32_t timeoutInMs) {}
void SimulatedFPGA::readU16ResponseFIFO(uint16_t* data, size_t length, uint32_t timeoutInMs) {
for (size_t i = 0; i < length; ++i) {
data[i] = _u16Response.front();
_u16Response.pop();
}
}
void SimulatedFPGA::writeHealthAndStatusFIFO(uint16_t request, uint16_t param) {}
void SimulatedFPGA::readHealthAndStatusFIFO(uint64_t* data, size_t length, uint32_t timeoutInMs) {
for (size_t i = 0; i < length; i++) {
data[i] = i;
}
}
void SimulatedFPGA::_monitorElevation(void) {
MTMount_elevationC mountElevationInstance;
SPDLOG_DEBUG("Start monitoring mount elevation...");
while (!_exitThread) {
ReturnCode_t status = _mgrMTMount.getSample_elevation(&mountElevationInstance);
if (status == 0) {
{
std::lock_guard<std::mutex> lock_g(_elevationReadWriteLock);
_mountElevation = mountElevationInstance.actualPosition;
SPDLOG_TRACE("Received mount elevation {:.06f}", _mountElevation);
_mountElevationValidTo = chrono::steady_clock::now() + MOUNT_VALIDITY;
}
}
std::this_thread::sleep_for(20ms);
}
}
void SimulatedFPGA::_writeModbus(std::queue<uint16_t>* response, uint16_t data) {
if (_sendResponse == false) {
return;
}
_crcVector.push(data);
response->push((data << 1) | 0x9000);
}
void SimulatedFPGA::_writeModbus16(std::queue<uint16_t>* response, int16_t data) {
_writeModbus(response, (data >> 8) & 0xFF);
_writeModbus(response, data & 0xFF);
}
void SimulatedFPGA::_writeModbus32(std::queue<uint16_t>* response, int32_t data) {
_writeModbus(response, (data >> 24) & 0xFF);
_writeModbus(response, (data >> 16) & 0xFF);
_writeModbus(response, (data >> 8) & 0xFF);
_writeModbus(response, data & 0xFF);
}
void SimulatedFPGA::_writeModbusFloat(std::queue<uint16_t>* response, float data) {
uint8_t buffer[4];
memcpy(buffer, &data, 4);
_writeModbus(response, buffer[3]);
_writeModbus(response, buffer[2]);
_writeModbus(response, buffer[1]);
_writeModbus(response, buffer[0]);
}
void SimulatedFPGA::_writeModbusCRC(std::queue<uint16_t>* response) {
uint16_t buffer[256];
int i = 0;
while (!_crcVector.empty()) {
buffer[i] = _crcVector.front();
i++;
_crcVector.pop();
}
uint16_t crc = CRC::modbus(buffer, 0, i);
response->push((((crc >> 0) & 0xFF) << 1) | 0x9000);
response->push((((crc >> 8) & 0xFF) << 1) | 0x9000); // Write CRC
uint64_t rawTimestamp = Timestamp::toRaw(M1M3SSPublisher::instance().getTimestamp());
for (int i = 0; i < 8; ++i) {
response->push(0xB000 | (rawTimestamp & 0xFF)); // Write Timestamp
rawTimestamp >>= 8;
}
response->push(0xA000); // Write End of Frame
}
void SimulatedFPGA::_writeHP_ILCStatus(std::queue<uint16_t>* response, int index) {
_writeModbus16(
response,
(_hardpointActuatorData->encoder[index] < _HPEncoderLow[index] ? 0x0200 : 0x0000) |
(_hardpointActuatorData->encoder[index] > _HPEncoderHigh[index] ? 0x0100 : 0x0000));
}
float SimulatedFPGA::_getAirPressure() {
float baseValue = 120;
auto now = std::chrono::steady_clock::now();
#define WAIT_SECONDS 60
if (AirSupplyStatus::instance().airValveClosed == true) {
baseValue = 0;
} else if (now < (_lastAirOpen + std::chrono::seconds(WAIT_SECONDS))) {
baseValue = 120 * std::chrono::duration_cast<std::chrono::milliseconds>(now - _lastAirOpen).count() /
(WAIT_SECONDS * 1000);
}
return fabs(baseValue + getRndPM1() * 0.5);
}
|
acb4236bb3d61737ea32aee9decf8f54f1553d58 | c3588ba0ee01bda41311c58f92ee21468e0b2132 | /1-19.cpp | eac838d047f52035dab034c27fc6915337bc892f | [] | no_license | Vito-bo/- | a51142bbd595861f2e1a3bf7b0d3b1af12bc36cc | bd3487fef1ec4b55bea02f8a4f127e7a8dad1387 | refs/heads/master | 2023-02-18T06:09:23.639963 | 2021-01-19T13:05:40 | 2021-01-19T13:05:40 | 223,978,053 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,007 | cpp | 1-19.cpp |
// 1-19 ACwing ÕÒÓ²±Ò
// ·½·¨1:¹þÏ£±í
#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_set>
using namespace std;
const int INF = 10000;
int main()
{
int n, m;
scanf("%d%d", &n, &m);
unordered_set<int> hash;
int v1 = INF, v2;
for (int i = 0; i < n; i++)
{
int a, b;
scanf("%d", &a);
b = m - a;
if (hash.count(b))
{
hash.insert(a);
if (a>b) swap(a, b);
if (a < v1) v1 = a, v2 = b;
}
else
hash.insert(a);
}
if (v1 == INF) puts("No Solution");
else printf("%d %d\n", v1, v2);
return 0;
}
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 100010;
int n, m;
int w[N];
int main()
{
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%d", &w[i]);
sort(w, w + n);
for (int i = 0, j = n - 1; i++)
{
while (i < j && w[i] + w[j] > m) j--;
if (i < j && w[i] + w[j] == m)
{
printf("%d %d", w[i], w[j]);
return 0;
}
}
puts("No Solution");
return 0;
} |
9f6a5e8ab43930b8deb080bf4dec722bffb43d0b | bc84c328d1cc2a318160d42ed1faa1961bdf1e87 | /C++/stream/stringstream4.cpp | 2ece27cede26c37febdf5eb652b395407b89573d | [
"MIT"
] | permissive | liangjisheng/C-Cpp | 25d07580b5dd1ff364087c3cf8e13cebdc9280a5 | 8b33ba1f43580a7bdded8bb4ce3d92983ccedb81 | refs/heads/master | 2021-07-10T14:40:20.006051 | 2019-01-26T09:24:04 | 2019-01-26T09:24:04 | 136,299,205 | 7 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,096 | cpp | stringstream4.cpp | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
istringstream iss;
string istr1,istr2,istr3;
int a;
iss.str("I love Ziyu");
iss>>istr1>>istr2>>istr3;
cout<<istr1<<" "<<istr2<<" "<<istr3<<endl;
iss.clear();
iss.str("1534");
iss>>a;
cout<<a<<endl;
//用C测试转换
printf("%d\n",a);
ostringstream oss;
string ostr1,ostr2,ostr3;
string ostr;
string strFromInt;
string strFromDouble;
//输出字符串
ostr1="My ";
ostr2="Name's ";
ostr3="Steve";
oss<<ostr1;
oss<<ostr2;
oss<<ostr3;
cout<<oss.str()<<endl;
ostr=oss.str();
cout<<ostr<<endl;
//int 转化为string
oss.str("");
oss<<23412;
strFromInt=oss.str();
cout<<strFromInt<<endl;
//double 转化为string
oss.str("");
oss<<1.2345;
strFromDouble=oss.str();
cout<<strFromDouble<<endl;
//将string型赋给char型。关键:c_str函数的返回值是const char*的,
// 不能直接赋值给char*,必须赋给const char*
const char *I=strFromInt.c_str();
const char *D=strFromDouble.c_str();
printf("%s,%s\n",I,D);
system("pause");
return 0;
} |
a8df5cce433f5fc20841708a89f50bf4f62457ec | fef2ab261b0e3cddf1a4c2562347e694c8adaeb8 | /Algo/Karatsuba/KaratsubaGenerator.cpp | b9d398662578573540a805fe50a8402f0cb53366 | [] | no_license | praivesi/Algo | 9cc10ab938dd01eed47422cef9b30ed49756a3f2 | c7230f008835d76549e273a70d042de8d61ba45c | refs/heads/master | 2021-06-16T17:42:06.033563 | 2021-02-21T09:15:31 | 2021-02-21T09:15:31 | 166,097,454 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 507 | cpp | KaratsubaGenerator.cpp | #include <iostream>
#include <ctime>
using namespace std;
const int GEN_CNT = 6;
int main()
{
srand((unsigned int)time(0));
cout << GEN_CNT / 2 << endl;
for (int i = 0; i < GEN_CNT; i++)
{
int numberSize = 0;
if (i / 2 == 0) numberSize = 1000;
else if (i / 2 == 1) numberSize = 10000;
else if (i / 2 == 2) numberSize = 100000;
else numberSize = 1000;
for (int n = 0; n < numberSize; n++)
{
if (n == 0) cout << rand() % 10 + 1;
else cout << rand() % 10;
}
cout << endl;
}
} |
56abc6dc77a3c873201b8e736dfddacfa302a414 | b0e233b9b173a866cf78f6e74a9b95c1e64eeb51 | /Code/Server/Logic/LuaHelps/LuaDynamicCasts.cpp | 12a08608bca79bf2849b6bdc557edb0dfd12420f | [] | no_license | xiaol-luo/Utopia | 47a6e987ebd6aaebb7759b736a4590859a6c4eb3 | 798741067114467680c6bcf9d22301f12f127f02 | refs/heads/master | 2021-07-10T13:21:24.547069 | 2019-01-14T14:03:31 | 2019-01-14T14:03:31 | 100,261,666 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 316 | cpp | LuaDynamicCasts.cpp | #include "LuaDynamicCasts.h"
#include "GameLogic/Scene/Effects/EffectConfigBase.h"
#include "GameLogic/Scene/Effects/EffectScript/EffectScriptConfig.h"
GameLogic::EffectScriptConfig * LuaDyCast::ToEffectScriptConfig(GameLogic::EffectConfigBase * ptr)
{
return dynamic_cast<GameLogic::EffectScriptConfig *>(ptr);
}
|
c7cc069df9b1afce153556117ee0f29b19928c5a | 2938b2f3c80d77a7ba0b1617ef0de8b05df7b69d | /Test/app/src/main/jni/interface/include/jnimodulerenderer.h | 6d093ef2152fe566e95b75283fc3e2a54e9f4d66 | [] | no_license | showeryoung/MP4Handler | 2a41d75da68a9f61a124a9583b4e0c00bfcba3db | b7b11bf3e9c1d218d457e34cde3141ba9261e4fa | refs/heads/master | 2021-06-25T10:04:30.481182 | 2017-08-14T07:29:29 | 2017-08-14T07:29:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,165 | h | jnimodulerenderer.h | /*******************************************************************************
* Module: interface
* File:
* Functionality: define jni renderer module.
* Related:
* System: android
* Language: C++
* Author: huangxuefeng
* Version: V1.0 Copyright(C) 2017 paomiantv, All rights reserved.
* -----------------------------------------------------------------------------
* Revisions:
* Date Version Reviser Description
* 2017-08-01 v1.0 huangxuefeng created
******************************************************************************/
#ifndef _PAOMIANTV_JNIMODULERENDER_H_
#define _PAOMIANTV_JNIMODULERENDER_H_
#include "jnimodule.h"
#include "renderer.h"
//method name
#define RENDERER_METHOD_NEW_FRAME_NAME "fireOnNewFrame"
//method signiture
#define RENDERER_METHOD_NEW_FRAME_SIG "()V"
//field name
#define RENDERER_FIELD_NATIVE_ADDRESS_NAME "mNativeRendererAddress"
//field signiture
#define RENDERER_FIELD_NATIVE_ADDRESS_SIG "I"
namespace paomiantv {
class CJNIModuleRenderer : public CJNIModule {
private:
CRenderer *m_pRenderer;
static CLock m_SingleInstanceLock;
public:
static TJavaClazzParam *GetJavaClazzParam();
static CJNIModuleRenderer *CreateJniRenderer(JNIEnv *env, jobject jRenderer);
static CJNIModuleRenderer *GetJniRenderer(JNIEnv *env, jobject jRenderer);
static void DestroyJniRenderer(CJNIModuleRenderer *&p);
static bool IsValid(CJNIModuleRenderer *p);
private:
friend void JNIModuleRenderer_OnNewFrame(void *delegate);
static void jni_Draw(JNIEnv *env, jobject thiz);
static void jni_Init(JNIEnv *env, jobject thiz, jint nWidth, jint nHeight);
static void jni_Create(JNIEnv *env, jobject thiz);
static void jni_Destroy(JNIEnv *env, jobject thiz);
static void jni_setDirection(JNIEnv *env, jobject thiz, jint nDirection);
static jint jni_getDirection(JNIEnv *env, jobject thiz);
static void jni_setRotate(JNIEnv *env, jobject thiz, jfloat fDegree);
static jfloat jni_getRotate(JNIEnv *env, jobject thiz);
static void jni_setTranslate(JNIEnv *env, jobject thiz, jfloat fTranslateX,
jfloat fTranslateY, jfloat fTranslateZ);
static jfloat jni_getTranslate(JNIEnv *env, jobject thiz, jint nTranslateEnum);
static void jni_setScale(JNIEnv *env, jobject thiz, jfloat fScaleX, jfloat fScaleY,
jfloat fScaleZ);
static jfloat jni_getScale(JNIEnv *env, jobject thiz, jint nScaleEnum);
static void jni_setFlip(JNIEnv *env, jobject thiz, jint nFlip);
static jint jni_getFlip(JNIEnv *env, jobject thiz);
static void jni_keepAspectRatio(JNIEnv *env, jobject thiz, jboolean bValue);
static jint jni_getAspectState(JNIEnv *env, jobject thiz);
static void jni_setAspectState(JNIEnv *env, jobject thiz, jint state);
static void jni_refresh(JNIEnv *env, jobject thiz);
static void jni_setFrame(JNIEnv *env, jobject thiz, jbyteArray jframeBuff,
jint jframeWidth, jint jframeheight);
public:
void newFrameCallback();
void Draw();
void Init(int nWidth, int nHeight);
inline void SetPause(BOOL32 isPause);
inline bool GetPause();
inline void SetRotate(float fDegree);
inline float GetRotate();
inline void SetTranslate(float fTranslateX, float fTranslateY, float fTranslateZ);
inline float GetTranslate(int nTranslateEnum);
inline void SetScale(float fScaleX, float fScaleY, float fScaleZ);
inline float GetScale(int nScaleEnum);
inline void SetDirection(int nDir);
inline int GetDirection();
inline void SetFlip(int nFlip);
inline int GetFlip();
inline bool IsEmptyFrame();
inline CRenderer *getRenderer();
void SetFrame(unsigned char *pbyData, int nWidth, int nHeight);
void SetFrame(unsigned char *pbyData, int nWidth, int nHeight,
int nFrameDirection, // recommendation for display orientation
bool bIsFrontCamera, // whether is captured from front camera
unsigned long long uTimestamp); // the timestamp of capture this frame
void SetChannel(int nChannel);
/*!
* \brief set the aspect state which indicates how to keep aspect ratio.
* \param nState binary format:
* _0 - keep viewport dimension
* _1 - transpose viewport dimension
* 0_ - keep frame dimension
* 1_ - transpose frame dimension
* \author huangxuefeng
* \date 2017-08-01
*/
inline void SetAspectState(int nState);
inline int GetAspectState();
void Refresh();
/*!
* \brief whether keep the aspect ratio or not.
* \author huang xuefeng
* \date 2017-08-01
*/
inline void KeepAspectRatio(EMAspectRatio mode);
inline void QuerySettings(TRendererSettings *settings);
inline void UpdateSettings(const TRendererSettings &settings);
private:
CJNIModuleRenderer(JNIEnv *env, jobject jRenderer,
jclass jcls, jfieldID jfld, jmethodID jmtd);
virtual ~CJNIModuleRenderer();
JavaVM *m_jvm;
jclass m_jcls;
jfieldID m_jfld;
jmethodID m_jmtd;
};
/*
* inline member functions implementation
*/
inline CRenderer *CJNIModuleRenderer::getRenderer() {
return m_pRenderer;
}
inline void CJNIModuleRenderer::SetPause(BOOL32 isPause) {
m_pRenderer->SetPause(isPause);
}
inline bool CJNIModuleRenderer::GetPause() {
return m_pRenderer->GetPause();
}
inline void CJNIModuleRenderer::SetRotate(float fDegree) {
m_pRenderer->SetRotate(fDegree);
}
inline float CJNIModuleRenderer::GetRotate() {
return m_pRenderer->GetRotate();
}
inline void
CJNIModuleRenderer::SetTranslate(float fTranslateX, float fTranslateY, float fTranslateZ) {
m_pRenderer->SetTranslate(fTranslateX, fTranslateY, fTranslateZ);
}
inline float CJNIModuleRenderer::GetTranslate(int nTranslateEnum) {
return m_pRenderer->GetTranslate((EMDirect) nTranslateEnum);
}
inline void CJNIModuleRenderer::SetScale(float fScaleX, float fScaleY, float fScaleZ) {
m_pRenderer->SetScale(fScaleX, fScaleY, fScaleZ);
}
inline float CJNIModuleRenderer::GetScale(int nScaleEnum) {
return m_pRenderer->GetScale((EMDirect) nScaleEnum);
}
inline void CJNIModuleRenderer::SetDirection(int nDir) {
m_pRenderer->SetDirection(nDir);
}
inline int CJNIModuleRenderer::GetDirection() {
return m_pRenderer->GetDirection();
}
inline void CJNIModuleRenderer::SetFlip(int nFlip) {
m_pRenderer->SetFlip(nFlip);
}
inline int CJNIModuleRenderer::GetFlip() {
return m_pRenderer->GetFlip();
}
// huangxuefeng 2017-08-01
inline void CJNIModuleRenderer::KeepAspectRatio(EMAspectRatio mode) {
m_pRenderer->KeepAspectRatio(mode);
}
// huangxuefeng 2017-08-01
inline void CJNIModuleRenderer::SetAspectState(int nState) {
m_pRenderer->SetAspectState(nState);
}
// huangxuefeng 2017-08-01
inline int CJNIModuleRenderer::GetAspectState() {
return m_pRenderer->GetAspectState();
}
// huangxuefeng 2017-08-01
inline void CJNIModuleRenderer::QuerySettings(TRendererSettings *settings) {
m_pRenderer->QuerySettings(settings);
}
// huangxuefeng 2017-08-01
inline void CJNIModuleRenderer::UpdateSettings(const TRendererSettings &settings) {
m_pRenderer->UpdateSettings(settings);
}
// huangxuefeng 2017-08-01
inline bool CJNIModuleRenderer::IsEmptyFrame() {
return m_pRenderer->IsEmptyFrame();
}
}
#endif //_PAOMIANTV_JNIMODULERENDER_H_
|
7f4a8c1c40503bd664f4b07a0f4c5d37bb7cf1be | 529d1e792189d6c7f907ae64eca291fb28f63fe4 | /(3-1)컴퓨터 그래픽스 실습1(C++, DirectX11)/190312 Graphics/ConsoleApplication1/Rectangle.h | 30d05d5804703ad8d2085c18a5943c4b8242b27f | [] | no_license | keyjjang5/UniversityHomeWork | a65e6c538aba7a92633b70ea4a2534f61c3de594 | 7069fe93859cd41e78e502e5952176c98930a95b | refs/heads/master | 2022-02-24T05:01:49.774852 | 2019-10-28T13:02:09 | 2019-10-28T13:02:09 | 188,168,680 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 178 | h | Rectangle.h | #pragma once
#include "Shape.h"
class Rectangle : public Shape
{
float width, height;
public:
Rectangle(float x, float y, float width, float height);
void draw() const;
}; |
0ff0ab90038df71e95f3569209fe51862e4bf6e5 | 9254fc558d175f76558be210c65a2e819753cb9e | /src/eval/call.hxx | 91bbe030b92ef4024b3dd0f015394181bb957770 | [] | permissive | urbiforge/urbi | ee36996e87c25dd0a75199d580ac13442ba3032c | d6c6091a28e79b935b4f6573225486238e3c7d47 | refs/heads/master | 2023-08-22T04:15:36.358115 | 2023-08-10T13:24:17 | 2023-08-10T13:24:17 | 56,369,573 | 18 | 5 | BSD-3-Clause | 2023-08-10T12:43:43 | 2016-04-16T06:38:50 | C++ | UTF-8 | C++ | false | false | 26,876 | hxx | call.hxx | /*
* Copyright (C) 2011-2012, Gostai S.A.S.
*
* This software is provided "as is" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of fitness for a particular purpose.
*
* See the LICENSE file for more information.
*/
/**
** \file eval/call.hxx
** \brief Implementation of routine application
*/
#ifndef EVAL_CALL_HXX
# define EVAL_CALL_HXX
#include <libport/compiler.hh>
#include <libport/compilation.hh>
#include <libport/range.hh>
#include <ast/exps-type.hh>
#include <ast/local-declarations-type.hh>
#include <ast/factory.hh>
#include <ast/new-clone.hh>
#include <ast/parametric-ast.hh>
#include <ast/print.hh>
#include <ast/routine.hh>
#include <ast/transformer.hh>
#include <object/system.hh>
#include <object/code.hh>
#include <urbi/kernel/userver.hh>
#include <urbi/object/event.hh>
#include <urbi/object/global.hh>
#include <urbi/object/list.hh>
#include <urbi/object/object.hh>
#include <urbi/object/primitive.hh>
#include <urbi/object/slot.hh>
#include <urbi/object/symbols.hh>
# include <urbi/runner/raise.hh>
#include <runner/state.hh>
#include <runner/job.hh>
#include <eval/ast.hh>
#include <eval/call.hh>
# if defined _MSC_VER || defined __arm__ || defined __clang__ || defined URBI_NO_VLENGTH_ARRAY
// Use malloc with CL.
# define URBI_DYNAMIC_STACK_NONE 1
# define URBI_DYNAMIC_STACK_VECTOR 0
# else
// Use variable size vectors on the stack with GCC.
# define URBI_DYNAMIC_STACK_NONE 0
# define URBI_DYNAMIC_STACK_VECTOR 1
# endif
namespace eval
{
using object::rLobby;
using object::rSlot;
using object::Slot;
using object::rCode;
using object::Code;
/*----------.
| Helpers. |
`----------*/
static inline
void
lazy_args(Job& job,
object::objects_type& args,
const object::objects_type& exp_args);
static inline
object::rObject
build_call_message(Job& job,
object::Object* code,
libport::Symbol msg,
const object::objects_type& args);
static inline
object::rObject
build_call_message(Job& job,
object::Object* tgt,
object::Object* code,
libport::Symbol msg,
const ::ast::exps_type& args);
LIBPORT_SPEED_INLINE
Action call(object::rObject function,
const object::objects_type& args)
{
return boost::bind(&call, _1, function, args);
}
LIBPORT_SPEED_INLINE
rObject call(Job& job,
object::rObject function,
const object::objects_type& args)
{
// GD_CATEGORY(Urbi.Eval.Call);
// GD_INFO_TRACE("Call rObject function");
// FIXME: Duplication is the root of all Evil.
object::objects_type args_(args);
args_.push_front(rObject(job.state.this_get()));
return call_apply(job, function, libport::Symbol::make_empty(), args_);
}
/*-----------------------------------------------------------------.
| Apply with evaluated arguments, and potentially a call message. |
`-----------------------------------------------------------------*/
LIBPORT_SPEED_INLINE
Action call_apply(object::rObject target,
object::rObject routine,
libport::Symbol message,
const object::objects_type& args)
{
typedef rObject (*bound)(Job& job,
object::rObject target,
object::rObject routine,
libport::Symbol message,
const object::objects_type& args);
return boost::bind((bound) &call_apply, _1,
target, routine, message, args);
}
LIBPORT_SPEED_INLINE
rObject call_apply(Job& job,
object::rObject target,
object::rObject routine,
libport::Symbol message,
const object::objects_type& args)
{
aver(routine);
object::objects_type args_with_target(args);
args_with_target.push_front(
target ? target : rObject(job.state.lobby_get()));
return call_apply(job, routine.get(), message, args_with_target, 0);
}
LIBPORT_SPEED_INLINE
Action call_apply(object::rObject function,
libport::Symbol msg,
const object::objects_type& args,
object::rObject call_message)
{
typedef rObject (*bound)(Job& job,
object::rObject function,
libport::Symbol msg,
const object::objects_type& args,
object::rObject call_message);
return boost::bind((bound) &call_apply, _1,
function, msg, args,
call_message);
}
LIBPORT_SPEED_INLINE
rObject call_apply(Job& job,
object::rObject function,
libport::Symbol msg,
const object::objects_type& args,
object::rObject call_message)
{
// Add empty location.
return call_apply(job, function, msg, args, call_message,
boost::optional< ::ast::loc>());
}
// We must check before poping the call stack, as it is a circular
// buffer.
#define FINALLY_Stack(DefineOrUse) \
FINALLY_ ## DefineOrUse \
(Stack, \
((Job&, job))((bool, reg)) \
((runner::Profile::idx, profile_prev)), \
if (reg && !job.state.call_stack_get().empty()) \
job.state.call_stack_get().pop_back(); \
if (job.is_profiling()) \
job.profile_leave(profile_prev); \
)
FINALLY_Stack(DEFINE);
LIBPORT_SPEED_INLINE
rObject call_apply(Job& job,
object::Object* function,
libport::Symbol msg,
const object::objects_type& args,
object::Object* call_message,
boost::optional< ::ast::loc> loc,
unsigned call_flags)
{
GD_CATEGORY(Urbi.Call);
GD_FPUSH_TRACE("Call %s (%s)", msg, loc ? string_cast(loc.get()) : "?");
aver(function);
aver(!args.empty());
aver(args.front());
bool reg = !msg.empty() && loc;
// GD_FINFO_DEBUG("reg = %d", reg);
// GD_FINFO_DEBUG("profile = %p", job.profile);
if (reg)
job.state.call_stack_get() << std::make_pair(msg, loc);
runner::Profile::idx profile_prev = 0;
if (job.is_profiling())
profile_prev = job.profile_enter(function, msg);
FINALLY_Stack(USE);
// GD_INFO_DEBUG("Check for void arguments");
// Check if any argument is void.
foreach (object::Object* arg, libport::skip_first(args))
if (arg == object::void_class)
runner::raise_unexpected_void_error();
object::rObject res;
// GD_FINFO_DEBUG("Function f = %p", function);
if (object::rCode code = function->as<object::Code>())
{
// GD_INFO_DEBUG("Function is a Code object");
res = call_apply_urbi(job, code, msg, args, call_message, call_flags);
// GD_FINFO_DEBUG("Function returned = %p", res.get());$
}
else if (const object::rPrimitive& p = function->as<object::Primitive>())
{
// GD_INFO_DEBUG("Function is a Primitive object");
// GD_FINFO_DEBUG("Args: %d", args.size() - 1);
res = p->call_raw(args, call_flags);
// GD_FINFO_DEBUG("Function returned = %p", res.get());
}
else // access a slot.
{
// GD_INFO_DEBUG("Function is a Slot");
if (args.size() != 1)
{
// GD_INFO_DEBUG("Function has arguments.");
// FIXME: args is modified.
if (rObject call =
function->slot_get_value(SYMBOL(LPAREN_RPAREN), false))
return call_apply(job, call,
SYMBOL(LPAREN_RPAREN), args, call_message, loc);
}
// GD_FINFO_DEBUG("Ensure that no arguments are provided (%d == 0)", args.size() - 1);
if (! (call_flags & object::Primitive::CALL_IGNORE_EXTRA_ARGS))
object::check_arg_count(args, 0);
return function;
}
return res;
}
/*----------------------------.
| Apply with a call message. |
`----------------------------*/
LIBPORT_SPEED_INLINE
rObject call_msg(Job& job,
object::Object* function,
libport::Symbol msg,
object::Object* call_message,
boost::optional< ::ast::loc> loc)
{
rObject target = call_message->slot_get_value(SYMBOL(target));
object::objects_type args;
args << target;
// This function is called when arguments haven't been evaluated:
// only a call message is provided. If the called function is
// strict, we need to extract arguments values for it. This can
// happen when
object::Code* c = function->as<object::Code>();
if (!c || c->ast_get()->strict())
{
rObject urbi_args = call_message->call(SYMBOL(evalArgs));
foreach (object::Object* arg,
urbi_args->as<object::List>()->value_get())
args << arg;
}
return call_apply(job, function, msg, args, call_message, loc);
}
/*-------------------------------------------------.
| Apply an urbi function (i.e., not a primitive). |
`-------------------------------------------------*/
#define FINALLY_Frame(DefineOrUse) \
FINALLY_ ## DefineOrUse \
(Frame, \
((Job&, job)) \
((libport::Symbol, msg)) \
((runner::State::var_frame_type, previous_frame)) \
((rLobby, caller_lobby)) \
((rSlot*, local_stack)) \
((rSlot*, captured_stack)) \
((runner::State::import_captured_type, import_captured)) \
((rCode, function)) \
((bool, prev_has_import_stack)) \
, \
job.state.pop_frame(msg, previous_frame); \
job.state.lobby_set(caller_lobby); \
std::swap(job.state.import_captured, import_captured); \
/* Warning, has_import_stack may change (see load)*/ \
/* So re-read it, do not rely on what function says*/ \
if (job.state.has_import_stack) \
job.state.import_stack.pop_back(); \
job.state.has_import_stack = prev_has_import_stack; \
BOOST_PP_IF(URBI_DYNAMIC_STACK_NONE, \
{ \
delete [] local_stack; \
delete [] captured_stack; \
}, \
); \
)
FINALLY_Frame(DEFINE);
// !!! GD_* macros are commented because this consume stack space in speed
// mode, even if messages are not printed.
LIBPORT_SPEED_INLINE
rObject call_apply_urbi(Job& job,
object::Code* function,
libport::Symbol msg,
const object::objects_type& args,
object::Object* call_message_,
unsigned call_flags)
{
// GD_CATEGORY(Urbi.Eval.Call);
rObject call_message = call_message_;
// The called function.
const object::Code::ast_type& ast = function->ast_get();
// If the function uses call and there's no call message, forge
// one. This happen when a lazy function is invoked with eval, for
// instance.
if (ast->uses_call_get() && !call_message)
{
// GD_INFO_DEBUG("Forge callMessage");
object::objects_type lz_args;
lazy_args(job, lz_args, args);
call_message = build_call_message(job, function, msg, lz_args);
}
// Determine the function's 'this' and 'call'
rObject self;
rObject call;
rLobby caller_lobby = job.state.lobby_get();
if (ast->closure_get())
{
// GD_INFO_DEBUG("Function is a closure");
self = function->this_get();
aver(self);
call = function->call_get();
}
else
{
// GD_INFO_DEBUG("Function is a function");
self = args.front();
call = call_message;
}
size_t local = ast->local_size_get();
size_t captured = ast->captured_variables_get()->size();
// GD_FINFO_DEBUG("Function has %d local variables and %d captured variables",
// local, captured);
// Use closure's lobby if there is one.
if (ast->closure_get() && function->lobby_get())
job.state.lobby_set(function->lobby_get());
// Push new frames on the stacks
local += 2;
# if URBI_DYNAMIC_STACK_VECTOR
rSlot local_stack_space[local];
rSlot captured_stack_space[captured];
rSlot* local_stack = &local_stack_space[0];
rSlot* captured_stack = &captured_stack_space[0];
#elif URBI_DYNAMIC_STACK_NONE
// FIXME: What about alloca?
rSlot* local_stack = new rSlot[local];
rSlot* captured_stack = new rSlot[captured];
#else
# error "No dynamic stack policy defined."
#endif
typedef runner::State::var_frame_type var_frame_type;
var_frame_type previous_frame =
job.state.push_frame(
msg, var_frame_type(local_stack, captured_stack),
self, call);
// Save import capture for this frame
runner::State::import_captured_type import_captured;
std::swap(import_captured, job.state.import_captured);
// Push the one to come.
job.state.import_captured = function->imports_get();
// If binder says we will need an import stack, push it
if (function->ast_get()->has_imports_get())
job.state.import_stack.push_back(std::vector<rObject>());
bool prev_has_import_stack = job.state.has_import_stack;
job.state.has_import_stack = function->ast_get()->has_imports_get();
// GD_INFO_DEBUG("Push frame");
FINALLY_Frame(USE);
// Push captured variables
// GD_INFO_DEBUG("Push captured variables");
foreach (const ::ast::rConstLocalDeclaration& dec,
*ast->captured_variables_get())
{
Slot* value = function->captures_get()[dec->local_index_get()];
job.state.def_captured(dec, value);
}
// Bind arguments if the function is strict.
if (ast->strict())
{
// GD_INFO_DEBUG("Strict function => bind arguments");
const ::ast::local_declarations_type& formals =
*ast->formals_get();
unsigned int max = formals.size();
unsigned int min = max;
if (!formals.empty() && formals.back()->list_get())
max = UINT_MAX;
rforeach (const ::ast::rLocalDeclaration& dec, formals)
{
if (!dec->list_get() && !dec->value_get())
break;
--min;
}
if (call_flags & object::Primitive::CALL_IGNORE_EXTRA_ARGS)
max = UINT_MAX;
if (call_flags & object::Primitive::CALL_IGNORE_MISSING_ARGS)
min = 0;
// Check arity
// GD_FINFO_DEBUG("Check args: %d in [ %d .. %d ]", args.size() - 1, min, max);
object::check_arg_count(args, min, max);
object::objects_type::const_iterator effective = args.begin();
// skip target
++effective;
unsigned pos = 0;
// Bind
foreach (::ast::rLocalDeclaration formal, formals)
if (effective != args.end())
if (formal->list_get())
{
// Remaining list arguments.
object::rList arg = new object::List;
do
{
arg->insertBack(*effective);
} while (++effective != args.end());
job.state.def_arg(formal, arg);
}
else
{
++pos;
// Validate type if specified
if (formal->type_get())
{
rObject oType = eval::ast(job, formal->type_get());
rObject res = (*effective)->call(SYMBOL(isA), oType);
if (!res->as_bool())
{
runner::raise_argument_type_error(pos, *effective, oType);
}
}
// Classical argument.
job.state.def_arg(formal, *(effective++));
}
else
if (formal->list_get())
// Empty list argument.
job.state.def_arg(formal, new object::List);
else
{
// Take default value.
// FIXME: !!! remove this cast.
if (formal->value_get())
job.state.def_arg(
formal,
eval::ast(job, ::ast::rConstAst(formal->value_get().get())));
else
job.state.def_arg(
formal,
object::nil_class);
}
}
// Before calling, check that we are not exhausting the stack
// space, for example in an infinite recursion.
job.check_stack_space();
// GD_INFO_DEBUG("Execution start");
job.state.execution_starts(msg);
return eval::ast(job, ast->body_get().get());
}
LIBPORT_SPEED_INLINE
rObject call_funargs(Job& job,
object::Code* function,
libport::Symbol msg,
const object::objects_type& args)
{
return call_apply_urbi(job, function, msg, args, 0, 0);
}
/*-------------------------------------.
| Apply with arguments as ast chunks. |
`-------------------------------------*/
/// !!! old apply_ast
LIBPORT_SPEED_INLINE
rObject call_msg(Job& job,
rObject target,
libport::Symbol message,
const ::ast::exps_type* arguments,
boost::optional< ::ast::loc> location)
{
// Accept to call methods on void only if void itself is holding
// the method.
if (target == object::void_class
&& !target->local_slot_get(message))
runner::raise_unexpected_void_error();
rObject routine = target->slot_get(message);
static ::ast::exps_type* empty_args = new ::ast::exps_type();
if (rSlot s = routine->as<Slot>())
{
if (s->hasLocalSlot(SYMBOL(autoEval)) && !arguments)
arguments = empty_args;
runner::Job& job = ::kernel::server().getCurrentRunner();
job.state.call_stack_get() << std::make_pair(message, location);
FINALLY((( runner::Job&, job)),
job.state.call_stack_get().pop_back());
routine = s->value(target);
}
// Bounce on the same function with routine argument.
return call_msg(job,
target,
routine,
message,
arguments, location);
}
LIBPORT_SPEED_INLINE
rObject call_msg(Job& job,
object::Object* target,
object::Object* routine,
libport::Symbol message,
const ::ast::exps_type* input_ast_args,
boost::optional< ::ast::loc> loc)
{
aver(routine);
aver(target);
if (!input_ast_args)
{
// Behavior change between urbi2 and urbi3
static bool report = getenv("URBI_REPORT_MISSING_PAREN");
if (report && ( routine->as<object::Code>()
|| routine->as<object::Primitive>()))
{
GD_CATEGORY(Urbi.Compatibility);
GD_FWARN("Maybe missing parens at %s", loc.get());
}
return routine;
}
// Evaluated arguments. Even if the function is lazy, it holds the
// target.
object::objects_type args;
args << target;
::ast::exps_type ast_args =
input_ast_args ? *input_ast_args : ::ast::exps_type();
rObject call_message;
const object::Code* c = routine->as<object::Code>().get();
// Build a call message if the function uses it.
if (c && c->ast_get()->uses_call_get())
call_message =
build_call_message(job, target, routine, message, ast_args);
// Unless the function is lazy, evaluate the arguments.
if (!c || c->ast_get()->strict())
strict_args(job, args, ast_args);
return call_apply(job, routine, message, args, call_message, loc);
}
/*----------.
| Helpers. |
`----------*/
LIBPORT_SPEED_INLINE
void
strict_args(Job& job,
object::objects_type& args,
const ::ast::exps_type& exp_args)
{
foreach (const ::ast::rConstExp& arg, exp_args)
{
rObject val = ast(job, arg.get());
// Check if any argument is void. This will be checked again in
// Interpreter::apply_urbi, yet raising exception here gives
// better location (the argument and not the whole function
// invocation).
if (val == object::void_class)
runner::raise_unexpected_void_error();
aver(val, *arg);
args << val;
}
}
LIBPORT_SPEED_INLINE
void
lazy_args(Job& /* job */,
object::objects_type& args,
const object::objects_type& exp_args)
{
args << exp_args.front();
foreach (object::Object* o, libport::skip_first(exp_args))
{
CAPTURE_GLOBAL(PseudoLazy);
rObject lazy = PseudoLazy->clone();
lazy->slot_set_value(SYMBOL(code), o);
args << lazy;
}
}
LIBPORT_SPEED_INLINE
object::rObject
build_call_message(Job& job,
object::Object* code,
libport::Symbol msg,
const object::objects_type& args)
{
CAPTURE_GLOBAL(CallMessage);
rObject res = CallMessage->clone();
// Set the sender to be the current self. self must always exist.
res->slot_set_value(SYMBOL(sender), job.state.this_get().get());
// Set the target to be the object on which the function is applied.
res->slot_set_value(SYMBOL(target), args.front());
// Set the code slot.
res->slot_set_value(SYMBOL(code), code);
// Set the name of the message call.
res->slot_set_value(SYMBOL(message), new object::String(msg));
res->slot_set_value(SYMBOL(args), new object::List(
object::objects_type(args.begin() + 1, args.end())));
return res;
}
class Rebinder: public ::ast::Transformer
{
public:
typedef ::ast::Transformer super_type;
Rebinder(::ast::rRoutine routine,
object::rCode code,
runner::State& state)
: idx_(0)
, routine_(routine)
, code_(code)
, state_(state)
{}
protected:
using super_type::visit;
LIBPORT_SPEED_INLINE
virtual void
visit(::ast::Routine* r)
{
foreach (const ::ast::rLocalDeclaration& decl,
*r->captured_variables_get())
transform(decl->value_get());
result_ = r;
}
LIBPORT_SPEED_INLINE
virtual void
visit(::ast::LocalDeclaration* decl)
{
if (has(decls_, decl))
{
result_ = decl;
return;
}
decls_.insert(decl);
// Reindex declarations.
decl->local_index_set(idx_++);
routine_->local_size_set(idx_);
super_type::visit(decl);
}
/// FIXME: Code duplication.
LIBPORT_SPEED_INLINE
virtual void
visit(::ast::LocalAssignment* assignment)
{
::ast::rLocalDeclaration d = assignment->declaration_get();
// If the variable is captured, or declared locally, we're good.
if (has(decls_, d.get()))
{
super_type::visit(assignment);
return;
}
object::rSlot value = state_.rget_assignment(assignment);
code_->captures_get() << value;
// Capture the variable
assignment->depth_set(assignment->depth_get() + 1);
::ast::rLocalDeclaration nd =
new ::ast::LocalDeclaration(d->location_get(),
d->what_get(), d->value_get());
nd->local_index_set(routine_->captured_variables_get()->size());
*routine_->captured_variables_get() << nd;
assignment->declaration_set(0);
super_type::visit(assignment);
assignment->declaration_set(nd);
}
LIBPORT_SPEED_INLINE
virtual void
visit(::ast::Local* local)
{
::ast::rLocalDeclaration d = local->declaration_get();
// If the variable is captured, or declared locally, we're good.
if (has(decls_, d.get()))
{
super_type::visit(local);
return;
}
// Retreive the value to capture.
object::rSlot value = state_.rget(local);
code_->captures_get() << value;
// Capture the variable
local->depth_set(local->depth_get() + 1);
::ast::rLocalDeclaration nd =
new ::ast::LocalDeclaration(d->location_get(),
d->what_get(), d->value_get());
nd->local_index_set(routine_->captured_variables_get()->size());
*routine_->captured_variables_get() << nd;
local->declaration_set(0);
super_type::visit(local);
local->declaration_set(nd);
}
private:
unsigned idx_;
std::set< ::ast::LocalDeclaration*> decls_;
::ast::rRoutine routine_;
object::rCode code_;
runner::State& state_;
};
LIBPORT_SPEED_INLINE
object::rObject
build_call_message(Job& job,
object::Object* tgt,
object::Object* code,
libport::Symbol msg,
const ::ast::exps_type& args)
{
DECLARE_LOCATION_FILE;
// Prepare current imports, to be stored in closure around args
std::vector<rObject> imports;
if (job.state.has_import_stack)
imports = job.state.import_stack.back();
imports.insert(imports.end(),
job.state.import_captured.begin(), job.state.import_captured.end());
// Build the list of lazy arguments
object::objects_type lazy_args;
lazy_args << tgt;
foreach (const ::ast::rConstExp& e, args)
{
// Create the lazy version of arguments.
::ast::rExp body = //const_cast< ::ast::Exp*>(e.get());
::ast::new_clone(e);
::ast::rRoutine routine =
new ::ast::Routine(LOCATION_HERE,
true, new ::ast::local_declarations_type,
::ast::Factory::make_scope(LOCATION_HERE, body));
rCode closure =
// FIXME: something fishy about the lobby here.
new Code(routine.get(),
job.state.call(),
job.state.lobby_get(),
job.state.this_get());
closure->imports_get() = imports;
Rebinder rebind(routine, closure, job.state);
rebind(body.get());
CAPTURE_GLOBAL(Lazy);
lazy_args << Lazy->call("new", closure);
}
return build_call_message(job, code, msg, lazy_args);
}
} // namespace eval
#endif // ! EVAL_CALL_HXX
|
93d4724ee3ee13536ce8d3fde40d3da46f2ade23 | a168a9af6ab99cdee546ccfa7c7a0cc2ad16b20e | /Codeup/PascalStar2/PascalStar2/Source.cpp | b06568c0ed1cfa97b983ff647e159cad2b14a91c | [] | no_license | BakJungHwan/Exer_algorithm | e6a0d2281d5901893566bc18cb5cf8c06b4f703b | aca66fc9b1e16677cd5772e6c8b76cf32d2a5664 | refs/heads/master | 2021-09-10T09:11:47.662041 | 2018-01-31T02:06:44 | 2018-01-31T02:06:44 | 114,535,444 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 753 | cpp | Source.cpp | #include <stdio.h>
#include <stdlib.h>
typedef long long int LLD;
int main()
{
int r;
int c;
int i;
int j;
scanf("%d", &r);
scanf("%d", &c);
LLD **arr;
arr = (LLD**)calloc(r, sizeof(LLD*));
for (i = 0; i < r; i++)
{
arr[i] = (LLD*)calloc(c, sizeof(LLD));
}
for (i = 0; i < r; i++)
{
arr[i][0] = 1;
}
for (i = 0; i < c; i++)
{
arr[0][i] = 1;
}
for (i = 1; i < r; i++)
{
for (j = 1; j < c; j++)
{
arr[i][j] = arr[i - 1][j] % 100000000 + arr[i][j - 1] % 100000000;
}
}
for (i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
printf("%6lld", arr[i][j]);
}
printf("\n");
}
printf("%lld\n", arr[r - 1][c - 1] % 100000000);
for (i = 0; i < r; i++)
{
free(arr[i]);
}
free(arr);
return 0;
} |
4e8c9b7abfcef137215109e33dc2bd3b5ffcb4ca | 3900a8feacf56a2db64c631f822c44191a714dc4 | /Examples/SDKLibrary/interface/common/portable/data_types/events/content_filter/icontent_filter_t.h | 63e968fdf190162c42175a3801195b7982301a80 | [
"MIT"
] | permissive | JayeshThamke/robot-examples | fc45f61d638001f2358a1b08c7543aa4f3b10664 | afc6b8b10809988b03663d703203625927e66e8f | refs/heads/master | 2020-03-08T17:18:09.409824 | 2018-03-29T20:41:10 | 2018-03-29T20:41:10 | 128,265,254 | 1 | 0 | null | 2018-04-05T21:16:55 | 2018-04-05T21:16:55 | null | UTF-8 | C++ | false | false | 3,061 | h | icontent_filter_t.h | /* -----------------------------------------------------------------------------------------------------------------
COPYRIGHT (c) 2009 - 2017
HONEYWELL INC.,
ALL RIGHTS RESERVED
This software is a copyrighted work and/or information protected as a trade
secret. Legal rights of Honeywell Inc. in this software are distinct from
ownership of any medium in which the software is embodied. Copyright or trade
secret notices included must be reproduced in any copies authorized by
Honeywell Inc. The information in this software is subject to change without
notice and should not be considered as a commitment by Honeywell Inc.
----------------------------------------------------------------------------------------------------------------- */
#ifndef _ICONTENT_FILTER_T_
#define _ICONTENT_FILTER_T_
#include "status_t.h"
#if (UASDK_INCLUDE_EVENTS > 0)
#include "iserver_configuration_t.h"
#include "intrusive_ptr_t.h"
#include "opcua_array_ua_t.h"
#include "opcua_base_data_type_t.h"
#include "inode_t.h"
#include "iattribute_access_t.h"
#include "content_filter_result_t.h"
namespace uasdk
{
/** \addtogroup grpEventsandAC
*@{*/
/*****************************************************************************/
/** \brief IContentFilter_t
*
* This class implements the IContentFilter_t interface
*
*/
class IContentFilter_t
{
public:
/******************************************************************************************************/
/** Processes this filter element and obtains the result of evaluating the filter against the provided node
*
* @param[in] element
* The element index to be processed
*
* @param[in] node
* node is the node to pass through the filter
*
* @param[in] eventAttributes
* eventAttributes is the event instance. This is used by the SimpleAttributeOperand to get the attribute values based on the input parameters.
*
* @param[in] configuration
* configuration is the instance of server configuration
*
* @param[out] evaluationResult
* evaluationResult is the result of the evaluation. May be a null reference for a null result, a Boolean_t for a boolean result, or any other data type for a casting request.
*
* @param[out] elementResult
* elementResult is the result of the given content filter element.
*
* @param[in] diagnosticsRequested
* diagnosticsRequested is the flag to get the diagnostic information in the result structure
*
* @return status
* status will return Good if the filter was applied correctly, bad otherwise.
*/
virtual Status_t EvaluateFilterElement(uint32_t element, const INode_t& node, IntrusivePtr_t<IAttributeAccess_t>& eventAttributes, IntrusivePtr_t<IServerConfiguration_t> configuration, IntrusivePtr_t<BaseDataType_t>& evaluatedResult, IntrusivePtr_t<ContentFilterElementResult_t>& elementResult, bool diagnosticsRequested) = 0;
};
/** @} */
} // namespace uasdk
#endif // UASDK_INCLUDE_EVENTS
#endif // _ICONTENT_FILTER_T_
|
faa3d74c02661dc0151082159c930d313e2a8460 | 8d4a8691a1a095b0b271b27fde97d886c4a24c8f | /NPCTank.cpp | 436253cf19b5eb4becd445c70790eaf9e2521eb1 | [] | no_license | felixwangchao/Tankwar | 4887e303bd40407de234323157c0e900171f0b57 | ba3c3820fb8f654a3965a1364246bcd678fb1830 | refs/heads/master | 2021-04-19T00:58:08.791073 | 2017-06-17T01:53:50 | 2017-06-17T01:53:50 | 94,594,038 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,269 | cpp | NPCTank.cpp | #include "Astar.h"
#include "Tank.h"
#include "NPCTank.h"
#include <queue>
#include <stack>
#include <map>
#include <math.h>
// 添加n个基础型坦克,k个增强型坦克,j个高级坦克,m个boss坦克
void NPCTank::AddNPC(int n, int k, int j, int m){
for (int i = 0; i < n+k+j+m; i++){
int ID = tank.size() + i + 3;
if (i<n)
tank.push_back(TankInfo(ID, TANKTYPE_1));
else if (i>=n && i<n+k)
tank.push_back(TankInfo(ID, TANKTYPE_3));
else if (i>=n+k && i< n+k+j)
tank.push_back(TankInfo(ID, TANKTYPE_4));
else if (i >= n + k +j && i < n + k + j + m)
tank.push_back(TankInfo(ID, TANKTYPE_BOSS));
}
}
// 在重生点上刷新坦克
void NPCTank::AddNPCOnScreen(){
for (int i = 2; i < tank.size(); i++)
{
if (tank[i].State() == STATE_UNBORN)
{
for (int j = 2; j < 36; j += 2) // 重生点为(2,2)(4,2)(6,2)(8,2) ---- (36,2)
{
tank[i].PosX(j); // 给坦克赋坐标
tank[i].PosY(2);
if (tank[i].checkTank()) // 检查该点是否能够放下坦克
{
tank[i].State(STATE_VALID); // 设置坦克状态
tank[i].drawTank(); // 画坦克
return;
}
}
}
}
return;
}
void NPCTank::AllNPCTankMove(){
// 移动所有存活坦克
vector<TankInfo>::iterator iter;
for (iter = tank.begin()+2; iter != tank.end();)
{
if (iter->State() == STATE_VALID) // 首先,只有活着的坦克才能移动
{
iter->drawTank(); // 在该位置画坦克(由于增加了被击中会变红的功能,这里恢复原来的颜色)
if (tank[0].State() == STATE_VALID || tank[1].State()==STATE_VALID) // 检查两个我方坦克是否存活
{
int flag = true; // 标志位
if (iter->TankType() == TANKTYPE_4){ // 由于3型坦克是穿甲弹,不会受到建筑物限制,所以只要在同一直线上就开火
iter->fireTank(); // 开火
if (iter->PosX() == tank[0].PosX() && tank[0].State()==STATE_VALID) // 如果与玩家1同行或同列且玩家1存活,则移动,开火
{
if (iter->PosY() > tank[0].PosY())
{
iter->Move(0);
iter->fireTank();
flag = false;
}
else
{
iter->Move(1);
iter->fireTank();
flag = false;
}
}
else if (iter->PosY() == tank[0].PosY() && tank[0].State() == STATE_VALID)
{
if (iter->PosX() > tank[0].PosX())
{
iter->Move(2);
iter->fireTank();
flag = false;
}
else
{
iter->Move(3);
iter->fireTank();
flag = false;
}
}
else if (iter->PosX() == tank[1].PosX() && tank[1].State() == STATE_VALID) // 玩家2同上
{
if (iter->PosY() > tank[1].PosY())
{
iter->Move(0);
iter->fireTank();
flag = false;
}
else
{
iter->Move(1);
iter->fireTank();
flag = false;
}
}
else if (iter->PosY() == tank[1].PosY() && tank[1].State() == STATE_VALID)
{
if (iter->PosX() > tank[1].PosX())
{
iter->Move(2);
iter->fireTank();
flag = false;
}
else
{
iter->Move(3);
iter->fireTank();
flag = false;
}
}
}
if(flag == true){ //如果flag为true,说明之前已经移动过,则放弃移动
int target = 0; // 设定target为零
if (CurrentMap.MapData[tank[0].PosX()][tank[0].PosY()].ShowLevel() < SHOWLEVEL_1 && tank[0].State()==STATE_VALID) // 如果玩家1活着,且玩家1不在草丛中,则第一位置1
target |= 1;
if (CurrentMap.MapData[tank[1].PosX()][tank[1].PosY()].ShowLevel() < SHOWLEVEL_1 && tank[1].State()==STATE_VALID) // 如果玩家2活着,且玩家2不在草丛中,则第二位置2
target |= 2;
if ((target & 1) == 1 && (target & 2) == 2) // 如果发现两个玩家都活着, 则计算到两个玩家的距离谁比较近,将目标设为近的
target = sqrt((tank[0].PosX() - iter->PosX())*(tank[0].PosX() - iter->PosX()) + (tank[0].PosY() - iter->PosY())*(tank[0].PosY() - iter->PosY())) -
sqrt((tank[1].PosX() - iter->PosX())*(tank[1].PosX() - iter->PosX()) + (tank[1].PosY() - iter->PosY())*(tank[1].PosY() - iter->PosY())) > 0 ? 2 : 1;
if (target != 0) // 如果找到了一个目标
{
if (sqrt((tank[target - 1].PosX() - iter->PosX())
*(tank[target - 1].PosX() - iter->PosX())
+ (tank[target - 1].PosY() - iter->PosY())
*(tank[target - 1].PosY() - iter->PosY())) > 30) // 设置坦克的感知距离为横坐标纵坐标之差30以内,超过半径30的范围则不追踪
{
int a = rand() % 4; // 随机移动
iter->Move(a); // 移动
}
else
{
Astar c(iter->PosX(), iter->PosY(), tank[target-1].PosX(), tank[target-1].PosY(), iter->TankID()); // 如果在感知范围内,构建A*算法
if (c.Start()) // 启动A*算法,观察是否找到路径
iter->Move(c.path.front()); // 如果找到路径,则移动一步
else // 否则随机移动一步
{
int a = rand() % 4;
iter->Move(a);
}
}
}
else // 如果没有找到目标,则随机移动
{
int a = rand() % 4;
iter->Move(a);
}
iter->fireTank(); // 并且开一枪
}
}
}
iter++; // 迭代器移动
}
// 检查页面上的坦克信息
UnBorn = 0,Die = 0,Valid = 0;
for (int i = 2; i < tank.size(); i++) // 根据坦克状态,刷新坦克信息
{
switch (tank[i].State())
{
case STATE_UNBORN: UnBorn++; break;
case STATE_VALID: Valid++; break;
case STATE_DIE: Die++; break;
}
}
alive = Valid + UnBorn; // 计算处剩余的坦克
int RestPosition = 2 - Valid; // 计算出需要刷新几个坦克,现在设定为屏幕上只能有两个敌方坦克
if (RestPosition > 0)
{
for (int i = 0; i < RestPosition; i++)
{
AddNPCOnScreen(); // 在屏幕上增加坦克
}
}
} |
1172b45cdb133eadd4f47aefdfd189c462d43404 | 9ebf0caa0d2b93a35ae5d513ab2cf50a16035feb | /src/InteractiveOpenGLDemo/Shader.cpp | c20d464fe45fb20bcf723b2028f123f2585959de | [] | no_license | xchuki00/Bakalarska_prace | 54248ad7d5eed1f56c16320bf81594fc4a7311a8 | b5993760989fda9e07e239bd48e311b43a5d69ad | refs/heads/master | 2021-01-12T07:24:24.100017 | 2017-05-24T17:24:35 | 2017-05-24T17:24:35 | 76,950,864 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,512 | cpp | Shader.cpp | #include "Shader.h"
GLuint LoadShaders(std::string vertex, std::string fragment)
{
GLuint vShaderID = glCreateShader(GL_VERTEX_SHADER);
GLuint fShaderID = glCreateShader(GL_FRAGMENT_SHADER);
std::string vCode;
std::string fCode;
std::ifstream vstream(vertex);
std::ifstream fstream(fragment);
if(vstream.is_open())
{
std::string line = "";
while (!vstream.eof()) {
std::getline(vstream,line);
vCode += "\n"+ line;
}
vstream.close();
}
if (fstream.is_open())
{
//read vshader to vshader code
std::string line = "";
while (!fstream.eof()) {
std::getline(fstream, line);
fCode += "\n" + line;
}
fstream.close();
}
char const *vPointer = vCode.c_str();
char const *fPointer = fCode.c_str();
glShaderSource(vShaderID, 1, &vPointer,NULL);
glShaderSource(fShaderID, 1, &fPointer,NULL);
glCompileShader(fShaderID);
glCompileShader(vShaderID);
//check shaders
GLint res = GL_FALSE;
int logLen;
int error = 0;
glGetShaderiv(vShaderID, GL_COMPILE_STATUS, &res);
glGetShaderiv(vShaderID, GL_INFO_LOG_LENGTH, &logLen);
if (logLen > 0) {
std::vector<char> VertexShaderErrorMessage(logLen + 1);
glGetShaderInfoLog(vShaderID, logLen, NULL, &VertexShaderErrorMessage[0]);
printf("%s\n", &VertexShaderErrorMessage[0]);
error = 1;
}else{
printf("vertex ok\n");
}
glGetShaderiv(fShaderID, GL_COMPILE_STATUS, &res);
glGetShaderiv(fShaderID, GL_INFO_LOG_LENGTH, &logLen);
if (logLen > 0) {
std::vector<char> fShaderErrorMessage(logLen + 1);
glGetShaderInfoLog(fShaderID, logLen, NULL, &fShaderErrorMessage[0]);
printf("%s\n", &fShaderErrorMessage[0]);
error = 1;
}else{
printf("fragment ok\n");
}
GLuint ProgramID = glCreateProgram();
glAttachShader(ProgramID, vShaderID);
glAttachShader(ProgramID, fShaderID);
glLinkProgram(ProgramID);
glGetProgramiv(ProgramID, GL_LINK_STATUS, &res);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &logLen);
if (logLen > 0) {
std::vector<char> ProgramErrorMessage(logLen + 1);
glGetProgramInfoLog(ProgramID, logLen, NULL, &ProgramErrorMessage[0]);
printf("Program: %s\n", &ProgramErrorMessage[0]);
error = 1;
}else{
printf("program ok\n");
}
glDetachShader(ProgramID, vShaderID);
glDetachShader(ProgramID, fShaderID);
glDeleteShader(vShaderID);
glDeleteShader(fShaderID);
if(error==0){
std::cout << "nacteny shadry " <<vertex<<" a "<<fragment << std::endl;
}else{
std::cout << "NEPODARILO se nacist shadry " << vertex << " a " << fragment << std::endl;
}
return ProgramID;
}
|
c6699c1f5a9d831db30958be48a7f0f16e13c2a9 | 337e351f12c583c6c86e6a8e7d6edeb0e0a43107 | /C++/RecordingAudioSolution/winrt/impl/Windows.Phone.System.2.h | 4977804837f5a8f198e260ef9e473162816cc5cf | [] | no_license | dngoins/HololensDXTutorials | de7d3ba8f25f633557b98f51828ac73d671266a4 | 532907a7be6005e9f3483e26727324b3392c02f3 | refs/heads/master | 2020-04-02T06:11:29.362302 | 2018-10-27T21:16:03 | 2018-10-27T21:16:03 | 64,985,100 | 30 | 5 | null | 2016-10-01T00:17:51 | 2016-08-05T03:16:10 | C++ | UTF-8 | C++ | false | false | 437 | h | Windows.Phone.System.2.h | // C++/WinRT v1.0.171013.2
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "winrt/impl/Windows.Phone.System.1.h"
WINRT_EXPORT namespace winrt::Windows::Phone::System {
}
namespace winrt::impl {
}
WINRT_EXPORT namespace winrt::Windows::Phone::System {
struct SystemProtection
{
SystemProtection() = delete;
static bool ScreenLocked();
static void RequestScreenUnlock();
};
}
|
fa54401363090781e34fd13730e4e6a23cc8157c | 5a7efa167f0796ee42ea6a8547f5bb9474d8780a | /tetris/tetris.h | a7b37616c7b89ae660eed426bf21fca210b69d2f | [] | no_license | shirry0129/3Jtetris | de9c1e5a85581ca525ff5e821f90ae8a42b3f9cf | 6f257caa853742bfff80e4023a2c974b2eb262ac | refs/heads/master | 2020-04-05T13:05:41.800235 | 2017-07-01T06:13:03 | 2017-07-01T06:13:03 | 95,082,819 | 0 | 1 | null | null | null | null | SHIFT_JIS | C++ | false | false | 358 | h | tetris.h | #pragma once
#include"cell.h"
const wchar tshape[7] = { L'I',L'O',L'S',L'Z',L'J',L'L',L'T' };
class Tetris {
private:
Cell field[4][4];
Color tetris_color;
public:
Tetris(wchar shape, Point origin); //コンストラクタ
void rotation(); //回転
void lmove(); //左移動
void rmove(); //右移動
void fall(); //落下
void draw(); //描画
}; |
b93605e88c18830dfed7eae69435dd394aef26eb | d20cf7de868dfb2c53578a70d0dda21306167d72 | /data/raw/train/student_64/2401/2399/Position.h | ba2988ca94653b6f436c08bba97565b1945bdb2a | [] | no_license | bulacu-magda/Alemia | 905a84ca79157fb657eb424e337b0303fd3323bd | 0fd019c4517064d300399feb94dbcb0f467e8d48 | refs/heads/main | 2023-03-01T17:41:08.788500 | 2021-02-05T08:00:35 | 2021-02-05T08:00:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 260 | h | Position.h | #pragma once
class Position
{
int _x, _y;
public:
Position() {
}
~Position() {
}
Position(int x, int y) {
_x = x;
_y = y;
}
void set_x(int x) { _x = x; }
void set_y(int y) { _y = y; }
int get_x() { return _x; }
int get_y() { return _y; }
};
|
e54fd492056e12a723e4e3e59781280cc78be1ff | 8c873b007feb8301285b7d807be6f8cb44b5cd94 | /Teamboard Master Folder/Teamboard/ContourDetectionSample.h | ee44742b3219f392a18046809afa52273cfded25 | [] | no_license | lemayjoe/TeamboardFreshstart | 6e9a16f9f3fb5b2c3d0f16f907afef66dcf69905 | bebd6ad52ec068480ee51f7e196acc0bd29bbab9 | refs/heads/master | 2021-03-12T20:04:24.483741 | 2013-06-12T13:17:11 | 2013-06-12T13:17:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 682 | h | ContourDetectionSample.h | //
// ContourDetectionSample.h
// Teamboard
//
// Copyright 2013, Joe Lemay, All Rights Reserved. Confidential \n6/23/12.
//
#ifndef Teamboard_ContourDetectionSample_h
#define Teamboard_ContourDetectionSample_h
#include "SampleBase.h"
class ContourDetectionSample : public SampleBase
{
//! Gets a sample name
virtual std::string getName() const;
virtual std::string getSampleIcon() const;
//! Returns a detailed sample description
virtual std::string getDescription() const;
//! Processes a frame and returns output image
virtual bool processFrame(const cv::Mat& inputFrame, cv::Mat& outputFrame);
private:
cv::Mat gray, edges;
};
#endif
|
b8dea75ed367dc52ad509e037dad29a11b3ca1a8 | 1e0e9d4583b9556cacb8b62d1c47c6a7feda480f | /ArchivosBinarios/main.cpp | cf66b4230eb45e5b4fa70efc50abfda088b0e901 | [] | no_license | UnitecProgra3/EjemplosEnClase | da1b8e77d7734489765261266acca6a0a39eb373 | efd3c2cee3df0d345df4ad80c1e5c67bdd791c00 | refs/heads/master | 2021-01-22T07:18:12.071377 | 2015-06-09T22:40:03 | 2015-06-09T22:40:03 | 35,568,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 477 | cpp | main.cpp | #include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
int main()
{
ofstream out("archivo");
int a = 10;
int b = 20;
int c = 30;
out.write((char*)&a,4);
out.write((char*)&b,4);
out.write((char*)&c,4);
out.close();
cout<<"-----"<<endl;
ifstream in("archivo");
int x;
cout<<"->"<<in.tellg()<<endl;
in.read((char*)&x,4);
cout<<"->"<<in.tellg()<<endl;
cout<<x<<endl;
return 0;
}
|
c2eaf09726e4ad01027afa36c15fd1f518333ad6 | 87b6c72a6ad994a5f5987e6fa295ed3ca65c6578 | /_MODEL_FOLDERS_/_modelNameHere/pianoKey_C_Sharp/pianoKey_C_Sharp_Keyboard.cpp | dfb3762c734cee86069dd63458fceeba32c7e4c4 | [] | no_license | marcclintdion/piano | 2b27eabd3cdcf60e0f40afeac83edeb7c7012a4f | daece661c3790c44fcd81c3257ae8ea11dc2f27f | refs/heads/master | 2020-12-24T18:04:24.213413 | 2015-09-17T11:29:37 | 2015-09-17T11:29:37 | 42,652,379 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,889 | cpp | pianoKey_C_Sharp_Keyboard.cpp | //=======================================================================================
/*if (keys['J'])
{
pianoKey_C_Sharp_POSITION[0] -= .01;
}
if (keys['L'])
{
pianoKey_C_Sharp_POSITION[0] += .01;
}
if (keys['I'])
{
pianoKey_C_Sharp_POSITION[1] += .01;
}
if (keys['K'])
{
pianoKey_C_Sharp_POSITION[1] -= .01;
}
if (keys['O'])
{
pianoKey_C_Sharp_POSITION[2] += .01;
}
if (keys['U'])
{
pianoKey_C_Sharp_POSITION[2] -= .01;
}*/
//=======================================================================================
//=======================================================================================
if (keys['J'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[0] -= .11;
}
if (keys['L'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[0] += .11;
}
if (keys['I'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[1] += .11;
}
if (keys['K'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[1] -= .11;
}
if (keys['O'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[2] += .11;
}
if (keys['U'])
{
pianoKey_C_Sharp_LIGHT_POSITION_01[2] -= .11;
}
//=======================================================================================
if (keys['M'])
{
pianoKey_C_Sharp_ATTENUATION += .01;
}
if (keys['N'])
{
pianoKey_C_Sharp_ATTENUATION -= .01;
}
if (keys['X'])
{
pianoKey_C_Sharp_SHININESS += 1.01;
}
if (keys['Z'])
{
pianoKey_C_Sharp_SHININESS -= 1.01;
}
if (keys[VK_F8])
{
ofstream outKeys("_MODEL_FOLDERS_/pianoKey_C_Sharp/pianoKey_C_Sharp_SHADER_SETTINGS.cpp");
outKeys << " GLfloat pianoKey_C_Sharp_LIGHT_POSITION_01[] = {" << pianoKey_C_Sharp_LIGHT_POSITION_01[0] << ", "
<< pianoKey_C_Sharp_LIGHT_POSITION_01[1] << ", "
<< pianoKey_C_Sharp_LIGHT_POSITION_01 [2] << ", " << 1.0 << "};\n";
outKeys << " GLfloat pianoKey_C_Sharp_ATTENUATION = " << pianoKey_C_Sharp_ATTENUATION << ";\n";
outKeys << " GLfloat pianoKey_C_Sharp_SHININESS = " << pianoKey_C_Sharp_SHININESS << ";\n";
}
|
23969d2080bb3a2030bca178c28fe5c13ac5bb3e | 627c6ca5d14153b5dfbbc9e3e690acdbeeadd63d | /PROYECTO FINAL PROGRA 1/Venta_Detalle.h | 2b054f34f2134f38a3152ee7bc448d40dc1aba15 | [] | no_license | Marlon2002/PROYECTO-FINAL-PROGRA | 9ceaa936107a677a1b0334fae8411d81bc162c8a | e3f8c23782f7374883c3dc64c2cbfe43b7eea806 | refs/heads/main | 2023-05-02T21:55:25.847105 | 2021-05-19T22:37:30 | 2021-05-19T22:37:30 | 369,017,837 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,330 | h | Venta_Detalle.h | #pragma once
#include <iostream>
#include "ConexionBD.h"
#include <mysql.h>
#include <string>
using namespace std;
class Venta_Detalle
{
private:
int id_venta, id_producto;
string cantidad;
float precio_unitario;
public:
Venta_Detalle() {
}
Venta_Detalle(int idv,int idp,string cant,float pu){
id_venta = idv;
id_producto = idp;
cantidad = cant;
precio_unitario = pu;
}
void setIdVenta(int idv) { id_venta = idv; }
void setIdProducto(int idp) { id_producto = idp; }
void setCantidad(string cant) { cantidad = cant; }
void setPrecioUnitario(float pu) { precio_unitario = pu; }
int getIdVenta() { return id_venta; }
int getIdProducto() { return id_producto; }
string getCantidad() { return cantidad; }
float getPrecioUnitario() { return precio_unitario; }
void ingresar() {
int q_estado;
string id_v = to_string(id_venta);
string id_p = to_string(id_producto);
string p_u = to_string(precio_unitario);
ConexionBD cn = ConexionBD();
cn.abrir_conexion();
if (cn.getConectar()) {
string insertar = "INSERT INTO ventas_detalle (idVenta, idProducto, cantidad, precio_unitario) VALUES ('"+id_v+"', '"+id_p+"', '"+cantidad+"', '"+p_u+"');";
const char* i = insertar.c_str();
// executar el query
q_estado = mysql_query(cn.getConectar(), i);
if (!q_estado) {
cout << "Ingreso Exitoso ..." << endl;
}
else {
cout << " xxx Error al Ingresar xxx" << endl;
}
}
else {
cout << "ERROR AL CONECTAR CON LA BASE DE DATOS";
}
cn.cerrar_conexion();
}
void mostrar() {
int q_estado;
ConexionBD cn = ConexionBD();
MYSQL_ROW fila;
MYSQL_RES* resultado;
cn.abrir_conexion();
if (cn.getConectar()) {
string consulta = "SELECT vd.idventas_detalle,v.nofactura,v.serie,v.fechafactura,p.producto,m.marca,p.descripcion,p.imagen,vd.cantidad,vd.precio_unitario FROM ventas_detalle as vd inner join ventas as v on vd.idVenta=v.idVenta inner join productos as p on vd.idProducto=p.idProducto inner join marcas as m on p.idMarca=m.idMarca;";
const char* c = consulta.c_str();
q_estado = mysql_query(cn.getConectar(), c);
if (!q_estado) {
resultado = mysql_store_result(cn.getConectar());
cout << "id | NO FACTURA | SERIE | FECHA | PRODUCTO | MARCA | DESCRIPCION | IMAGEN | CANTIDAD | PRECIO UNITARIO" << endl;
while (fila = mysql_fetch_row(resultado)) {
cout << fila[0] << " | " << fila[1] << " | " << fila[2] << " | " << fila[3] << " | " << fila[4] << " | " << fila[5] << " | " << fila[6] << " | " << fila[7] << " | " << fila[8] << " | " << fila[9] << endl;
}
}
else {
cout << "ERROR AL CONECTAR CON LA BASE DE DATOS";
}
}
else {
cout << "ERROR AL CONECTAR CON LA BASE DE DATOS";
}
cn.cerrar_conexion();
}
void buscar() {
int q_estado;
string id_v = to_string(id_venta);
ConexionBD cn = ConexionBD();
MYSQL_ROW fila;
MYSQL_RES* resultado;
cn.abrir_conexion();
if (cn.getConectar()) {
string consulta = "SELECT vd.idventas_detalle,v.nofactura,v.serie,v.fechafactura,p.producto,m.marca,p.descripcion,p.imagen,vd.cantidad,vd.precio_unitario FROM ventas_detalle as vd inner join ventas as v on vd.idVenta=v.idVenta inner join productos as p on vd.idProducto=p.idProducto inner join marcas as m on p.idMarca=m.idMarca where vd.idVenta="+id_v+";";
const char* c = consulta.c_str();
q_estado = mysql_query(cn.getConectar(), c);
if (!q_estado) {
resultado = mysql_store_result(cn.getConectar());
cout << "id | NO FACTURA | SERIE | FECHA | PRODUCTO | MARCA | DESCRIPCION | IMAGEN | CANTIDAD | PRECIO UNITARIO" << endl;
while (fila = mysql_fetch_row(resultado)) {
cout << fila[0] << " | " << fila[1] << " | " << fila[2] << " | " << fila[3] << " | " << fila[4] << " | " << fila[5] << " | " << fila[6] << " | " << fila[7] << " | " << fila[8] << " | " << fila[9] << endl;
}
}
else {
cout << "ERROR AL CONECTAR CON LA BASE DE DATOS";
}
}
else {
cout << "ERROR AL CONECTAR CON LA BASE DE DATOS";
}
cn.cerrar_conexion();
}
void modificar(int idve) {
int q_estado;
ConexionBD cn = ConexionBD();
string id_v = to_string(id_venta);
string id_p = to_string(id_producto);
string p_u = to_string(precio_unitario);
string id_ve = to_string(idve);
cn.abrir_conexion();
if (cn.getConectar()) {
string consulta = "UPDATE ventas_detalle SET idVenta = '"+id_v+"', `idProducto` = '"+id_p+"', `cantidad` = '"+cantidad+"', `precio_unitario` = '"+p_u+"' WHERE (idVenta=" + id_ve + ");";
const char* c = consulta.c_str();
q_estado = mysql_query(cn.getConectar(), c);
if (!q_estado) {
cout << "actualizacion Exitosa ..." << endl;
}
else {
cout << " xxx Error al Actualizar xxx" << endl;
}
}
else {
cout << "error de conexion" << endl;
}
cn.cerrar_conexion();
}
void eliminar(int idve) {
int q_estado;
string id_ve = to_string(idve);
ConexionBD cn = ConexionBD();
cn.abrir_conexion();
if (cn.getConectar()) {
string consulta = "DELETE FROM ventas_detalle WHERE idVenta=" + id_ve + ";";
const char* c = consulta.c_str();
q_estado = mysql_query(cn.getConectar(), c);
if (!q_estado) {
cout << "eliminacion Exitosa ..." << endl;
}
else {
cout << " xxx Error al Eliminar xxx" << endl;
}
}
else {
cout << "error de conexion" << endl;
}
cn.cerrar_conexion();
}
};
|
ddd9ecaeab7876d0ec46b9de20ee849fb5399ed6 | d99d2c0145d7f0609339a868b66a5e9a92e42b61 | /card.h | ccfba6ac723304dfc70f2be08eacc4cc444e8b41 | [] | no_license | AustenBrooks/CatanGame | be0e3c53a24c99e609b778863a7b6e616b2bca2a | a275bdc2f55c700a54720c4b65e3325b2937f3ea | refs/heads/master | 2020-06-01T22:02:37.105194 | 2019-06-08T23:08:26 | 2019-06-08T23:08:26 | 190,943,401 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 514 | h | card.h | #ifndef CARDS_H
#define CARDS_H
#include "players.h"
#include <vector>
#include <ctime>
#include <iostream>
#include <cstdlib>
using namespace std;
class DevelopmentCards{
public:
void action(int, Players *playerName);
void drawCard(Players *playerName);
int deckArray[20] = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5}; // array of cards
void robberCard(Players *robber, Players *victim);
void stealing(Players *robber, int);
};
#endif |
6f3acc35531e89087764596a0bce9f365495bba3 | 703d887e869b7d510eec309d7bfb0acc2da59c10 | /damBreakmodified/0.15/alphaPhi0.water | 6f319dd10d29fb4f3d0c859c4570b8b9f46a8ca9 | [] | no_license | luiscascelli/OpenFoam | a063df7af02b89abdc36268aaa21f5b012963b74 | 9ff3218c8ba584fe15017c766aed9afccf5ddd00 | refs/heads/master | 2023-08-01T00:12:25.059964 | 2021-09-14T19:37:54 | 2021-09-14T19:37:54 | 406,498,391 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 35,123 | water | alphaPhi0.water | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.15";
object alphaPhi0.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
2805
(
-0.000824978
0.000694519
3.43879e-05
-1.95518e-08
-0.000796112
-6.4261e-08
4.94153e-08
-3.23655e-08
-6.78501e-10
0
-2.59375e-08
2.54805e-09
0
-1.57813e-09
2.89415e-09
-1.13762e-10
9.24218e-09
-7.08562e-10
6.55586e-09
3.39506e-09
5.00081e-08
5.1625e-09
1.22229e-09
-1.98033e-11
0
6.40406e-11
2.12083e-06
-1.2123e-05
-6.50512e-06
5.01831e-13
-3.02081e-13
-1.27405e-25
-5.35573e-22
1.40047e-22
-1.27889e-25
1.34772e-28
1.15954e-07
1.23383e-06
4.02485e-15
4.52624e-13
-0.000908976
0.00158137
8.46958e-15
-3.12292e-15
8.39576e-05
6.05367e-05
-0.000247328
8.51544e-20
-9.73481e-19
-5.44016e-19
-2.31539e-09
3.63388e-11
1.95436e-09
9.03616e-16
1.74644e-14
9.49401e-22
1.13578e-22
1.81625e-25
-3.29979e-24
4.76776e-25
8.51131e-24
-7.52958e-23
-3.21536e-06
-0.000734441
0.000749808
5.65777e-09
-3.25273e-09
-4.8786e-09
-6.61613e-05
-0.0012638
0.00132996
-3.63714e-09
-7.15547e-10
-4.70289e-22
1.71195e-22
1.29892e-06
7.93648e-08
-1.42039e-06
3.21609e-08
0
-3.19686e-06
2.15022e-09
-1.06859e-11
7.12255e-12
1.41182e-20
-1.29173e-19
-4.09812e-09
7.2904e-09
0.00110578
-0.00117194
1.52352e-09
2.24065e-23
-2.58026e-22
0.000161601
-6.66078e-05
8.0224e-27
1.64985e-09
-1.32462e-09
-0.000149224
0.00113332
-0.000984632
8.09083e-08
1.59413e-08
-2.04005e-07
0.00198381
-0.0018539
-0.00012803
0.00133999
-0.000544137
-0.00079364
0.000457165
-0.00106289
0.00022618
-0.000125501
0.000108808
7.64535e-06
8.99727e-12
-8.91041e-12
-8.8451e-14
9.71995e-05
-2.67191e-17
3.95463e-19
1.22372e-16
8.99626e-12
3.89767e-08
-4.26752e-08
1.78509e-09
-3.14379e-06
0.00107337
0.0011912
-0.000286733
0.00142491
-4.07349e-30
-2.30592e-32
7.78897e-31
1.61704e-09
4.56949e-12
-4.78507e-31
-1.45267e-25
7.01287e-10
0
-0.00128447
0.00087608
0.000408393
2.12715e-16
-2.0609e-16
-0.00126263
0.000721465
-2.88145e-32
1.71449e-32
-1.25451e-34
1.16103e-13
-1.31112e-11
3.19047e-08
-7.04028e-10
7.02781e-10
-1.84592e-12
-4.32425e-09
7.28527e-10
-4.81546e-31
7.84752e-34
-0.000178698
-0.00155155
0.000287758
-0.00114254
-0.000408995
2.69919e-09
-5.61404e-09
1.29616e-09
-0.000790336
-0.000446609
-0.00149493
0.000352496
-0.00172616
0.000932761
-6.71258e-12
-1.28515e-10
-2.72461e-16
1.2855e-10
5.95919e-26
1.04496e-25
-0.00122485
0.000632902
0.000591949
8.05726e-05
-7.79586e-06
3.54583e-05
1.26808e-14
2.65508e-16
-0.000977394
-5.49213e-21
4.29236e-21
-2.77115e-05
2.96492e-07
-2.68705e-07
-7.55137e-30
7.21469e-30
2.46038e-27
-6.63292e-29
3.35508e-08
5.03433e-10
-4.42309e-09
-5.06647e-10
-9.3668e-06
4.00109e-06
-9.94077e-18
1.52912e-16
-0.000723985
6.35665e-05
9.35373e-09
-4.64626e-08
-1.29052e-28
-2.02692e-29
0
1.8385e-09
6.60152e-08
-3.78222e-09
-3.1059e-08
6.62553e-05
5.9057e-28
-9.82705e-27
3.67289e-29
1.39974e-27
1.82845e-11
1.35048e-10
-4.94488e-05
0.00130838
4.82293e-05
4.97678e-09
-7.59328e-09
1.52493e-10
2.44244e-11
-4.8317e-11
7.12704e-34
-2.4048e-32
1.45418e-08
-0.000476295
1.16009e-05
3.48706e-09
8.60799e-09
-3.24505e-08
0.000452697
-0.00121109
0.000758389
-0.00130865
-0.000416555
2.81788e-10
-7.68002e-06
3.22433e-08
1.33711e-28
-5.56101e-34
2.24223e-21
-1.45817e-19
-1.41841e-20
-0.00173254
4.80512e-08
3.37039e-05
-0.00448741
0.00442616
6.12424e-05
-0.000211196
-1.17053e-08
1.11209e-32
2.39487e-36
-1.5575e-12
2.12015e-12
-3.77276e-12
-8.42501e-09
-2.63799e-10
-0.000220614
-0.00127303
2.95638e-09
-0.00133299
0.00356804
-0.00223505
-3.08751e-05
-2.45745e-05
8.60515e-10
-5.01935e-10
-1.64508e-12
3.69165e-10
-0.000772154
0.00012366
2.062e-10
-7.20919e-10
-2.71627e-09
2.17149e-08
-9.8031e-17
3.40936e-15
-1.68678e-08
-0.00010252
-6.50595e-31
0.00150549
-0.00150575
-7.09118e-07
2.85237e-07
2.5462e-09
-7.54633e-10
-0.0021708
0.000837811
4.65815e-12
0
-3.95864e-37
2.69649e-35
5.90658e-23
7.48915e-24
0.000191734
0.000441168
-0.00448742
-4.69177e-08
-1.21899e-08
7.92411e-10
-1.61999e-11
6.63444e-10
4.36086e-13
4.09493e-13
0.00407034
0.000355825
8.00335e-09
-3.0888e-05
5.74034e-08
-0.001036
0.00019953
0.000836467
-0.000341988
-0.000869098
3.02601e-10
3.18932e-11
-0.00452352
3.61029e-05
-0.00072889
0.000597661
0.000131229
2.99501e-11
8.46003e-14
-1.96451e-13
0.0014876
0.00258274
-0.000651983
-0.000391821
7.85538e-10
5.10478e-09
7.00118e-08
7.04784e-10
-4.39747e-11
-2.61584e-11
-4.17167e-05
4.40212e-31
-0.000105128
1.75714e-10
-1.14814e-11
-3.47043e-10
0.000987972
-2.00428e-09
1.6583e-09
5.57398e-12
2.67058e-14
4.57517e-11
-2.593e-12
3.17514e-14
-6.48907e-14
-6.56043e-15
9.4137e-32
1.33319e-28
-0.00147788
0.00103185
0.00044607
4.54305e-14
1.39709e-14
-0.000897702
-0.000396965
2.84109e-05
-0.00185903
-4.04879e-07
2.21535e-08
-2.80227e-15
1.62421e-15
-2.72558e-17
-4.45967e-05
-0.00131961
0.000450517
3.02299e-11
-7.02996e-11
1.91447e-11
-1.1089e-05
-4.2246e-08
1.22355e-12
8.87305e-15
-5.43193e-15
-0.00452352
-1.36998e-17
9.63052e-18
6.68639e-20
4.15757e-12
1.09541e-10
2.57249e-12
-5.88132e-13
2.2482e-10
-8.75217e-10
-3.7034e-06
6.8201e-12
-3.73907e-11
-1.19916e-12
2.02173e-11
1.50069e-14
1.24644e-12
-8.50799e-14
1.27159e-07
-1.06668e-06
0
-2.76301e-11
-0.00461322
8.96958e-05
9.17771e-11
-3.07568e-20
1.84545e-18
-8.01793e-19
1.44965e-15
1.1631e-16
4.40427e-17
0.00118127
5.44117e-39
-4.03234e-37
2.53993e-12
2.81795e-14
-0.00125235
-1.20276e-05
8.30457e-13
-0.000444048
1.05063e-12
7.05624e-22
-3.41349e-20
2.88515e-13
2.67147e-20
1.27801e-19
-4.55733e-08
-3.47838e-11
5.26578e-11
-1.84303e-10
1.4571e-11
5.51696e-17
1.30993e-15
2.21888e-11
1.04783e-11
-6.11285e-08
-2.09961e-10
1.03155e-30
2.18075e-30
-8.21739e-30
1.69998e-12
4.37976e-21
2.017e-21
0.00019953
2.45379e-18
7.46279e-20
2.41865e-14
-3.22019e-15
1.85887e-13
-1.60292e-14
-0.00461322
9.41373e-32
-3.70887e-37
3.31805e-14
-1.89508e-13
1.91462e-16
-1.87211e-16
-1.94017e-07
2.26594e-08
0.00196894
-0.000836468
4.59292e-06
-2.28374e-14
3.06858e-13
-1.88871e-05
-0.00112502
5.29929e-12
-0.000462664
-0.00307474
-0.00153848
4.7851e-17
-1.43783e-18
5.15394e-11
-2.03067e-07
-9.60307e-06
-5.13237e-21
2.99395e-21
2.23778e-27
3.44359e-29
-4.99959e-15
2.44112e-15
-1.5917e-14
2.14618e-14
8.08376e-16
1.39422e-14
1.65462e-13
-1.85956e-32
6.08575e-32
5.71394e-05
2.2185e-24
3.34842e-25
0.000844968
-0.00125391
0
-5.84586e-05
0.000570685
-1.36814e-09
1.1904e-09
0.00137651
6.29818e-12
-3.41963e-11
-0.000537156
-1.57655e-07
-1.29788e-16
6.11422e-17
-2.79312e-17
-1.7102e-32
2.69108e-33
0
-1.34517e-16
2.95731e-15
8.88539e-22
-1.84552e-21
6.93318e-12
2.70204e-12
-7.3088e-06
-0.00307474
-4.01645e-29
3.76551e-19
4.68126e-17
3.94518e-05
-0.000155493
-2.53489e-09
0
-0.00356804
0.0004933
6.45189e-16
-9.08704e-17
7.62866e-15
5.54504e-14
3.80932e-14
-0.00100191
-0.000170027
2.00002e-23
1.83789e-23
-2.96541e-21
7.59519e-19
-2.13978e-08
-0.000244064
0.000841725
8.1811e-22
-8.82738e-21
8.73289e-07
-3.96503e-06
-7.85625e-05
1.07866e-24
3.49416e-12
-9.84859e-18
9.98273e-19
-3.25258e-42
1.28846e-40
-3.89744e-16
3.16309e-15
-3.03083e-19
1.71442e-19
-5.88992e-20
6.20147e-06
-5.44618e-06
-5.05406e-16
-4.43736e-17
8.52711e-17
-0.00142897
-1.64193e-05
3.29285e-24
-4.16086e-22
3.56864e-19
-4.02107e-20
4.85062e-21
2.88359e-21
-1.97634e-19
-7.24089e-07
2.92556e-08
1.35401e-15
2.86371e-17
2.05482e-14
2.43382e-16
-0.000156938
4.64151e-13
5.32709e-13
2.6626e-13
0.000533397
-0.000777461
-2.28002e-22
3.84704e-24
1.03988e-12
-1.2162e-15
-6.50104e-12
1.05368e-15
2.3578e-19
-1.88309e-05
-4.17387e-15
-2.15817e-11
2.18744e-13
-1.294e-34
9.24188e-37
4.49857e-21
-3.39633e-20
5.7474e-17
0.00110792
-0.00111601
6.49783e-24
-1.77695e-23
3.79501e-33
3.02921e-15
3.34627e-15
1.21237e-21
3.52477e-19
1.39658e-13
0
0.000221232
-1.42366e-23
7.096e-24
3.22475e-08
3.65923e-08
1.56396e-22
-4.76054e-23
-1.84097e-36
5.57824e-34
2.63449e-36
-2.38226e-37
1.98803e-26
3.10752e-27
-1.61815e-25
1.3601e-26
-0.000640698
0.000771927
1.32191e-18
-7.70602e-26
2.14326e-05
5.3022e-09
-1.09637e-08
-0.000733502
0.00142969
-0.00209312
8.55579e-18
-1.82476e-18
3.87101e-17
-2.12309e-16
-1.46793e-20
8.346e-18
5.88303e-26
8.67164e-26
-2.56872e-23
2.99522e-24
-1.0624e-17
7.65957e-34
-2.29646e-34
1.9337e-26
1.08604e-14
2.73623e-23
8.339e-14
-2.98173e-13
1.39638e-21
-4.26051e-22
5.57312e-16
-1.14504e-15
2.91e-17
2.13223e-17
-9.33169e-19
3.36064e-36
9.40254e-32
-2.2177e-28
1.42626e-29
-6.79542e-09
4.06512e-10
9.16649e-25
1.53261e-24
-1.58027e-25
5.93521e-26
1.8546e-36
1.21209e-37
1.98859e-39
5.21343e-10
6.94379e-17
2.57944e-18
9.20412e-14
-1.20209e-15
-5.52261e-16
-0.00014553
1.34207e-35
3.25498e-31
3.85194e-15
1.07656e-23
9.44546e-24
5.24025e-18
2.45104e-37
-1.94937e-37
1.30765e-17
9.41176e-17
-3.66119e-28
1.48522e-28
1.87922e-25
-2.46528e-14
1.51173e-14
3.07832e-37
-0.00105085
-0.00111995
0.000544117
-2.04562e-08
1.04896e-08
-7.08973e-08
-1.10753e-10
0.0014876
2.86952e-34
-2.66242e-35
9.5522e-17
8.38508e-16
-9.3403e-16
5.75983e-40
7.04906e-29
2.02562e-26
-5.21034e-26
5.04964e-24
-7.33443e-23
4.57091e-19
3.50013e-18
2.2071e-16
1.0321e-24
1.38585e-21
6.76176e-44
-3.33003e-42
1.28058e-15
-2.72673e-16
1.86997e-24
-1.7097e-26
1.84251e-16
-8.12435e-16
6.4102e-17
-6.13103e-08
7.0586e-26
1.2072e-14
1.16597e-14
7.46806e-17
0
-4.7216e-27
4.54584e-28
-4.1961e-17
-4.20355e-26
-1.23412e-06
0
-0.00113202
0.000961996
3.76226e-25
1.07785e-24
-5.99873e-32
3.33173e-32
2.29342e-36
7.44744e-17
-5.57175e-34
6.3088e-24
2.65157e-24
-1.2346e-22
1.13245e-18
-1.47648e-32
-7.28227e-17
8.24787e-06
-3.99103e-08
-1.12792e-05
9.55044e-17
2.74982e-28
1.08492e-14
-7.39035e-31
1.68836e-31
2.55679e-19
0.000701677
0.000140048
5.87463e-39
-6.52242e-40
4.65879e-28
2.33248e-28
-6.19907e-05
3.59537e-19
6.8923e-37
-3.9451e-37
4.8346e-26
2.08374e-25
1.99786e-20
5.80987e-14
-8.11509e-14
1.70529e-32
2.1767e-20
-1.57592e-15
8.35509e-17
-4.24931e-26
3.56506e-26
-1.99513e-25
2.09792e-26
-6.10608e-41
1.44198e-39
2.97584e-16
-3.1015e-16
-2.7246e-26
5.21489e-27
2.14134e-08
5.70007e-08
6.7556e-25
1.03926e-09
9.50689e-10
2.45941e-38
6.59974e-40
-3.02694e-40
6.68689e-25
-1.29702e-24
1.63254e-18
-0.000496194
-4.60207e-29
4.70115e-30
1.35084e-25
7.80241e-27
0.000935815
-0.00109273
-8.42984e-16
1.06294e-15
-3.54569e-15
-2.75769e-11
-0.00108443
0.000905727
9.48635e-20
-1.33197e-20
1.84145e-40
9.75762e-41
-1.433e-39
3.71602e-37
5.83015e-19
3.52405e-20
3.19332e-38
5.5106e-43
1.77993e-26
3.82001e-30
-1.52586e-32
3.51294e-34
1.16655e-36
-1.57205e-40
-5.88248e-34
2.74813e-35
-1.47744e-07
0
-1.19716e-35
3.95613e-27
-6.07275e-08
8.59287e-26
-2.61211e-28
-2.67718e-16
4.88118e-16
1.76207e-42
4.35334e-37
-3.16308e-38
-3.34172e-34
-0.000281767
0.000815164
1.36599e-25
3.00026e-28
2.82156e-15
-1.31009e-28
2.70583e-29
1.47605e-07
-3.09595e-48
2.98135e-46
-1.7571e-26
2.63526e-28
-1.08057e-31
2.70542e-32
6.74656e-28
3.49575e-27
-1.23284e-16
-1.53885e-25
2.9011e-08
-3.11117e-08
9.81996e-17
2.72248e-39
1.9129e-21
9.17926e-40
-7.19898e-40
1.95354e-41
5.46048e-29
1.32085e-21
1.85876e-18
1.21198e-42
5.13948e-28
9.37203e-29
-3.72246e-29
4.13247e-16
-3.66892e-16
-9.29434e-17
9.26639e-23
7.63137e-23
0.00101241
-0.00115516
-5.52109e-12
6.70596e-12
6.27962e-33
8.90491e-28
6.31773e-25
8.34275e-28
1.54197e-26
8.08286e-21
2.67938e-20
1.36711e-28
3.92992e-16
1.00387e-14
1.59997e-10
-3.73957e-10
-3.17598e-43
6.52299e-43
3.57274e-21
4.93208e-17
5.87869e-17
-1.385e-30
9.4401e-32
-3.73987e-28
3.10927e-28
0.000558369
-0.000840136
-6.75889e-12
5.5731e-14
5.27039e-09
-8.86035e-16
8.04325e-17
-1.2333e-35
3.09012e-37
-0.00102631
-0.000105711
-0.000201639
0.00107772
-6.46136e-43
3.84248e-42
2.14801e-08
-8.63278e-15
-4.11758e-37
3.20123e-38
-1.27331e-40
1.5638e-40
5.7674e-29
5.98074e-29
-3.59775e-34
2.16697e-35
7.31156e-17
1.91875e-16
5.27485e-16
-8.90298e-14
0.000234479
0.000580685
-0.00012243
5.54118e-32
1.05487e-29
-1.62151e-10
3.68387e-41
1.19731e-16
-2.2804e-14
1.28473e-16
-3.34777e-09
-9.04941e-05
4.3833e-29
-2.86376e-16
-4.20505e-39
-1.93887e-35
7.62448e-40
-3.65481e-41
0.000719629
-5.70178e-06
7.87066e-43
-7.56644e-43
-9.83552e-15
3.33215e-14
1.58895e-08
2.19303e-25
-1.51975e-30
1.54729e-19
-2.86081e-18
-1.49994e-29
1.65659e-30
-5.29574e-44
8.06049e-44
1.40794e-20
2.45418e-42
-2.10929e-16
4.89077e-18
-2.79366e-15
-2.63682e-28
1.53297e-30
1.31447e-28
2.71945e-27
2.71513e-16
1.5076e-16
-0.000556229
-5.88689e-33
8.37686e-34
1.63223e-30
0.000874418
0.000500609
-1.19735e-19
-2.15059e-17
1.81294e-25
1.42401e-44
-7.5047e-11
3.49959e-11
3.72736e-46
1.02725e-27
2.19435e-28
-1.46605e-20
-2.53652e-23
-1.42501e-31
2.94892e-28
-1.87509e-27
-0.00102794
0.000826303
2.49802e-30
2.14755e-30
-6.74111e-23
2.53637e-24
1.79579e-08
-9.92047e-10
-8.66205e-14
1.21066e-14
0
9.1573e-31
2.93687e-34
3.74516e-29
2.89805e-17
-3.07889e-07
3.38496e-12
3.28552e-30
1.43754e-43
6.27687e-44
7.65179e-24
2.08147e-11
7.75147e-12
1.49468e-20
-2.46427e-22
0.000823486
0.000254233
-1.15083e-16
-1.85084e-25
9.65995e-17
-6.42077e-12
-3.89205e-32
7.44883e-33
1.86734e-21
6.07594e-24
-8.00273e-05
-1.35398e-14
2.23387e-15
1.00994e-45
7.79439e-26
7.07503e-19
1.64382e-18
-4.16257e-44
1.23932e-42
-4.36877e-37
2.55248e-38
-1.00045e-10
4.41414e-28
7.0002e-31
3.13604e-22
-3.38695e-38
0.000936156
4.23673e-39
-1.76099e-40
-4.7831e-17
9.19119e-44
3.69186e-41
-1.30388e-43
-2.33552e-31
6.94375e-31
-2.25958e-35
1.90327e-36
4.6629e-48
-2.28482e-47
-3.74517e-29
1.37535e-31
7.39994e-33
1.88768e-47
1.3631e-36
3.32977e-42
2.4842e-31
8.24447e-32
3.30287e-44
2.43582e-25
1.52337e-15
7.90516e-43
-3.28081e-44
1.92301e-31
2.80518e-30
1.16257e-08
-2.36744e-37
1.22956e-20
-2.23783e-18
-1.24615e-15
2.81357e-17
-5.16147e-05
-2.65425e-16
3.55728e-17
1.68992e-45
-0.000122214
-1.53844e-34
1.13593e-35
6.69918e-46
2.44849e-32
1.69857e-32
2.03439e-32
-1.74315e-31
4.88802e-32
4.86957e-10
-3.07765e-16
-5.88901e-08
5.37217e-08
-1.34964e-36
-5.30609e-17
1.34709e-20
-1.23632e-42
1.57298e-40
-2.8451e-17
1.83287e-19
-1.48884e-19
2.45145e-17
-1.53272e-30
8.8745e-33
-5.86747e-34
-4.53443e-46
2.1975e-45
4.56926e-46
-2.35962e-46
4.63067e-36
5.59937e-24
5.08542e-46
-5.92644e-46
0.00101304
-0.000317724
-0.000695315
2.42432e-25
-8.15004e-33
-9.43067e-18
0.000431743
1.39656e-28
-4.97982e-11
-3.51803e-38
9.57803e-40
3.20069e-33
-1.4335e-31
5.68709e-34
1.31023e-20
5.98441e-06
-5.40198e-08
5.90731e-33
-3.1571e-33
3.19741e-34
2.22799e-16
-2.57161e-17
4.71742e-30
3.86957e-30
1.78774e-40
-1.73816e-41
3.07517e-09
-1.20408e-19
1.25144e-21
2.1794e-43
1.31718e-43
-2.92237e-46
-1.36386e-39
1.09959e-25
6.60211e-34
8.43787e-33
9.57717e-34
-8.54214e-20
7.59596e-47
0.000545348
0.000467691
-3.42631e-37
5.68848e-38
3.30916e-44
-1.06211e-46
2.04366e-31
3.48576e-32
-3.053e-39
1.28888e-05
3.01094e-06
1.59714e-07
-3.16018e-47
4.25518e-47
2.81316e-11
-2.44329e-17
4.19389e-17
3.53515e-46
-8.81828e-09
-6.0005e-10
-2.46313e-22
3.81142e-25
1.3286e-12
2.23261e-12
-4.99631e-17
-1.04854e-25
2.30094e-47
2.46232e-22
-0.00104067
0.000269458
0.000771207
3.24289e-34
4.79994e-50
3.65063e-39
7.68127e-48
-1.7156e-43
7.99432e-47
1.67415e-47
4.27008e-32
-1.15011e-22
6.13136e-46
-2.288e-47
2.41962e-17
-4.21721e-23
1.69765e-23
2.51774e-23
1.97291e-11
-0.000771927
0.000911975
-1.0556e-33
2.96281e-34
4.11048e-21
1.4848e-34
-1.23508e-17
-4.98336e-36
9.82638e-37
-8.99524e-52
6.7858e-51
6.40005e-23
0.000217179
-0.000999999
0.000782819
1.78669e-26
-0.00112807
0.00102236
-7.31401e-26
0.000142487
-0.00119334
4.42051e-49
0.00104271
-0.00113318
8.93423e-49
-7.87852e-46
-6.97625e-46
-4.45461e-17
7.97038e-18
4.4785e-37
-1.80934e-23
5.31257e-22
-1.38985e-39
1.98346e-41
-7.853e-35
7.87313e-35
-6.65521e-18
9.58484e-20
-1.82369e-41
7.66887e-43
-2.39644e-47
2.78726e-47
-7.01263e-43
-0.00029376
0.000874445
1.07154e-46
-2.16795e-49
7.15062e-10
8.31061e-33
-8.14119e-37
7.3099e-35
-3.38302e-41
-2.38494e-20
2.2078e-49
2.22549e-32
6.61623e-08
-4.39972e-10
5.59951e-24
-1.63244e-28
-6.71466e-10
-9.79409e-17
0.00110732
-0.00118564
6.27682e-45
9.60942e-44
-4.55282e-45
5.9005e-34
-1.77346e-42
0.000812602
2.42727e-24
2.95482e-34
3.59785e-35
2.4015e-36
5.0243e-50
-3.18393e-35
3.97143e-36
1.29819e-17
1.20002e-34
-3.31369e-10
-1.55705e-16
1.44019e-10
1.31942e-46
4.24798e-35
2.06668e-35
2.82001e-14
-4.83477e-39
9.24847e-40
-0.00107891
0.000956485
4.44465e-10
-2.91822e-16
4.1771e-39
-0.000173696
2.69823e-49
2.30485e-47
-6.87658e-50
1.885e-36
0.000884897
-8.18919e-07
1.25907e-25
-1.57106e-34
0.000518843
4.27328e-23
-6.85723e-23
5.76414e-36
8.37884e-36
-1.55428e-22
5.50358e-22
-7.4697e-51
5.66107e-49
-8.61117e-20
2.34167e-22
1.01577e-40
3.05469e-21
-9.08659e-20
2.52803e-34
1.82293e-34
3.56855e-28
-3.08783e-39
1.15914e-41
-1.2702e-22
-3.37581e-49
2.47448e-49
3.1877e-26
4.23544e-37
1.05997e-50
-9.10492e-50
1.24263e-50
2.65181e-24
-1.72154e-47
3.39438e-46
5.66852e-16
-3.4644e-16
-1.50085e-37
1.6946e-36
-7.10672e-43
1.05551e-44
-2.74569e-37
3.07809e-38
-1.74509e-44
2.35314e-08
-7.5187e-51
4.2085e-53
-1.15495e-17
-1.9193e-23
0.00151746
-0.00176033
-5.8625e-13
2.3963e-22
-2.78563e-25
4.64287e-45
-1.92543e-46
-3.49789e-41
8.35312e-43
0.00184923
1.737e-35
2.68658e-36
3.06129e-48
1.43569e-38
-2.78055e-49
1.80593e-50
4.62687e-37
6.78385e-23
3.4696e-49
-1.23688e-50
-3.88487e-22
1.56246e-22
5.49671e-12
1.5147e-49
2.20485e-49
-6.74232e-51
2.19874e-36
-2.75492e-37
8.00375e-37
-1.0976e-22
1.91388e-24
1.17069e-07
-4.41822e-08
9.05076e-53
2.81942e-47
1.3194e-52
0.0010832
-4.04887e-05
3.8905e-35
2.12817e-34
6.92946e-50
-1.30308e-52
-8.3766e-26
-1.02675e-42
1.22182e-25
4.83843e-26
-1.92299e-18
1.82982e-37
-7.09755e-33
-2.92589e-35
1.0696e-33
-2.37205e-37
2.40218e-38
-4.48743e-05
6.37779e-17
9.40477e-31
2.49895e-13
-2.77493e-05
-3.0153e-48
-0.00097727
0.000855056
6.15524e-38
4.64152e-51
-2.56767e-05
4.57279e-53
-9.45771e-52
-2.37091e-40
5.77406e-41
2.62253e-53
5.61771e-14
3.61327e-52
3.15406e-51
-1.03151e-38
4.73703e-39
1.46559e-16
-8.04164e-19
1.16015e-05
-6.69545e-08
-3.75581e-46
-3.06747e-55
2.40134e-36
1.62745e-40
5.02079e-37
2.55406e-34
-1.91816e-34
-1.06318e-50
1.08415e-50
1.05085e-36
-3.57786e-46
6.44405e-45
-1.59209e-26
7.09665e-26
-7.501e-05
9.80755e-39
-6.8912e-26
3.01106e-29
-1.76194e-44
2.67905e-46
8.12232e-42
-9.38666e-42
3.68454e-42
-1.20388e-22
1.21872e-25
-1.97649e-46
5.09146e-48
3.31915e-48
-5.04085e-48
-5.65549e-05
4.2094e-35
1.00956e-17
-5.84641e-18
-6.18992e-29
1.24455e-50
-3.51582e-53
-2.65549e-27
-4.62368e-46
4.62038e-39
1.71653e-07
-1.82576e-08
-5.03223e-07
4.09177e-51
-2.6997e-39
1.45413e-40
-0.000107234
0.000974842
-0.000867608
1.68005e-22
-1.21351e-23
1.84191e-28
9.68292e-17
3.06144e-48
-5.16446e-52
9.58864e-41
8.87502e-53
-1.05158e-42
2.46096e-44
3.35601e-39
1.38025e-38
1.32194e-52
1.46775e-55
3.94002e-11
-6.50705e-56
6.55882e-55
2.95084e-39
2.50595e-39
1.59658e-51
5.13703e-54
5.49783e-12
-9.62463e-16
-1.62997e-10
2.88903e-10
1.48812e-22
-1.04015e-09
1.97592e-25
-1.23659e-28
5.01318e-53
1.39399e-41
6.62356e-56
-3.41021e-26
2.22593e-27
-7.17644e-51
5.44844e-51
9.93418e-39
5.6234e-39
-2.40255e-44
3.46647e-40
1.3936e-39
2.98242e-54
-3.73005e-53
5.13015e-37
4.55507e-29
-6.53324e-55
1.20769e-52
0.000305199
0.000569245
4.36946e-19
-2.35994e-18
-1.24134e-40
5.74148e-40
-2.50589e-20
-1.37111e-20
-9.8286e-26
6.9675e-29
3.53882e-53
-6.25716e-56
-9.60712e-47
-8.2469e-42
1.31112e-42
-5.10361e-48
7.66567e-50
-3.16753e-30
8.4516e-16
-6.25535e-16
-1.29982e-40
1.0946e-40
7.46357e-09
-1.0933e-49
-3.51671e-51
-2.07849e-05
3.22593e-56
-1.26034e-58
5.231e-52
-9.04702e-54
9.16538e-53
-1.44204e-52
0
4.30886e-53
3.92114e-55
1.49289e-39
6.91371e-39
-3.91398e-41
4.52648e-41
-4.68286e-46
6.61313e-48
1.47424e-52
-5.11814e-54
2.00568e-43
0.00100929
-0.000226474
-0.000964261
0.000790565
2.96095e-41
-3.36745e-18
1.05807e-56
4.09088e-20
-2.17723e-41
1.09443e-42
1.49449e-41
5.55765e-10
3.80036e-40
8.87341e-41
1.029e-55
2.73095e-56
4.27704e-58
6.92179e-30
-1.23573e-47
-2.602e-27
2.58018e-30
6.4307e-41
1.32106e-58
7.19708e-42
-4.09844e-51
3.98167e-51
-1.70189e-14
3.31848e-33
-1.30614e-33
0.000635232
0.000374061
-6.37137e-43
1.31772e-43
-7.57606e-31
-6.57804e-53
3.62588e-54
8.88667e-54
-3.19824e-56
3.04586e-33
2.77809e-29
-2.77809e-29
-1.43625e-55
-3.89793e-55
2.79431e-42
-2.55885e-44
1.07181e-45
1.88131e-41
-5.12229e-44
-7.18679e-54
1.99261e-54
-1.05158e-40
0.000413288
4.61122e-17
3.60162e-16
-2.66561e-17
6.33848e-56
3.07327e-57
4.00358e-43
5.14435e-54
-1.39181e-56
-0.00126835
0.000736319
0.000199836
2.46418e-41
1.04345e-22
9.73791e-55
-6.21747e-29
1.71568e-32
-5.6713e-34
1.56217e-43
8.17639e-15
0.000788301
-5.79956e-46
-1.53696e-39
3.27108e-39
1.10409e-53
-6.23627e-21
1.10023e-55
6.39212e-55
-1.10651e-49
2.0077e-51
2.73546e-18
-2.63978e-18
-3.75174e-53
2.07394e-53
-8.49852e-54
5.9709e-59
2.25312e-45
2.89916e-47
-4.79385e-48
-1.91302e-30
7.29684e-31
-9.77369e-44
2.4965e-45
1.21084e-10
-3.44531e-18
-2.74592e-51
-1.0441e-54
1.59871e-57
1.45514e-43
5.36178e-44
3.92067e-55
4.7312e-59
5.35133e-41
-8.83635e-45
1.07325e-43
-0.000109205
2.97814e-33
2.73563e-16
-3.09732e-51
1.10731e-53
-1.25508e-47
1.78539e-49
2.83766e-18
-3.48977e-30
1.73014e-33
-2.41797e-54
1.53466e-54
-2.37842e-34
1.4943e-46
-2.25733e-44
6.32846e-44
1.2775e-58
1.39937e-56
-1.72612e-59
1.00341e-28
-1.43258e-31
-1.06579e-59
1.08282e-58
-2.13572e-44
2.6088e-44
-2.50557e-49
0.00100427
-0.00104476
-4.22092e-56
-2.23326e-61
-1.17444e-44
4.30717e-45
-8.92047e-06
1.10608e-07
-5.24529e-38
-1.33779e-39
2.7499e-38
1.40354e-43
2.23292e-43
3.65622e-17
-3.30591e-17
9.16888e-60
1.02974e-56
-1.27625e-58
1.60864e-60
-2.44069e-45
1.40793e-45
1.38303e-59
-1.00799e-59
0.00104472
-0.00106999
-0.00100427
0.000959396
-6.04005e-46
1.71703e-47
-2.45788e-57
-5.77053e-55
3.22509e-60
-7.58242e-31
1.24578e-34
5.26822e-46
-9.46795e-46
2.6686e-47
8.14764e-44
2.15064e-43
-0.000410336
0.00106579
-8.63593e-54
1.38625e-55
-3.8069e-18
1.94074e-19
2.89525e-18
2.75753e-44
1.39571e-43
-3.40235e-57
5.78331e-62
7.48224e-58
-1.16401e-56
-2.47733e-55
-3.27429e-35
2.58004e-56
-4.63948e-56
-4.2186e-23
4.77625e-35
-1.16249e-48
-3.48847e-40
6.21956e-42
3.62337e-46
-2.78119e-51
4.2648e-53
-8.41776e-59
2.93952e-42
-1.07881e-58
1.58055e-56
3.41749e-34
2.69049e-29
-1.85385e-29
-4.57417e-09
2.8966e-59
1.42592e-59
1.95892e-46
-3.53171e-09
1.32927e-17
4.7875e-62
4.72081e-56
-1.59426e-57
-1.21632e-54
5.95773e-55
7.3832e-47
6.68826e-46
-4.2429e-53
-8.22148e-36
6.77103e-20
-6.75497e-20
6.21732e-34
-1.10122e-36
8.66983e-48
1.2265e-62
7.45766e-36
-7.43484e-43
3.70442e-43
-1.69953e-47
1.57653e-48
3.39128e-09
-7.429e-11
-2.53367e-49
2.50912e-51
2.32145e-48
-0.000959396
0.000902841
-5.43578e-07
5.41533e-07
4.46872e-10
3.58254e-61
-2.0102e-18
2.25807e-57
-2.28214e-59
2.54517e-60
-7.74038e-58
1.1763e-48
3.74509e-44
3.2778e-35
1.60083e-57
-4.164e-60
0.000365801
0.0004225
6.4846e-61
1.70068e-64
1.2542e-61
1.32719e-10
-7.27937e-18
-2.46815e-52
1.39219e-06
-0.000372974
9.34045e-05
-2.38014e-34
6.00797e-37
1.16832e-61
5.14056e-17
-4.29781e-17
1.72109e-50
-1.08612e-49
-3.34399e-45
9.31169e-46
2.75875e-46
-6.09505e-39
6.02595e-60
-2.49946e-58
-8.30313e-65
-0.000911074
0.0006846
-0.00081783
2.24884e-58
2.45792e-59
7.78725e-46
-8.46874e-57
3.73964e-58
1.00176e-45
7.93604e-64
5.12738e-64
-1.0425e-48
3.96426e-48
1.69349e-32
-4.49269e-35
-1.11385e-48
1.20594e-50
-1.29311e-59
-1.18916e-61
-2.54283e-55
6.98901e-57
5.98341e-19
4.77907e-17
-1.64612e-48
3.26096e-48
-3.82595e-61
-0.000120509
0.000882057
-0.000902841
-7.45737e-64
1.5904e-63
0.00106635
-0.000923859
-5.00554e-57
-1.68948e-48
1.92614e-48
-6.08039e-44
2.67114e-44
3.65191e-61
-5.83862e-55
2.01018e-57
-9.17732e-60
3.55227e-48
-2.60521e-49
4.18223e-60
1.22692e-63
-1.17037e-48
7.1973e-49
-4.2701e-53
3.65768e-55
0.000518159
-0.000625393
2.30224e-17
9.00779e-64
-4.47172e-63
-4.92448e-49
9.31967e-50
2.7428e-54
-5.9149e-55
-3.27784e-35
3.37325e-39
4.45322e-59
3.22829e-09
0.00104152
-1.37791e-63
1.03522e-62
-1.42477e-52
3.41749e-34
1.04204e-42
3.18944e-11
-4.33848e-60
2.25222e-63
-2.60968e-56
-7.19429e-50
2.06796e-50
0.000935046
-1.07795e-58
-3.99854e-40
1.21233e-46
-1.13242e-16
4.93553e-16
-2.25695e-31
-2.47808e-52
1.6272e-54
-1.80885e-61
5.2274e-42
-2.05944e-42
1.57346e-66
-6.70792e-63
4.079e-64
2.96672e-66
2.02982e-48
4.08814e-49
7.22505e-64
1.00317e-50
1.75197e-54
1.53415e-61
-2.75064e-60
-7.9715e-63
3.95545e-62
1.19135e-36
-5.00431e-41
4.47387e-40
-2.91831e-58
8.66415e-59
-1.04508e-50
3.03255e-52
5.21492e-64
7.94803e-67
1.27281e-50
0.000911975
-1.70702e-64
8.83859e-51
9.63757e-64
3.60105e-51
1.14137e-59
-3.64027e-61
0.000772851
3.62592e-25
-3.62561e-25
0.000891205
-0.000255973
0.00223505
-0.00116871
3.13252e-65
5.5046e-60
-1.12688e-59
1.05582e-51
0.000573481
-3.06826e-56
-1.93417e-44
1.9348e-44
1.20687e-52
4.6403e-48
1.64467e-49
1.01264e-52
5.34242e-51
1.8749e-42
-3.92042e-61
9.44753e-63
-6.75492e-20
-6.10054e-39
2.55602e-41
-6.02274e-47
1.97089e-47
3.53541e-17
-3.73684e-17
-5.07377e-57
8.0095e-59
3.61065e-61
-2.83047e-63
5.76045e-49
2.15161e-48
-3.5145e-43
9.1199e-18
-1.5506e-16
3.65176e-61
-9.10571e-64
1.37797e-67
-7.86903e-67
2.56057e-35
-2.42708e-39
3.78846e-62
-4.08812e-16
3.28117e-16
-5.69649e-62
1.94838e-66
-1.03109e-62
1.03356e-60
-7.5352e-61
-2.54242e-68
-2.32936e-60
2.30508e-65
-4.7656e-64
1.00273e-53
3.8456e-63
0.00124577
-0.000727611
-5.52438e-64
-1.00182e-46
-1.16211e-67
7.0996e-68
5.22546e-67
1.42122e-62
-5.9107e-64
-1.3848e-52
1.50374e-54
-3.65805e-63
-2.61906e-56
1.7746e-58
0.000321912
-8.05858e-58
2.68658e-59
8.68643e-64
-2.03839e-63
-1.2403e-17
5.84022e-65
-6.6638e-50
1.34885e-51
-5.88464e-68
1.00711e-67
0.000206485
5.06253e-10
-2.90881e-60
2.4886e-42
-6.64475e-44
-0.00123431
-1.14007e-47
1.15432e-47
1.09044e-66
9.9601e-68
-1.98889e-62
2.18008e-19
-1.28946e-20
2.5346e-70
2.05483e-63
-5.79407e-65
4.43496e-66
6.78259e-57
-1.81517e-65
1.56209e-66
1.49122e-69
1.02867e-42
1.91526e-50
9.13627e-64
3.68921e-66
-1.29911e-61
1.74485e-51
-6.37405e-67
1.06007e-65
4.00097e-40
5.76448e-29
-4.05039e-29
2.33839e-43
-1.08974e-58
3.23678e-61
-3.62739e-09
-0.000218498
3.91889e-51
-5.46999e-68
2.24838e-69
3.50123e-67
1.63816e-69
3.94403e-67
0.00111181
1.17536e-67
-3.07431e-56
2.05404e-58
6.53307e-71
-1.65714e-54
9.40571e-50
9.85001e-68
-2.6546e-67
-9.33944e-68
4.6701e-67
1.26045e-16
-2.02544e-16
-5.6535e-07
4.99812e-41
-8.32194e-46
0.000404374
-0.00102977
2.05967e-70
6.03849e-44
-2.86543e-63
3.50223e-65
-3.39698e-61
1.38061e-62
-1.79844e-65
3.99382e-69
5.80671e-65
-1.3766e-67
8.65288e-64
7.77104e-69
-4.19031e-65
2.97656e-68
-0.000902841
-1.1379e-62
8.51489e-71
0.000999785
-0.000595411
-3.71506e-66
3.73762e-50
3.74066e-67
-1.82297e-54
3.39795e-51
-6.77742e-49
1.15063e-51
-2.10605e-53
5.78623e-51
-5.86155e-65
6.91841e-65
1.49519e-39
-3.18912e-43
-0.000484419
-0.000830846
0.000574874
-6.43388e-53
6.52673e-51
-2.17086e-59
6.29705e-55
0.00116871
-0.000846795
5.80933e-69
-2.34624e-60
2.84355e-62
-0.000772851
0.000652342
-1.14259e-52
3.44169e-51
2.66356e-67
-5.85933e-69
-1.22118e-52
1.74741e-51
-3.81607e-25
1.90759e-07
-1.91416e-07
-3.01222e-10
-6.96186e-53
5.16593e-52
-5.99216e-59
0.000138252
-0.0010342
1.64622e-71
9.09554e-71
3.86647e-72
-1.94293e-53
4.79276e-53
3.14787e-64
-1.38345e-65
-3.51622e-43
4.39827e-46
-1.23326e-66
1.0112e-68
-5.05686e-71
4.06442e-71
-2.29211e-64
-7.33029e-72
2.84837e-72
-1.39439e-63
-6.39588e-72
4.92603e-19
-6.65818e-18
-2.3196e-17
-4.22755e-68
3.13566e-69
4.95768e-52
-1.1717e-54
8.66162e-72
-3.5146e-71
-0.000146246
1.37983e-67
5.8959e-69
8.23432e-34
-8.23432e-34
-1.40621e-66
-5.00675e-49
-8.97699e-10
0.000272173
-1.27784e-54
3.56335e-55
-1.7403e-55
-8.23594e-43
-1.25108e-48
-1.01982e-69
-2.91909e-60
2.0493e-62
1.65102e-71
-1.77795e-50
5.86579e-69
-1.26369e-71
-2.57036e-65
-4.05027e-29
-4.64513e-67
1.77894e-65
-3.08203e-51
7.41869e-50
2.74764e-50
2.0449e-70
-5.68279e-74
3.25482e-18
-8.77141e-18
2.64629e-73
-2.59934e-72
2.17884e-72
8.83781e-73
4.52392e-71
2.1485e-72
7.16516e-53
8.58265e-52
9.46112e-67
-3.07425e-68
3.92885e-67
-9.30327e-69
-2.8002e-52
2.0905e-51
-9.7234e-68
7.44068e-68
-1.25518e-65
8.19598e-17
1.49496e-73
1.3698e-42
-1.72864e-43
1.15343e-62
-1.51993e-65
-6.0559e-57
7.18613e-58
1.18785e-74
3.41542e-67
-1.5302e-68
4.0313e-71
-1.1988e-50
2.9574e-50
-8.81618e-68
5.44773e-71
-7.04008e-63
1.22695e-73
1.43938e-72
2.5669e-71
-3.2359e-17
7.77207e-72
-1.3179e-61
1.04378e-63
-2.1856e-69
4.10999e-75
0.000425657
-0.000910076
1.70462e-65
0.000827914
-0.000402257
-1.73743e-65
-9.75425e-53
-1.30054e-69
2.98896e-72
3.12524e-72
-9.39707e-74
1.02253e-64
-1.47455e-66
0.000846795
-0.000574621
-1.74974e-69
4.01658e-74
1.26547e-71
5.67646e-72
0.000232503
1.96067e-43
-3.70557e-48
2.74356e-10
7.08218e-10
-5.7219e-71
3.96655e-72
5.86555e-45
-3.26207e-49
-0.000336595
4.33913e-43
-8.23432e-34
9.38654e-43
-1.34243e-50
8.06771e-52
-1.56193e-66
-1.35958e-75
-8.31534e-46
7.31215e-49
-1.16313e-70
6.28825e-74
9.66824e-70
-3.07584e-71
2.55869e-75
-4.31082e-71
5.75981e-71
-5.78508e-51
-2.62606e-22
2.62488e-22
-6.02802e-59
5.40188e-61
-9.82266e-73
1.53515e-74
-1.8014e-25
1.80119e-25
4.22277e-70
-1.43049e-71
-0.000755423
0.000418827
-2.01262e-72
3.0507e-73
-0.000652342
0.000506097
8.30316e-75
1.8011e-75
-2.02709e-72
-1.4632e-65
6.67312e-68
-1.81758e-68
2.6399e-73
-1.38739e-77
-2.10515e-72
3.9381e-77
4.25002e-29
-4.24962e-29
-4.93604e-52
3.9265e-53
8.79677e-75
2.30901e-20
-3.64498e-74
-2.21756e-73
-2.3085e-64
2.77746e-66
1.57852e-72
-3.70256e-74
8.19748e-75
0.000872453
-0.000449953
1.49195e-07
1.06263e-68
-1.23392e-70
-9.19631e-71
4.55466e-71
-4.82664e-74
3.01777e-75
4.78195e-75
-1.89813e-75
2.04547e-77
0.000574621
-0.000342118
-1.46861e-73
1.46923e-73
7.33105e-73
-2.21987e-74
4.30089e-77
-9.15931e-74
-6.58517e-75
3.17034e-74
-1.94535e-53
2.11246e-54
-5.0146e-49
3.24295e-51
-0.000180549
-3.26748e-76
2.27317e-75
2.04423e-76
-1.90955e-25
-1.58283e-75
1.67827e-80
-1.49252e-75
2.27414e-80
-9.42588e-44
1.53275e-42
4.22555e-78
-5.92952e-73
-5.38704e-76
1.70599e-65
-2.10277e-68
-7.07467e-63
5.03846e-65
-2.65393e-77
-6.24419e-67
-1.59101e-72
5.14938e-76
2.04375e-75
-1.64118e-22
5.81451e-67
-1.6321e-77
-1.00807e-75
-2.19537e-62
6.2986e-55
-2.44917e-33
-8.57504e-30
1.79927e-72
-2.11707e-74
-1.76157e-64
3.22381e-65
1.00267e-75
-2.27424e-77
-3.84946e-62
3.11577e-62
-2.44917e-33
8.63331e-75
-3.48405e-57
3.43082e-57
5.73998e-59
-1.70807e-45
-2.21837e-49
-2.02525e-65
0.000462253
0.000472793
-0.000506097
0.000325548
-1.56978e-52
3.66515e-81
-9.47841e-79
8.00809e-84
1.57328e-80
-3.87162e-77
1.25329e-78
-2.35677e-77
2.3108e-48
-4.14364e-55
-7.48999e-17
3.90535e-17
-1.0085e-80
-5.8498e-67
4.13401e-65
-1.72321e-68
1.75373e-70
4.2261e-76
-7.94817e-78
-1.61027e-49
-3.44602e-55
-5.57792e-79
6.8817e-84
-1.06797e-76
8.64459e-77
2.50068e-78
7.56102e-17
-2.05321e-17
-9.71387e-70
-2.16189e-79
6.50719e-25
-8.93204e-28
8.48595e-79
-1.36908e-80
-1.63959e-54
2.12438e-68
-3.48782e-70
-9.56574e-77
8.97315e-79
8.98484e-79
-2.26651e-73
3.6949e-75
-0.000642425
0.000240169
-1.11665e-62
2.31147e-84
-5.95924e-65
2.14318e-62
-2.84414e-81
-1.98559e-79
2.57643e-79
-5.25841e-81
-3.52312e-74
1.0044e-74
-1.20209e-69
-1.87841e-55
-1.71986e-54
4.42392e-28
-2.10163e-31
2.05108e-81
-2.94165e-82
1.95642e-87
-4.17148e-82
8.34825e-88
1.65664e-77
-4.34551e-84
-1.49144e-24
3.28004e-20
-4.04056e-74
3.19693e-72
-4.53827e-60
6.45453e-54
-3.53774e-57
-1.77584e-65
-0.000223598
-5.26883e-72
-2.14505e-62
5.13005e-60
-8.1304e-52
3.49255e-53
1.5375e-55
-5.97168e-55
-1.47175e-84
-1.27098e-79
-2.21195e-56
-2.36425e-71
1.42559e-69
2.01867e-84
-1.0226e-54
-2.71155e-55
1.59788e-82
-2.41567e-84
-3.49255e-53
2.50594e-33
0.000342118
-0.000101949
-1.05322e-85
1.47611e-91
-8.29748e-60
-5.7861e-51
7.49857e-56
1.01248e-08
1.9366e-84
-6.01698e-81
-4.30478e-69
5.02342e-65
-1.00636e-76
3.83627e-78
-7.48965e-83
6.8256e-88
-2.7532e-65
-6.27961e-67
4.77251e-69
-5.26477e-88
-5.91259e-88
5.97187e-86
1.2502e-87
6.07048e-76
-9.14873e-78
-4.03349e-74
1.06324e-31
-9.20138e-36
1.79261e-82
-4.62573e-81
-3.19947e-86
1.50158e-91
-1.10979e-89
5.89714e-95
-2.48656e-52
4.16839e-91
-8.29876e-65
4.65296e-65
2.32035e-79
-5.81543e-81
-0.000325548
0.000101949
-5.89757e-73
-5.47437e-92
-1.3625e-55
2.16157e-58
-2.74151e-78
7.9114e-79
-5.44046e-70
1.27705e-55
-2.55717e-57
1.52698e-80
-2.92473e-57
1.61968e-83
2.16182e-58
-2.44283e-62
-2.54244e-57
-8.97463e-90
7.41574e-96
1.91513e-82
-4.30053e-84
-7.013e-19
-3.04933e-17
-5.06079e-78
1.82632e-58
-2.31803e-73
-1.43482e-83
-4.50392e-59
2.62569e-57
-2.32614e-66
4.60022e-36
-1.14142e-41
1.18038e-85
-1.88066e-87
-4.60646e-80
-6.43108e-94
1.84252e-99
-3.98006e-91
3.98369e-89
4.72862e-77
-2.61343e-75
9.12195e-81
-1.17634e-82
-1.27397e-79
1.14892e-73
-2.45335e-55
-7.09055e-74
2.69726e-69
-3.29087e-95
6.13743e-93
-5.38117e-66
6.83136e-61
-7.07308e-61
-1.70782e-81
6.64329e-83
-4.90138e-80
3.34995e-80
7.5592e-79
1.68301e-82
4.01157e-83
5.70661e-42
-4.50866e-49
-7.07308e-61
6.71531e-69
4.99568e-66
-2.76726e-69
-2.92541e-57
8.19736e-87
2.47512e-97
2.62128e-106
8.5206e-101
2.8456e-67
-6.00941e-66
3.82618e-67
-3.87438e-67
4.82073e-69
7.01693e-90
3.87698e-93
-2.25419e-49
3.82263e-69
-1.46563e-70
1.02599e-96
8.57888e-67
4.47136e-67
-1.39402e-66
1.02099e-67
6.32238e-70
9.13163e-69
1.82447e-68
0.000101949
-7.22506e-13
0.000101949
-9.33055e-84
-1.88396e-70
-1.24972e-87
4.57249e-86
-2.88421e-89
2.07821e-84
-2.48571e-73
6.58341e-91
-1.06647e-92
5.43554e-73
4.95936e-71
-5.88461e-74
1.02791e-71
1.09459e-70
-7.22264e-69
1.99523e-69
-2.7827e-74
-1.54582e-78
3.21431e-75
9.64285e-104
3.59706e-101
1.37981e-98
1.53562e-96
-1.68011e-94
-0.000787947
-1.43991e-57
-2.18521e-57
-0.000399917
0.00127455
0.000680138
0.000361381
8.75028e-61
-5.74237e-59
-2.48801e-52
2.24073e-57
1.87478e-21
-8.13381e-21
0.000172483
-0.00240122
-0.00117059
0.00114239
0.00111181
-0.00147319
0.00147319
3.87212e-22
0.000426524
0.000472536
-0.00222247
0.00222247
-3.91598e-08
1.27349e-09
0.000945329
1.33773e-21
-7.70739e-22
0.0020151
-0.0020151
0.0021409
-0.0021409
-0.00306028
0.00306028
-0.00220214
0.00220214
0.0020151
-0.0021048
0.0021048
0.000321254
0.000749275
0.000393116
-2.52468e-07
1.08795e-07
1.25818e-10
-2.13064e-10
3.85707e-11
2.8096e-10
-4.03421e-08
3.28584e-08
-2.64393e-10
3.49157e-10
-1.84531e-10
-0.000726831
0.00157235
-0.00070609
2.32776e-06
-3.28517e-06
0.00220602
-0.000356781
-0.000456344
-2.01582e-09
1.20462e-09
-0.00355358
0.00255797
0.000704765
-0.00100846
2.67908e-11
2.13217e-06
-0.000109943
0.000229609
-2.52514e-07
1.52518e-10
3.96996e-07
7.49479e-05
-9.10361e-05
-1.75761e-05
0
3.49255e-12
2.35447e-07
-3.95421e-08
-0.000417645
1.20986e-06
1.75751e-05
-1.75749e-05
2.90454e-08
8.10664e-16
1.54579e-17
2.70679e-13
-5.38151e-07
9.59513e-15
-1.24346e-14
0.000330718
6.41226e-14
3.93915e-15
1.09712e-05
0.000295054
-0.00107361
1.02842e-14
-9.62348e-16
1.63274e-15
-1.9658e-05
4.00094e-17
0.00035063
0.00122043
-1.41964e-18
0.000786998
-0.0014876
)
;
boundaryField
{
patch0
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //
|
ffc972404ab33769e47e486070f873afd8b97990 | e2a207e280aaed5f9cba4ebb06b39fe2e7b279d8 | /client/dbus/dbusstatementiteratorinterface.h | 2c6c13fb89caa28afe8d3aedbefa3cdd6f6196d2 | [] | no_license | aldebaran/soprano | c9fd05203913ce42966dc913ff11f0bf23fffcff | eff3ebf9a2a9b441ff09ef9bc8c374d5422bff33 | refs/heads/master | 2023-09-04T04:38:38.269293 | 2018-08-02T16:49:08 | 2018-08-03T07:02:35 | 115,737,101 | 0 | 1 | null | 2017-12-29T16:21:53 | 2017-12-29T16:21:53 | null | UTF-8 | C++ | false | false | 2,297 | h | dbusstatementiteratorinterface.h | /*
* This file is part of Soprano Project.
*
* Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _SOPRANO_SERVER_DBUS_STATEMENTITERATOR_INTERFACE_H_
#define _SOPRANO_SERVER_DBUS_STATEMENTITERATOR_INTERFACE_H_
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
#include "statement.h"
#include "dbusabstractinterface.h"
Q_DECLARE_METATYPE(Soprano::Statement)
namespace Soprano {
class Statement;
namespace Client {
class DBusStatementIteratorInterface: public DBusAbstractInterface
{
Q_OBJECT
public:
DBusStatementIteratorInterface( const QString& service, const QString& path, const QDBusConnection& connection, QObject *parent = 0 );
~DBusStatementIteratorInterface();
public Q_SLOTS:
inline QDBusReply<Soprano::Statement> current()
{
QList<QVariant> argumentList;
return callWithArgumentListAndBigTimeout(QDBus::Block, QLatin1String("current"), argumentList);
}
inline QDBusReply<bool> next()
{
QList<QVariant> argumentList;
return callWithArgumentListAndBigTimeout(QDBus::Block, QLatin1String("next"), argumentList);
}
inline QDBusReply<void> close()
{
QList<QVariant> argumentList;
return callWithArgumentListAndBigTimeout(QDBus::Block, QLatin1String("close"), argumentList);
}
};
}
}
#endif
|
d159c919f765a3de50129e8c3ed399614915ef25 | 3e1681991b304fc007b75bb7d870f96a65e1ac28 | /C++/test542.cpp | 8e8ec50c091128b6229c3f7c272205a3718a3b9a | [] | no_license | naveenls/Competitive-Coding | 8306d7e04f27ad91cd6956cceea2bae83c8ad33a | f59189a5d9e7ffa505a4bb8d3560d66b35be5aca | refs/heads/main | 2023-03-21T14:56:06.206429 | 2021-03-17T18:34:16 | 2021-03-17T18:34:16 | 340,908,452 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,995 | cpp | test542.cpp | #include<bits/stdc++.h>
using namespace std;
vector<long long> count_vals(vector<int> slopes)
{
if(slopes.size()==0)
{
return vector<long long>(1,0);
}
map<int,long long> mp;
for(auto m:slopes)
{
mp[m]++;
}
vector<long long> count;
for(auto ele:mp)
{
count.push_back(ele.second);
}
sort(count.begin(),count.end());
vector<long long> sum1(count.size()+1);
vector<long long> sum2(count.size()+1);
vector<long long> sum3(count.size()+1);
sum1[count.size()]=0;
sum2[count.size()]=0;
sum3[count.size()]=0;
for(int i=count.size()-1;i>=0;i--)
{
sum1[i]=count[i]+sum1[i+1];
sum2[i]=sum2[i+1] + count[i]*sum1[i+1];
sum3[i]=sum3[i+1] + count[i]*sum2[i+1];
}
vector<long long> ans;
for(int i=0;i<count.size();i++)
{
while(count[i])
{
ans.push_back(count[i]*sum2[i+1] + sum3[i+1]);
count[i]--;
}
}
return ans;
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n,c,k;
cin>>n>>c>>k;
pair<int,int> line[n];
int col[n];
long long count[c]={0};
vector<vector<int> > groups(c);
for(int i=0;i<n;i++)
{
cin>>line[i].first>>line[i].second;
cin>>col[i],col[i]--;
groups[col[i]].push_back(line[i].first);
count[col[i]]++;
}
int v[c];
for(int i=0;i<c;i++)
cin>>v[i];
vector<vector<long long> > min_triangle(c);
for(int i=0;i<c;i++)
{
min_triangle[i]=count_vals(groups[i]);
}
long long DP[c+1][k+1];
for(int j=0;j<=k;j++)
DP[c][j]=0;
for(int i=c-1;i>=0;i--)
{
for(int j=0;j<=k;j++)
{
DP[i][j]=1e18;
}
for(int ct=0;ct<=count[i] && ct*v[i]<=k ;ct++)
{
long long t=min_triangle[i][ct];
for(int j=ct*v[i];j<=k;j++)
{
DP[i][j]=min(DP[i][j],t+DP[i+1][j-ct*v[i]]);
}
}
}
cout<<DP[0][k]<<endl;
}
return 0;
}
|
31dc96543280a137b9206f17b91991b4ce5dcc74 | 91d9deec9cefe107d4df1ef9d1df755ad1509162 | /src/exceptions.h | 833a6e7ddf9053c67bdbccfe5df14d3114db43c1 | [] | no_license | streetninja22/shooter | aaaec3f72958314178c65824a7a7ca1d96f0181b | 0d6cf81987be46dd86f264ad27669140e9903f51 | refs/heads/master | 2020-03-12T13:06:36.873270 | 2018-10-05T04:25:57 | 2018-10-05T04:25:57 | 130,634,084 | 0 | 0 | null | 2018-05-29T04:12:27 | 2018-04-23T03:17:48 | C++ | UTF-8 | C++ | false | false | 331 | h | exceptions.h | #pragma once
#include <framework/Exception.h>
class GameException : public Exception
{
public:
GameException(int code, std::string value) : Exception(code, value)
{
}
};
class ObjectNotFoundException : public GameException
{
public:
ObjectNotFoundException() : GameException(5, "Object not found in space")
{
}
};
|
0b101e8266fef0c4de67d0cb9b7946b389cc034e | 7b9f37b84695a85241a6a67ad156b1ef941f34ab | /Quest01/Quest01/Engine.h | fc0501543d518d1032fccd39881701801cf00eb9 | [] | no_license | HyunOSung/PracticeProject | 4cda8e12523b065466af962609a91fd0c93a3446 | ed81fa6d450fe5262fb39e2fbef71f846d1d5496 | refs/heads/master | 2020-06-09T16:40:26.124593 | 2019-07-23T13:15:02 | 2019-07-23T13:15:02 | 193,469,782 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 206 | h | Engine.h | #pragma once
class Engine
{
public:
Engine();
~Engine();
void Init();
void Start();
void Tick();
void Input();
void Render();
void Term();
bool bIsRunning = true; //엔진 작동 체크
};
|
31702f06074739f68f9f6dafc63f7b5b58ca7a5d | 3983df15a20c6fc8080999b2c5c23ec35b557922 | /card_karuba_lib/util.h | 9ec4bcf82de2f8ed1ec2d02f283b5a6d6643734b | [
"MIT"
] | permissive | MariusUrbonas/-WIP-karuba-card-game-learning-enviroment | 8d361c1418d8c9048e3f07a002c847ee865ab1ca | eee638229f045cd8563209c81aee6f2f319292cf | refs/heads/master | 2020-05-20T06:54:22.109222 | 2019-05-19T16:23:44 | 2019-05-19T16:23:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 788 | h | util.h | //
// Created by Marius Urbonas on 2019-05-07.
//
#ifndef CARD_KARUBA_ENVIRONMENT_UTIL_H
#define CARD_KARUBA_ENVIRONMENT_UTIL_H
#include <string>
namespace card_karuba_env {
constexpr int kMaxNumRanks = 16;
// Returns a character representation of an integer rank index.
std::string RankIndexToString(int rank);
#if defined(NDEBUG)
#define REQUIRE(expr) \
(expr ? (void)0 \
: (fprintf(stderr, "Input requirements failed at %s:%d in %s: %s\n", \
__FILE__, __LINE__, __func__, #expr), \
std::abort()))
#else
#define REQUIRE(expr) assert(expr)
#endif
}
#endif //CARD_KARUBA_ENVIRONMENT_UTIL_H
|
21db3839d32536f91fc52b3b60e0a8cc7863e3b5 | e8282e3ae8aafa07b7f7261c639f206c4e97e0fc | /03 - Online Judges/jollybee/cekk.cpp | 315512b1890f8b0f7655cca9d0e9b8b232bfe6af | [] | no_license | irfansofyana/cp-codes | 7cad844da49b901ccf678b75c31ed41e2fa9d645 | 9fa723129088f0e4832ecb7e012fe586b6d59e41 | refs/heads/master | 2023-04-04T00:48:36.334817 | 2021-04-12T03:07:06 | 2021-04-12T03:07:06 | 218,084,148 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 264 | cpp | cekk.cpp | #include <bits/stdc++.h>
using namespace std;
int i,j,ans;
vector<int> A,B;
int main(){
for (i = 1 ; i<= 100; i++) {
for (j = 1 ; j<= 100 ; j++) {
for (int k = 1 ; k<=100; k++) {
if (i*j*k==72) ans++;
}
}
}
cout << ans << '\n';
} |
cfc1e9ad423eab0aa79329a0c09f6354d8b47e49 | 6c49fad41b5109d4dabc4db0007e1ae931ee4898 | /2018 Summer/Assignments/Assignment04/SahranRiaz2975/Rect.h | 2f1b2aa9601d3230344149c290c1ef65b37daad4 | [] | no_license | ZainAU/oop | 964fbf6701ccac77fe14d04d83fb7f5d11b1cb15 | a895b7ce10ed4ec09a2e178005bb82da7b58e32e | refs/heads/master | 2022-01-06T21:03:26.842634 | 2018-09-26T05:35:13 | 2018-09-26T05:35:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 636 | h | Rect.h | #pragma once
#include "SDL.h"
#include "Point.h"
/** Rect class **/
//Rect class prototype
class Rect
{
private:
SDL_Rect fillRect; //Object of type SDL_Rect is created, fillRect is a rectangle
Point topLeft; //Variable of type Point is created, has an x and y coordinate pair initially assigned with the value 0 respectively
Point bottomRight; //Variable of type Point is created, has an x and y coordinate pair initially assigned with the value 0 respectively
public:
Rect() //Default constructor with no coding
{
}
Rect(SDL_Rect);
void Draw(SDL_Renderer*, SDL_Rect*);
};
|
4b53adf683a9f3407744c84510c48621c5480377 | 9d9ad238d591e8e67c662f36a4546ac36ac90269 | /test/line_adaptation_tests/gitrepo/2 | 39c5e1dab20a73dc962e9f10e60bcb8ece6f90aa | [
"BSD-3-Clause"
] | permissive | ispras/qdt | eb1fa45e27698af329f44b89604f1c2d0bc203b0 | 93e03c2b3f880f5c7c9f90e1ba5593dbf602bdb9 | refs/heads/master | 2023-03-08T20:35:44.206463 | 2022-02-09T03:47:18 | 2022-02-09T03:47:18 | 113,609,715 | 38 | 9 | NOASSERTION | 2022-02-09T02:36:52 | 2017-12-08T19:25:28 | Python | UTF-8 | C++ | false | false | 7 | 2 | a
b
d
| |
7b72b00f79007e7cb0f201f0b32d49861799572b | 0f6b28bf6dfdc14808b5849455abc41ad7a79466 | /AI/8-queen/firstchoice/firstchoice.cpp | 8e4d8b1abd75620034ff2c3249396dda86adf942 | [] | no_license | warsonchou/AI | c18e73bff3de953e56b6eded022ae9f096d4047d | 42fca33773e527911e4db3109722676bb809d8c1 | refs/heads/master | 2021-05-31T04:14:43.491229 | 2016-02-25T03:31:12 | 2016-02-25T03:31:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,832 | cpp | firstchoice.cpp | // first choice version
#include "iostream"
#include "algorithm"
#include "stdlib.h"
#include "stdio.h"
#include "time.h"
using namespace std;
const int range = 100;
struct queen{
int x; //position
int y;
};
bool isReached(queen q[]) {
int i, j;
bool isAllSafe = true;
for (i = 0; i < 8; i++) {
for (j = i + 1; j < 8; j++) {
if (q[i].x == q[j].x || q[i].y == q[j].y || (q[i].x - q[i].y == q[j].x - q[j].y) || (q[i].x + q[i].y == q[j].x + q[j].y)) {
isAllSafe = false;
break;
}
}
}
return isAllSafe;
}
int getH(queen q[]) {
int i, j, sum = 0;
for (i = 0; i < 8; i++) {
for (j = i + 1; j < 8; j++) {
if (q[i].x == q[j].x || q[i].y == q[j].y || (q[i].x - q[i].y == q[j].x - q[j].y) || (q[i].x + q[i].y == q[j].x + q[j].y)) {
sum++;
}
}
}
return sum;
}
bool isSafe(queen q[], int targetIndex, int x, int y) {
bool safe = true;
int i, j;
for (i = 0; i < 8; i++) {
if (q[i].x == x && q[i].y == y) {
safe = false;
break;
}
for (j = 0; j < 8; j++) {
if (j == targetIndex)
continue;
if (q[j].x == x || q[j].y == y || (q[j].x - q[j].y == x - y) || (q[j].x + q[j].y == x + y)) {
if ((q[i].x > q[j].x && q[j].x > x) || (q[i].x < q[j].x && q[j].x < x)) {
safe = false;
break;
}
}
}
}
return safe;
}
bool move(queen a[], int &bestH, bool isFoundEqual) {
int i, j, h;
queen temp;
bool isFoundbetter = false;
for (i = 0; i < 8; i++) {
// 左移动
for (j = 1; j < 8; j++) {
if(a[i].x - j >= 0 && isSafe(a, i, a[i].x - j, a[i].y)) {
temp.x = a[i].x;
a[i].x -= j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].x = temp.x;
}
}
if (isFoundbetter)
break;
// 右移动
for (j = 1; j < 8; j++) {
if(a[i].x + j < 8 && isSafe(a, i, a[i].x + j, a[i].y)) {
temp.x = a[i].x;
a[i].x += j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].x = temp.x;
}
}
if (isFoundbetter)
break;
// 上移
for (j = 1; j < 8; j++) {
if(a[i].y - j >= 0 && isSafe(a, i, a[i].x, a[i].y - j)) {
temp.y = a[i].y;
a[i].y -= j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
}
}
if (isFoundbetter)
break;
// 右移动
for (j = 1; j < 8; j++) {
if(a[i].y + j < 8 && isSafe(a, i, a[i].x, a[i].y + j)) {
temp.y = a[i].y;
a[i].y += j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
}
}
if (isFoundbetter)
break;
// 左上移动
for (j = 1; j < 8; j++) {
if (a[i].x - j >= 0 && a[i].y - j >= 0 && isSafe(a, i, a[i].x - j, a[i].y - j)) {
temp.x = a[i].x;
temp.y = a[i].y;
a[i].x -= j;
a[i].y -= j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
a[i].x = temp.x;
}
}
if (isFoundbetter)
break;
// 右下移动
for (j = 1; j < 8; j++) {
if (a[i].x + j < 8 && a[i].y + j < 8 && isSafe(a, i, a[i].x + j, a[i].y + j)) {
temp.x = a[i].x;
temp.y = a[i].y;
a[i].x += j;
a[i].y += j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
a[i].x = temp.x;
}
}
if (isFoundbetter)
break;
// 右上角
for (j = 1; j < 8; j++) {
if (a[i].x + j < 8 && a[i].y - j >= 0 && isSafe(a, i, a[i].x + j, a[i].y - j)) {
temp.x = a[i].x;
temp.y = a[i].y;
a[i].x += j;
a[i].y -= j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
a[i].x = temp.x;
}
}
if (isFoundbetter)
break;
// 左下
for (j = 1; j < 8; j++) {
if (a[i].x - j >= 0 && a[i].y + j < 8 && isSafe(a, i, a[i].x - j, a[i].y + j)) {
temp.x = a[i].x;
temp.y = a[i].y;
a[i].x -= j;
a[i].y += j;
h = getH(a);
if (h < bestH) {
bestH = h;
isFoundbetter = true;
break;
}
if (isFoundEqual && h == bestH) {
break;
}
a[i].y = temp.y;
a[i].x = temp.x;
}
}
}
return isFoundbetter;
}
bool hillClimb(queen a[]) {
int i, j, h, loops, currentH, bestH;
queen temp;
currentH = getH(a);
bestH = currentH;
for (loops = 0; loops < 10000; loops++) {
move(a, bestH, false);
if (isReached(a))
return true;
if (bestH == currentH) {
// return false;
for (int g = 0; g < range; g++) {
if (move(a, bestH, true)) {
break;
}
}
if(bestH == currentH) {
return false;
} else {
currentH = bestH;
}
} else {
currentH = bestH;
}
}
return false;
}
int main(int argc, char const *argv[])
{
int i, j, k, count = 0;
queen a[8], test[8], test1[8], q[8];
while(cin >> a[0].x) {
cin >> a[0].y;
for (i = 1; i < 8; i++) {
cin >> a[i].x >> a[i].y;
}
// for (j = 0; j < 3; j++) {
// for (k = 0; k < 3; k++) {
// cout << a[j][k] << " ";
// }
// }
// cout << endl;
if (hillClimb(a)) {
count++;
}
// for (j = 0; j < 3; j++) {
// for (k = 0; k < 3; k++) {
// cout << a[j][k] << " ";
// }
// }
// cout << endl << endl;
}
cout << "FirstChioce HillClimb algorithm in solving the 8-queen problem:\nSolved percentage: ";
cout << ((double)count / (double)10000 * (double)100) << "%" << endl;
return 0;
} |
2737ce463a6a50899a4637c09b55d1e3371596f4 | 94a88c9cb36803c36eeff0fad57689e5fe76cab1 | /C++/project/BaiduProduct/baidu_deploy.cpp | f2ec18e8a2256f920d80605bbbbd15a5b380f705 | [] | no_license | YFCbingyi/test_own | c5e38842765831dcc6c45e3181f370083877fc7f | 8b5461deceeb0b64ef8b571796a017ee532be429 | refs/heads/master | 2021-07-19T19:15:56.742920 | 2020-10-29T02:32:49 | 2020-10-29T02:32:49 | 225,312,122 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,731 | cpp | baidu_deploy.cpp | #include "baidu_deploy.h"
#include "debug_log.h"
#include <exception>
std::string BaiduDeploy::organiza_msg_product(const int cmdId, int botid, std::string ®ion, std::string &module, int taskid)
{
Json::Value value;
switch (cmdId)
{
case TASK_ADD:
value["botId"] = botid;
value["region"] = region;
value["modelVersion"] = module;
get_utterance_url = "https://aip.baidubce.com/rpc/2.0/unit/deployment/add";
break;
case TASK_UPDATE:
value["botId"] = botid;
value["region"] = region;
value["modelVersion"] = module;
get_utterance_url = "https://aip.baidubce.com/rpc/2.0/unit/deployment/updateModelVersion";
break;
case TASK_GET_STATE:
value["botId"] = botid;
value["deploymentId"] = taskid;
get_utterance_url = "https://aip.baidubce.com/rpc/2.0/unit/deployment/getStatus";
break;
default:
break;
}
std::string out = value.toStyledString();
return out;
}
/**
* curl发送http请求调用的回调函数,回调函数中对返回的json格式的body进行了解析,解析结果储存在result中
* @param 参数定义见libcurl库文档
* @return 返回值定义见libcurl库文档
*/
size_t BaiduDeploy::callback_token(void *ptr, size_t size, size_t nmemb, void *stream)
{
// 获取到的body存放在ptr中,先将其转换为string格式
std::string s((char *)ptr, size * nmemb);
// 开始获取json中的access token项目
Json::Reader reader;
Json::Value root;
// 使用boost库解析json
reader.parse(s, root);
std::string *access_token_result = static_cast<std::string *>(stream);
*access_token_result = root["access_token"].asString();
return size * nmemb;
}
/**
* 用以获取access_token的函数,使用时需要先在百度云控制台申请相应功能的应用,获得对应的API Key和Secret Key
* @param access_token 获取得到的access token,调用函数时需传入该参数
* @param AK 应用的API key
* @param SK 应用的Secret key
* @return 返回0代表获取access token成功,其他返回值代表获取失败
*/
int BaiduDeploy::get_access_token(std::string &access_token, const std::string &AK, const std::string &SK)
{
std::string access_token_url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials";
CURL *curl;
CURLcode result_code;
int error_code = 0;
curl = curl_easy_init();
if (curl)
{
std::string url = access_token_url + "&client_id=" + AK + "&client_secret=" + SK;
curl_easy_setopt(curl, CURLOPT_URL, url.data());
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
std::string access_token_result;
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &access_token_result);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, this->callback_token);
result_code = curl_easy_perform(curl);
if (result_code != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(result_code));
return 1;
}
access_token = access_token_result;
curl_easy_cleanup(curl);
error_code = 0;
}
else
{
fprintf(stderr, "curl_easy_init() failed.");
error_code = 1;
}
return error_code;
}
/**
* curl发送http请求调用的回调函数,回调函数中对返回的json格式的body进行了解析,解析结果储存在全局的静态变量当中
* @param 参数定义见libcurl文档
* @return 返回值定义见libcurl文档
*/
size_t BaiduDeploy::callback_result(void *ptr, size_t size, size_t nmemb, void *stream)
{
std::string s((char *)ptr, size * nmemb);
std::string *json_result = static_cast<std::string *>(stream);
*json_result = s;
// std::string json_result(reinterpret_cast<const char *>(ptr), size * nmemb);
// *(reinterpret_cast<std::ostringstream*>(stream)) << json_result;
return size * nmemb;
}
/**
* 调用对话接口,返回int格式的结果,具体格式解析见百度大脑文档
* @param json_result 以string格式返回的json格式的结果
* @param json_request_body 以string格式传递的json数据(如:{"log_id":"UNITTEST_10000","version":"2.0","service_id":"S10000","session_id":"","request":{"query":"你好","user_id":"88888"},"dialog_state":{"contexts":{"SYS_REMEMBERED_SKILLS":["1057"]}}}; // json格式 )
* @param access_token 以string格式传入的access token数据,access token获取方式见access_token获取相关文档及代码
* @return 调用成功返回0,发生错误返回其他错误码
*/
int BaiduDeploy::unit_utterance(std::string &json_result, const std::string json_request_body,
const std::string &access_token)
{
std::string url = get_utterance_url + "?access_token=" + access_token;
LOG(INFO) << "url :" << url;
CURL *curl = NULL;
CURLcode result_code;
int is_success = 0;
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, url.data());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type:application/json;charset=UTF-8");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_request_body.data());
std::string access_token_result;
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &access_token_result);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, this->callback_result);
result_code = curl_easy_perform(curl);
if (result_code != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(result_code));
cout << "error code " << result_code << endl;
is_success = 1;
return is_success;
}
json_result = access_token_result;
curl_easy_cleanup(curl);
is_success = 0;
}
else
{
fprintf(stderr, "curl_easy_init() failed.");
is_success = 1;
}
return is_success;
}
int BaiduDeploy::get_errorcode(string &str)
{
try
{
Json::Reader Reader;
Json::Value DevJson;
if (Reader.parse(str, DevJson))
{
return DevJson["error_code"].asInt();
}
}
catch (std::exception &e)
{
LOG(ERROR) << e.what();
}
return -1;
}
std::string BaiduDeploy::get_error_msg(string &str)
{
try
{
Json::Reader Reader;
Json::Value DevJson;
if (Reader.parse(str, DevJson))
{
return DevJson["error_msg"].asString();
}
}
catch (std::exception &e)
{
LOG(ERROR) << e.what();
}
return "";
}
bool BaiduDeploy::set_deploymentId(string &str)
{
try
{
Json::Reader Reader;
Json::Value DevJson;
Json::Value root;
int deploymentid;
if (Reader.parse(str, DevJson))
{
deploymentid = atoi(DevJson["result"]["deploymentId"].asString().c_str());
}
else
{
return false;
}
{
ifstream is("./DeploymentInfo", std::ios::binary);
if (!is.is_open())
return false;
bool changed = false;
if (Reader.parse(is, root))
{
for (int i = 0; i < static_cast<int>(root.size()); i++)
{
if (root[i]["botid"] == m_botid)
{
root[i]["deploymentid"] = deploymentid;
changed = true;
break;
}
}
}
if (!changed)
{
Json::Value params;
params["deploymentid"] = deploymentid;
params["botid"] = m_botid;
root.append(params);
}
is.close();
}
Json::StyledWriter sw;
ofstream os;
os.open("./DeploymentInfo");
os << sw.write(root);
os.close();
}
catch (std::exception &e)
{
LOG(ERROR) << e.what();
}
return true;
}
int BaiduDeploy::get_deploymentId(int botid)
{
int deploymentid = -1;
try
{
Json::Reader reader;
Json::Value root;
//从文件中读取
ifstream is;
is.open("./DeploymentInfo", std::ios::binary);
if (reader.parse(is, root))
{
for (int i = 0; i < static_cast<int>(root.size()); i++)
{
if (root[i]["botid"].asInt() == botid)
{
deploymentid = root[i]["deploymentid"].asInt();
break;
}
}
}
is.close();
return deploymentid;
}
catch (std::exception &e)
{
LOG(ERROR) << e.what();
}
return deploymentid;
}
bool BaiduDeploy::inital()
{
try
{
Json::Reader reader;
Json::Value root;
//从文件中读取
ifstream is;
is.open("./baidu_conf.json", std::ios::binary);
if (reader.parse(is, root))
{
this->m_botid = root["botId"].asInt();
this->m_region = root["region"].asString();
this->m_model = root["version"].asString();
return true;
}
}
catch (std::exception &e)
{
LOG(ERROR) << e.what();
}
return false;
}
|
10e9efe80777ce496bfa3e8977169a511ee80e6c | c5c559574b06453c91fec4d173e2f3f09b0b7964 | /CodeForces/Contests/Div3/642/1.cpp | f38d814dfe7f20952d9d0d5639cad876cec92eaa | [] | no_license | iamishansharma/Competitive-Programming | bdbd02f4a02f7b83472348bb29cc2b6c5d3d51c7 | 320ab013b3199b81247b3136eb85b1e42d4655e6 | refs/heads/master | 2022-12-16T19:04:42.764489 | 2020-09-20T15:46:12 | 2020-09-20T15:46:12 | 270,191,905 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,012 | cpp | 1.cpp | #include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int ll;
using namespace std;
void solve()
{
int n=0, k=0;
cin>>n>>k;
vector<int> a(n);
vector<int> b(n);
for(int i=0; i<n; i++)
cin>>a[i];
for(int i=0; i<n; i++)
cin>>b[i];
sort(a.begin(),a.end());
sort(b.begin(),b.end());
reverse(b.begin(),b.end());
int ai = 0;
int bi = 0;
if(a[0] >= b[0] || k == 0)
{
int sum = 0;
for(int i=0; i<n; i++)
sum += a[i];
cout<<sum<<endl;
}
else
{
int flag = 0;
int j=0;
while(k > 0 && flag == 0)
{
if(a[j] < b[j])
{
int temp = a[j];
a[j] = b[j];
b[j] = a[j];
k--;
j++;
}
else
{
flag = 1;
}
}
int sum = 0;
for(int i=0; i<n; i++)
sum += a[i];
cout<<sum<<endl;
}
}
int main()
{
fastIO;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int tc=0;
cin>>tc;
while(tc--)
{
solve();
}
return 0;
} |
92daddc7de31e564d3628790e5794ba69573f31b | 948ff8b7c994b0038d6d7d7cbf85c600a184ec74 | /petrozavodsk-training-camp/2014-winter/moscow-su-trinity-contest/F.cc | e5dabd01042230d95fdc5ef9b2afc30a255dd16f | [] | no_license | RiturajKulshresth/competitive-programming | 9b420374e5679ce9d69bcf495d8ad406e87747de | 147cb2be02917d12fdbe488c084567c9d0a7d76c | refs/heads/master | 2023-02-10T17:18:10.903381 | 2021-01-10T03:50:52 | 2021-01-10T03:50:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,461 | cc | F.cc | #include <cstdio>
#include <vector>
#include <algorithm>
using int64 = long long;
using pii = std::pair<int64, int64>;
const int N = 2000 + 10;
int64 dp[N][N], s[N];
std::vector<pii> hull[N];
std::vector<double> xs[N];
pii buffer[N];
double inter(const pii &a, const pii &b) {
return double(b.second - a.second) / (a.first - b.first);
}
int64 query(int i, int64 x) {
if (hull[i].empty()) return 0;
int id = std::lower_bound(xs[i].begin(), xs[i].end(), x) - xs[i].begin();
return hull[i][id].first * x + hull[i][id].second;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
scanf("%lld", &s[i]);
s[i] += s[i - 1];
}
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < i; ++j) {
if (j == 0) dp[i][j] = 0;
else {
dp[i][j] = query(j, s[j] - s[i]) + (s[i] - s[j]) * s[j];
}
buffer[j] = {s[j], dp[i][j]};
}
std::sort(buffer, buffer + i);
int sz = 0;
for (int j = 0; j < i; ++j) {
while ((sz >= 1 && hull[i].back().first == buffer[j].first) ||
(sz >= 2 && inter(hull[i].back(), buffer[j]) <= xs[i].back())) {
--sz;
if (sz) xs[i].pop_back();
hull[i].pop_back();
}
hull[i].push_back(buffer[j]); ++sz;
if (sz >= 2) xs[i].push_back(inter(hull[i][sz - 1], hull[i][sz - 2]));
}
}
int64 ret = 0;
for (int i = 0; i < n; ++i) {
ret = std::max(ret, dp[n][i]);
}
printf("%lld\n", ret);
return 0;
}
|
49d8a4a493106889cb1e0f346612b3325b7b82db | a181d598dbbba4399bfd91ce15d1a84b71b7612b | /ch2/squareRoot.cpp | 9f0569d8fb880f5c7c0db294a5cd7c7c53eecadc | [] | no_license | harsh-debug/UEE2304-Data-Structure | d289e5904857c5fedbd5fcf842b71eea3bf1e7a4 | a6d5a0604390df332f705a664e34d7733add6f86 | refs/heads/master | 2021-05-31T02:50:53.396990 | 2016-01-06T07:11:45 | 2016-01-06T07:11:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 521 | cpp | squareRoot.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
double squareRoot(double num, double ans, double tol);
int main(){
int ans = 1;
printf("square root of 125: %f\n", squareRoot(125, ans,0.01));
printf("square root of 763: %f\n", squareRoot(763, ans,0.01));
printf("square root of 997: %f\n", squareRoot(997, ans,0.01));
return 0;
}
double squareRoot(double num, double ans, double tol){
if(abs(pow(ans, 2) - num) < tol)
return ans;
else
return squareRoot(num, (pow(ans, 2) + num)/(2*ans), tol);
}
|
ef2d0aa03ec5b75422297106c90a7b55d226a488 | 953257aa83945e6997bf028d4611b54f7ae7e665 | /serial/Atom.cpp | 3e40a3419aa7ba63cf266148c336b4c30484ae87 | [] | no_license | morpheby/ntc-13.04.5-ui | a77d7d3f5aabdcd47393e748d146e45e0194f27c | f92d623edf7811cb16a0a381eb24c0bd71b3d008 | refs/heads/master | 2021-01-22T01:04:50.563195 | 2015-08-19T13:10:54 | 2015-08-19T13:10:54 | 37,424,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 157 | cpp | Atom.cpp | /*
* Atom.cpp
*
* Created on: 24.08.2013
* Author: morpheby
*/
#include "platform.h"
#include "Atom.h"
namespace util {
} /* namespace util */
|
62492148c02eedff0b45ec56b8d270cdb8701822 | b1ff43b46b9c9fd23a1c2842f7e292f5146db206 | /console/solutions/reader.cpp | d2915af395d8ce2a1655b74d2a925ed09d9128a5 | [] | no_license | AsMaNick/CommivoyagerProblem | 291ce23c15a34ef769a2829a77c110fac1cd1a4d | f5d13976140b1d2b7313f684b4975a5793f71ef4 | refs/heads/master | 2020-03-22T22:31:31.594052 | 2018-07-19T15:53:11 | 2018-07-19T15:53:11 | 140,756,099 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 759 | cpp | reader.cpp | #ifndef READER
#define READER
#include <bits/stdc++.h>
using namespace std;
struct point {
int x, y;
point(): x(0), y(0) {
}
point(int x, int y): x(x), y(y) {
}
point operator - (const point &p) const {
return point(x - p.x, y - p.y);
}
bool operator < (const point &p) const {
return (x < p.x) || (x == p.x && y < p.y);
}
};
vector<point> read_points() {
int n;
cin >> n;
vector<point> res(n);
for (point &c : res) {
cin >> c.x >> c.y;
}
return res;
}
vector<int> read_path(ifstream &in) {
double score;
vector<int> path;
int vertex;
in >> score;
while (in >> vertex) {
path.push_back(vertex);
}
return path;
}
#endif // READER
|
01392e22b761be6e0aa59a1f9351b323844483fc | eba6f81e064942b165e905b3b322f57076e6a449 | /src/view/gui/fFeaturePanel.h | aa9b625db188f40cd5c0a4d19560030096006114 | [] | no_license | lxmwust/CaPTk | 98fd5a0464036d66af713af40153c752e1839854 | 939af09b35a8c384ea6a11597cf5a615cfb164f7 | refs/heads/master | 2020-04-19T05:13:23.278438 | 2019-01-26T17:45:27 | 2019-01-26T17:45:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,329 | h | fFeaturePanel.h | ///////////////////////////////////////////////////////////////////////////////////////
// fFeaturePanel.h
//
// Copyright (c) 2018. All rights reserved.
// Section of Biomedical Image Analysis
// Center for Biomedical Image Computing and Analytics
// Department of Radiology
// Perelman School of Medicine
// University of Pennsylvania
//
// Contact details: software@cbica.upenn.edu
//
// License Agreement: https://www.med.upenn.edu/sbia/software-agreement.html
///////////////////////////////////////////////////////////////////////////////////////
#ifndef _fFeaturePanel_h_
#define _fFeaturePanel_h_
//#include "CAPTk.h"
//#include "Landmarks.h"
#include "ui_fFeaturePanel.h"
#include "fFeatureDialog.h"
#include "cbicaLogging.h"
//#include "FeatureExtraction.h"
/**
\class fFeaturePanel
\brief This class controls the elements in the Feature panel of the tab
*/
class fFeaturePanel : public QWidget, private Ui::fFeaturePanel
{
Q_OBJECT
public:
//! Constructor
fFeaturePanel(QWidget * parent = 0);
//! Destructor
~fFeaturePanel() {}
// void writeFeatureList(std::string Filename, std::vector< std::tuple<std::string, std::string, float>>featurevec);
template <class TImageType = itk::Image< float, 3 >>
typename TImageType::Pointer get_selected_mask(typename TImageType::Pointer total_mask, int roi);
void setListner(void* lst)
{
m_listener = lst;
}
//! Sets the same temporary folder everywhere
void setTempFolderLocation(const std::string& input_tempFolder)
{
m_tempFolderLocation = input_tempFolder;
}
signals:
void m_btnComputeClicked();
void helpClicked_FeaUsage(std::string);
public slots :
void browseOutputFileName();
void ComputeFunctionality();
void CancelFunctionality();
void onComputeButtonClicked();
void computeFeature(int type);
void featureTypeChanged(int type);
void advancedButtonClicked();
void helpClicked();
std::map< std::string, bool > getEnabledFeatures();
private:
// FeatureExtraction features_extraction; // TBD change i to m_
FeatureDialogTree* m_featureDialog;
std::vector< std::map< std::string, std::vector< std::map< std::string, std::string> > > > m_FeatureMaps;// TBD typedef the map value so the code doenst look ugly
void* m_listener;//TBD this is a bad design (because of time pressure): needs to be changed RK
std::vector< std::string > m_featureFiles;
private:
void loadFeatureFiles() // TBD move to cpp
{
//auto names = FeatureExtraction::getFeatureMapFiles();
std::string dataFeatureDir = cbica::normPath(getCaPTkDataDir() + "/features");
//std::string defaultFeatureFile = dataFeatureDir + "/1_params_default.csv";
if (!cbica::isFile(dataFeatureDir + "/1_params_default.csv"))
{
dataFeatureDir = cbica::normPath(captk_currentApplicationPath + "/../../data/features/");
//defaultFeatureFile = dataFeatureDir + "/1_params_default.csv";
}
auto filesInDir = cbica::filesInDirectory(dataFeatureDir);
//if (filesInDir.size() != m_featureFiles.size())
//{
// cbica::Logging(loggerFile, "Feature file number mismatch");
// return;
//}
for (size_t i = 0; i < filesInDir.size(); i++)
{
auto featureMap = FeatureParser(filesInDir[i]).getFeatureMap();
m_FeatureMaps.push_back(featureMap);
}
}
};
#endif
|
bf3df770a5c7c1c4f29e634228ff68e41d58ed5b | fa95a74b601e9e33449c54863100d4903ba26408 | /Stealth/src/Game.h | ff4fd3d4f7fe4e61ffffb352d2b1ee329d870c87 | [
"Apache-2.0"
] | permissive | ajsaucier/StealthGame | 9e5b82f95a1fa9ec400045f7f5c01efbfdbf6d7f | ccc68d2e96bb1769bcceefdff7cb0f551ad143de | refs/heads/master | 2020-08-07T15:28:09.011388 | 2019-10-07T18:36:59 | 2019-10-07T18:36:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,494 | h | Game.h | #pragma once
//
// Copyright (C) 2019 Pharap (@Pharap)
//
// 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 <Arduboy2.h>
#include "Levels.h"
#include "World.h"
#include "Direction.h"
#include "Enemy.h"
#include "Player.h"
class Game
{
private:
Arduboy2 arduboy;
Player player { 1, 1, Direction::North } ;
World world { TestLevel::level };
Enemy enemy;
public:
void setup()
{
this->arduboy.begin();
enemy.x = pgm_read_byte(&TestLevel::enemy.x);
enemy.y = pgm_read_byte(&TestLevel::enemy.y);
enemy.direction = static_cast<Direction>(pgm_read_byte(&TestLevel::enemy.direction));
enemy.aiState = static_cast<const uint8_t *>(pgm_read_ptr(&TestLevel::enemy.script));
}
void loop()
{
if(!this->arduboy.nextFrame())
return;
this->arduboy.pollButtons();
this->update();
this->arduboy.clear();
this->render();
this->arduboy.display();
}
private:
void update();
void render();
}; |
0b8304d5d1e1655ad10c39f8d9aeaab12150bdfe | 214dbcc732e0f6a49336164c793bd4af4754a6f7 | /Algorithmics/Problems from various contests/chimie.cpp | 659dc267c22e1cffbc74e08d9872d76390173042 | [] | no_license | IrinaMBejan/Personal-work-contests | f878c25507a8bfdab3f7af8d55b780d7632efecb | 4ab2841244a55d074d25e721aefa56431e508c43 | refs/heads/master | 2021-01-20T08:24:47.492233 | 2017-05-03T12:22:26 | 2017-05-03T12:22:26 | 90,142,452 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,135 | cpp | chimie.cpp | #include <fstream>
#include <cstring>
#define Lmax 110
using namespace std;
ifstream fin("chimie.in");
ofstream fout("chimie.out");
char sM[Lmax],s[Lmax];
int vM[800],v[800];
bool coincide();
void compus(int & poz, int nrm);
void atom (int & poz, int nrm);
void formula(int & poz);
int nr (int & poz);
int main()
{
int N, poz = 0;
fin.getline(s,Lmax);
strcpy(sM,s);
formula(poz);
for(int i=0; i<750; i++)
vM[i]=v[i], v[i]=0;
fin>>N;
fin.get();
for(int i=1; i<=N; i++)
{
fin.getline(s,Lmax);
poz = 0;
formula(poz);
if(coincide())
fout<<sM<<"=="<<s<<'\n';
else
fout<<sM<<"!="<<s<<'\n';
for(int j = 0; j<=750; j++)
v[j]=0;
}
return 0;
}
bool coincide()
{
int i;
for( i = 0; i<= 750; i++)
if(vM[i] != v[i])
return 0;
return 1;
}
void formula( int & poz)
{
int q = nr(poz);
compus(poz, q);
while (s[poz] == '+' || (s[poz] >='A' && s[poz]<='Z'))
{
if(s[poz] == '+')
formula(++poz);
else
formula(poz);
}
}
void compus(int & poz, int nrm)
{
while( (s[poz]>='A' && s[poz]<='Z') || s[poz] == '(')
{
if(s[poz]!='(')
{
int p = poz+1;
if ( s[p]>='a' && s[p] <='z')
p++;
int q= nr(p);
atom(poz, nrm*q);
poz = p;
}
else
{
++poz;
int p = poz;
int nrd = 1, nri = 0;
while ( nrd != nri)
{
if(s[p] == ')') nri++;
if(s[p]== '(') nrd++;
p++;
}
int q= nr(p);
compus(poz, nrm*q);
poz = p;
}
}
}
void atom(int & poz, int nrm)
{
if(s[poz+1]>='a' && s[poz+1]<='z')
v[(s[poz]-'A'+1)*27+(s[poz+1]-'a'+1)] +=nrm, poz+=2;
else
v[(s[poz]-'A'+1)*27]+=nrm, ++poz;
}
int nr(int & poz)
{
int x=0;
while(s[poz] >='0' && s[poz]<='9')
x=x*10+(s[poz++]-'0');
if(x)
return x;
return 1;
}
|
f118b506b0563575b82cbc3f9e9d3cae048515d2 | 888b29b165c1a5bcf14b239e356ae0f76c45b2e3 | /NVR-16/GuiSample1/source/PageBasicConfigFrameWork.cpp | caae77540938756d514f60f6b9db08b78a3680e9 | [] | no_license | github188/NVR-1 | a3f438a4d4ba9c9199945876f7be42ae8afd0c53 | b4dbf50cc992b75b956958e093760b48690ad040 | refs/heads/master | 2021-07-22T18:24:24.944071 | 2017-09-06T06:34:19 | 2017-09-06T06:34:19 | 111,356,197 | 0 | 1 | null | 2017-11-20T03:16:07 | 2017-11-20T03:16:06 | null | GB18030 | C++ | false | false | 57,776 | cpp | PageBasicConfigFrameWork.cpp | #include "GUI/Pages/PageBasicConfigFrameWork.h"
#include "GUI/Pages/PageMainFrameWork.h"
#include "GUI/Pages/BizData.h"
#include "biz.h"
#include "GUI/Pages/PageMessageBox.h"
#include "GUI/Pages/PageInfoBox.h"
#include "GUI/Pages/PageConfigFrameWork.h"
//csp modify
#include "GUI/Pages/BizData.h"
#include "GUI/Pages/PageDesktop.h"
#include "System/ntp_client.h"
#include "sg_platform.h"
extern "C" s32 ModAlarmSetTimeZoneOffset(int nOffset);
extern "C" s32 ModRecordSetTimeZoneOffset(int nOffset);
//csp modify
//static std::vector<CItem*> items[BASICCFG_SUBPAGES];
static std::vector<CItem*> items[BASICCFG_SUBPAGES+1];
static VD_BITMAP * pBmp_button_normal;
static VD_BITMAP * pBmp_button_push;
static VD_BITMAP * pBmp_button_select;
static VD_BITMAP * pBmp_tab_normal;
static VD_BITMAP * pBmp_tab_push;
static VD_BITMAP * pBmp_tab_select;
static VD_BITMAP * pBmp_infoicon;
//csp modify 20130421
//#define HIDE_NTP//QYJ
static CPageBasicConfigFrameWork* pagebasic = NULL;
static int GetMaxChnNum()
{
return GetVideoMainNum();
}
static int synctimefromntp(int timesyncflag, char *ntpserveradress, int timeout)
{
if(1 == timesyncflag)
{
int dateformatcursel = GetDateFormat();
int timestandardcursel = GetTimeFormat();
int timezone = GetTimeZone();
int ipcsyncflag = GetTimeSyncToIPC();
//int timesyncflag = GetNetworkSyscCheck();
//char ntpserveradress[32] = {0};
//GetNtpServer(ntpserveradress, 32);
struct timeval tv;
if(getTimeFromNtpserver(ntpserveradress, 0, timeout, &tv))
{
return -1;
}
struct timeval now;
gettimeofday(&now, NULL);
//time_t curr = time(NULL);
//printf("curr=%d,now=%d,ntp=%d\n",curr,now.tv_sec,tv.tv_sec);
if(abs(now.tv_sec-tv.tv_sec) > 1)
{
SBizDateTime sBizDT;
memset(&sBizDT, 0, sizeof(sBizDT));
if(0 == dateformatcursel)
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_YYYYMMDDHHNNSS;
}
else if(1 == dateformatcursel)
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_MMDDYYYYHHNNSS;
}
else if(2 == dateformatcursel)
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_DDMMYYYYHHNNSS;
}
else
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_YYYYMMDDHHNNSS;
}
if(0 == timestandardcursel)
{
sBizDT.emTimeFormat = EM_BIZTIME_24HOUR;
}
else if(1 == timestandardcursel)
{
sBizDT.emTimeFormat = EM_BIZTIME_12HOUR;
}
else
{
sBizDT.emTimeFormat = EM_BIZTIME_24HOUR;
}
time_t t = tv.tv_sec;
u8 flag = 0;
int i = 0;
for(i = 0; i < GetVideoMainNum(); i++)
{
if(GetCurRecStatus(i))
{
break;
}
}
if(i < GetVideoMainNum())
{
BizRecordStopAll();
usleep(2000*1000); //多睡会儿吧,否则结束时间戳容易出问题
flag = 1;
t += 2;
}
struct tm tm_time;
gmtime_r(&t, &tm_time);
struct tm *ptm = &tm_time;
sBizDT.nYear = ptm->tm_year + 1900;
sBizDT.nMonth = ptm->tm_mon + 1;
sBizDT.nDay = ptm->tm_mday;
sBizDT.nHour = ptm->tm_hour;
sBizDT.nMinute = ptm->tm_min;
sBizDT.nSecond = ptm->tm_sec;
BizSysComplexDTSet(&sBizDT);
usleep(20*1000);//csp modify 20140406
IPC_SetTimeZone(timezone, ipcsyncflag, 1);
if(flag)
{
usleep(20*1000);
for(i = 0; i < GetVideoMainNum(); i++)
{
BizRecordResume(i);
}
}
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_DST_CONFIG);
}
}
return 0;
}
static u8 ntp_param_changed = 0;
//QYJ
static void* keepsynchronizing(void* p)
{
printf("$$$$$$$$$$$$$$$$$$keepsynchronizing id:%d\n",getpid());
unsigned int count = 0;
while(1)
{
int timesyncflag = GetNetworkSyscCheck();
char ntpserveradress[32] = {0};
GetNtpServer(ntpserveradress, 32);
int ret = synctimefromntp(timesyncflag, ntpserveradress, 10);
//sleep(1*60*60);
//sleep(2*60*60);
//sleep(24*60*60);
while(++count < (12*60*24))
{
sleep(5);
if(ntp_param_changed)
{
ntp_param_changed = 0;
break;
}
if(ret < 0)
{
if((count%12) == 0)
{
break;
}
}
}
count = 0;
}
printf("stop keepsynchronizing...\n");
return 0;
}
static void* updatetimenow(void* p)
{
printf("$$$$$$$$$$$$$$$$$$updatetimenow id:%d\n",getpid());
printf("haha,start updatetimenow...\n");
while(1)
{
if((0 == pagebasic->nThisPageOpened) || (pagebasic->nTimeChanged))
//if((0 == pagebasic->nThisPageOpened) || (pagebasic->nTimeChanged) || (pagebasic->nDateChanged))
{
//csp modify
//break;
sleep(1);
continue;
}
if(0 == pagebasic->nDateChanged)
{
pagebasic->updatetime(0);
}
if(0 == pagebasic->nTimeChanged)
{
pagebasic->updatetime(1);
}
//if(pagebasic->nEdittingTime)
//{
// usleep(500*1000);
// continue;
//}
usleep(300*1000);
}
printf("haha,stop updatetimenow...\n");
}
CPageBasicConfigFrameWork::CPageBasicConfigFrameWork( VD_PCRECT pRect,VD_PCSTR psz,VD_BITMAP* icon /*= NULL*/,CPage * pParent /*= NULL*/ ):CPageFrame(pRect, psz, icon, pParent)
, curID(0)
{
//SetRect(CRect(0, 0, 700, 400/*370*/), FALSE);
SetMargin(3, m_TitleHeight, 4, m_TitleHeight);
m_lastVFormat = 0;
m_lastOutput = 0;
m_lastLanguage = 0;
//pBmp_button_normal = VD_LoadBitmap(DATA_DIR"/button_normal.bmp");
pBmp_button_normal = VD_LoadBitmap(DATA_DIR"/temp/btn.bmp");
ReplaceBitmapBits(pBmp_button_normal, VD_GetSysColor(COLOR_TRANSPARENT) , VD_GetSysColor(VD_COLOR_WINDOW));
//pBmp_button_push = VD_LoadBitmap(DATA_DIR"/button_push.bmp");
pBmp_button_push = VD_LoadBitmap(DATA_DIR"/temp/btn_f.bmp");
ReplaceBitmapBits(pBmp_button_push, VD_GetSysColor(COLOR_TRANSPARENT) , VD_GetSysColor(VD_COLOR_WINDOW));
//pBmp_button_select = VD_LoadBitmap(DATA_DIR"/button_select.bmp");
pBmp_button_select = VD_LoadBitmap(DATA_DIR"/temp/btn_f.bmp");
ReplaceBitmapBits(pBmp_button_select, VD_GetSysColor(COLOR_TRANSPARENT) , VD_GetSysColor(VD_COLOR_WINDOW));
//第一个页面的子页面控制按钮 录像设置,手动录像,录像布防
pBmp_tab_normal = VD_LoadBitmap(DATA_DIR"/temp/tab.bmp");
pBmp_tab_push = VD_LoadBitmap(DATA_DIR"/temp/tab_check.bmp");
pBmp_tab_select = VD_LoadBitmap(DATA_DIR"/temp/tab_f.bmp");
char* szSubPgName[BASICCFG_BTNNUM+2] = {
"&CfgPtn.System",
"&CfgPtn.DateTime",
"&CfgPtn.Default",
"&CfgPtn.apply",
"&CfgPtn.Exit",
"&CfgPtn.Prev",
"&CfgPtn.Next",
};
int szSubPgNameLen[BASICCFG_BTNNUM+2] = {
TEXT_WIDTH*3,//"&CfgPtn.System",
TEXT_WIDTH*5,//"&CfgPtn.DateTime",
TEXT_WIDTH*3,//"&CfgPtn.Default",
TEXT_WIDTH*2,//"&CfgPtn.apply",
TEXT_WIDTH*2,//"&CfgPtn.Exit",
TEXT_WIDTH*3,
TEXT_WIDTH*3,
};
SetMargin(0, m_TitleHeight, 0, m_TitleHeight);
CTableBox* pTabFrame = CreateTableBox(CRect(17, 40, m_Rect.Width()-17, 40+290),this,1,1);
//pTabFrame->SetFrameColor(VD_RGB(56,108,148));
pTabFrame->SetFrameColor(VD_RGB(8,66,189));
CRect rtSub(25, 10, m_Rect.Width()-20, 10+pBmp_tab_normal->height);
int i;
for(i = 0; i<BASICCFG_SUBPAGES; i++)
{
int btWidth = szSubPgNameLen[i]+10;
rtSub.right = rtSub.left + btWidth;
pButton[i] = CreateButton(rtSub, this, szSubPgName[i], (CTRLPROC)&CPageBasicConfigFrameWork::OnClickSubPage, NULL, buttonNormalBmp, TRUE);
pButton[i]->SetBitmap(pBmp_tab_normal, pBmp_tab_select, pBmp_tab_push, pBmp_tab_push);
rtSub.left = rtSub.right;
}
CRect rtSub1(295, m_Rect.Height()-80, m_Rect.Width()-20, m_Rect.Height()-80+pBmp_button_normal->height);
pInfoBar = CreateStatic(CRect(40, rtSub1.top, 385, rtSub1.top+22),
this,
"");
//pInfoBar->SetBkColor(VD_RGB(67,77,87));
//pInfoBar->SetTextAlign(VD_TA_CENTER);
pBmp_infoicon = VD_LoadBitmap(DATA_DIR"/temp/icon_info.bmp");
pIconInfo = CreateStatic(CRect(17, rtSub1.top+1, 37, rtSub1.top+21),
this,
"");
pIconInfo->SetBitmap(pBmp_infoicon,NULL);
pIconInfo->Show(FALSE);
//pInfoBar->SetBkColor(VD_RGB(8,66,189));
rtSub1.left = rtSub1.right;
for(i=BASICCFG_SUBPAGES; i<BASICCFG_BTNNUM; i++)
{
rtSub1.left -= szSubPgNameLen[i]+10;
}
rtSub1.left -= 12*2;
rtSub1.left += 3;
for(i=BASICCFG_SUBPAGES; i<BASICCFG_BTNNUM; i++)
{
int btWidth = szSubPgNameLen[i]+10;
rtSub1.right = rtSub1.left + btWidth;
pButton[i] = CreateButton(rtSub1, this, szSubPgName[i], (CTRLPROC)&CPageBasicConfigFrameWork::OnClickSubPage, NULL, buttonNormalBmp);
pButton[i]->SetBitmap(pBmp_button_normal, pBmp_button_select, pBmp_button_push, pBmp_button_push);
rtSub1.left = rtSub1.right+12;
}
rtSub1.left -= (200*3);
for(i = BASICCFG_BTNNUM; i < BASICCFG_BTNNUM + 2; i++)
{
//printf("***%s\n", __FUNCTION__);
int btWidth = szSubPgNameLen[i];
rtSub1.right = rtSub1.left + btWidth;
pButton[i] = CreateButton(rtSub1, this, szSubPgName[i], (CTRLPROC)&CPageBasicConfigFrameWork::OnClickSubPage, NULL, buttonNormalBmp);
pButton[i]->SetBitmap(pBmp_button_normal, pBmp_button_select, pBmp_button_push, pBmp_button_normal);
rtSub1.left = rtSub1.right+12;
}
pButton[BASICCFG_BTNNUM]->Enable(FALSE);
//CRect rtSub2(13, 35, m_Rect.Width()-18, 300);
//pTable = CreateTableBox(&rtSub2,this, 1,1,0);
InitPage0();
InitPage1();
CRect infoRt = CRect(0, 0, 480, 300/*370*/);
m_pPageInfoBox = new CPageInfoBox(&infoRt/*&recordRt*/, "&CfgPtn.Info"/*"&titles.mainmenu"*/,"&CfgPtn.Reboot", icon_dvr, this);
pagebasic = this;
m_IsLoader = 0;
}
void RebootSystem()
{
BizSysComplexExit(EM_BIZSYSEXIT_RESTART);
}
void CPageBasicConfigFrameWork::OnClickSubPage()
{
//printf("OnClickSubPage##########################################\n");
int i = 0;
BOOL bFind = FALSE;
CButton *pFocusButton = (CButton *)GetFocusItem();
for(i = 0; i < BASICCFG_BTNNUM+2; i++)
{
if(pFocusButton == pButton[i])
{
bFind = TRUE;
break;
}
}
if(bFind)
{
switch(i)
{
case 0:
case 1:
{
SwitchPage(i);
}break;
case 2://默认值
{
//printf("cur page:%d,default\n",curID);
if(0 == curID)//系统子页面
{
char devName[32] = {0};
int ret = GetDevNameDefault(devName,31);
pEdit0[0]->SetText(devName);
char devID[32] = {0};
GetDevIdDefault(devID,31);
pEdit0[1]->SetText(devID);
int index = GetVideoFormatDefault();
pComboBox0[0]->SetCurSel(index);
int value = GetAuthCheckDefault();
pCheckBox0[0]->SetValue(value);
value = GetTimeDisplayCheckDefault();
pCheckBox0[1]->SetValue(value);
value = GetChnKbpsDisplayCheckDefault();
pCheckBox0[3]->SetValue(value);
value = GetShowGuideDefault();
pCheckBox0[2]->SetValue(value);
index = GetMaxUserDefault();
pComboBox0[1]->SetCurSel(index);
index = GetOutputDefault();
pComboBox0[2]->SetCurSel(index);
index = GetLanguageDefault();
//printf("OnClickSubPage:GetLanguageDefault=%d\n",GetLanguageDefault());
pComboBox0[3]->SetCurSel(index);
//index = GetScreenSaverDefault();
index = GetDWellSwitchTimeDefault();
pComboBox0[4]->SetCurSel(index);
index = GetDWellSwitchPictureDefault();
pComboBox0[5]->SetCurSel(index);
//csp modify
index = GetLockTimeIndexDefault();
pComboBox01[0]->SetCurSel(index);
//csp modify
SBizParaTarget bizTar;
bizTar.emBizParaType = EM_BIZ_SYSTEMPARA;
SBizSystemPara bizSysPara;
BizGetDefaultPara(&bizTar, &bizSysPara);
pEdit01[0]->SetText(bizSysPara.sn);
if(ret == 0)
{
SetInfo("&CfgPtn.LoadDefaultSuccess");
}
else
{
SetInfo("&CfgPtn.LoadDefaultFail");
}
}
else if(1 == curID)//日期和时间子页面
{
int ret = GetDateFormatDefault();
pComboBox1[0]->SetCurSel(ret);
int index = GetTimeFormatDefault();
pComboBox1[1]->SetCurSel(index);
index = GetTimeZoneDefault();
pComboBox1[2]->SetCurSel(index);
//QYJ
int value = GetNetworkSyscCheckDefault();
pCheckBox1[0]->SetValue(value);
pButton1[0]->Enable(value);
//QYJ
char pServer[32] = {0};
GetNtpServerDefault(pServer,32);
pEdit1[0]->SetText(pServer);
//csp modify 20131217
value = GetTimeSyncToIPCDefault();
pCheckBox1[1]->SetValue(value);
SYSTEM_TIME date;
//csp modify 20131213
//GetSysDate(&date);
GetSysDate_TZ(&date);
pDateTime1[0]->SetDateTime(&date);
SYSTEM_TIME time;
//csp modify 20131213
//GetSysTime(&time);
GetSysTime_TZ(&time);
pDateTime1[1]->SetDateTime(&time);
if(ret >= 0)
{
SetInfo("&CfgPtn.LoadDefaultSuccess");
}
else
{
SetInfo("&CfgPtn.LoadDefaultFail");
}
}
}break;
case 3://应用
{
//printf("cur page:%d ,apply\n",curID);
if(0 == curID) //系统子页面
{
//printf("language %d\n", pComboBox0[3]->GetCurSel());
//pCdc->SetLanguage(pComboBox0[3]->GetCurSel());
SSG_MSG_TYPE msg;
memset(&msg, 0, sizeof(msg));
msg.type = EM_DVR_PARAM_SAVE;
msg.chn = 0;
//系统参数保存
strcpy(msg.note, GetParsedString("&CfgPtn.CfgSYSTEMSave"));
upload_sg(&msg);
u8 flag_DevID_valid = 0;
char tmp[50];
memset(tmp, 0, sizeof(tmp));
pEdit0[1]->GetText(tmp,sizeof(tmp));
if((strlen(tmp)<6) && strlen(tmp))
{
int i;
for(i=0; i<strlen(tmp); i++)
{
if((tmp[i]<'0') || (tmp[i]>'9'))
{
break;
}
}
if(i>=strlen(tmp))
{
sscanf(tmp, "%d", &i);
if(i<=0xff)//255
{
flag_DevID_valid = 1;
}
}
}
if(!flag_DevID_valid)
{
MessageBox("&CfgPtn.InvalidDeviceId","&CfgPtn.WARNING",MB_OK|MB_ICONERROR);
break;
}
int curVFormat = pComboBox0[0]->GetCurSel();
int curOutput = pComboBox0[2]->GetCurSel();
int curLanguage = pComboBox0[3]->GetCurSel();
int nRestart = 0;
if(curVFormat != m_lastVFormat
|| curOutput != m_lastOutput
|| curLanguage != m_lastLanguage)
{
//m_pPageInfoBox->SetOkCallBack(RebootSystem);
UDM ret = MessageBox("&CfgPtn.RebootOrNot", "&CfgPtn.WARNING", MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2);
if(GetRunStatue() == UDM_OK)
{
nRestart = 1;
}
else if(GetRunStatue() == UDM_CANCEL)
{
//add by Lirl on Nov/08/2011
UpdateData(UDM_OPEN);//点击取消按钮时刷新页面
break;
}
}
#if 1
//add by Lirl on Nov/17/2011,制式改变时转换到对应制式的满帧
if((curVFormat!=m_lastVFormat) && (EM_BIZ_NTSC==(EMBIZVIDSTANDARD)GetVideoFormatReal()))
{
SBizEncodePara sBizEncParaMain;
SBizEncodePara sBizEncParaSub;
for(int i=0; i<GetMaxChnNum(); i++)
{
BizGetVMainEncodePara(0,&sBizEncParaMain, i);
if(30 == sBizEncParaMain.nFrameRate
|| 0 == sBizEncParaMain.nFrameRate)
{
sBizEncParaMain.nFrameRate = 25;
BizSetVMainEncodePara(&sBizEncParaMain, i);
}
BizGetVSubEncodePara(0,&sBizEncParaSub, i);
if(30 == sBizEncParaSub.nFrameRate
|| 0 == sBizEncParaSub.nFrameRate)
{
sBizEncParaSub.nFrameRate = 25;
BizSetVSubEncodePara(&sBizEncParaSub, i);
}
}
}
if((curVFormat!=m_lastVFormat) && (EM_BIZ_PAL==(EMBIZVIDSTANDARD)GetVideoFormatReal()))
{
SBizEncodePara sBizEncParaMain;
SBizEncodePara sBizEncParaSub;
for(int i=0; i<GetMaxChnNum(); i++)
{
BizGetVMainEncodePara(0,&sBizEncParaMain, i);
if(25 == sBizEncParaMain.nFrameRate
|| 0 == sBizEncParaMain.nFrameRate)
{
sBizEncParaMain.nFrameRate = 30;
BizSetVMainEncodePara(&sBizEncParaMain, i);
}
BizGetVSubEncodePara(0,&sBizEncParaSub, i);
if(25 == sBizEncParaSub.nFrameRate
|| 0 == sBizEncParaSub.nFrameRate)
{
sBizEncParaSub.nFrameRate = 30;
BizSetVSubEncodePara(&sBizEncParaSub, i);
}
}
}
//end
#endif
WriteLogs();
u32 id1[2] = {
GSR_CONFIG_BASIC_SYSTEM_DEVICENAME,
GSR_CONFIG_BASIC_SYSTEM_DEVICEID
};
int i = 0;
int ret = 0;
for(i=0; i<2; i++)
{
ret |= SaveScrStr2Cfg(pEdit0[i],
id1[i],
EM_GSR_CTRL_EDIT,
0);
//printf("ret1 = %d\n", ret);
}
u32 id2[4] = {
GSR_CONFIG_BASIC_SYSTEM_AUTHCHECK,
GSR_CONFIG_BASIC_SYSTEM_TIMEDISPLAY,
GSR_CONFIG_BASIC_SYSTEM_SHOWGUIDE,
GSR_CONFIG_BASIC_SYSTEM_SHOWCHNKBPS,
};
for(i=0; i<4; i++)
{
ret |= SaveScrStr2Cfg(pCheckBox0[i],
id2[i],
EM_GSR_CTRL_CHK,
0);
//printf("ret2 = %d\n", ret);
}
u32 id3[5] = {
GSR_CONFIG_BASIC_SYSTEM_VIDEOFORMAT,
GSR_CONFIG_BASIC_SYSTEM_MAXNETUSERS,
GSR_CONFIG_BASIC_SYSTEM_OUTPUT,
GSR_CONFIG_BASIC_SYSTEM_LANGUAGE,
GSR_CONFIG_BASIC_SYSTEM_SCRENNSAVER,
};
RESAVE:
for(i=0; i<5; i++)
{
if ((0 == nRestart) && ((GSR_CONFIG_BASIC_SYSTEM_VIDEOFORMAT == id3[i])
|| (GSR_CONFIG_BASIC_SYSTEM_OUTPUT == id3[i])
|| (GSR_CONFIG_BASIC_SYSTEM_LANGUAGE == id3[i])
))
{
continue;
}
ret |= SaveScrStr2Cfg(pComboBox0[i],
id3[i],
EM_GSR_CTRL_COMB,
0);
//printf("ret3 = %d\n", ret);
}
//CDC* pCdc = GetDC();
ret |= SetDWellSwitchTimeIndex(pComboBox0[4]->GetCurSel());
//printf("yg pComboBox0[5]->GetCurSel(): %d\n", pComboBox0[5]->GetCurSel());
ret |= SetDWellSwitchPictureIndex(pComboBox0[5]->GetCurSel());
ret |= SetLockTimeIndex(pComboBox01[0]->GetCurSel());//csp modify
#if 1//#if defined(CHIP_HISI3531) || defined(CHIP_HISI3521)//csp modify
#else
SBizParaTarget bizTar;
bizTar.emBizParaType = EM_BIZ_SYSTEMPARA;
SBizSystemPara bizSysPara;
BizGetPara(&bizTar, &bizSysPara);
memset(tmp, 0, sizeof(tmp));
pEdit01[0]->GetText(tmp,sizeof(tmp));
memset(bizSysPara.sn, 0, sizeof(bizSysPara.sn));
strcpy(bizSysPara.sn, tmp);
BizSetPara(&bizTar, &bizSysPara);
//验证序列号
if(BizVerifySN() == 0)
{
BizRecordSetWorkingEnable(1);
CPage** page = GetPage();
if(page && page[EM_PAGE_DESKTOP])
{
CPageDesktop *pDesktop = (CPageDesktop *)page[EM_PAGE_DESKTOP];
if(pDesktop->pStaticVerifySNResult)
{
pDesktop->pStaticVerifySNResult->Show(FALSE);
}
}
}
else
{
BizRecordSetWorkingEnable(0);
CPage** page = GetPage();
if(page && page[EM_PAGE_DESKTOP])
{
CPageDesktop *pDesktop = (CPageDesktop *)page[EM_PAGE_DESKTOP];
if(pDesktop->pStaticVerifySNResult)
{
pDesktop->pStaticVerifySNResult->Show(TRUE);
}
}
}
#endif
if(ret == 0)
{
SetInfo("&CfgPtn.SaveConfigSuccess");
}
else
{
SetInfo("&CfgPtn.SaveConfigFail");
}
usleep(1000 * 1000 * 1);
/*if(m_lastLanguage != curLanguage)
{
printf("lalalalalalalal***\n");
SBizSystemPara sysPara;
if(0 == BizGetSysInfo(&sysPara))
{
CLocales* pLocale = NULL;
bizData_GetLocales(&pLocale);
printf("lalalalalalalal***\n");
if(pLocale)
{
printf("lalalalalal %d\n",sysPara.nLangId);
pLocale->SetLanguage(sysPara.nLangId);
}
}
}*/
m_lastVFormat = curVFormat;
m_lastOutput = curOutput;
m_lastLanguage = curLanguage;
if(nRestart && (0 == ret))
{
//printf("***nRestart = %d, ret = %d\n", nRestart, ret);
SetInfo("");
SetSystemLockStatus(1);//cw_shutdown
m_pPageInfoBox->Open();
BizSysComplexExit(EM_BIZSYSEXIT_RESTART);
//usleep(1000 * 3000);
//m_pPageInfoBox->Close();
//Modify by Lirl on Jan/16/2012,set the font color to red
pInfoBar->SetTextColor(VD_RGB(255,0,0), 1);
SetInfo("&CfgPtn.SysRestartNow");
}
else if(nRestart && ret)
{
//Modify by Lirl on Feb/28/2012
//防止参数选项没有完全存在就重启
//printf("***nRestart = %d, ret = %d\n", nRestart, ret);
static int count = 0;
if(count++ < 3)
{
goto RESAVE;
}
}
}
else if(1 == curID) //日期和时间子页面
{
SSG_MSG_TYPE msg;
memset(&msg, 0, sizeof(msg));
msg.type = EM_DVR_PARAM_SAVE;
msg.chn = 0;
//日期和时间参数保存
strcpy(msg.note, GetParsedString("&CfgPtn.DateTimeSave"));
upload_sg(&msg);
u32 id1[3] = {
GSR_CONFIG_BASIC_DATETIME_DATEFORMAT,
GSR_CONFIG_BASIC_DATETIME_TIMEFORMAT,
GSR_CONFIG_BASIC_DATETIME_TIMEZONE,
};
char pServer[32] = {0};
pEdit1[0]->GetText(pServer,32);
int i = 0;
int ret = 0;
for(i=0; i<3; i++)
{
ret |= SaveScrStr2Cfg(pComboBox1[i],
id1[i],
EM_GSR_CTRL_COMB,
0);
}
//QYJ
u32 id2[1] = {GSR_CONFIG_BASIC_DATETIME_NETSYN};
for(i=0; i<1; i++)
{
printf("saving netsyn\n");
ret |= SaveScrStr2Cfg(pCheckBox1[i],
id2[i],
EM_GSR_CTRL_CHK,
0);
//printf("ret = %d\n", ret);
}
//QYJ
u32 id3[1] = {GSR_CONFIG_BASIC_DATETIME_NTPSERVER};
for(i=0; i<1; i++)
{
ret |= SaveScrStr2Cfg(pEdit1[i],
id3[i],
EM_GSR_CTRL_EDIT,
0);
//printf("ret = %d\n", ret);
}
u32 id4[1] = {GSR_CONFIG_BASIC_DATETIME_SYNCTIMETOIPC};
for(i=0; i<1; i++)
{
printf("saving synctimetoipc\n");
ret |= SaveScrStr2Cfg(pCheckBox1[1+i],
id4[i],
EM_GSR_CTRL_CHK,
0);
//printf("ret = %d\n", ret);
}
//printf("######OnSave1######\n");
//IPC 同步时间在此
OnSave1();//yzw add
ntp_param_changed = 1;
if(ret == 0)
{
SetInfo("&CfgPtn.SaveConfigSuccess");
}
else
{
SetInfo("&CfgPtn.SaveConfigFail");
}
}
}break;
case 4://退出
{
//printf("exit\n");
this->Close();
}break;
case 5:
{
//上一步
;
} break;
case 6:
{
//下一步
CPage** page = GetPage();
if(page && page[EM_PAGE_NETCFG])
{
//先保存配置
//日期和时间
u32 id0[3] = {
GSR_CONFIG_BASIC_DATETIME_DATEFORMAT,
GSR_CONFIG_BASIC_DATETIME_TIMEFORMAT,
GSR_CONFIG_BASIC_DATETIME_TIMEZONE,
};
//int i = 0;
for(i=0; i<3; i++)
{
SaveScrStr2Cfg(pComboBox1[i],
id0[i],
EM_GSR_CTRL_COMB,
0);
}
//SaveScrStr2Cfg(pCheckBox1[1],
SaveScrStr2Cfg(pCheckBox1[2],
GSR_CONFIG_BASIC_SYSTEM_SHOWGUIDE,
EM_GSR_CTRL_CHK,
0);
//QYJ
char pServer[32] = {0};
pEdit1[0]->GetText(pServer,32);
//QYJ
u32 id2[1] = {GSR_CONFIG_BASIC_DATETIME_NETSYN};
for(i=0; i<1; i++)
{
printf("saving netsyn\n");
SaveScrStr2Cfg(pCheckBox1[i],
id2[i],
EM_GSR_CTRL_CHK,
0);
//printf("ret = %d\n", ret);
}
//QYJ
u32 id3[1] = {GSR_CONFIG_BASIC_DATETIME_NTPSERVER};
for(i=0; i<1; i++)
{
SaveScrStr2Cfg(pEdit1[i],
id3[i],
EM_GSR_CTRL_EDIT,
0);
//printf("ret = %d\n", ret);
}
u32 id4[1] = {GSR_CONFIG_BASIC_DATETIME_SYNCTIMETOIPC};
for(i=0; i<1; i++)
{
printf("saving synctimetoipc\n");
SaveScrStr2Cfg(pCheckBox1[1+i],
id4[i],
EM_GSR_CTRL_CHK,
0);
//printf("ret = %d\n", ret);
}
//printf("######OnSave1######\n");
OnSave1();
//
ntp_param_changed = 1;
page[EM_PAGE_NETCFG]->UpdateData(UDM_GUIDE);
if(page[EM_PAGE_NETCFG]->Open())
{
this->Close();
}
//page[EM_PAGE_NETCFG]->UpdateData(UDM_EMPTY);
}
}
break;
default:
break;
}
}
//csp modify
if(bFind)
{
nDateChanged = 0;
nTimeChanged = 0;
nEdittingTime = 0;
}
}
CPageBasicConfigFrameWork::~CPageBasicConfigFrameWork()
{
}
void CPageBasicConfigFrameWork::RecvNotifyClose() //跃天解码板CMS remote CTRL
{
if ( (GetFlag(IF_SHOWN)) && (curID == 1) )
{
this->Close();
}
}
VD_PCSTR CPageBasicConfigFrameWork::GetDefualtTitleCenter()
{
return "&CfgPtn.MAINMENU";
}
//csp modify
void CPageBasicConfigFrameWork::OnTrackMove0()
{
#if 1
int pos = pScrollbar0->GetPos();
//printf("OnTrackMove0:curID=%d,pos=%d,pg0_page=%d\n",curID,pos,pg0_page);
if(curID != 0 || pg0_page == pos)
{
//printf("hehe1\n");
return;
}
if(pg0_page!=1 && pos==1)
{
//printf("hehe2\n");
ShowSubPage(curID, FALSE);
pg0_page = pos;
//printf("hehe2.1\n");
ShowSubPage(curID, TRUE);
}
if(pg0_page!=0 && pos==0)
{
//printf("hehe3\n");
ShowSubPage(curID, FALSE);
pg0_page = pos;
ShowSubPage(curID, TRUE);
}
//printf("hehe4\n");
#endif
}
void CPageBasicConfigFrameWork::InitPage0()
{
char* statictext[10] = {
"&CfgPtn.DeviceName",
"&CfgPtn.DeviceID",
"&CfgPtn.VideoFormat",
"&CfgPtn.PasswordCheck",
"&CfgPtn.ShowSystemTime",
"&CfgPtn.MaxOnlineUsers",//5
"&CfgPtn.VideoOutput",
"&CfgPtn.Language",
"&CfgPtn.DWellSwitchTime",
"&CfgPtn.DWellSwitchPicture",
//"&CfgPtn.ShowGuide",
//"&CfgPtn.Screensaver",//
};
#if 1//csp modify
pg0_page = 0;
#endif
CRect rtSubPage(m_Rect.left+27, m_Rect.top+50,
m_Rect.Width()-27,m_Rect.top+50+270);
#if 1//csp modify
pTable0 = CreateTableBox(&rtSubPage,this,3,9,0);
pTable0->SetColWidth(0,280);
pTable0->SetColWidth(1,286);
#else
pTable0 = CreateTableBox(&rtSubPage,this,2,9,0);
pTable0->SetColWidth(0,294);
#endif
items[0].push_back(pTable0);
//csp modify
pScrollbar0 = CreateScrollBar(CRect(m_Rect.Width()-30-20+2,53,m_Rect.Width()-30+2,53+264),
this,
scrollbarY,
0,
10,
1,
(CTRLPROC)&CPageBasicConfigFrameWork::OnTrackMove0);
items[0].push_back(pScrollbar0);
#if 1//csp modify
items[2].push_back(pTable0);
items[2].push_back(pScrollbar0);
#endif
CRect tmpRt;
int i = 0;
#if 1//csp modify
//yaogang modify 20140918
char* statictext01[4] = /*2*/
{
"&CfgPtn.KeyLock",
"&CfgPtn.SN",
"&CfgPtn.ShowChnKbps", //显示实时码流
"&CfgPtn.ShowGuide",//显示向导
};
for(i=0; i<4; i++)
{
if (i < 2)
{
pTable0->GetTableRect(0, i, &tmpRt);
pStatic01[i] = CreateStatic(CRect(rtSubPage.left+tmpRt.left+3, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.right-3,rtSubPage.top+tmpRt.bottom),
this, statictext01[i]);
}
else
{
pTable0->GetTableRect(0, i-1, &tmpRt);
pStatic01[i] = CreateStatic(CRect(rtSubPage.left+tmpRt.left+3, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.right-3,rtSubPage.top+tmpRt.bottom),
this, statictext01[i]);
}
pStatic01[i]->Show(FALSE);
#if 1//#if defined(CHIP_HISI3531) || defined(CHIP_HISI3521)//csp modify
if(i != 1)
{
items[2].push_back(pStatic01[i]);
}
#else
items[2].push_back(pStatic01[i]);
#endif
if(i == 0)
{
pTable0->GetTableRect(1,i,&tmpRt);
pComboBox01[i] = CreateComboBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this, NULL, NULL, NULL, 0);
pComboBox01[i]->SetBkColor(VD_RGB(67,77,87));
SValue LockTimeList[10];
int nLockTime = 0;
GetLockTimeList(LockTimeList, &nLockTime, 10);
//printf("InitPage0 nLockTime = %d\n",nLockTime);
for(int k=0; k<nLockTime; k++)
{
pComboBox01[i]->AddString(LockTimeList[k].strDisplay);
//printf("InitPage0 AddString : %s\n",LockTimeList[k].strDisplay);
}
pComboBox01[i]->SetCurSel(0);
pComboBox01[i]->Show(FALSE);
items[2].push_back(pComboBox01[i]);
pTable0->GetTableRect(1,1,&tmpRt);
pEdit01[i] = CreateEdit(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this,20,0,
(CTRLPROC)&CPageBasicConfigFrameWork::OnEditChange0);
pEdit01[i]->SetBkColor(VD_RGB(67,77,87));
pEdit01[i]->Show(FALSE);
#if 1//#if defined(CHIP_HISI3531) || defined(CHIP_HISI3521)//csp modify
#else
items[2].push_back(pEdit01[i]);
#endif
}
if (i == 2) //显示实时码流
{
pTable0->GetTableRect(1,1,&tmpRt);//上移一行
pCheckBox0[3] = CreateCheckBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+4,
rtSubPage.left+tmpRt.left+22,rtSubPage.top+tmpRt.top+24),
this);
pCheckBox0[3]->Show(FALSE);
items[2].push_back(pCheckBox0[3]);
}
if (i == 3)
{
//显示向导
pTable0->GetTableRect(1, 2, &tmpRt);
pCheckBox0[2] = CreateCheckBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+4,
rtSubPage.left+tmpRt.left+22,rtSubPage.top+tmpRt.top+24),
this);
pCheckBox0[2]->Show(FALSE);
items[2].push_back(pCheckBox0[2]);
}
}
#endif
for(i=0; i<10; i++)
{
pTable0->GetTableRect(0,i,&tmpRt);
if(i > 5)//yzw add this line
{
pTable0->GetTableRect(0, i-1, &tmpRt);//yzw add this line
}
pStatic0[i] = CreateStatic(CRect(rtSubPage.left+tmpRt.left+3, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.right-3,rtSubPage.top+tmpRt.bottom),
this, statictext[i]);
if((i<10) && (i!=5))//yzw add this line
items[0].push_back(pStatic0[i]);
}
for(i=0; i < 2; i++)
{
pTable0->GetTableRect(1,i,&tmpRt);
pEdit0[i] = CreateEdit(CRect(rtSubPage.left+tmpRt.left+1, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this,(1==i)?3:20,(1==i)?edit_KI_NUMERIC:0,
(CTRLPROC)&CPageBasicConfigFrameWork::OnEditChange0);
pEdit0[i]->SetBkColor(VD_RGB(67,77,87));
items[0].push_back(pEdit0[i]);
}
SValue videoFormatList[10];
int nVideoFormatReal;
GetVideoFormatList(videoFormatList, &nVideoFormatReal, 10);
pTable0->GetTableRect(1,2,&tmpRt);
//printf("l:%d,t:%d,r:%d,b:%d \n",tmpRt.left,tmpRt.top,tmpRt.right,tmpRt.bottom);
pComboBox0[0] = CreateComboBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this, NULL, NULL, NULL, 0);
for(int k=0; k<nVideoFormatReal; k++)
{
pComboBox0[0]->AddString(videoFormatList[k].strDisplay);
}
pComboBox0[0]->SetBkColor(VD_RGB(67,77,87));
items[0].push_back(pComboBox0[0]);
for(i=0; i < 2; i++)
{
//if (2 != i)
{
pTable0->GetTableRect(1,i+3,&tmpRt);
}
//else
//{
// pTable0->GetTableRect(1,i+6,&tmpRt);
//}
pCheckBox0[i] = CreateCheckBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+4,
rtSubPage.left+tmpRt.left+22,rtSubPage.top+tmpRt.top+24),
this);
items[0].push_back(pCheckBox0[i]);
}
SValue maxUserList[10];
int nMaxUserReal;
GetMaxUserList(maxUserList, &nMaxUserReal, 10);
SValue outputList[10];
int nOutputReal;
GetOutputList(outputList, &nOutputReal, 10);
//csp modify 20121224//大于20种语言怎么办???
SValue languageList[20];
int nLanguageReal = 0;
GetLanguageList(languageList, &nLanguageReal, 20);
SValue screenSaverList[10];
int nScreenSaverReal;
GetScreenSaverList(screenSaverList, &nScreenSaverReal, 10);
SValue dWellTimeList[10];
int nDWellTime;
GetDWellSwitchTimeList(dWellTimeList, &nDWellTime, 10);
/*
printf("yg nDWellTime: %d\n", nDWellTime);
for(i=0; i < nDWellTime; i++)
{
printf("yg dWellTimeList[%d]: %d\n", i, dWellTimeList[i].nValue);
printf("yg dWellTimeList[%d]: %s\n", i, dWellTimeList[i].strDisplay);
}
*/
SValue dWellSwitchPicture[10];//轮巡画面选择: 单画面,四画面,九画面
int nPicturesReal;
GetDWellSwitchPictureList(dWellSwitchPicture, &nPicturesReal, 10);
printf("yg nPicturesReal: %d\n", nPicturesReal);
for(i=0; i < nPicturesReal; i++)
{
BizConfigGetParaListValue(
EM_BIZ_CFG_PARALIST_SWITCHPICTURE,
i,
&dWellSwitchPicture[i].nValue);
printf("yg DWellSwitchPicture[%d]: %d\n", i, dWellSwitchPicture[i].nValue);
printf("yg DWellSwitchPicture[%d]: %s\n", i, dWellSwitchPicture[i].strDisplay);
}
for(i=0; i<5; i++)
{
pTable0->GetTableRect(1,i+5,&tmpRt);
if (i)//yzw add this line
{
pTable0->GetTableRect(1,i+4,&tmpRt);//yzw add this line
}
//printf("l:%d,t:%d,r:%d,b:%d \n",tmpRt.left,tmpRt.top,tmpRt.right,tmpRt.bottom);
pComboBox0[i+1] = CreateComboBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this, NULL, NULL, NULL, 0);
pComboBox0[i+1]->SetBkColor(VD_RGB(67,77,87));
switch(i+1)
{
case 1:
{
for(int k=0; k<nMaxUserReal; k++)
{
pComboBox0[i+1]->AddString(maxUserList[k].strDisplay);
}
}break;
case 2:
{
for(int k=0; k<nOutputReal; k++)
{
pComboBox0[i+1]->AddString(outputList[k].strDisplay);
pComboBox0[2]->isListExist = 1;
}
}break;
case 3:
{
for(int k=0; k<nLanguageReal; k++)
{
pComboBox0[i+1]->AddString(languageList[k].strDisplay);
pComboBox0[3]->isListExist = 1;
}
}break;
case 4:
{
for(int k=0; k<nDWellTime; k++)
{
pComboBox0[i+1]->AddString(dWellTimeList[k].strDisplay);
}
}break;
case 5:
{
for(int k=0; k<nPicturesReal; k++)
{
pComboBox0[i+1]->AddString(dWellSwitchPicture[k].strDisplay);
}
}break;
default:
{}break;
}
if (i) //yzw add this line
{
items[0].push_back(pComboBox0[i+1]);
}
}
//轮训时间
//pComboBox0[4]->Show(FALSE);//yzw add this line//csp modify
//pStatic0[8]->Show(FALSE);//yzw add this line//csp modify
pComboBox0[1]->Show(FALSE);//yzw add this line
pStatic0[5]->Show(FALSE);//yzw add this line
ShowSubPage(0,TRUE);//zlbtmp
pButton[0]->Enable(FALSE);
}
void CPageBasicConfigFrameWork::InitPage1()
{
char* statictext[10] = {
"&CfgPtn.DateFormat",
"&CfgPtn.TimeFormat",
"&CfgPtn.TimeZone",
"&CfgPtn.SyncTimeWithNTPServer",
"&CfgPtn.NTPServer",
"",
"&CfgPtn.SystemDate",
"&CfgPtn.SystemTime",
"&CfgPtn.SyncTimeToIPC",
"&CfgPtn.ShowGuide",
};
CRect rtSubPage(m_Rect.left+27, m_Rect.top+50,
m_Rect.Width()-27,m_Rect.top+50+270);
//csp modify 20131217
//pTable1 = CreateTableBox(&rtSubPage,this,2,9,0);
pTable1 = CreateTableBox(&rtSubPage,this,2,10,0);
pTable1->SetColWidth(0,294);
items[1].push_back(pTable1);
CRect tmpRt;
int i = 0;
for(i=0; i < 10; i++)
{
#ifdef HIDE_NTP
if(i <= 5)
{
pTable1->GetTableRect(0,i,&tmpRt);
}
else
{
pTable1->GetTableRect(0,i-4,&tmpRt);
}
#else
pTable1->GetTableRect(0,i,&tmpRt);
#endif
pStatic1[i] = CreateStatic(CRect(rtSubPage.left+tmpRt.left+3, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.right-3,rtSubPage.top+tmpRt.bottom),
this, statictext[i]);
#ifdef HIDE_NTP
if(i >= 2 && i <= 5)
{
pStatic1[i]->Show(FALSE);
}
else
{
items[1].push_back(pStatic1[i]);
}
#else
items[1].push_back(pStatic1[i]);
#endif
}
SValue dateFormatList[10];
int nDateFormatReal;
GetDateFormatList(dateFormatList, &nDateFormatReal, 10);
SValue timeFormatList[10];
int nTimeFormatReal;
GetTimeFormatList(timeFormatList, &nTimeFormatReal, 10);
SValue timeZoneList[50];
int nTimeZoneReal;
GetTimeZoneList(timeZoneList, &nTimeZoneReal, 50);
for(i=0; i<3; i++)
{
pTable1->GetTableRect(1,i,&tmpRt);
//printf("l:%d,t:%d,r:%d,b:%d\n",tmpRt.left,tmpRt.top,tmpRt.right,tmpRt.bottom);
if(1 == i)
{
pComboBox1[i] = CreateComboBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this, NULL, NULL,(CTRLPROC)&CPageBasicConfigFrameWork::OnComb, 0);
}
else
{
pComboBox1[i] = CreateComboBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this, NULL, NULL, NULL, 0);
}
pComboBox1[i]->SetBkColor(VD_RGB(67,77,87));
/*
if(i == 2)
{
pComboBox1[i]->Enable(FALSE);
}
*/
#ifdef HIDE_NTP
u8 push_flag = 1;
#endif
switch(i)
{
case 0:
{
for(int k=0; k<nDateFormatReal; k++)
{
pComboBox1[i]->AddString(dateFormatList[k].strDisplay);
}
}break;
case 1:
{
for(int k=0; k<nTimeFormatReal; k++)
{
pComboBox1[i]->AddString(timeFormatList[k].strDisplay);
}
}break;
case 2:
{
for(int k=0; k<nTimeZoneReal; k++)
{
pComboBox1[i]->AddString(timeZoneList[k].strDisplay);
}
//QYJ
#ifdef HIDE_NTP
pComboBox1[i]->Enable(FALSE);
#else
//pComboBox1[i]->Enable(FALSE);
#endif
#ifdef HIDE_NTP
pComboBox1[i]->Show(FALSE);
push_flag = 0;
#endif
}break;
default:
{}break;
}
#ifdef HIDE_NTP
if(push_flag)
{
items[1].push_back(pComboBox1[i]);
}
#else
items[1].push_back(pComboBox1[i]);
#endif
}
pTable1->GetTableRect(1,4,&tmpRt);
int vLen = (tmpRt.right-tmpRt.left-4)/TEXT_WIDTH*2;
pEdit1[0] = CreateEdit(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.right-15,rtSubPage.top+tmpRt.bottom-1),
this,vLen,0,(CTRLPROC)&CPageBasicConfigFrameWork::OnEditChange1);
pEdit1[0]->SetBkColor(VD_RGB(67,77,87));
//QYJ
#ifdef HIDE_NTP
pEdit1[0]->Enable(FALSE);
#else
//pEdit1[0]->Enable(FALSE);
#endif
#ifdef HIDE_NTP
pEdit1[0]->Show(FALSE);
#else
items[1].push_back(pEdit1[0]);
#endif
int btWidth = strlen("Synchronize")*TEXT_WIDTH/2+20;
pTable1->GetTableRect(1,5,&tmpRt);
pButton1[0] = CreateButton(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+2,
rtSubPage.left+tmpRt.left+btWidth,rtSubPage.top+tmpRt.top+27),
this, "&CfgPtn.UpdateNow",
(CTRLPROC)&CPageBasicConfigFrameWork::OnSynchronize1, NULL, buttonNormalBmp);
pButton1[0]->SetBitmap(pBmp_button_normal, pBmp_button_select, pBmp_button_push, pBmp_button_normal);
//QYJ
#ifdef HIDE_NTP
pButton1[0]->Enable(FALSE);
#else
//pButton1[0]->Enable(FALSE);
#endif
#ifdef HIDE_NTP
pButton1[0]->Show(FALSE);
#else
items[1].push_back(pButton1[0]);
#endif
#ifdef HIDE_NTP
pTable1->GetTableRect(1,6-4,&tmpRt);
#else
pTable1->GetTableRect(1,6,&tmpRt);
#endif
pDateTime1[0] = CreateDateTimeCtrl(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.left+126,rtSubPage.top+tmpRt.top+27),
this,(CTRLPROC)&CPageBasicConfigFrameWork::OnDateTimeChange0,DTS_DATE);
pDateTime1[0]->SetBkColor(VD_RGB(67,77,87));
//pDateTime1[0]->Show(FALSE);
items[1].push_back(pDateTime1[0]);
#ifdef HIDE_NTP
pTable1->GetTableRect(1,7-4,&tmpRt);
#else
pTable1->GetTableRect(1,7,&tmpRt);
#endif
pDateTime1[1] = CreateDateTimeCtrl(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+3,
rtSubPage.left+tmpRt.left+126,rtSubPage.top+tmpRt.top+27),
this,(CTRLPROC)&CPageBasicConfigFrameWork::OnDateTimeChange1,DTS_TIME);
pDateTime1[1]->SetBkColor(VD_RGB(67,77,87));
//pDateTime1[1]->Show(FALSE);
items[1].push_back(pDateTime1[1]);
pTable1->GetTableRect(1,8,&tmpRt);
pButton1[1] = CreateButton(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+1,
rtSubPage.left+tmpRt.left+btWidth,rtSubPage.top+tmpRt.top+25),
this, "&CfgPtn.SaveNow",
(CTRLPROC)&CPageBasicConfigFrameWork::OnSave1, NULL, buttonNormalBmp);
pButton1[1]->SetBitmap(pBmp_button_normal, pBmp_button_select, pBmp_button_push, pBmp_button_push);
//items[1].push_back(pButton1[1]);
pButton1[1]->Show(FALSE);
//csp modify 20131217
//for(i = 0; i < 2; i++)
for(i = 0; i < 3; i++)
{
if(i)
{
#ifdef HIDE_NTP
pTable1->GetTableRect(1,8-4,&tmpRt);
#else
pTable1->GetTableRect(1,8+i-1,&tmpRt);
#endif
pCheckBox1[i] = CreateCheckBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+4,
rtSubPage.left+tmpRt.left+22,rtSubPage.top+tmpRt.top+24),
this);
}
else
{
pTable1->GetTableRect(1,3,&tmpRt);
pCheckBox1[i] = CreateCheckBox(CRect(rtSubPage.left+tmpRt.left+2, rtSubPage.top+tmpRt.top+4,
rtSubPage.left+tmpRt.left+22,rtSubPage.top+tmpRt.top+24),
this, styleEditable, (CTRLPROC)&CPageBasicConfigFrameWork::OnCheckBoxNTPEnable);
}
#ifdef HIDE_NTP
if(i == 0)
{
pCheckBox1[i]->Show(FALSE);
}
else
{
items[1].push_back(pCheckBox1[i]);
}
#else
items[1].push_back(pCheckBox1[i]);
#endif
}
//QYJ
#ifdef HIDE_NTP
pCheckBox1[0]->Enable(FALSE);
#else
//pCheckBox1[0]->Enable(FALSE);
#endif
ShowSubPage(1,FALSE);
nThisPageOpened = 0;
nDateChanged = 0;
nTimeChanged = 0;
nEdittingTime = 0;
#ifndef HIDE_NTP
pthread_t pid1 = 0;
pthread_create(&pid1, NULL, keepsynchronizing, NULL);
#endif
}
void CPageBasicConfigFrameWork::OnDateTimeChange0()
{
nDateChanged = 1;
}
void CPageBasicConfigFrameWork::OnDateTimeChange1()
{
//printf("%s\n", __func__);
nTimeChanged = 1;
}
void CPageBasicConfigFrameWork::OnEditChange0()
{
//printf("OnEditChange0\n");
}
void CPageBasicConfigFrameWork::OnEditChange1()
{
//printf("OnEditChange1\n");
}
void CPageBasicConfigFrameWork::OnSynchronize1()
{
//printf("unsupported now!\n");
char pServer[32] = {0};
pEdit1[0]->GetText(pServer,32);
int ret = synctimefromntp(1, pServer, 5);
if(ret == 0)
{
ntp_param_changed = 0;
SetInfo("&CfgPtn.Success");
}
else
{
SetInfo("&CfgPtn.Fail");
}
}
void CPageBasicConfigFrameWork::OnComb()
{
pDateTime1[1]->SetTimeFormat(0, 0, pComboBox1[1]->GetCurSel());
}
void CPageBasicConfigFrameWork::OnCheckBoxNTPEnable()
{
int value = pCheckBox1[0]->GetValue();
pButton1[0]->Enable(value);
}
void CPageBasicConfigFrameWork::OnSave1()
{
SBizDateTime sBizDT;
memset(&sBizDT, 0, sizeof(sBizDT));
int sel = pComboBox1[0]->GetCurSel();
if(0 == sel)//(0==strcmp(pComboBox1[0]->GetString(sel),"yy.MM.dd"))
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_YYYYMMDDHHNNSS;
}
else if(1 == sel)
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_MMDDYYYYHHNNSS;
}
else if(2 == sel)
{
sBizDT.emDateTimeFormat = EM_BIZDATETIME_DDMMYYYYHHNNSS;
}
/*
else
{}
*/
sel = pComboBox1[1]->GetCurSel();
if(0 == sel)
{
sBizDT.emTimeFormat = EM_BIZTIME_24HOUR;
}
else if(1 == sel)
{
sBizDT.emTimeFormat = EM_BIZTIME_12HOUR;
}
/*
else
{}
*/
u8 i = 0;
u8 flag = 0;
u8 syncing = 1;
if((nDateChanged) || (nTimeChanged))
{
//syncing = 0;//csp modify 20140406
SYSTEM_TIME date, time;
pDateTime1[0]->GetDateTime(&date);
pDateTime1[1]->GetDateTime(&time);
sBizDT.nYear = date.year;
sBizDT.nMonth = date.month;
sBizDT.nDay = date.day;
sBizDT.nHour = time.hour;
sBizDT.nMinute = time.minute;
sBizDT.nSecond = time.second;
printf("%04d-%02d-%02d %02d:%02d:%02d\n",
sBizDT.nYear,sBizDT.nMonth,sBizDT.nDay,
sBizDT.nHour,sBizDT.nMinute,sBizDT.nSecond);
struct tm tm_time;
tm_time.tm_year = sBizDT.nYear - 1900;
tm_time.tm_mon = sBizDT.nMonth - 1;
tm_time.tm_mday = sBizDT.nDay;
tm_time.tm_hour = sBizDT.nHour;
tm_time.tm_min = sBizDT.nMinute;
tm_time.tm_sec = sBizDT.nSecond;
time_t t = mktime(&tm_time);
int nTimeZone = pComboBox1[2]->GetCurSel();
t -= GetTimeZoneOffset(nTimeZone);
/*
printf("BizSysComplexDTSet %d %d %d %d %d %d\n",
sBizDT.nYear,// = date.year;
sBizDT.nMonth,// = date.month;
sBizDT.nDay,// = date.day;
sBizDT.nHour,// = date.hour;
sBizDT.nMinute,// = date.minute;
sBizDT.nSecond// = date.second;
);
*/
for(i = 0; i < GetVideoMainNum(); i++)
{
if(GetCurRecStatus(i))
{
break;
}
}
if((i < GetVideoMainNum()) && ((nDateChanged) || (nTimeChanged)))
{
UDM ret = MessageBox("&CfgPtn.ModifyTimeRecording", "&CfgPtn.WARNING" ,
MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2);
if(UDM_OK != GetRunStatue())
{
return;
}
BizRecordStopAll();
usleep(2000*1000); //多睡会儿吧,否则结束时间戳容易出问题
flag = 1;
t += 2;
}
gmtime_r(&t,&tm_time);
sBizDT.nYear = tm_time.tm_year + 1900;
sBizDT.nMonth = tm_time.tm_mon + 1;
sBizDT.nDay = tm_time.tm_mday;
sBizDT.nHour = tm_time.tm_hour;
sBizDT.nMinute = tm_time.tm_min;
sBizDT.nSecond = tm_time.tm_sec;
}
//csp modify 20131213
int nTimeZone = pComboBox1[2]->GetCurSel();
BizSysComplexSetTimeZone(nTimeZone);
BizSysComplexDTSet(&sBizDT);
//csp modify 20131213
ModAlarmSetTimeZoneOffset(GetTimeZoneOffset(nTimeZone));
ModRecordSetTimeZoneOffset(GetTimeZoneOffset(nTimeZone));
usleep(20*1000);//csp modify 20140406
//csp modify 20131213
int syncflag = pCheckBox1[1]->GetValue();
IPC_SetTimeZone(nTimeZone, syncflag, syncing);
if(flag)
{
usleep(20*1000);
for(i = 0; i < GetVideoMainNum(); i++)
{
BizRecordResume(i);
}
}
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_DST_CONFIG);
//SetInfo("&CfgPtn.ChangeSysTime");
//printf("OnSave1\n");
}
void CPageBasicConfigFrameWork::SwitchPage(int subID)
{
if(subID < 0 || subID >= BASICCFG_SUBPAGES)
{
return;
}
if(subID == curID)
{
return;
}
//printf("###curID = %d\n",curID);
//printf("###subID = %d\n",subID);
//隐藏当前子页面,显示新的子页面
ShowSubPage(curID, FALSE);
pButton[curID]->Enable(TRUE);
curID = subID;
pButton[curID]->Enable(FALSE);
ShowSubPage(curID, TRUE);
}
void CPageBasicConfigFrameWork::ShowSubPage( int subID, BOOL bShow )
{
if(subID<0 || subID>=BASICCFG_SUBPAGES)
{
return;
}
//csp modify
if(subID == 0 && pg0_page == 1)
{
subID = 2;
}
int count = items[subID].size();
//Modify by Lirl on Mar/05/2012
//"时间和日期"页面,count-1为是了不显示最后一个checkbox控件,向导用
#if 1//csp modify
((subID == 1) && !m_IsLoader)? (count -= 1): count;
#else
(subID && !m_IsLoader)? (count -= 1): count;
#endif
//printf("ShowSubPage count=%d\n",count);
for(int i=0; i<count; i++)
{
if(items[subID][i])
{
items[subID][i]->Show(bShow);
}
}
//要显式的置FALSE,否则鼠标放上控件上还会再次显示出来
#if 1//csp modify
if(subID == 1 && !m_IsLoader)
{
items[subID][count]->Show(FALSE);
}
#else
if(subID && !m_IsLoader)
{
items[subID][count]->Show(FALSE);
}
#endif
//printf("ShowSubPage 2222\n");
}
void CPageBasicConfigFrameWork::updatetime(int flag)
{
if(0 == flag)
{
SYSTEM_TIME date;
//csp modify 20131213
//GetSysDate(&date);
GetSysDate_TZ(&date);
//printf("year : %d,month : %d,day : %d\n",date.year,date.month,date.wday);
pDateTime1[0]->SetDateTime(&date);
}
else
{
SYSTEM_TIME time;
//csp modify 20131213
//GetSysTime(&time);
GetSysTime_TZ(&time);
//printf("%s\n", __func__);
//printf("hour : %d,min : %d,sec : %d\n",date.hour,date.minute,date.second);
pDateTime1[1]->SetDateTime(&time);
}
}
VD_BOOL CPageBasicConfigFrameWork::UpdateData( UDM mode )
{
if(UDM_OPEN == mode)
{
char devName[32] = {0};
GetDevName(devName,31);
pEdit0[0]->SetText(devName);
char devID[32] = {0};
GetDevId(devID,31);
pEdit0[1]->SetText(devID);
int index = GetVideoFormat();
pComboBox0[0]->SetCurSel(index);
int value = GetAuthCheck();
pCheckBox0[0]->SetValue(value);
value = GetTimeDisplayCheck();
pCheckBox0[1]->SetValue(value);
value = GetChnKbpsDisplayCheck();
pCheckBox0[3]->SetValue(value);
value = GetShowGuide();
pCheckBox0[2]->SetValue(value);
index = GetMaxUser();
pComboBox0[1]->SetCurSel(index);
index = GetOutput();
pComboBox0[2]->SetCurSel(index);
index = GetLanguageIndex();
//printf("UpdateData:GetLanguageIndex=%d\n",index);
pComboBox0[3]->SetCurSel(index);
//index = GetScreenSaver();
index = GetDWellSwitchTimeIndex();
pComboBox0[4]->SetCurSel(index);
index = GetDWellSwitchPictureIndex();
pComboBox0[5]->SetCurSel(index);
//csp modify
index = GetLockTimeIndex();
pComboBox01[0]->SetCurSel(index);
//csp modify
SBizParaTarget bizTar;
bizTar.emBizParaType = EM_BIZ_SYSTEMPARA;
SBizSystemPara bizSysPara;
BizGetPara(&bizTar, &bizSysPara);
pEdit01[0]->SetText(bizSysPara.sn);
index = GetDateFormat();
pComboBox1[0]->SetCurSel(index);
index = GetTimeFormat();
pComboBox1[1]->SetCurSel(index);
index = GetTimeZone();
pComboBox1[2]->SetCurSel(index);
value = GetNetworkSyscCheck();
pCheckBox1[0]->SetValue(value);
pButton1[0]->Enable(value);
char pServer[32] = {0};
GetNtpServer(pServer,32);
pEdit1[0]->SetText(pServer);
//csp modify 20131217
value = GetTimeSyncToIPC();
pCheckBox1[1]->SetValue(value);
SYSTEM_TIME date;
//csp modify 20131213
//GetSysDate(&date);
GetSysDate_TZ(&date);
//printf("year : %d,month : %d,day : %d\n",date.year,date.month,date.wday);
pDateTime1[0]->SetDateTime(&date);
SYSTEM_TIME time;
//csp modify 20131213
//GetSysTime(&time);
GetSysTime_TZ(&time);
//printf("hour : %d,min : %d,sec : %d\n",date.hour,date.minute,date.second);
pDateTime1[1]->SetDateTime(&time);
OnComb();
pButton[0]->SetText("&CfgPtn.System");
m_lastVFormat = pComboBox0[0]->GetCurSel();
m_lastOutput = pComboBox0[2]->GetCurSel();
m_lastLanguage = pComboBox0[3]->GetCurSel();
LoadButtomCtl();
}
else if(UDM_OPENED == mode)
{
if(0 == nThisPageOpened)
{
nThisPageOpened = 1;
//csp modify
static unsigned char create = 0;
if(!create)
{
pthread_t pid = 0;
pthread_create(&pid, NULL, updatetimenow, NULL);
create = 1;
}
}
//csp modify
nDateChanged = 0;
nTimeChanged = 0;
nEdittingTime = 0;
//m_pThread->ClearMessage();
}
else if(UDM_CLOSED == mode)
{
if(m_IsLoader)
{
m_IsLoader = 0;//~m_IsLoader;
LoadButtomCtl();
SetTitle(GetParsedString("&CfgPtn.Basic"));
SwitchPage(0);
}
else
{
((CPageConfigFrameWork *)(this->GetParent()))->ReflushItemName();
}
nThisPageOpened = 0;
nDateChanged = 0;
nTimeChanged = 0;
nEdittingTime = 0;
}
else if(UDM_GUIDE == mode)
{
m_IsLoader = 1;//~m_IsLoader;
SetTitle(GetParsedString("&CfgPtn.Guide"));
SwitchPage(1);
//csp modify
nDateChanged = 0;
nTimeChanged = 0;
nEdittingTime = 0;
}
return TRUE;
}
void CPageBasicConfigFrameWork::WriteLogs()
{
if(pComboBox0[0]->GetCurSel() != GetVideoFormat())
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_CHANGE_VIDEOFORMAT);
}
if(pCheckBox0[0]->GetValue() != GetAuthCheck())
{
if(pCheckBox0[0]->GetValue())
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_ENABLE_PWDCHECK);
}
else
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_DISABLE_PWDCHECK);
}
}
if(pComboBox0[1]->GetCurSel() != GetMaxUser())
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_CHANGE_MAX_NETUSER);
}
if(pComboBox0[2]->GetCurSel() != GetOutput())
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_CHANGE_VO);
}
if(pComboBox0[3]->GetCurSel() != GetLanguageIndex())
{
BizGUiWriteLog(BIZ_LOG_MASTER_SYSCONFIG, BIZ_LOG_SLAVE_CHANGE_LANGUAGE);
}
}
void CPageBasicConfigFrameWork::SetInfo(char* szInfo)
{
if (m_IsLoader)
{
return;
}
pIconInfo->Show(TRUE);
pInfoBar->SetText(szInfo);
}
void CPageBasicConfigFrameWork::ClearInfo()
{
if (m_IsLoader)
{
return;
}
pIconInfo->Show(FALSE);
pInfoBar->SetText("");
}
void CPageBasicConfigFrameWork::LoadButtomCtl()
{
if(m_IsLoader)
{
pButton[0]->Show(FALSE);
pButton[1]->Show(FALSE);
pButton[2]->Show(FALSE);
pButton[3]->Show(FALSE);
pButton[5]->Show(TRUE);
pButton[6]->Show(TRUE);
//csp modify 20131217
//pStatic1[8]->SetText("&CfgPtn.ShowGuide");
//pCheckBox1[1]->SetValue(GetShowGuide());
pStatic1[9]->SetText("&CfgPtn.ShowGuide");
pCheckBox1[2]->SetValue(GetShowGuide());
}
else
{
pButton[0]->Show(TRUE);
pButton[1]->Show(TRUE);
pButton[2]->Show(TRUE);
pButton[3]->Show(TRUE);
pButton[5]->Show(FALSE);
pButton[6]->Show(FALSE);
//csp modify 20131217
//pStatic1[8]->SetText("");
pStatic1[9]->SetText("");
}
}
VD_BOOL CPageBasicConfigFrameWork::MsgProc( uint msg, uint wpa, uint lpa )
{
u8 lock_flag = 0;//cw_shutdown
GetSystemLockStatus(&lock_flag);
if(lock_flag)
{
return FALSE;
}
int px,py;
switch(msg)
{
case XM_RBUTTONDOWN:
case XM_RBUTTONDBLCLK:
{
if(m_IsLoader)
{
return TRUE;
}
} break;
case XM_KEYDOWN://cw_panel
switch(wpa)
{
case KEY_RIGHT:
case KEY_LEFT:
case KEY_UP:
case KEY_DOWN:
{
CPage::MsgProc(msg, wpa, lpa);
static CItem* last = NULL;
CItem* temp = GetFocusItem();//cw_panel
if(pEdit0[1]->IsPadOpen() || pEdit0[0]->IsPadOpen())
{
break;
}
if(temp != last)
{
if(temp == pEdit0[1])
{
SetInfo("&CfgPtn.MaxScope");
}
else if(temp == pComboBox0[0])
{
SetInfo("&CfgPtn.ChangeVideoFormat");
}
else if(temp == pComboBox0[2])
{
SetInfo("&CfgPtn.ChangeOutput");
}
else if(temp == pComboBox0[3])
{
if(pComboBox0[3]->isListExist && !pComboBox0[2]->isListExist)
{
//SetInfo("&CfgPtn.ChangeLanguage");
}
else
{
SetInfo("&CfgPtn.ChangeLanguage");
}
}
else
{
ClearInfo();
}
last = temp;
}
return TRUE;
}
default:break;
}
case XM_MOUSEMOVE:
{
static CItem* last = NULL;
/*
px = VD_HIWORD(lpa);
py = VD_LOWORD(lpa);
CItem* temp = GetItemAt(px, py);
*/
CItem* temp = GetFocusItem();//cw_panel
if(pEdit0[1]->IsPadOpen() || pEdit0[0]->IsPadOpen())
{
break;
}
if(temp != last)
{
if(temp == pEdit0[1])
{
SetInfo("&CfgPtn.MaxScope");
}
else if(temp == pComboBox0[0])
{
SetInfo("&CfgPtn.ChangeVideoFormat");
}
else if(temp == pComboBox0[2])
{
SetInfo("&CfgPtn.ChangeOutput");
}
else if(temp == pComboBox0[3])
{
if(pComboBox0[3]->isListExist && !pComboBox0[2]->isListExist)
{
//SetInfo("&CfgPtn.ChangeLanguage");
}
else
{
SetInfo("&CfgPtn.ChangeLanguage");
}
}
else if(temp == pDateTime1[1])
{
nEdittingTime = 1;
}
else
{
ClearInfo();
nEdittingTime = 0;
}
last = temp;
}
}
break;
default:
break;
}
return CPage::MsgProc(msg, wpa, lpa);
}
VD_BOOL CPageBasicConfigFrameWork::Open()
{
//WaitForSem();
VD_BOOL ret = CPage::Open();
//ReleaseSem();
return ret;
}
|
302133d91cb281ccef385fc1e22e502be5edf7a0 | 7a8fc83af8c296c202776f408b4f8461e42b37cc | /CODE/MovieDatabase/MovieDatabase/Database.cpp | 2132fae8442315b0e9ac3575738d70b0b467c130 | [] | no_license | N0681800/SDI2Coursework | 228ed6b237db91b3d0601fb3e4ecdc17719735a8 | 1706eb58ec8549d0b2a933b4faff2a292fd32452 | refs/heads/master | 2021-04-27T18:53:45.303425 | 2018-04-25T20:59:16 | 2018-04-25T20:59:16 | 122,342,667 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,618 | cpp | Database.cpp | #include "Database.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <map>
#include <sstream>
#include "Library.h"
#include "Templates.cpp"
Database::Database(string filmPath_, string ccPath_,string matPath_, int Max)
{
filmPath = filmPath_;
ccPath = ccPath_;
matPath = matPath_;
FilmSetup(Max);
getchar();
MaterialSetup(Max);
//CastCrewSetup(Max);
createNewTree("TITLE");
}
Database::~Database()
{
SaveData();
}
void Database::FilmSetup(int MAX)
{
string Line;
ifstream FromFile(filmPath);
if (FromFile.is_open()) cout << "\nFile sucessfully Loaded!\n" << endl;
while (getline(FromFile, Line))
{
Storage.push_back(Film(Line));
if (Storage.size() == MAX) break;
}
cout << "\n"<< Storage.size() << " Films Loaded.\n" << endl;
}
void Database::MaterialSetup(int MAX)
{
string Line;
ifstream MaterialFile(matPath);
if (MaterialFile.is_open()) cout << "\Materials sucessfully Loaded!\n" << endl;
int n = 0;
while(getline(MaterialFile, Line))
{
vector<string> MaterialLine = AddTokens(Line, '|');
try {
Film* Pointer;
if (!(Pointer = (Find(MaterialLine[0], &Storage))))
{
throw(50);
}
else
{
for (vector<string>::iterator i = MaterialLine.begin() + 1; i != MaterialLine.end(); i++)
{
Pointer->Materials.push_back(Film::Material(*i));
n++;
}
}
}
catch (int a)
{
continue;//Film does not exist skip over it
}
}
cout << "\n" << n << " Materials Loaded.\n" << endl;
}
void Database::PrintResults(string Order)//Prints out details of a number of films
{
const int MaxTitleLength = 35;
const int MaxGenreLength = 20;
const int MaxMaterialLength = 15;
char Border = 179;
cout << setw(6) << left << "ID" << Border;
cout << setw(MaxTitleLength + 3) << left << "Title" << Border;
cout << setw(MaxGenreLength + 6) << left << "Genres" << Border;
cout << setw(10) << left << "Released" << Border;
cout << setw(10) << left << "Runtime" << Border;
cout << setw(18) << left << "Box Office Sales" << Border;
cout << setw(12) << left << "Status" << Border;
cout << setw(MaxMaterialLength + 3) << left << "Avalible Materials" << Border << endl;
PrintTable();
CURRENT_SORT_TYPE = Order;
Tree.printTree(Order);
}
void Database::Search(string SearchField, string Query,char Order)//Searchs field for a value
{
if (SearchField == "TITLE" || SearchField == "GENRE" || SearchField == "PRODCOMP" || SearchField == "LANGUAGES" || SearchField == "LOCATIONS")
{
map<string, string> SearchFields;
for (vector<Film>::iterator i = Storage.begin(); i != Storage.end(); i++)
{
SearchFields["TITLE"] = i->Title;
SearchFields["GENRE"] = VectorAsString(i->Genres); SearchFields["PRODCOMP"] = VectorAsString(i->ProdComps);
SearchFields["LOCATIONS"] = VectorAsString(i->Locations); SearchFields["LANGUAGES"] = VectorAsString(i->Languages);
if ((ToLower(SearchFields[SearchField])).find(ToLower(Query)) != string::npos)
{
Results.push_back(&*i);
}
}
PrintResultsVector();
cout << "\n\nHere are the search results for: " << Query << "in" << SearchField << endl;
}
else if (SearchField == "REVENUE" || SearchField == "RUNTIME" || SearchField == "RELEASED")
{
map<string, int> SearchFields;
for (vector<Film>::iterator i = Storage.begin(); i != Storage.end(); i++)
{
SearchFields["REVENUE"] = i->Revenue; SearchFields["RUNTIME"] = i->Runtime; SearchFields["RELEASED"] = i->ReleaseDate;
if (Order == '>')
{
if (SearchFields[SearchField] >= stoi(Query))
{
Results.push_back(&*i);
}
}
else
{
if (SearchFields[SearchField] <= stoi(Query))
{
Results.push_back(&*i);
}
}
}
PrintResultsVector();
cout << "\n\nHere are the search results for: " << SearchField << " " << Order << " " << Query << endl;
}
else //Sort by status
{
for (vector<Film>::iterator i = Storage.begin(); i != Storage.end(); i++)
{
if (i->Status == stoi(Query))
{
Results.push_back(&*i);
}
}
PrintResultsVector();
if (Query == "0") cout << "\n\nHere are the search results for status: Released"<< endl;
else if (Query == "1") cout << "\n\nHere are the search results for status: Now Playing" << endl;
else cout << "\n\nHere are the search results for status: Unreleased" << endl;
}
}
void Database::PrintResultsVector()
{
const int MaxTitleLength = 35;
const int MaxGenreLength = 20;
const int MaxMaterialLength = 15;
char Border = 179;
cout << setw(6) << left << "ID" << Border;
cout << setw(MaxTitleLength + 3) << left << "Title" << Border;
cout << setw(MaxGenreLength + 6) << left << "Genres" << Border;
cout << setw(10) << left << "Released" << Border;
cout << setw(10) << left << "Runtime" << Border;
cout << setw(18) << left << "Box Office Sales" << Border;
cout << setw(12) << left << "Status" << Border;
cout << setw(MaxMaterialLength + 3) << left << "Avalible Materials" << Border << endl;
PrintTable();
for (vector<Film*>::iterator i = Results.begin(); i != Results.end(); i++)
{
(*i)->Details();
}
}
string Database::GenerateID()
{
string ID, Line, CurrentID;
ifstream File; File.open("Database.txt");
bool IDFound = false;
int i = 2;
while (!IDFound)
{
ID = to_string(i);
while (ID.length() < 6) { ID = "0" + ID; }
getline(File, Line); stringstream IDToken(Line); getline(IDToken, CurrentID, '|');
if (CurrentID == ID) i++;
else IDFound = true;
}
return ID;
}
bool Database::SaveData()
{
bool Saved = false;
ofstream outFile("Database.txt");
ofstream MaterialoutFile("Materials.txt");
for (vector<Film>::const_iterator i = Storage.begin(); i != Storage.end(); i++)
{
Film Temp = *i;
outFile << Temp.Save() << endl;
MaterialoutFile << Temp.SaveMaterials() << endl;;
}
outFile.flush();
MaterialoutFile.flush();
Saved = true;
MaterialoutFile.close();
outFile.close();
return Saved;
}
void Database::createNewTree(string SortBy)
{
for (vector<Film>::iterator i = Storage.begin(); i != Storage.end(); i++)
{
CURRENT_SORT = SortBy;
//CURRENT_SORT_TYPE
Tree.Insert(&*i, SortBy);
}
}
Database::BinaryTree::BinaryTree()
{
Root = NULL;
}
void Database::BinaryTree::Insert(Film *toAdd, string toSort)
{
if (!Root)
{
Root = new TreeNode;
Root->Left = NULL;
Root->Right = NULL;
Root->FilmInfo = toAdd;
}
else
{
if (toSort == "REVENUE" || toSort == "RUNTIME" || toSort == "STATUS" || toSort == "RELEASEDATE")
{
insertInt(Root, toAdd, toSort);
}
else
{
insertString(Root, toAdd, toSort);
}
}
}
void Database::BinaryTree::insertInt(TreeNode *Node, Film *toAdd, string toSort)
{
struct intPtr
{
int *Value;
int *Node;
};
map<string, intPtr> Comparison;
Comparison["REVENUE"] = { &toAdd->Revenue,&Node->FilmInfo->Revenue };
Comparison["RUNTIME"] = { &toAdd->Runtime,&Node->FilmInfo->Runtime };
Comparison["STATUS"] = { &toAdd->Status,&Node->FilmInfo->Status };
Comparison["RELEASEDATE"] = { &toAdd->ReleaseDate,&Node->FilmInfo->ReleaseDate };
if (*Comparison[toSort].Value < *Comparison[toSort].Node)
{
if (!(Node->Left))
{
Node->Left = new TreeNode;
Node->Left->Left = NULL;
Node->Left->Right = NULL;
Node->Left->FilmInfo = toAdd;
}
else
{
insertInt(Node->Left, toAdd, toSort);
}
}
else if (*Comparison[toSort].Value > *Comparison[toSort].Node)
{
if (!(Node->Right))
{
Node->Right = new TreeNode;
Node->Right->Left = NULL;
Node->Right->Right = NULL;
Node->Right->FilmInfo = toAdd;
}
else
{
insertInt(Node->Right, toAdd, toSort);
}
}
else //Values Same, Defualt to Alphabeitcal Sort
{
//insertString(Node, toAdd, "TITLE");
if (ToLower(*&toAdd->Title) < ToLower(*&Node->FilmInfo->Title))
{
if (!(Node->Left))
{
Node->Left = new TreeNode;
Node->Left->Left = NULL;
Node->Left->Right = NULL;
Node->Left->FilmInfo = toAdd;
}
else
{
insertInt(Node->Left, toAdd, toSort);
}
}
else if (ToLower(*&toAdd->Title) > ToLower(*&Node->FilmInfo->Title))
{
if (!(Node->Right))
{
Node->Right = new TreeNode;
Node->Right->Left = NULL;
Node->Right->Right = NULL;
Node->Right->FilmInfo = toAdd;
}
else
{
insertInt(Node->Right, toAdd, toSort);
}
}
}
}
void Database::BinaryTree::insertString(TreeNode *Node, Film *toAdd, string toSort)
{
struct strPtr
{
string *Value;
string *Node;
};
map<string, strPtr> Comparison;
Comparison["ID"] = { &toAdd->ID,&Node->FilmInfo->ID };
Comparison["TITLE"] = { &toAdd->Title,&Node->FilmInfo->Title };
//ID,TITLE,ReleaseDate,Revenue,Runtime,Status
if (ToLower(*Comparison[toSort].Value) < ToLower(*Comparison[toSort].Node))
{
if (!(Node->Left))
{
Node->Left = new TreeNode;
Node->Left->Left = NULL;
Node->Left->Right = NULL;
Node->Left->FilmInfo = toAdd;
}
else
{
insertString(Node->Left, toAdd, toSort);
}
}
else if(ToLower(*Comparison[toSort].Value) > ToLower(*Comparison[toSort].Node))
{
if (!(Node->Right))
{
Node->Right = new TreeNode;
Node->Right->Left = NULL;
Node->Right->Right = NULL;
Node->Right->FilmInfo = toAdd;
}
else
{
insertString(Node->Right, toAdd, toSort);
}
}
else //Values Same, Defualt to Alphabeitcal Sort
{
//insertString(Node, toAdd, "TITLE");
if (ToLower(*&toAdd->Title) < ToLower(*&Node->FilmInfo->Title))
{
if (!(Node->Left))
{
Node->Left = new TreeNode;
Node->Left->Left = NULL;
Node->Left->Right = NULL;
Node->Left->FilmInfo = toAdd;
}
else
{
insertString(Node->Left, toAdd, toSort);
}
}
else if (ToLower(*&toAdd->Title) > ToLower(*&Node->FilmInfo->Title))
{
if (!(Node->Right))
{
Node->Right = new TreeNode;
Node->Right->Left = NULL;
Node->Right->Right = NULL;
Node->Right->FilmInfo = toAdd;
}
else
{
insertString(Node->Right, toAdd, toSort);
}
}
}
}
/*
void Database::BinaryTree::SearchFilm(string toSearch, string Find)
{
//SearchTree(Root, toSearch, Find);
}
void Database::BinaryTree::SearchTree(TreeNode* Node, string toSearch, int toFind, char Parameter)
{
if (!Node)
{
return;
}
if (Parameter == '<')//LEss than
{
if (toFind < Node->FilmInfo->Revenue)
{
//add to results
SearchTree(Node->Left, toSearch, toFind, Parameter);
}
}
else //Greater than
{
}
//Search["ID"] = { &Node->FilmInfo->ID };
//Search["TITLE"] = { &Node->FilmInfo->Title };
//Search["GENRE"] = { &Node->FilmInfo->Genres };
//Search["PRODCOMP"] = { &Node->FilmInfo->ProdComps };
//Search["LANGUAGES"] = { &Node->FilmInfo->Languages };
//Search["STATUS"] = { &Node->FilmInfo->Status };
//string hello = (Node->FilmInfo->ReleaseDate);
//int hi = stoi(Node->FilmInfo->ReleaseDate);
//int* hey = &int(stoi(Node->FilmInfo->ReleaseDate));
//Search["RELEASED"] = { stoi(Node->FilmInfo->ReleaseDate) };
struct intPtr
{
int* value;
int* Left;
int* Right;
};
map<string, intPtr*> Search;
Film Tempy = **&Node->FilmInfo;
intPtr Rev;
Rev.value = &Node->FilmInfo->Revenue;
Rev.Left = &Node->Left->FilmInfo->Revenue;
Search["REVENUE"] = { &Node->FilmInfo->Revenue,&Node->Left->FilmInfo->Revenue,&Node->Right->FilmInfo->Revenue };
Search["RUNTIME"] = { &Node->FilmInfo->Runtime };
//Search["REVENUE"] = { &Tempy.Revenue };
//Search["RUNTIME"] = { &Tempy.Runtime };
if (Search[toSearch] > &toFind)
{
Results.push_back((Node->FilmInfo));
}
if (Search[toSearch] >= toFind))
{
if (Node->Left)
{
SearchTree(Node->Left, toSearch, toFind);
}
}
else
{
if (Node->Right)
{
SearchTree(Node->Right, toSearch, toFind);
}
}
}
*/
void Database::BinaryTree::printTree(string Order)
{
Print(Root,Order);
}
void Database::BinaryTree::Print(TreeNode *Node,string Order)
{
if (!Node)
{
return;
}
if (Order == "ASC")
{
Print(Node->Left,Order);
Node->FilmInfo->Details();
Print(Node->Right,Order);
}
else
{
Print(Node->Right, Order);
Node->FilmInfo->Details();
Print(Node->Left, Order);
}
}
int Database::BinaryTree::getSize()
{
return Size(Root);
}
int Database::BinaryTree::Size(TreeNode* Node)
{
if (!Node)
{
return 0;
}
else
{
int tree_size = Size(Node->Left) + Size(Node->Right) + 1;
return tree_size;
}
}
void Database::BinaryTree::Delete()
{
DeleteNode(Root);
}
void Database::BinaryTree::DeleteNode(TreeNode *Node)
{
if (Node)
{
DeleteNode(Node->Left);
DeleteNode(Node->Right);
if (Node != Root) delete Node;
else
{
Root = NULL;
}
}
}
/*
void Database::CastCrewSetup(int MAX)
{
string Line;
ifstream CastFile(ccPath);
getline(CastFile, Line);
cout << Line << endl;
string TokenizedData, TempData[3]; int i = 0;
stringstream LineOfData(Line);
while (getline(LineOfData, TokenizedData, '|')) //getting data
{
cout << TokenizedData << endl;
TempData[i] = TokenizedData; //Store data in temp array
i++;
}
bool isCast = true;
stringstream Actors(TempData[1]); string Actor, ActorInfo[5];
while (getline(Actors, Actor, '/')) //getting data
{
stringstream ActorInfoStream(Actor);
int j = 0;
while (getline(ActorInfoStream, ActorInfo[j], '\,'))
{
cout << ActorInfo[j] << endl;
j++;
}
//Check info
if (!ccExists(ActorInfo[2], isCast)) CastCrew Temp(ActorInfo[2], ActorInfo[3], GetGender(ActorInfo[1]), isCast);
}
//role,gender,id,name
}
string Database::GetFilmTitle(string FilmID)
{
string Title;
for (vector<Film>::const_iterator i = Storage.begin(); i != Storage.end(); i++)
{
Film Temp = *i;
if (Temp.ID == FilmID)
{
Title = Temp.Title; break;
}
}
return Title;
}
*/ |
a28a223a0cf174f6c583340ab4e6977c0706cb36 | 39eac74fa6a244d15a01873623d05f480f45e079 | /ReasonDlg.cpp | 69b84f67a13f05e965095b4f5f258e96e7c5f6e3 | [] | no_license | 15831944/Practice | a8ac8416b32df82395bb1a4b000b35a0326c0897 | ae2cde9c8f2fb6ab63bd7d8cd58701bd3513ec94 | refs/heads/master | 2021-06-15T12:10:18.730367 | 2016-11-30T15:13:53 | 2016-11-30T15:13:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,824 | cpp | ReasonDlg.cpp | // CancelApptDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ReasonDlg.h"
#include "NxStandard.h"
#include "EditComboBox.h"
#include "InternationalUtils.h"
#include "DateTimeUtils.h"
#include "CommonSchedUtils.h"
#include "GlobalSchedUtils.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace NXDATALISTLib;
/////////////////////////////////////////////////////////////////////////////
// CReasonDlg dialog
using namespace ADODB;
CReasonDlg::CReasonDlg(CWnd* pParent)
: CNxDialog(CReasonDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReasonDlg)
m_strText = _T("");
m_strReason = _T("");
//}}AFX_DATA_INIT
//DRT 4/12/2004 - Sometimes this dialog is not opened (cut/paste an appt, say yes to cancel). In
// that case, this needs to be set!
m_nIsChecked = 1;
m_bNoShow = false;
}
void CReasonDlg::DoDataExchange(CDataExchange* pDX)
{
CNxDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReasonDlg)
DDX_Control(pDX, IDC_CUSTOM_REASON, m_customReason);
DDX_Text(pDX, IDC_REASON_TEXT, m_strText);
DDX_Text(pDX, IDC_CUSTOM_REASON_EDIT, m_strReason);
DDX_Control(pDX, IDC_CUSTOM_REASON_EDIT, m_nxeditCustomReasonEdit);
DDX_Control(pDX, IDC_REASON_PATIENT, m_nxeditReasonPatient);
DDX_Control(pDX, IDC_REASON_START_TIME, m_nxeditReasonStartTime);
DDX_Control(pDX, IDC_REASON_END_TIME, m_nxeditReasonEndTime);
DDX_Control(pDX, IDC_REASON_DATE, m_nxeditReasonDate);
DDX_Control(pDX, IDC_REASON_TEXT, m_nxeditReasonText);
DDX_Control(pDX, IDC_REASON_TYPE, m_nxeditReasonType);
DDX_Control(pDX, IDC_REASON_PURPOSE, m_nxeditReasonPurpose);
DDX_Control(pDX, IDC_REASON_CAPTION, m_nxstaticReasonCaption);
DDX_Control(pDX, IDOK, m_btnOK);
DDX_Control(pDX, IDCANCEL, m_btnCancel);
DDX_Control(pDX, IDC_EDIT_REASON_COMBO, m_btnReasonCombo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReasonDlg, CNxDialog)
//{{AFX_MSG_MAP(CReasonDlg)
ON_BN_CLICKED(IDC_CUSTOM_REASON, OnCustomReason)
ON_BN_CLICKED(IDC_EDIT_REASON_COMBO, OnEditReasonCombo)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReasonDlg message handlers
BOOL CReasonDlg::OnInitDialog()
{
CNxDialog::OnInitDialog();
// (d.singleton 2011-10-12 12:10) - PLID cashe properties
g_propManager.CachePropertiesInBulk("CReasonDlg", propNumber,
"(Username = '<None>' OR Username = '%s') AND Name IN ( \r\n"
" 'ApptCancellationReason' \r\n" // (d.singleton 2011-10-12 12:12) - PLID 25956 add pref for canacellation reason
")"
, _Q(GetCurrentUserName()));
// (d.singleton 2011-12-28 10:34) - PLID 47110 store prop value in mem variable
m_bReqReason = GetRemotePropertyInt("ApptCancellationReason", 0, 0, "<None>", true);
// (c.haag 2008-04-24 15:17) - PLID 29776 - NxIconized the buttons
m_btnOK.AutoSet(NXB_OK);
m_btnCancel.AutoSet(NXB_CANCEL);
m_ReasonCombo = BindNxDataListCtrl(IDC_REASON_COMBO,false);
// (a.walling 2014-12-22 10:05) - PLID 64366
m_bReschedule = false;
// (c.haag 2008-06-04 10:37) - PLID 29882 - Create the back brush
if(m_bNoShow) {
m_ReasonCombo->FromClause = _bstr_t("AptNoShowReasonT");
SetDlgItemText(IDC_REASON_CAPTION, "Reason for marking as No Show");
SetWindowText("No Show Appointment");
}
else {
m_ReasonCombo->FromClause = _bstr_t("AptCancelReasonT");
SetDlgItemText(IDC_REASON_CAPTION, "Reason for cancelling appointment");
SetWindowText("Cancel Appointment");
}
m_ReasonCombo->Requery();
m_ReasonCombo->WaitForRequery(dlPatienceLevelWaitIndefinitely);
IRowSettingsPtr pRow;
pRow = m_ReasonCombo->GetRow(-1);
pRow->PutValue(0,(long)-1);
pRow->PutValue(1,"<No Item Selected>");
m_ReasonCombo->InsertRow(pRow, 0);
//Set the text on screen.
_RecordsetPtr rsAppointment = CreateRecordset("SELECT PersonT.Last + ', ' + PersonT.First + ' ' + PersonT.Middle AS Name, "
"AptTypeT.Name AS Type, dbo.GetPurposeString(AppointmentsT.ID) AS Purpose, AppointmentsT.Date, AppointmentsT.StartTime, AppointmentsT.EndTime "
"FROM AppointmentsT LEFT JOIN AptTypeT ON AppointmentsT.AptTypeID = AptTypeT.ID LEFT JOIN PersonT ON "
"AppointmentsT.PatientID = PersonT.ID WHERE AppointmentsT.ID = %li", m_nApptID);
if(rsAppointment->eof) {
//Yikes!
ASSERT(FALSE);
CNxDialog::OnCancel();
}
SetDlgItemText(IDC_REASON_PATIENT, AdoFldString(rsAppointment, "Name", ""));
SetDlgItemText(IDC_REASON_TYPE, AdoFldString(rsAppointment, "Type", "<None>"));
SetDlgItemText(IDC_REASON_PURPOSE, AdoFldString(rsAppointment, "Purpose", "<None>"));
SetDlgItemText(IDC_REASON_DATE, FormatDateTimeForInterface(AdoFldDateTime(rsAppointment, "Date"), 0, dtoDate, true));
SetDlgItemText(IDC_REASON_START_TIME, FormatDateTimeForInterface(AdoFldDateTime(rsAppointment, "StartTime"), DTF_STRIP_SECONDS, dtoTime, true));
SetDlgItemText(IDC_REASON_END_TIME, FormatDateTimeForInterface(AdoFldDateTime(rsAppointment, "EndTime"), DTF_STRIP_SECONDS, dtoTime, true));
m_nIsChecked = m_customReason.GetCheck();
// (a.walling 2014-12-22 10:05) - PLID 64366 - reschedule checkbox should be red
SafeGetDlgItem<NxButton>(IDC_CHECK_RESCHEDULE)->SetTextColor(HEXRGB(0x800000));
// (a.walling 2015-02-04 09:12) - PLID 64412 - hide checkbox to add to rescheduling queue
if (m_bDisableReschedulingQueue) {
auto pCheck = GetDlgItem(IDC_CHECK_RESCHEDULE);
pCheck->ShowWindow(SW_HIDE);
pCheck->EnableWindow(FALSE);
}
return FALSE;
}
void CReasonDlg::OnCustomReason()
{
// (d.singleton 2011-09-28 16:40) - PLID 39952 - add permission to add regular and custom cancellation reasons
if(CheckCurrentUserPermissions(bioCancellationReasons, sptWrite, FALSE, 0, FALSE, TRUE))
{
// (a.walling 2014-12-22 10:05) - PLID 64366 - Move the reschedule checkbox when toggling custom reason edit box
CRect rcEdit;
GetDlgItem(IDC_CUSTOM_REASON_EDIT)->GetWindowRect(&rcEdit);
ScreenToClient(&rcEdit);
CRect rcCheck;
auto* pCheckWnd = GetDlgItem(IDC_CHECK_RESCHEDULE);
pCheckWnd->GetWindowRect(&rcCheck);
ScreenToClient(&rcCheck);
auto checkHeight = rcCheck.Height();
if (m_customReason.GetCheck()) {
rcCheck.top = rcEdit.bottom + 1;
rcCheck.bottom = rcCheck.top + checkHeight;
}
else {
rcCheck.bottom = rcEdit.bottom - 1;
rcCheck.top = rcCheck.bottom - checkHeight;
}
pCheckWnd->MoveWindow(rcCheck);
//Check Show Window functions
if (m_customReason.GetCheck()) {
GetDlgItem(IDC_REASON_COMBO)->ShowWindow(false);
GetDlgItem(IDC_EDIT_REASON_COMBO)->ShowWindow(false);
GetDlgItem(IDC_CUSTOM_REASON_EDIT)->ShowWindow(true);
}
else {
GetDlgItem(IDC_REASON_COMBO)->ShowWindow(true);
GetDlgItem(IDC_EDIT_REASON_COMBO)->ShowWindow(true);
GetDlgItem(IDC_CUSTOM_REASON_EDIT)->ShowWindow(false);
}
m_nIsChecked = m_customReason.GetCheck();
}
else
{
m_customReason.SetCheck(0);
}
}
void CReasonDlg::EditCustomList(_DNxDataListPtr &list, long listID)
{
//I copied this function from custom1dlg.cpp and then made some changes to it
//BVB - this crashed without a selection,
//also duplicating this code 6 times is not acceptable
_bstr_t value;
long curSel;
//save the current value
curSel = list->CurSel;
if (curSel != -1)
value = list->Value[curSel][1];
// CH 3/1: Even though it doesnt LOOK like you added
// it to the list with this conditional, it still doesnt work!!
// (j.armen 2012-06-06 15:51) - PLID 49856 - Refactored CEditComboBox
if (IDOK == CEditComboBox(this, listID, list, "Edit Combo Box").DoModal())
{
IRowSettingsPtr pRow;
pRow = list->GetRow(-1);
_variant_t var;
var.vt = VT_NULL;
// (d.singleton 2011-11-08 17:57) - PLID 25956 - had to change the below line to assign value of -1, this is the value assigned OnInit and im checking for this value OnOK
pRow->PutValue(0,(long)-1);
pRow->PutValue(1,"<No Item Selected>");
list->InsertRow(pRow,0);
//try and set the combo to the old value
if (curSel != -1)
list->SetSelByColumn(1, value);
}
else {
//DRT 7/25/02
//if we cancel the dialog, it requeries the list (because changes are made whether you hit ok or cancel)
//so the list will have no selection.
list->SetSelByColumn(1, value);
}
}
void CReasonDlg::OnEditReasonCombo()
{
// (d.singleton 2011-09-28 16:40) - PLID 39952 - add permission to add regular and custom cancellation reasons
if(CheckCurrentUserPermissions(bioCancellationReasons, sptWrite, FALSE, 0, FALSE, TRUE)){
if(m_bNoShow) {
EditCustomList(m_ReasonCombo, 13); //NO_SHOW_REASON_COMBO
}
else {
EditCustomList(m_ReasonCombo, 12); //CANCEL_REASON_COMBO
}
}
}
void CReasonDlg::OnOK()
{
try {
// (d.singleton 2011-12-27 08:57) - PLID 47110 - changed to check mem variable for preference state since i now fill that in OnInit
if (m_bReqReason)
{
// (d.singleton 2011-11-14 17:42) - PLID 25956 added this check to make sure im not calling GetRow() on a row that doesnt exist and returns -1, if its a custom reason this check doesnt matter
if(m_ReasonCombo->GetCurSel() != -1 || IsCustomReason())
{
IRowSettingsPtr pReasonRow = m_ReasonCombo->GetRow(m_ReasonCombo->GetCurSel());
// (d.singleton 2011-10-12 12:12) - PLID 25956 add pref to require canacellation reason
if(IsCustomReason())
{
CString strDlgText;
GetDlgItemText(IDC_CUSTOM_REASON_EDIT, strDlgText);
if(strDlgText.Trim().CompareNoCase("") == 0)
{
AfxMessageBox("Please enter a reason before saving");
return;
}
}
// (d.singleton 2011-11-08 17:56) - PLID 25956 - check for empty or null rows
else if(pReasonRow->GetValue(0).vt != VT_EMPTY && pReasonRow->GetValue(0).vt != VT_NULL)
{
// (d.singleton 2011-11-08 17:58) - PLID check for value of <no item selected>
if(VarLong(pReasonRow->GetValue(0)) == -1)
{
AfxMessageBox("Please enter a reason before saving");
return;
}
}
else
{
AfxMessageBox("Please enter a reason before saving");
return;
}
}
else
{
AfxMessageBox("Please enter a reason before saving");
return;
}
}
// (a.walling 2014-12-22 10:05) - PLID 64366 - update m_bReschedule flag
// (a.walling 2015-02-04 09:12) - PLID 64412 - hide checkbox to add to rescheduling queue
m_bReschedule = !m_bDisableReschedulingQueue && !!IsDlgButtonChecked(IDC_CHECK_RESCHEDULE);
}NxCatchAll(__FUNCTION__);
CNxDialog::OnOK();
}
void CReasonDlg::OnCancel()
{
CNxDialog::OnCancel();
}
BEGIN_EVENTSINK_MAP(CReasonDlg, CNxDialog)
//{{AFX_EVENTSINK_MAP(CReasonDlg)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
CString CReasonDlg::GetReason(long &ReasonID)
{
if (m_ReasonCombo->CurSel == -1)
{
ReasonID = -1;
return "";
}
//Gets reason ID
ReasonID = VarLong(m_ReasonCombo->GetValue(m_ReasonCombo->CurSel, 0));
//Returns reason
return VarString(m_ReasonCombo->GetValue(m_ReasonCombo->CurSel, 1));
}
Nx::Scheduler::Reason CReasonDlg::GetReason()
{
if (IsCustomReason()) {
return{ -1, m_strReason };
}
else if (m_ReasonCombo->CurSel != -1) {
return{ VarLong(m_ReasonCombo->GetValue(m_ReasonCombo->CurSel, 0)), VarString(m_ReasonCombo->GetValue(m_ReasonCombo->CurSel, 1)) };
}
else {
return{};
}
}
int CReasonDlg::IsCustomReason()
{
return m_nIsChecked;
}
HBRUSH CReasonDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// (c.haag 2008-05-09 15:15) - PLID 29882 - This code will force
// the read-only edit boxes to share the solid background color
// instead of an ugly gray.
switch (pWnd->GetDlgCtrlID()) {
case IDC_REASON_TEXT:
case IDC_REASON_PATIENT:
case IDC_REASON_DATE:
case IDC_REASON_TYPE:
case IDC_REASON_START_TIME:
case IDC_REASON_PURPOSE:
case IDC_REASON_END_TIME:
{
pDC->SetBkColor(GetSolidBackgroundColor());
return (HBRUSH)m_brBackground;
}
default:
HANDLE_GENERIC_TRANSPARENT_CTL_COLOR();
break;
}
}
|
7453ffe57268df3fbc4b15fae484d471a7970bfc | 2f5f72b081e0408c279351d7a5ef60118200e84d | /boost_test_case_expected_failures/test/main.cpp | 4e3491eacea2d32b9d62d67e4e70071f76a03f31 | [] | no_license | czerniecki-wojciech/cmake_magisterka | 2aad80ea918dfba215d0f188beed104f6c9bc898 | 752da71ddbe5b7a454ac462d4ec5d22294929afe | refs/heads/master | 2021-01-19T11:11:51.707467 | 2016-07-22T21:07:20 | 2016-07-22T21:07:20 | 60,837,229 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 438 | cpp | main.cpp | #define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE example
#include <boost/test/unit_test.hpp>
//definicja grupy testow
BOOST_AUTO_TEST_SUITE(testSuite1)
//zdefiniowanie maksymalnej liczny niepowodzen w tescie
BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_case1, 1);
//definicja testu
BOOST_AUTO_TEST_CASE(test_case1)
{
BOOST_CHECK(true == false);
BOOST_CHECK(2 == 2);
}
//koniec definicji grupy testow
BOOST_AUTO_TEST_SUITE_END()
|
40557cd9353e4674d536bdb03f8e2e4b012b7d4f | 323803788a843d35bb81c2b5377477f6b0f09e73 | /nnnEdit/programview.cpp | 33386858a7429c5f782745079bfe002549bf6ce5 | [] | no_license | tinyan/SystemNNN_Editor | 138384493986eb11714871237a4b31f28ddc342d | c8e9f5cf51b152817d855f6c01bc95465c2c5aa8 | refs/heads/master | 2023-03-04T18:22:47.794068 | 2023-02-26T10:51:03 | 2023-02-26T10:51:03 | 38,660,049 | 5 | 2 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,621 | cpp | programview.cpp | //
// programview.cpp
//
#include <windows.h>
#include <stdio.h>
#include "resource.h"
#include "..\..\systemNNN\nyanLib\include\commonmacro.h"
//#include "mydirectx.h"
#include "windowlist.h"
#include "case.h"
#include "messageData.h"
#include "myapplicationBase.h"
#include "programdoc.h"
#include "programview.h"
#include "commanddatatype.h"
#include "storydata.h"
#include "commanddata.h"
#include "bitmapnumber.h"
#include "mybutton.h"
CProgramView::CProgramView(CMyDocument* pDocument,HWND clientHWND,HINSTANCE hinstance) : CMyScrollView(pDocument, clientHWND, hinstance)
{
SetMyViewWindowName("programWindow");
SetResizeFlag();
SetBlockSize(512,512);
SetBlockKosuuMin(1,1);
SetBlockKosuuMax(1,1);
SetNonBlockArea(0,24,0,0);
SetFreeSizeFlag(0);
SetFreeSizeFlag(1);
// SetScrollFlag(FALSE,FALSE);
SetWindowStyle();
SetViewWindowText("Program");
// LONG style = GetWindowLong(m_hWnd,GWL_STYLE);
// style &= ~(WS_MINIMIZEBOX | WS_SIZEBOX);
/// style |= WS_VSCROLL;
// SetWindowLong(m_hWnd,GWL_STYLE,style);
// m_buttonEdit = new CMyButton(0,m_hWnd,m_document->GetCommonBitmap(BITMAPNUMBER_EDIT),0,0);
ReCalcuScrollPara();
}
CProgramView::~CProgramView()
{
End();
}
void CProgramView::End(void)
{
// ENDDELETECLASS(m_buttonEdit);
}
LRESULT CProgramView::ViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
// int x,y;
CProgramDoc* pDoc = (CProgramDoc*)m_document;
switch (message)
{
case WM_CLOSE:
Show(FALSE);
// m_document->OnClose();
//hide window
return 0;
break;
// case WM_RBUTTONDOWN:
// pDoc->OnEditText(-1);
// break;
case WM_LBUTTONDOWN:
// if (m_buttonEdit != NULL) m_buttonEdit->CalcuLButtonDown(wParam,lParam);
break;
case WM_COMMAND:
switch (wParam)
{
case ID_USER_LBUTTONDOWN:
switch (lParam)
{
case 0:
pDoc->OnEditText(-1);
break;
}
break;
}
break;
case WM_ERASEBKGND:
EraseSplit((HDC)wParam);
return TRUE;
break;
case WM_PAINT:
PAINTSTRUCT ps;
BeginPaint(hWnd,&ps);
// RECT tmpRect;
// RECT rc;
//ps.rcPaintとくらべてかきなおす IntersectRect IntersectClipRect
HDC hdc = ps.hdc;
HDC src = CreateCompatibleDC(hdc);
// if (m_buttonEdit != NULL) m_buttonEdit->Print(hdc,src,0,&ps.rcPaint);
// HGDIOBJ old;
// static char m1[] = "アルメリア好意度+=1;";
// static char m2[] = "絵里花触角取れる=0;";
// static char m3[] = "はらぽんこわれた=1;";
// TextOut(hdc,0,0,m1,strlen(m1));
// TextOut(hdc,0,24,m2,strlen(m2));
// TextOut(hdc,0,48,m3,strlen(m3));
RECT rc;
SetRect(&rc,0,24,320,24*15);
CStoryData* pStory = m_document->GetNowSelectStory();
if (pStory != NULL)
{
CCommandData* pCommand = (CCommandData*)(pStory->GetNowSelectObject());
if (pCommand != NULL)
{
int typ = pCommand->GetCommandType();
LPSTR mes = pCommand->GetTextBuffer();
//dummy
switch (typ)
{
case COMMANDDATATYPE_NOP:
DrawText(hdc,"【nop】",-1,&rc,0);
break;
case COMMANDDATATYPE_IF:
case COMMANDDATATYPE_ELSIF:
case COMMANDDATATYPE_SELECT:
case COMMANDDATATYPE_STORY:
case COMMANDDATATYPE_FILM:
case COMMANDDATATYPE_CALCU:
case COMMANDDATATYPE_SCRIPT:
if (mes != NULL)
{
DrawText(hdc,mes,-1,&rc,DT_NOPREFIX);
}
else
{
DrawText(hdc,"ERROR!",-1,&rc,0);
}
break;
case COMMANDDATATYPE_ELSE:
DrawText(hdc,"【else】",-1,&rc,0);
break;
case COMMANDDATATYPE_BGM:
DrawText(hdc,"BGM",-1,&rc,0);
break;
case COMMANDDATATYPE_BGM_CD:
DrawText(hdc,"BGM",-1,&rc,0);
break;
case COMMANDDATATYPE_SYSTEM:
DrawText(hdc,"SYSTEM",-1,&rc,0);
break;
case COMMANDDATATYPE_RET:
DrawText(hdc,"【ret】",-1,&rc,0);
break;
case COMMANDDATATYPE_NEXT:
DrawText(hdc,"【next】",-1,&rc,0);
break;
case COMMANDDATATYPE_END:
DrawText(hdc,"【end】",-1,&rc,0);
break;
}
// DrawText(hdc,"アルメリア好意度+=1;\n絵里花触角取れる=0;そしてこれはながーーーーーーーーーーーーぎょう\nはらぽんこわれた=1;",-1,&rc,0);
}
}
DeleteDC(src);
EndPaint(hWnd,&ps);
return 0;
break;
}
return DefMDIChildProc(hWnd,message,wParam,lParam);
}
BOOL CProgramView::MoveMouse(int x,int y,POINT screenPos)
{
POINT pt;
pt.x = x + m_windowX;
pt.y = y + m_windowY;
int subType = -1;
int type = PROGRAM_WINDOW;
if (subType == -1)
{
type = -1;
}
m_document->GetApp()->OnBalloonArea(type,pt,subType,screenPos);
// OutputDebugString("*moveMouse layer*\x00f\x00a");
return FALSE;
}
/*_*/
|
7297658179cfa64e81197172a39e3d6b34982df4 | 9402813fe21aa43666f139cd4a3104e16ad262e9 | /ch10/MyVector.cpp | aed036faf342cd1ea3cdaf3d6937318a2fc10acc | [] | no_license | kahyunKo/C-plus-plus_class | 90eaf2297d0723bf722d0f316e51021c92f16405 | 78d1fe5f32633ff3b290c4a4181698002d494608 | refs/heads/main | 2023-05-29T08:41:05.909167 | 2021-06-12T06:14:09 | 2021-06-12T06:14:09 | 357,534,868 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 640 | cpp | MyVector.cpp | // p403
#include <iostream>
#include <string>
using namespace std;
class MyVector {
private :
double x, y;
public :
MyVector(double x = 0.0, double y = 0.0) : x{ x }, y{ y } {}
string toString() {
return " ( " + to_string(x) + " , " + to_string(y) + " ) ";
}
MyVector operator+(const MyVector& v2);
};
MyVector MyVector::operator+(const MyVector& v2) {
MyVector v;
v.x = this->x + v2.x;
v.y = this->y + v2.y;
return v;
}
int main() {
MyVector v1(1.0, 2.0), v2(3.0, 4.0);
MyVector v3 = v1 + v2;
cout << v1.toString() << " + " << v2.toString() << " = " << v3.toString() << endl;
return 0;
} |
373799f02a3de060a1fced852dd93a31cf2d27f0 | a9ca50c09adbe6b078701174d3592eab02afaba5 | /updownFish.cpp | 5b9b065abcd301f59efd6d6ce024945519c7157b | [] | no_license | AaronCui/ShortCodingExercises | e110cd72711302431dc2af4a3bcdaa8d324564ab | dbe24fb50984a9cee171336580be219902ad0349 | refs/heads/master | 2020-05-29T12:10:06.280702 | 2016-01-04T05:19:14 | 2016-01-04T05:19:14 | 30,182,543 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,064 | cpp | updownFish.cpp | // https://codility.com/demo/results/demo4EP3DN-RYC/
// Above link shows the question for this solution is for
// As well as a recording of my entire time line of completing the code and failing / passing the tests
//DoubleAce
//Feb2
#include<cstdlib>
#include<iostream>
#include<vector>
#include<stack>
int solution(std::vector<int> &A, std::vector<int> &B) {
std::stack<int> stacky;
int survive = 0;
for (int i = 0; i < B.size(); i++){
if (stacky.empty() && B[i] == 0){
//when top fishes are going up, they live to see another day
survive++;
}
if (B[i] == 1){
//all fishes going down will be considered for fight, until left alone in stacky
stacky.push(A[i]);
}
if (!stacky.empty() && B[i] == 0){
//if fishes looking for fight and one rises up to the wrong neighborhood
while (!stacky.empty() && stacky.top() < A[i]){
//while down fish is losing to up fish
stacky.pop();
//for bottom fish rising to le top
if (stacky.empty()){
survive++;
}
//loop for bottom fish eating up until eaten or finish eatting and survive
}
}
}
// after all the started bottom now we heres are done, check how many happily sinks down forever
survive += stacky.size();
return survive;
}
int main(){
std::cout<< "Testing with [6,5,4,3,2,1],[1,0,0,0,0,0] and [1,2,3,4,5,6],[0,0,0,1,1,1]" <<std::endl;
//hard coded, original code has passed much more extensive testing
int a1t[6] = {6,5,4,3,2,1};
int a2t[6] = {1,0,0,0,0,0};
int b1t[6] = {1,2,3,4,5,6};
int b2t[6] = {0,0,0,1,1,1};
std::vector<int> a1, b1, a2, b2;
for (int i = 0; i <6 ; i++){
a1.push_back(a1t[i]);
b1.push_back(b1t[i]);
a2.push_back(a2t[i]);
b2.push_back(b2t[i]);
}
std::cout<< "result 1 is: " << solution (a1,b1) << std::endl;
std::cout<< "result 2 is: " << solution (a2,b2) << std::endl;
return 0;
} |
74abce75dcd43e4a291b470238d715eca0bfbb95 | feeb50c2bc9b0692c2bd5496798a24542be961d4 | /convert_bwtest/sample1_unittest.h | edf520fa06e82556f73ac0d55032f2a4e526e1e2 | [] | no_license | masterpiece2014/convert_and_bwtest | ad6e1bf51882b700a45a3da59e905ff977097753 | 24ba19e1be85655984ccf86ee7558543c90598f6 | refs/heads/master | 2020-12-26T00:26:36.287679 | 2014-04-27T13:24:14 | 2014-04-27T13:24:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,917 | h | sample1_unittest.h |
#include "bwtest\bwtest.h"
#include "sample1.h"
TEST(sample1, odd_even, 1) {
expect_true(true == isOdd(5)) << "if 5 is not odd, \
hence this expectation failed, \
this line will be put out.";
expect_false(true == isOdd(7)) << "e.g. this line will be put out\
'cause 7 is odd";
expect_eq(true, isOdd(11)) << "this line won't be put out";
expect_nq(true, isOdd(10)) << "either";
}
// step 1 : inherite
class MyCustomTestClass : public bwtest::TestBase
{
// step 2 : define constructor
CONSTRUCT(MyCustomTestClass) {
// you own initialzation actions here
}
// step 3 : overwrite run()
void run() {
put_out << "\n\t====test invoked====\n";
long num = rand() / 10;
expect_eq(myCorrectFactorialFunction(num), factorial(num)) << " wrong factorial"
<< "correct: " << myCorrectFactorialFunction(num)
<< "incrrect:" << factorial(num);
expect_true(isPrime(97)) << 97 << "is not prime";
expect_true(isPrime(2));
expect_true(isPrime(3));
expect_true(isPrime(5));
expect_false(isPrime(1));
expect_false(isPrime(91));
expect_false(isPrime(-1));
expect_false(isPrime(-17));
}
int myCorrectFactorialFunction(long n) {
int result = 1;
for (long i = 1; i <= n; i++) {
result *= i;
}
return result;
}
};
REGISTER(MyCustomTestClass);
TEST(sample1, exceptions, 2) {
put_out << "\n\n===this test will be excuted twice";
expect_throw(throwRangeError(), std::range_error);
expect_throw(throwRangeError(), std::bad_alloc) << "caught no bad_alloc";
expect_throw_any(throwRandomStdExcept());
}
|
5a29e0b373b9f526c2ba09c363ef6eeb30922c67 | 15214308abdd5dd1603d32303051647282295e3e | /resources/imap/noselectattribute.cpp | dbb5945255476034a83ffecd8cee169c13710dc7 | [
"BSD-3-Clause"
] | permissive | KDE/kdepim-runtime | 2c3f6bcc6f251cb3e51b3a49f85009593afd3339 | 61c3403c0632579d2996d5a3b12380076703ff77 | refs/heads/master | 2023-08-16T11:15:00.872529 | 2023-08-16T01:47:59 | 2023-08-16T01:47:59 | 42,729,679 | 14 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 865 | cpp | noselectattribute.cpp | /*
SPDX-FileCopyrightText: 2008 Omat Holding B.V. <info@omat.nl>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "noselectattribute.h"
#include <QByteArray>
NoSelectAttribute::NoSelectAttribute(bool noSelect)
: mNoSelect(noSelect)
{
}
void NoSelectAttribute::setNoSelect(bool noSelect)
{
mNoSelect = noSelect;
}
bool NoSelectAttribute::noSelect() const
{
return mNoSelect;
}
QByteArray NoSelectAttribute::type() const
{
static const QByteArray sType("noselect");
return sType;
}
Akonadi::Attribute *NoSelectAttribute::clone() const
{
return new NoSelectAttribute(mNoSelect);
}
QByteArray NoSelectAttribute::serialized() const
{
return mNoSelect ? QByteArray::number(1) : QByteArray::number(0);
}
void NoSelectAttribute::deserialize(const QByteArray &data)
{
mNoSelect = (data.toInt() == 0) ? false : true;
}
|
dc51b7c8ed33c4bbd42045d46e0ff4d3c5d3e1a4 | 4aa49a41be21411e16f103d5bb1ecd679e9df3b1 | /core/caroline.h | ccfd4c5d642d5a729b95582edf196dcc478ffb39 | [
"MIT"
] | permissive | it-workshop/caroline | 0f88bcb0ff307f26da4dbc32b204d69e9d16b475 | 9a8ebc5af010e8b1969a40ccf6d5b25eedb182e7 | refs/heads/master | 2021-03-12T23:52:52.923887 | 2014-11-28T20:19:41 | 2014-11-28T20:19:41 | 15,731,111 | 1 | 1 | MIT | 2020-10-01T08:50:07 | 2014-01-08T09:33:55 | C++ | UTF-8 | C++ | false | false | 1,859 | h | caroline.h | // Copyright (c) 2014 The Caroline authors. All rights reserved.
// Use of this source file is governed by a MIT license that can be found in the
// LICENSE file.
/// @author Aleksandr Derbenev <alex@technoworks.ru>
#ifndef CORE_CAROLINE_H_
#define CORE_CAROLINE_H_
#include <memory>
#include <utility>
#include <vector>
#include "base/logging.h"
#include "base/thread_bundle.h"
#include "core/serialization.h"
#include "core/return_codes.h"
namespace base {
class CommandLine;
} // namespace base
namespace core {
namespace stat {
class Metric;
}
class Cameras;
class ImageCaptureManager;
class OpticalFlowProcessor;
class Caroline {
public:
explicit Caroline(base::CommandLine* command_line);
virtual ~Caroline();
virtual bool Init();
virtual int Run();
base::CommandLine* command_line() const {
return command_line_;
}
ImageCaptureManager* image_capture_manager() const {
return image_capture_manager_.get();
}
OpticalFlowProcessor* optical_flow_processor() const {
return optical_flow_processor_.get();
}
private:
void Grab();
void CalculateOpticalFlow(std::vector<std::pair<cv::Mat, Position>> frameset);
void CalculateDepthMap(
std::vector<std::pair<cv::Mat, Position>> frameset,
std::vector<std::pair<cv::Point2d, cv::Point2d>> optical_flow);
void BuildScene(std::shared_ptr<DepthMap> depth_map);
base::CommandLine* command_line_;
bool send_message_;
bool receive_message_;
base::ThreadBundle* thread_bundle_;
std::unique_ptr<bitdata::GlobalMessage>message_;
std::unique_ptr<ImageCaptureManager> image_capture_manager_;
std::unique_ptr<OpticalFlowProcessor> optical_flow_processor_;
std::unique_ptr<Cameras> cameras_properties_;
std::vector<std::unique_ptr<stat::Metric>> metrics_;
ReturnCode error_code_;
};
} // namespace core
#endif // CORE_CAROLINE_H_
|
e72103859b1b647c8fc4086328bdfd1bb928da98 | 68474d9d5b67759b6bd2608a8b5c996cb00f4efc | /Ejercicio2/E2V4/iniciadorBroker.cpp | d37b270f3e8a4714361a356d5cd562bd795a1012 | [] | no_license | serpi90/RedesIV2014 | 3ad4c065e0d5d29b80fc317ae7ad2c00d470c093 | f10ec55386911d177cae8fe86cca1372c26d0fe7 | refs/heads/master | 2020-12-24T13:52:14.801719 | 2014-06-27T21:32:05 | 2014-06-27T21:32:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,564 | cpp | iniciadorBroker.cpp | #include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include "includes.h"
#include "net-idManagerProtocol.h"
#include "Queue.cpp"
#include "Semaphore.h"
#include "SharedMemory.cpp"
using namespace IPC;
int main(int argc, char * argv[]) {
std::string owner = "iniciador broker";
pid_t pid;
Queue<ColaActivado::message> * act;
Queue<ColaArmado::message> * arm;
Queue<ColaDispositivo::message> * disp;
Queue<ColaSalida::message> * sal;
Queue<Broker::message> * brk;
Queue<Broker::outgoingMessage> * brko;
Queue<ColaPlataforma::syncMessage> * syncPlat;
Queue<IdManager::messageRequest> * idmReq;
Queue<Net::interfaceMessage> * toBroker;
Semaphore * mutex;
SharedMemory<ColaPlataforma::shared> * shm;
SharedMemory<Broker::tokenShm> * shmToken;
Semaphore * s;
s = new Semaphore(IPC::path, (int) IPC::SemaphoreIdentifier::MUTEX_TOKEN, owner);
s->create();
s->post();
s = new Semaphore(IPC::path, (int) IPC::SemaphoreIdentifier::TENGO_TOKEN, owner);
s->create();
s = new Semaphore(IPC::path, (int) IPC::SemaphoreIdentifier::DEVUELVO_TOKEN, owner);
s->create();
shmToken = new SharedMemory<Broker::tokenShm>(IPC::path, (int) IPC::SharedMemoryIdentifier::BROKER_TOKEN, owner);
shmToken->create();
Broker::tokenShm * ts = shmToken->attach();
ts->necesitoToken = 0;
toBroker = new Queue<Net::interfaceMessage>(IPC::path, (int) IPC::QueueIdentifier::TO_BROKER_FROM_BROKER, owner);
toBroker->create();
idmReq = new Queue<IdManager::messageRequest>(IPC::path, (int) IPC::QueueIdentifier::ID_MANAGER_BROKER, owner);
idmReq->create();
shm = new SharedMemory<ColaPlataforma::shared>(IPC::path, (int) IPC::SharedMemoryIdentifier::BROKER_PLAT, owner);
shm->create();
mutex = new Semaphore(IPC::path, (int) IPC::SemaphoreIdentifier::MUTEX_BROKER_SYNC, owner);
mutex->create();
mutex->post();
brk = new Queue<Broker::message>(IPC::path, (int) IPC::QueueIdentifier::TO_BROKER_FROM_RECEIVER, owner);
brk->create();
brko = new Queue<Broker::outgoingMessage>(IPC::path, (int) IPC::QueueIdentifier::TO_SENDER_FROM_BROKER, owner);
brko->create();
arm = new Queue<ColaArmado::message>(IPC::path, (int) IPC::QueueIdentifier::ARMADO_BROKER, owner);
arm->create();
act = new Queue<ColaActivado::message>(IPC::path, (int) IPC::QueueIdentifier::ACTIVADO_BROKER, owner);
act->create();
sal = new Queue<ColaSalida::message>(IPC::path, (int) IPC::QueueIdentifier::SALIDA_BROKER, owner);
sal->create();
disp = new Queue<ColaDispositivo::message>(IPC::path, (int) IPC::QueueIdentifier::DISPOSITIVOS_BROKER, owner);
disp->create();
syncPlat = new Queue<ColaPlataforma::syncMessage>(IPC::path, (int) IPC::QueueIdentifier::PLATAFORMA_BROKER, owner);
syncPlat->create();
pid = fork();
if (pid == 0) {
execlp("./broker-sender", "broker-sender", NULL);
perror("broker-sender - execlp: ");
exit(EXIT_FAILURE);
} else if (pid < 0) {
perror("broker-sender - fork: ");
}
pid = fork();
if (pid == 0) {
execlp("./broker-receiver", "broker-receiver", NULL);
perror("broker-receiver - execlp: ");
exit(EXIT_FAILURE);
} else if (pid < 0) {
perror("broker-receiver - fork: ");
}
if (argc > 1) {
pid = fork();
if (pid == 0) {
execlp("./broker", "broker", argv[1], NULL);
perror("broker - execlp: ");
exit(EXIT_FAILURE);
} else if (pid < 0) {
perror("broker - fork: ");
}
} else {
pid = fork();
if (pid == 0) {
execlp("./broker", "broker", NULL);
perror("broker - execlp: ");
exit(EXIT_FAILURE);
} else if (pid < 0) {
perror("broker - fork: ");
}
}
return 0;
}
|
10ac7519be6415b7ad33ac1b9eec995101b11b87 | 6c189ab93c0609a45b7af58c16fbb70c95f8089a | /nextwarmerday.cpp | 057449da3973001bb8a2b4dda1494945606716ff | [] | no_license | dhritisaini/leetcode | fd66352c60aad618b5d163896d6c8accfe4a48c2 | a719ee2cab3751b9592619d34ee4adb24cd00ffb | refs/heads/master | 2021-07-11T01:44:35.814867 | 2020-09-23T18:54:08 | 2020-09-23T18:54:08 | 195,511,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 782 | cpp | nextwarmerday.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int> findWarmerTemp(vector<int> temps )
{
stack<int> st;
vector <int> nge(temps.size(),0);
for(int i=temps.size()-1;i>=0;i--)
{
while(!st.empty()&&temps[i]>temps[st.top()])
{
st.pop();
}
nge[i]=(st.empty())?0:st.top()-i;
st.push(i);
}
return nge;
}
int main()
{
int n = 0;
cin >> n;
vector<int> temps(n, 0);
for(int i=0; i<n; i++)
{
int a=0;
cin >> temps[i];
}
vector<int> res = findWarmerTemp(temps);
for(int i=0; i<res.size(); i++)
{
cout << res[i] << endl;
}
return 0;
}
|
4e563e8bd6effca269d4d86bc545695ba71ee72f | c026c9fd72fca3ebb9dd837f356a9ce791c7025f | /Room.h | aef4335db512df50f5932f18dc718d1aea999ed7 | [] | no_license | thweattm/Text-Based-Adventure-Game-Office-Urgency | b9dacc6315edc6744e8016d74006910f83d33f0d | b37a63d2e95a39cd9cf0193000b91e7866625346 | refs/heads/master | 2020-03-28T21:25:04.153848 | 2018-12-11T18:19:40 | 2018-12-11T18:19:40 | 149,154,037 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 627 | h | Room.h | /*********************************************************
* Author: Mike Thweatt
* Date: 08/02/16
* Description: Room Headers
* ******************************************************/
#ifndef ROOM_H
#define ROOM_H
#include "Player.h"
#include <string>
//Room Parent Class
class Room
{
public:
virtual void specialAction(Player&)=0;
std::string getRoomname();
void setPointers(Room *&, Room *&, Room *&, Room *&);
bool checkDirection(int);
bool moveDirection(Room *&, int);
protected:
Room *left;
Room *right;
Room *straight;
Room *back;
std::string roomName;
};
#endif // ROOM_H
|
db3acb756198967fe13c461810a9dff8285c482c | 674af49e57d81d884ec51dbe02a62614637a6f72 | /test/TestGelfAppender.cpp | 9535fe23730a76c2599870be6a42bc1f89ab0f9c | [
"MIT"
] | permissive | pss146/log4cplus_gelf | 6cafeb54c496208f7a23f2edce0500847140c80a | 7bba62e58490667466251b944d20ee2c1c4b524c | refs/heads/master | 2020-09-21T05:41:47.442830 | 2019-12-03T13:04:29 | 2019-12-03T13:04:29 | 224,698,461 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,443 | cpp | TestGelfAppender.cpp | #include <log4cplus_gelf/GelfAppender.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <exception>
#include <iostream>
#include "log4cplus/logger.h"
#include "log4cplus/helpers/loglog.h"
#include "log4cplus/helpers/pointer.h"
#include "log4cplus/helpers/property.h"
#include "log4cplus/spi/loggingevent.h"
#include "log4cplus/initializer.h"
#include <log4cplus/loggingmacros.h>
using namespace log4cplus;
int main(int argc, char **argv) {
log4cplus::Initializer initializer;
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
// The fixture for testing class
class TestGelfAppender : public ::testing::Test {
protected:
void SetUp() override {
}
void TearDown() override {
Logger::getRoot().removeAllAppenders();
}
};
TEST(TestGelfAppender, Create)
{
GelfAppender appender;
EXPECT_EQ(true, true);
}
TEST(TestGelfAppender, UnsupportedTransport)
{
try {
log4cplus::tistringstream propsStream(
LOG4CPLUS_TEXT("transport=tcp\n"));
log4cplus::helpers::Properties props(propsStream);
log4cplus::helpers::SharedObjectPtr<GelfAppender> append(new log4cplus::GelfAppender(props));
append->setName(LOG4CPLUS_TEXT ("Gelf"));
}
catch (std::invalid_argument const & e) {
SUCCEED();
return;
}
FAIL();
}
TEST(TestGelfAppender, AdditionalFields)
{
try {
helpers::LogLog::getLogLog()->setInternalDebugging(true);
// Init appender
tistringstream propsStream (
LOG4CPLUS_TEXT("serverHost=graylog\n")
LOG4CPLUS_TEXT("serverPort=12201\n")
LOG4CPLUS_TEXT("transport=udp\n")
LOG4CPLUS_TEXT("host=pss-home\n")
LOG4CPLUS_TEXT("facility=Relay\n")
LOG4CPLUS_TEXT("includeLocationInformation=true\n")
LOG4CPLUS_TEXT("additionalField.environment=DEV\n"));
helpers::Properties props(propsStream);
// Init Appender/Logger
SharedAppenderPtr append(new GelfAppender(props));
append->setName(LOG4CPLUS_TEXT ("Gelf"));
Logger::getRoot().addAppender(append);
// Log message
Logger logger = Logger::getRoot();
LOG4CPLUS_DEBUG(logger, "Test from GelfAppender");
}
catch(std::exception const & e) {
log4cplus::tcout << "**** Exception occured: " << e.what() << std::endl;
FAIL();
}
} |
067338a0ccb3a049f5bde99d61bd2bf4cbf70b57 | 6226d6aed3629aa4069c46971ffe764bb6c743f6 | /MGui/MGUI_InputManager.h | 0498e69d3571a7c0239a585e18b33e9834c214bc | [] | no_license | Myway3D/Myway3D | 83c30258f1e3eae90e619269406acd0ddeac7887 | 39cf569993f62fc648cbba49ebf74b3f8a64e46a | refs/heads/master | 2020-04-22T20:24:15.817427 | 2014-03-09T14:25:23 | 2014-03-09T14:25:23 | 170,640,096 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,442 | h | MGUI_InputManager.h | #pragma once
#include "MGUI_Types.h"
#include "MGUI_Widget.h"
#include "MGUI_Timer.h"
namespace Myway {
class MGUI_ENTRY MGUI_InputManager
{
DECLARE_SINGLETON(MGUI_InputManager);
public:
tEvent2<int, int> eventMouseMove;
tEvent1<int> eventMouseWheel;
tEvent3<int, int, MGUI_MouseButton> eventMousePressed;
tEvent3<int, int, MGUI_MouseButton> eventMouseReleased;
tEvent2<MGUI_KeyCode, MGUI_Char> eventKeyPressed;
tEvent1<MGUI_KeyCode> eventKeyReleased;
tEvent1<int> eventTimer;
public:
MGUI_InputManager();
~MGUI_InputManager();
void SetKeyFocusedWidget(MGUI_Widget * _widget);
MGUI_Widget * GetKeyFocusedWidget();
void SetMouseFocusedWidget(MGUI_Widget * _widget);
MGUI_Widget * GetMouseFocusedWidget();
bool IsMouseCaptured() { return mMouseCapture; }
bool _injectMouseMove(int _x, int _y);
bool _injectMouseWheel(int _z);
bool _injectMousePressed(int _x, int _y, MGUI_MouseButton _id);
bool _injectMouseReleased(int _x, int _y, MGUI_MouseButton _id);
bool _injectKeyPressed(MGUI_KeyCode _key, MGUI_Char _text = 0);
bool _injectKeyReleased(MGUI_KeyCode _key);
void Update();
int StartTimer(int _dtime);
void EndTimer(int _id);
protected:
int mMouseX, mMouseY, mMouseZ;
bool mMouseCapture;
MGUI_Widget* mMouseFocusWidget;
MGUI_Widget* mKeyFocusWidget;
MGUI_Timer mTimer;
List<MGUI_Counter> mCounters;
};
} |
288e533b3b68593c0f3693c812559f2abcfb5a5f | 2aed63d9aa027419b797e56b508417789a604a8b | /injector2degHex/case_interFoam_3mm/processor2/0.8/p_rgh | ccaa9ec142caea4c04c86bc637ab494f7f54b441 | [] | no_license | icl-rocketry/injectorCFDModelling | 70137f1c6574240c7202638c3713102a3e1e9fd8 | 96591cf2cf3cd4cbd64536d8ae47ed8080ed9016 | refs/heads/main | 2023-08-25T03:30:59.244137 | 2021-10-09T21:04:45 | 2021-10-09T21:04:45 | 322,369,673 | 3 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 43,388 | p_rgh | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.8";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField nonuniform List<scalar>
3320
(
4.49558e+06
4.49765e+06
4.49897e+06
4.49981e+06
4.50034e+06
4.50066e+06
4.50084e+06
4.50093e+06
4.50096e+06
4.50094e+06
4.5009e+06
4.50084e+06
4.50077e+06
4.5007e+06
4.50062e+06
4.50056e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.4959e+06
4.49781e+06
4.49904e+06
4.49984e+06
4.50035e+06
4.50065e+06
4.50083e+06
4.50091e+06
4.50094e+06
4.50092e+06
4.50088e+06
4.50082e+06
4.50076e+06
4.50069e+06
4.50062e+06
4.50055e+06
4.50049e+06
4.50043e+06
4.50037e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49621e+06
4.49794e+06
4.49909e+06
4.49984e+06
4.50033e+06
4.50063e+06
4.5008e+06
4.50088e+06
4.50091e+06
4.5009e+06
4.50086e+06
4.5008e+06
4.50074e+06
4.50067e+06
4.50061e+06
4.50054e+06
4.50048e+06
4.50042e+06
4.50037e+06
4.50032e+06
4.50028e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49663e+06
4.49813e+06
4.49916e+06
4.49986e+06
4.50031e+06
4.50059e+06
4.50076e+06
4.50084e+06
4.50087e+06
4.50086e+06
4.50083e+06
4.50078e+06
4.50072e+06
4.50065e+06
4.50059e+06
4.50053e+06
4.50047e+06
4.50041e+06
4.50036e+06
4.50032e+06
4.50028e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49703e+06
4.49832e+06
4.49924e+06
4.49986e+06
4.50028e+06
4.50055e+06
4.50071e+06
4.50079e+06
4.50083e+06
4.50082e+06
4.50079e+06
4.50074e+06
4.50069e+06
4.50063e+06
4.50057e+06
4.50051e+06
4.50045e+06
4.5004e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49742e+06
4.49852e+06
4.49931e+06
4.49987e+06
4.50025e+06
4.5005e+06
4.50066e+06
4.50074e+06
4.50077e+06
4.50077e+06
4.50074e+06
4.5007e+06
4.50065e+06
4.5006e+06
4.50054e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50034e+06
4.5003e+06
4.50026e+06
4.50023e+06
4.5002e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49779e+06
4.49871e+06
4.49939e+06
4.49988e+06
4.50022e+06
4.50045e+06
4.5006e+06
4.50068e+06
4.50072e+06
4.50072e+06
4.5007e+06
4.50066e+06
4.50062e+06
4.50057e+06
4.50051e+06
4.50046e+06
4.50041e+06
4.50037e+06
4.50032e+06
4.50028e+06
4.50025e+06
4.50022e+06
4.50019e+06
4.50016e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49811e+06
4.49888e+06
4.49946e+06
4.49989e+06
4.5002e+06
4.50041e+06
4.50054e+06
4.50062e+06
4.50066e+06
4.50066e+06
4.50065e+06
4.50062e+06
4.50058e+06
4.50053e+06
4.50048e+06
4.50044e+06
4.50039e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.4984e+06
4.49904e+06
4.49953e+06
4.49991e+06
4.50018e+06
4.50037e+06
4.50049e+06
4.50057e+06
4.5006e+06
4.50061e+06
4.5006e+06
4.50057e+06
4.50054e+06
4.5005e+06
4.50045e+06
4.50041e+06
4.50037e+06
4.50033e+06
4.50029e+06
4.50026e+06
4.50022e+06
4.5002e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49865e+06
4.49918e+06
4.4996e+06
4.49992e+06
4.50016e+06
4.50033e+06
4.50045e+06
4.50052e+06
4.50055e+06
4.50056e+06
4.50055e+06
4.50053e+06
4.5005e+06
4.50046e+06
4.50043e+06
4.50039e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49966e+06
4.49994e+06
4.50015e+06
4.5003e+06
4.5004e+06
4.50047e+06
4.5005e+06
4.50051e+06
4.50051e+06
4.50049e+06
4.50046e+06
4.50043e+06
4.5004e+06
4.50036e+06
4.50032e+06
4.50029e+06
4.50026e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49972e+06
4.49995e+06
4.50013e+06
4.50027e+06
4.50036e+06
4.50042e+06
4.50046e+06
4.50047e+06
4.50047e+06
4.50045e+06
4.50043e+06
4.5004e+06
4.50037e+06
4.50034e+06
4.5003e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49977e+06
4.49997e+06
4.50013e+06
4.50024e+06
4.50033e+06
4.50038e+06
4.50041e+06
4.50043e+06
4.50043e+06
4.50041e+06
4.50039e+06
4.50037e+06
4.50034e+06
4.50031e+06
4.50028e+06
4.50025e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49981e+06
4.49998e+06
4.50012e+06
4.50022e+06
4.5003e+06
4.50035e+06
4.50038e+06
4.50039e+06
4.50039e+06
4.50038e+06
4.50036e+06
4.50034e+06
4.50032e+06
4.50029e+06
4.50026e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49985e+06
4.5e+06
4.50011e+06
4.5002e+06
4.50027e+06
4.50032e+06
4.50034e+06
4.50035e+06
4.50036e+06
4.50035e+06
4.50033e+06
4.50031e+06
4.50029e+06
4.50027e+06
4.50024e+06
4.50022e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49988e+06
4.50001e+06
4.50011e+06
4.50019e+06
4.50025e+06
4.50029e+06
4.50031e+06
4.50032e+06
4.50032e+06
4.50032e+06
4.50031e+06
4.50029e+06
4.50027e+06
4.50025e+06
4.50023e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.49991e+06
4.50002e+06
4.50011e+06
4.50018e+06
4.50023e+06
4.50026e+06
4.50028e+06
4.50029e+06
4.5003e+06
4.50029e+06
4.50028e+06
4.50027e+06
4.50025e+06
4.50023e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.49994e+06
4.50003e+06
4.5001e+06
4.50016e+06
4.50021e+06
4.50024e+06
4.50026e+06
4.50027e+06
4.50027e+06
4.50027e+06
4.50026e+06
4.50024e+06
4.50023e+06
4.50021e+06
4.50019e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.49996e+06
4.50004e+06
4.5001e+06
4.50015e+06
4.50019e+06
4.50022e+06
4.50024e+06
4.50024e+06
4.50025e+06
4.50024e+06
4.50024e+06
4.50022e+06
4.50021e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.49998e+06
4.50004e+06
4.5001e+06
4.50014e+06
4.50018e+06
4.5002e+06
4.50021e+06
4.50022e+06
4.50023e+06
4.50022e+06
4.50022e+06
4.50021e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.49999e+06
4.50005e+06
4.5001e+06
4.50013e+06
4.50016e+06
4.50018e+06
4.5002e+06
4.5002e+06
4.50021e+06
4.5002e+06
4.5002e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50001e+06
4.50005e+06
4.50009e+06
4.50012e+06
4.50015e+06
4.50017e+06
4.50018e+06
4.50019e+06
4.50019e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50016e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50002e+06
4.50006e+06
4.50009e+06
4.50012e+06
4.50014e+06
4.50015e+06
4.50016e+06
4.50017e+06
4.50017e+06
4.50017e+06
4.50016e+06
4.50016e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50002e+06
4.50006e+06
4.50009e+06
4.50011e+06
4.50013e+06
4.50014e+06
4.50015e+06
4.50015e+06
4.50016e+06
4.50015e+06
4.50015e+06
4.50014e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50003e+06
4.50006e+06
4.50008e+06
4.5001e+06
4.50012e+06
4.50013e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50003e+06
4.50006e+06
4.50008e+06
4.50009e+06
4.50011e+06
4.50012e+06
4.50012e+06
4.50013e+06
4.50013e+06
4.50013e+06
4.50012e+06
4.50012e+06
4.50011e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50004e+06
4.50006e+06
4.50007e+06
4.50009e+06
4.5001e+06
4.50011e+06
4.50011e+06
4.50011e+06
4.50012e+06
4.50011e+06
4.50011e+06
4.50011e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50004e+06
4.50005e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.49558e+06
4.49765e+06
4.49897e+06
4.49981e+06
4.50034e+06
4.50066e+06
4.50084e+06
4.50093e+06
4.50096e+06
4.50094e+06
4.5009e+06
4.50084e+06
4.50077e+06
4.5007e+06
4.50062e+06
4.50056e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.4959e+06
4.49781e+06
4.49904e+06
4.49984e+06
4.50035e+06
4.50065e+06
4.50083e+06
4.50091e+06
4.50094e+06
4.50092e+06
4.50088e+06
4.50082e+06
4.50076e+06
4.50069e+06
4.50062e+06
4.50055e+06
4.50049e+06
4.50043e+06
4.50037e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49621e+06
4.49794e+06
4.49909e+06
4.49984e+06
4.50033e+06
4.50063e+06
4.5008e+06
4.50088e+06
4.50091e+06
4.5009e+06
4.50086e+06
4.5008e+06
4.50074e+06
4.50067e+06
4.50061e+06
4.50054e+06
4.50048e+06
4.50042e+06
4.50037e+06
4.50032e+06
4.50028e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49663e+06
4.49813e+06
4.49916e+06
4.49986e+06
4.50031e+06
4.50059e+06
4.50076e+06
4.50084e+06
4.50087e+06
4.50086e+06
4.50083e+06
4.50078e+06
4.50072e+06
4.50065e+06
4.50059e+06
4.50053e+06
4.50047e+06
4.50041e+06
4.50036e+06
4.50032e+06
4.50028e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49703e+06
4.49832e+06
4.49924e+06
4.49986e+06
4.50028e+06
4.50055e+06
4.50071e+06
4.50079e+06
4.50083e+06
4.50082e+06
4.50079e+06
4.50074e+06
4.50069e+06
4.50063e+06
4.50057e+06
4.50051e+06
4.50045e+06
4.5004e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49742e+06
4.49852e+06
4.49931e+06
4.49987e+06
4.50025e+06
4.5005e+06
4.50066e+06
4.50074e+06
4.50077e+06
4.50077e+06
4.50074e+06
4.5007e+06
4.50065e+06
4.5006e+06
4.50054e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50034e+06
4.5003e+06
4.50026e+06
4.50023e+06
4.5002e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49779e+06
4.49871e+06
4.49939e+06
4.49988e+06
4.50022e+06
4.50045e+06
4.5006e+06
4.50068e+06
4.50072e+06
4.50072e+06
4.5007e+06
4.50066e+06
4.50062e+06
4.50057e+06
4.50051e+06
4.50046e+06
4.50041e+06
4.50037e+06
4.50032e+06
4.50028e+06
4.50025e+06
4.50022e+06
4.50019e+06
4.50016e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49811e+06
4.49888e+06
4.49946e+06
4.49989e+06
4.5002e+06
4.50041e+06
4.50054e+06
4.50062e+06
4.50066e+06
4.50066e+06
4.50065e+06
4.50062e+06
4.50058e+06
4.50053e+06
4.50048e+06
4.50044e+06
4.50039e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.4984e+06
4.49904e+06
4.49953e+06
4.49991e+06
4.50018e+06
4.50037e+06
4.50049e+06
4.50057e+06
4.5006e+06
4.50061e+06
4.5006e+06
4.50057e+06
4.50054e+06
4.5005e+06
4.50045e+06
4.50041e+06
4.50037e+06
4.50033e+06
4.50029e+06
4.50026e+06
4.50022e+06
4.5002e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49865e+06
4.49918e+06
4.4996e+06
4.49992e+06
4.50016e+06
4.50033e+06
4.50045e+06
4.50052e+06
4.50055e+06
4.50056e+06
4.50055e+06
4.50053e+06
4.5005e+06
4.50046e+06
4.50043e+06
4.50039e+06
4.50035e+06
4.50031e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49966e+06
4.49994e+06
4.50015e+06
4.5003e+06
4.5004e+06
4.50047e+06
4.5005e+06
4.50051e+06
4.50051e+06
4.50049e+06
4.50046e+06
4.50043e+06
4.5004e+06
4.50036e+06
4.50032e+06
4.50029e+06
4.50026e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49972e+06
4.49995e+06
4.50013e+06
4.50027e+06
4.50036e+06
4.50042e+06
4.50046e+06
4.50047e+06
4.50047e+06
4.50045e+06
4.50043e+06
4.5004e+06
4.50037e+06
4.50034e+06
4.5003e+06
4.50027e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49977e+06
4.49997e+06
4.50013e+06
4.50024e+06
4.50033e+06
4.50038e+06
4.50041e+06
4.50043e+06
4.50043e+06
4.50041e+06
4.50039e+06
4.50037e+06
4.50034e+06
4.50031e+06
4.50028e+06
4.50025e+06
4.50023e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49981e+06
4.49998e+06
4.50012e+06
4.50022e+06
4.5003e+06
4.50035e+06
4.50038e+06
4.50039e+06
4.50039e+06
4.50038e+06
4.50036e+06
4.50034e+06
4.50032e+06
4.50029e+06
4.50026e+06
4.50024e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49985e+06
4.5e+06
4.50011e+06
4.5002e+06
4.50027e+06
4.50032e+06
4.50034e+06
4.50035e+06
4.50036e+06
4.50035e+06
4.50033e+06
4.50031e+06
4.50029e+06
4.50027e+06
4.50024e+06
4.50022e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49988e+06
4.50001e+06
4.50011e+06
4.50019e+06
4.50025e+06
4.50029e+06
4.50031e+06
4.50032e+06
4.50032e+06
4.50032e+06
4.50031e+06
4.50029e+06
4.50027e+06
4.50025e+06
4.50023e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50015e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.49991e+06
4.50002e+06
4.50011e+06
4.50018e+06
4.50023e+06
4.50026e+06
4.50028e+06
4.50029e+06
4.5003e+06
4.50029e+06
4.50028e+06
4.50027e+06
4.50025e+06
4.50023e+06
4.50021e+06
4.50019e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.49994e+06
4.50003e+06
4.5001e+06
4.50016e+06
4.50021e+06
4.50024e+06
4.50026e+06
4.50027e+06
4.50027e+06
4.50027e+06
4.50026e+06
4.50024e+06
4.50023e+06
4.50021e+06
4.50019e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.49996e+06
4.50004e+06
4.5001e+06
4.50015e+06
4.50019e+06
4.50022e+06
4.50024e+06
4.50024e+06
4.50025e+06
4.50024e+06
4.50024e+06
4.50022e+06
4.50021e+06
4.5002e+06
4.50018e+06
4.50016e+06
4.50015e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.49998e+06
4.50004e+06
4.5001e+06
4.50014e+06
4.50018e+06
4.5002e+06
4.50021e+06
4.50022e+06
4.50023e+06
4.50022e+06
4.50022e+06
4.50021e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.49999e+06
4.50005e+06
4.5001e+06
4.50013e+06
4.50016e+06
4.50018e+06
4.5002e+06
4.5002e+06
4.50021e+06
4.5002e+06
4.5002e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50001e+06
4.50005e+06
4.50009e+06
4.50012e+06
4.50015e+06
4.50017e+06
4.50018e+06
4.50019e+06
4.50019e+06
4.50019e+06
4.50018e+06
4.50017e+06
4.50016e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50002e+06
4.50006e+06
4.50009e+06
4.50012e+06
4.50014e+06
4.50015e+06
4.50016e+06
4.50017e+06
4.50017e+06
4.50017e+06
4.50016e+06
4.50016e+06
4.50015e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50002e+06
4.50006e+06
4.50009e+06
4.50011e+06
4.50013e+06
4.50014e+06
4.50015e+06
4.50015e+06
4.50016e+06
4.50015e+06
4.50015e+06
4.50014e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50003e+06
4.50006e+06
4.50008e+06
4.5001e+06
4.50012e+06
4.50013e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50014e+06
4.50013e+06
4.50012e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50003e+06
4.50006e+06
4.50008e+06
4.50009e+06
4.50011e+06
4.50012e+06
4.50012e+06
4.50013e+06
4.50013e+06
4.50013e+06
4.50012e+06
4.50012e+06
4.50011e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50004e+06
4.50006e+06
4.50007e+06
4.50009e+06
4.5001e+06
4.50011e+06
4.50011e+06
4.50011e+06
4.50012e+06
4.50011e+06
4.50011e+06
4.50011e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50004e+06
4.50005e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50006e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50003e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50003e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
4.5e+06
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform 4.5e+06;
}
outlet
{
type fixedValue;
value nonuniform List<scalar> 0();
}
walls
{
type fixedFluxPressure;
gradient uniform 0;
value nonuniform List<scalar>
166
(
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.5e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50007e+06
4.50007e+06
4.50006e+06
4.50006e+06
4.50006e+06
4.50005e+06
4.50005e+06
4.50004e+06
4.50004e+06
4.50003e+06
4.50003e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.5e+06
4.49558e+06
4.49765e+06
4.49897e+06
4.49981e+06
4.50034e+06
4.50066e+06
4.50084e+06
4.50093e+06
4.50096e+06
4.50094e+06
4.5009e+06
4.50084e+06
4.50077e+06
4.5007e+06
4.50062e+06
4.50056e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
4.49558e+06
4.49765e+06
4.49897e+06
4.49981e+06
4.50034e+06
4.50066e+06
4.50084e+06
4.50093e+06
4.50096e+06
4.50094e+06
4.5009e+06
4.50084e+06
4.50077e+06
4.5007e+06
4.50062e+06
4.50056e+06
4.50049e+06
4.50043e+06
4.50038e+06
4.50033e+06
4.50028e+06
4.50025e+06
4.50021e+06
4.50018e+06
4.50016e+06
4.50014e+06
4.50012e+06
4.50011e+06
4.5001e+06
4.50009e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50008e+06
4.50009e+06
4.50009e+06
4.50009e+06
4.5001e+06
4.5001e+06
4.5001e+06
)
;
}
side1
{
type cyclic;
}
side2
{
type cyclic;
}
procBoundary2to1
{
type processor;
value nonuniform List<scalar>
84
(
4.49234e+06
4.49297e+06
4.49362e+06
4.49444e+06
4.4952e+06
4.49593e+06
4.49657e+06
4.49712e+06
4.49759e+06
4.49799e+06
4.49886e+06
4.49931e+06
4.49931e+06
4.49942e+06
4.49951e+06
4.4996e+06
4.49967e+06
4.49973e+06
4.49979e+06
4.49983e+06
4.49987e+06
4.4999e+06
4.49993e+06
4.49995e+06
4.49997e+06
4.49999e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
4.49234e+06
4.49297e+06
4.49362e+06
4.49444e+06
4.4952e+06
4.49593e+06
4.49657e+06
4.49712e+06
4.49759e+06
4.49799e+06
4.49886e+06
4.49931e+06
4.49931e+06
4.49942e+06
4.49951e+06
4.4996e+06
4.49967e+06
4.49973e+06
4.49979e+06
4.49983e+06
4.49987e+06
4.4999e+06
4.49993e+06
4.49995e+06
4.49997e+06
4.49999e+06
4.5e+06
4.50001e+06
4.50001e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50002e+06
4.50001e+06
4.50001e+06
4.50001e+06
4.5e+06
)
;
}
}
// ************************************************************************* //
| |
a8b5261ae8155d5e166d5de0f352dfe19fd3d93b | b7d4e34cf3a7960825053c907245e4c8db699707 | /ClanCor_HHC/ui_PrinterSetup.h | 71ab70bc429a79d6a5a2f91a723d591c929ffc0d | [] | no_license | ramanathanaspires/SDK | 46d2e962ec3ad469235e41da98b25b8132331778 | a8979b9f8ba80b3d41bf977cba22a176230469ee | refs/heads/master | 2021-01-23T05:55:41.387830 | 2017-06-01T00:21:27 | 2017-06-01T00:21:27 | 92,999,596 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,020 | h | ui_PrinterSetup.h | /********************************************************************************
** Form generated from reading UI file 'PrinterSetup.ui'
**
** Created: Tue Feb 11 18:04:02 2014
** by: Qt User Interface Compiler version 4.6.3
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_PRINTERSETUP_H
#define UI_PRINTERSETUP_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
QT_BEGIN_NAMESPACE
class Ui_PrinterSetup
{
public:
QDialogButtonBox *buttonBox;
QLabel *label_2;
QPushButton *btnHeader;
QPushButton *btnFooter;
QPushButton *btnTest_print;
QPushButton *btnHeader_revert;
QPushButton *btnFooter_revert;
void setupUi(QDialog *PrinterSetup)
{
if (PrinterSetup->objectName().isEmpty())
PrinterSetup->setObjectName(QString::fromUtf8("PrinterSetup"));
PrinterSetup->resize(320, 460);
PrinterSetup->setStyleSheet(QString::fromUtf8("QDialog{Background-color:rgb(238, 238, 238)};"));
buttonBox = new QDialogButtonBox(PrinterSetup);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setGeometry(QRect(100, 387, 210, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
label_2 = new QLabel(PrinterSetup);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setGeometry(QRect(38, 180, 250, 50));
QFont font;
font.setFamily(QString::fromUtf8("Century Schoolbook L"));
font.setPointSize(14);
font.setBold(true);
font.setWeight(75);
label_2->setFont(font);
btnHeader = new QPushButton(PrinterSetup);
btnHeader->setObjectName(QString::fromUtf8("btnHeader"));
btnHeader->setGeometry(QRect(15, 66, 250, 50));
btnHeader->setStyleSheet(QString::fromUtf8("QLabel {\n"
" border: 2px solid green;\n"
" border-radius: 4px;\n"
" padding: 2px;}"));
btnHeader->setDefault(true);
btnHeader->setFlat(true);
btnFooter = new QPushButton(PrinterSetup);
btnFooter->setObjectName(QString::fromUtf8("btnFooter"));
btnFooter->setGeometry(QRect(15, 285, 250, 50));
btnFooter->setStyleSheet(QString::fromUtf8("QLabel {\n"
" border: 2px solid green;\n"
" border-radius: 4px;\n"
" padding: 2px;}"));
btnFooter->setDefault(true);
btnFooter->setFlat(true);
btnTest_print = new QPushButton(PrinterSetup);
btnTest_print->setObjectName(QString::fromUtf8("btnTest_print"));
btnTest_print->setGeometry(QRect(10, 388, 82, 30));
btnHeader_revert = new QPushButton(PrinterSetup);
btnHeader_revert->setObjectName(QString::fromUtf8("btnHeader_revert"));
btnHeader_revert->setGeometry(QRect(275, 71, 40, 40));
QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/revert1.png"), QSize(), QIcon::Normal, QIcon::Off);
btnHeader_revert->setIcon(icon);
btnHeader_revert->setIconSize(QSize(40, 40));
btnHeader_revert->setFlat(true);
btnFooter_revert = new QPushButton(PrinterSetup);
btnFooter_revert->setObjectName(QString::fromUtf8("btnFooter_revert"));
btnFooter_revert->setGeometry(QRect(275, 290, 40, 40));
btnFooter_revert->setIcon(icon);
btnFooter_revert->setIconSize(QSize(40, 40));
btnFooter_revert->setFlat(true);
QWidget::setTabOrder(btnHeader, btnHeader_revert);
QWidget::setTabOrder(btnHeader_revert, btnFooter);
QWidget::setTabOrder(btnFooter, btnFooter_revert);
QWidget::setTabOrder(btnFooter_revert, btnTest_print);
QWidget::setTabOrder(btnTest_print, buttonBox);
retranslateUi(PrinterSetup);
QObject::connect(buttonBox, SIGNAL(accepted()), PrinterSetup, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), PrinterSetup, SLOT(reject()));
QMetaObject::connectSlotsByName(PrinterSetup);
} // setupUi
void retranslateUi(QDialog *PrinterSetup)
{
PrinterSetup->setWindowTitle(QApplication::translate("PrinterSetup", "Dialog", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("PrinterSetup", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Century Schoolbook L'; font-size:14pt; font-weight:600; font-style:normal;\">\n"
"<table border=\"0\" style=\"-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;\">\n"
"<tr>\n"
"<td style=\"border: none;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Sans'; font-size:16pt;\">PRINTER </span></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Sans'; font-size:16pt;\">SETUP</span></p></td></tr></table></body></html>", 0, QApplication::UnicodeUTF8));
btnHeader->setText(QString());
btnFooter->setText(QString());
btnTest_print->setText(QApplication::translate("PrinterSetup", "Test Print", 0, QApplication::UnicodeUTF8));
btnHeader_revert->setText(QString());
btnFooter_revert->setText(QString());
} // retranslateUi
};
namespace Ui {
class PrinterSetup: public Ui_PrinterSetup {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_PRINTERSETUP_H
|
b67ac40e6a8bb1d193a2cc885c92a0db50d80d1b | 1e73a7cad11d49f4e7adc39fdb4bf5e5811a5513 | /Sorting and Searching/Q13.cpp | d8bd8f755ee8716d9bc3c6eab3b108a8bab1d7e6 | [] | no_license | amanKumar-144/CSES-Solutions | c1392548079dd29a3cd89ec7dce81ec4a82c3415 | 63591ffd97a0bb236f1e7d4e99049e4dec7c9c3c | refs/heads/main | 2023-04-06T06:59:26.679973 | 2021-04-13T06:50:13 | 2021-04-13T06:50:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,188 | cpp | Q13.cpp | #include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ins insert
#define int long long
#define vii vector<int>
#define pii pair<int,int>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int32_t main()
{
FAST;
int n;cin>>n;
vii a;
for(int i=0;i<n;i++){
int x;cin>>x;
a.pb(x);
}
deque<int>dq;
set<int>s;
dq.push_back(a[0]);
int ans=1;
s.ins(a[0]);
for(int i=1;i<n;i++)
{
if(s.find(a[i])==s.end())
{
s.ins(a[i]);
dq.push_back(a[i]);
if(dq.size()>ans)ans=dq.size();
}
else
{
while(dq.size()>0 && dq.front()!=a[i])
{
auto itr=s.find(dq.front());
s.erase(itr);
dq.pop_front();
}
auto itr=s.find(dq.front());
s.erase(itr);
dq.pop_front();
s.ins(a[i]);
dq.push_back(a[i]);
if(dq.size()>ans)ans=dq.size();
}
}
if(dq.size()>ans)ans=dq.size();
cout<<ans<<endl;
return 0;
} |
d40cf7a481f496bdab14cf2587c936482330496d | 71797a9c0844c7223585449eeabc2278e9c9993c | /include/derplanner/compiler/signature_table.h | 5977ad80fe968389b3014c2d2ff37227eafc556c | [
"Zlib"
] | permissive | miccol/derplanner | e2a724e680f124edeb3dcbde9ed270c91d251c1d | cd5d15acb741f027807796af9a12ed8968b4a91e | refs/heads/master | 2020-04-02T21:28:24.448493 | 2018-10-26T14:19:59 | 2018-10-26T14:19:59 | 154,800,395 | 0 | 0 | Zlib | 2018-10-26T08:13:57 | 2018-10-26T08:13:57 | null | UTF-8 | C++ | false | false | 3,090 | h | signature_table.h | //
// Copyright (c) 2015 Alexander Shafranov shafranov@gmail.com
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef DERPLANNER_COMPILER_SIGNATURE_TABLE_H_
#define DERPLANNER_COMPILER_SIGNATURE_TABLE_H_
#include "derplanner/compiler/types.h"
#include "derplanner/compiler/array.h"
namespace plnnrc {
void init(Signature_Table& table, Memory* mem, uint32_t max_signatures);
void destroy(Signature_Table& table);
// begin building signature.
void begin_signature(Signature_Table& table);
// add parameter type to the currenly built signature, parameter index in tuple is returned.
uint32_t add_param(Signature_Table& table, Token_Type type);
// end building signature, compactify if the same signature was already built.
void end_signature(Signature_Table& table);
// total number of signatures stored in the `table`.
uint32_t size_sparse(const Signature_Table& table);
// the number of unique signatures stored in the `table`.
uint32_t size_dense(const Signature_Table& table);
// returns signature reference given the sparse index.
Signature get_sparse(const Signature_Table& table, uint32_t sparse_index);
// returns signature reference given the dense index.
Signature get_dense(const Signature_Table& table, uint32_t dense_index);
// maps sparse index to dense index.
uint32_t get_dense_index(const Signature_Table& table, uint32_t sparse_index);
}
inline uint32_t plnnrc::size_sparse(const plnnrc::Signature_Table& table)
{
return plnnrc::size(table.remap);
}
inline uint32_t plnnrc::size_dense(const plnnrc::Signature_Table& table)
{
return plnnrc::size(table.hashes);
}
inline plnnrc::Signature plnnrc::get_sparse(const plnnrc::Signature_Table& table, uint32_t sparse_index)
{
uint32_t dense_index = table.remap[sparse_index];
return plnnrc::get_dense(table, dense_index);
}
inline plnnrc::Signature plnnrc::get_dense(const plnnrc::Signature_Table& table, uint32_t dense_index)
{
uint32_t offset = table.offsets[dense_index];
uint32_t length = table.lengths[dense_index];
plnnrc::Signature result = { length > 0 ? &table.types[offset] : 0, length, offset };
return result;
}
inline uint32_t plnnrc::get_dense_index(const plnnrc::Signature_Table& table, uint32_t sparse_index)
{
return table.remap[sparse_index];
}
#endif
|
15593116cf971758b9f405f9ef62c5f7fe9f6f67 | 5e7b8bfa89225e03bc8cdc0723e8756b81b9e008 | /lcsthreestring.cpp | 51a8024445729688e03a564106e4f8f1ec4fbf2b | [] | no_license | shashankch/DataStructures-Algorithms | 3e0137065f878c962a815d17cb7916487ebdeb0b | b6b447ebf4e1a18ec23b94172e844ce0d53f7a14 | refs/heads/master | 2020-09-11T13:55:21.068954 | 2020-05-06T07:24:07 | 2020-05-06T07:24:07 | 222,088,726 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,114 | cpp | lcsthreestring.cpp |
#include <iostream>
#include <cstring>
using namespace std;
int dp[201][201][201];
int lcs3d(char x[], char y[], char z[])
{
int m = strlen(x);
int n = strlen(y);
int p = strlen(z);
///base case
for (int i = 0; i <= m; i++)
{
dp[i][0][0] = 0;
}
for (int i = 0; i <= n; i++)
{
dp[0][i][0] = 0;
}
for (int i = 0; i <= p; i++)
{
dp[0][0][i] = 0;
}
for (int i = 1; i <= m; i++)
{
for (int j = 1; j <= n; j++)
{
for (int k = 1; k <= p; k++)
{
int q = 0;
if (x[i - 1] == y[j - 1] && y[j - 1] == z[k - 1])
{
q = 1 + dp[i - 1][j - 1][k - 1];
}
else
{
q = max(dp[i - 1][j][k], max(dp[i][j - 1][k], dp[i][j][k - 1]));
}
dp[i][j][k] = q;
}
}
}
return dp[m][n][p];
}
int main()
{
char a[200], b[200], c[200];
cin >> a >> b >> c;
int ans = lcs3d(a, b, c);
cout << ans;
return 0;
}
|
f926922b52a66d89ced2702ab4997bd72fc43d2e | cc8927495275b9fbe835c3bd0dc0d4840c909d8b | /3D-21일차/Reference/Header/RenderTargetMgr.h | b0d6724e430e9c9444649c5d54ae5bfb28236a3b | [] | no_license | wjrm600/ClientProject | 4d46376238b17d133e2311aa050c623973ace94d | b8f4e7a5d66e65277a0300d55c502a7f1218fe5f | refs/heads/master | 2023-03-04T05:19:12.626218 | 2021-02-08T23:07:19 | 2021-02-08T23:07:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,273 | h | RenderTargetMgr.h | #ifndef RenderTargetMgr_h__
#define RenderTargetMgr_h__
#include "Engine_Define.h"
#include "Base.h"
#include "RenderTarget.h"
BEGIN(Engine)
class ENGINE_DLL CRenderTargetMgr : public CBase
{
DECLARE_SINGLETON(CRenderTargetMgr)
private:
explicit CRenderTargetMgr(void);
virtual ~CRenderTargetMgr(void);
public:
HRESULT Ready_RenderTarget(LPDIRECT3DDEVICE9 pGraphicDev,
const _tchar* pTargetTag, const _uint& iWidth,
const _uint& iHeight,
D3DFORMAT Format,
D3DXCOLOR Color);
HRESULT Ready_MRT(const _tchar* pMRTTag, const _tchar* pTargetTag);
HRESULT Begin_MRT(const _tchar* pMRTTag);
HRESULT End_MRT(const _tchar* pMRTTag);
HRESULT Ready_DebugBuffer(const _tchar* pTargetTag, const _float& fX, const _float& fY, const _float& fSizeX, const _float& fSizeY);
void Render_DebugBuffer(const _tchar* pMRTTag);
void Throw_RenderTargetTexture(LPD3DXEFFECT& pEffect, const _tchar* pTargetTag, const char* pConstantName);
private:
CRenderTarget* Find_RenderTarget(const _tchar* pTargetTag);
list<CRenderTarget*>* Find_MRT(const _tchar* pMRTTag);
private:
map<const _tchar*, CRenderTarget*> m_mapRenderTarget;
map<const _tchar*, list<CRenderTarget*>> m_mapMRT;
private:
virtual void Free(void);
};
END
#endif // RenderTargetMgr_h__
|
b4bb2c091c58a7f67b6bd5a3a39511d087b45306 | 14fe137c60481ea3ad445ac1da585d9aad0a551b | /PODSampler-v1912/libPOD/lnInclude/main.cpp | 221553f1b4257d53fa7ed93fc25d5f51941a7321 | [] | no_license | maxshatsky/libDataAnalysis | 7eec4384cfee085e2601b15cff70fada8b8154be | 0d17b0678c7881a7f0c46bb7a87ec2a746b01486 | refs/heads/master | 2021-07-09T15:01:03.778585 | 2020-09-07T09:53:36 | 2020-09-07T09:53:36 | 192,750,658 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 48 | cpp | main.cpp | ../thirdparty/Eigen/bench/btl/libs/mtl4/main.cpp |
12b8558ef29a70d67ed9b8dee114d47455925407 | 7eb522b0c569fbedc724b34c31ea9708a098a824 | /Bearlet/Interactive.hpp | 3032f098ea4678baa6f5346791ae4adbe92c4404 | [] | no_license | BookmanHan/Bearlet | c5b4069dc635666bf9572b261eae9d4f9f6e8832 | 045e2bff82b899301701f7ef8ea967c4e51b1458 | refs/heads/master | 2021-07-08T19:58:54.650758 | 2017-10-08T04:43:02 | 2017-10-08T04:43:02 | 106,171,954 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 775 | hpp | Interactive.hpp | #pragma once
#include "Import.hpp"
#include "Logging.hpp"
#include "File.hpp"
class RemoteCommander
{
protected:
map<string, function<void(FormatFile&)>> fn_proc;
const string network_path;
public:
RemoteCommander(const string network_path)
:network_path(network_path)
{
;
}
public:
void registe(const string command_name, function<void(FormatFile&)> fn_parameter)
{
fn_proc[command_name] = fn_parameter;
}
public:
void send(const string command_name, function<void(FormatFile&)> fn_parameter)
{
FormatFile file(network_path, ios::out, sNetwork);
file << command_name;
fn_parameter(file);
}
void recieve()
{
FormatFile file(network_path, ios::in, sNetwork);
string command_name;
file >> command_name;
fn_proc[command_name](file);
}
};
|
b62e5fb9992ce34092ccab47947dbccfc630bee9 | 26a71000a382332b3859742fb5591202cba67a35 | /URK96/TrafficLightsDetect/exam_cv.cpp | 40fab96812a1b0c27ce8d8737b5534256cc5d894 | [] | no_license | URK96/EmbeddedCar | 5afe018ee035d7f50447708669959ff160d20f44 | 6052b0ceefc9321bc9bd181847714f1a8766ff8c | refs/heads/master | 2020-07-02T04:16:41.006584 | 2019-09-27T15:34:51 | 2019-09-27T15:34:51 | 201,413,250 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,531 | cpp | exam_cv.cpp |
#include <iostream>
#include <stdio.h>
#include <string.h>
//#include <sys/time.h>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/gpu/device/utility.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include "exam_cv.h"
#define PI 3.1415926
#define _ROI_Xmin 0.0f
#define _ROI_Xmax 1.0f
#define _ROI_Ymin 0.5f
#define _ROI_Ymin_max 0.6f
#define _ROI_Ymax 0.9f
/* Red Detection Threshold */
#define Red_lowH 170
#define Red_highH 175
#define Red_lowS 50
#define Red_highS 255
#define Red_lowV 90
#define Red_highV 255
/* Yellow Detection Threshold */
#define Yellow_lowH 25
#define Yellow_highH 30
#define Yellow_lowS 50
#define Yellow_highS 255
#define Yellow_lowV 90
#define Yellow_highV 255
/* Green Detection Threshold */
#define Green_lowH 50
#define Green_highH 80
#define Green_lowS 30
#define Green_highS 255
#define Green_lowV 30
#define Green_highV 255
#define REDa
#define YELLOWa
#define GREEN
using namespace std;
using namespace cv;
typedef enum
{
STRAIGHT,
CURVELEFT,
CURVERIGHT
}DrivingMode;
extern "C" {
/**
* @brief To load image file to the buffer.
* @param file: pointer for load image file in local path
outBuf: destination buffer pointer to load
nw : width v of the destination buffer
nh : height v of the destination buffer
* @retval none
*/
void OpenCV_load_file(char* file, unsigned char* outBuf, int nw, int nh)
{
Mat srcRGB;
Mat dstRGB(nh, nw, CV_8UC3, outBuf);
srcRGB = imread(file, CV_LOAD_IMAGE_COLOR); // rgb
//cvtColor(srcRGB, srcRGB, CV_RGB2BGR);
cv::resize(srcRGB, dstRGB, cv::Size(nw, nh), 0, 0, CV_INTER_LINEAR);
}
/**
* @brief To convert format from BGR to RGB.
* @param inBuf: buffer pointer of BGR image
w: width v of the buffers
h : height v of the buffers
outBuf : buffer pointer of RGB image
* @retval none
*/
void OpenCV_Bgr2RgbConvert(unsigned char* inBuf, int w, int h, unsigned char* outBuf)
{
Mat srcRGB(h, w, CV_8UC3, inBuf);
Mat dstRGB(h, w, CV_8UC3, outBuf);
cvtColor(srcRGB, dstRGB, CV_BGR2RGB);
}
/**
* @brief Detect faces on loaded image and draw circles on the faces of the loaded image.
* @param file: pointer for load image file in local path
outBuf: buffer pointer to draw circles on the detected faces
nw : width v of the destination buffer
nh : height v of the destination buffer
* @retval none
*/
void OpenCV_face_detection(char* file, unsigned char* outBuf, int nw, int nh)
{
Mat srcRGB = imread(file, CV_LOAD_IMAGE_COLOR);
Mat dstRGB(nh, nw, CV_8UC3, outBuf);
// Load Face cascade (.xml file)
CascadeClassifier face_cascade;
face_cascade.load( "haarcascade_frontalface_alt.xml" );
// Detect faces
std::vector<Rect> faces;
face_cascade.detectMultiScale( srcRGB, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );
// Draw circles on the detected faces
for( int i = 0; i < faces.size(); i++ )
{
Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
ellipse( srcRGB, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );
}
cv::resize(srcRGB, dstRGB, cv::Size(nw, nh), 0, 0, CV_INTER_LINEAR);
}
/**
* @brief To bind two images on destination buffer.
* @param file1: file path of first image to bind
file2: file path of second image to bind
outBuf : destination buffer pointer to bind
nw : width v of the destination buffer
nh : height v of the destination buffer
* @retval none
*/
void OpenCV_binding_image(char* file1, char* file2, unsigned char* outBuf, int nw, int nh)
{
Mat srcRGB = imread(file1, CV_LOAD_IMAGE_COLOR);
Mat srcRGB2 = imread(file2, CV_LOAD_IMAGE_COLOR);
Mat dstRGB(nh, nw, CV_8UC3, outBuf);
cv::resize(srcRGB2, srcRGB2, cv::Size(srcRGB2.cols/1.5, srcRGB2.rows/1.5));
cv::Point location = cv::Point(280, 220);
for (int y = std::max(location.y, 0); y < srcRGB.rows; ++y)
{
int fY = y - location.y;
if (fY >= srcRGB2.rows)
break;
for (int x = std::max(location.x, 0); x < srcRGB.cols; ++x)
{
int fX = x - location.x;
if (fX >= srcRGB2.cols)
break;
double opacity = ((double)srcRGB2.data[fY * srcRGB2.step + fX * srcRGB2.channels() + 3]) / 255.;
for (int c = 0; opacity > 0 && c < srcRGB.channels(); ++c)
{
unsigned char overlayPx = srcRGB2.data[fY * srcRGB2.step + fX * srcRGB2.channels() + c];
unsigned char srcPx = srcRGB.data[y * srcRGB.step + x * srcRGB.channels() + c];
srcRGB.data[y * srcRGB.step + srcRGB.channels() * x + c] = srcPx * (1. - opacity) + overlayPx * opacity;
}
}
}
cv::resize(srcRGB, dstRGB, cv::Size(nw, nh), 0, 0, CV_INTER_LINEAR);
}
/**
* @brief Apply canny edge algorithm and draw it on destination buffer.
* @param file: pointer for load image file in local path
outBuf: destination buffer pointer to apply canny edge
nw : width v of destination buffer
nh : height v of destination buffer
* @retval none
*/
void OpenCV_canny_edge_image(char* file, unsigned char* outBuf, int nw, int nh)
{
Mat srcRGB = imread(file, CV_LOAD_IMAGE_COLOR);
Mat srcGRAY;
Mat dstRGB(nh, nw, CV_8UC3, outBuf);
cvtColor(srcRGB, srcGRAY, CV_BGR2GRAY);
// �ɴ� �˰����� ����
cv::Mat contours;
cv::Canny(srcGRAY, // ���̷��� ����
contours, // ��� �ܰ���
125, // ���� ��谪
350); // ���� ��谪
// ������ ȭ�ҷ� �ܰ����� ǥ���ϹǷ� ��� ���� ����
//cv::Mat contoursInv; // ���� ����
//cv::threshold(contours, contoursInv, 128, 255, cv::THRESH_BINARY_INV);
// ��� ���� 128���� ������ 255�� �ǵ��� ����
cvtColor(contours, contours, CV_GRAY2BGR);
cv::resize(contours, dstRGB, cv::Size(nw, nh), 0, 0, CV_INTER_LINEAR);
}
/**
* @brief Detect the hough and draw hough on destination buffer.
* @param srcBuf: source pointer to hough transform
iw: width v of source buffer
ih : height v of source buffer
outBuf : destination pointer to hough transform
nw : width v of destination buffer
nh : height v of destination buffer
* @retval none
*/
DriveLine OpenCV_hough_transform(unsigned char* srcBuf, int iw, int ih, unsigned char* outBuf, int nw, int nh, int* mode)
{
CvPoint ptv = {0,0};
Scalar lineColor = cv::Scalar(255, 0, 0);
Scalar yellow(131, 232, 252);
DriveLine dLine;
Mat dstRGB(nh, nw, CV_8UC3, outBuf);
Mat srcRGB(ih, iw, CV_8UC3, srcBuf);
Mat srcHSV;
Mat dstHSV;
Mat resRGB(ih, iw, CV_8UC3);
cvtColor(srcRGB, srcHSV, CV_BGR2HSV);
IplImage *iplImage = new IplImage(srcHSV);
IplImage *dstImage = new IplImage(srcHSV);
int i, j;
const unsigned char HUE = 0, SAT = 1, VAL = 2;
unsigned int colorCount = 0;
#ifdef RED
for (i = 0; i < iplImage->height; i++)
{
for (j = 0; j < iplImage->width; j++)
{
if (
((unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] >= Red_lowH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] <= Red_highH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] >= Red_lowS &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] <= Red_highS) &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] >= Red_lowV &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] <= Red_highV
)
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)255;
}
else // elsewhere
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)0;
}
}
}
#endif
#ifdef YELLOW
for (i = 0; i < iplImage->height; i++)
{
for (j = 0; j < iplImage->width; j++)
{
if (
((unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] >= Yellow_lowH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] <= Yellow_highH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] >= Yellow_lowS &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] <= Yellow_highS) &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] >= Yellow_lowV &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] <= Yellow_highV
)
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)255;
}
else // elsewhere
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)0;
}
}
}
#endif
#ifdef GREEN
for (i = 0; i < iplImage->height; i++)
{
for (j = 0; j < iplImage->width; j++)
{
if (
((unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] >= Green_lowH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + HUE] <= Green_highH &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] >= Green_lowS &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + SAT] <= Green_highS) &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] >= Green_lowV &&
(unsigned char)iplImage->imageData[i*iplImage->widthStep + 3 * j + VAL] <= Green_highV
)
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)255;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)255;
colorCount++;
}
else // elsewhere
{
dstImage->imageData[i*dstImage->widthStep + 3 * j + HUE] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + SAT] = (unsigned char)0;
dstImage->imageData[i*dstImage->widthStep + 3 * j + VAL] = (unsigned char)0;
}
}
}
#endif
cout << "Green Lights : " << colorCount << endl;
dstHSV = cvarrToMat(dstImage);
cv::resize(dstHSV, dstRGB, cv::Size(nw, nh), 0, 0, CV_INTER_LINEAR);
return dLine;
}
CvPoint CalVanishPoint(CvPoint pt1, CvPoint pt2, CvPoint pt3, CvPoint pt4)
{
CvPoint ptv = {0,0};
ptv.x = 320 * (pt3.y-pt1.y) / (pt2.y-pt1.y+pt3.y-pt4.y);
ptv.y = (pt2.y-pt1.y) * ptv.x / 320 + pt1.y;
return ptv;
}
/**
* @brief Merge two source images of the same size into the output buffer.
* @param src1: pointer to parameter of rgb32 image buffer
src2: pointer to parameter of bgr32 image buffer
dstImage : pointer to parameter of rgb32 output buffer
w : width of src and dstImage buffer
h : height of src and dstImage buffer
* @retval none
*/
void OpenCV_merge_image(unsigned char* src1, unsigned char* src2, unsigned char* dstImage, int w, int h)
{
Mat src1AR32(h, w, CV_8UC4, src1);
Mat src2AR32(h, w, CV_8UC4, src2);
Mat dstAR32(h, w, CV_8UC4, dstImage);
cvtColor(src2AR32, src2AR32, CV_BGRA2RGBA);
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
double opacity = ((double)(src2AR32.data[y * src2AR32.step + x * src2AR32.channels() + 3])) / 255.;
for (int c = 0; opacity > 0 && c < src1AR32.channels(); ++c) {
unsigned char overlayPx = src2AR32.data[y * src2AR32.step + x * src2AR32.channels() + c];
unsigned char srcPx = src1AR32.data[y * src1AR32.step + x * src1AR32.channels() + c];
src1AR32.data[y * src1AR32.step + src1AR32.channels() * x + c] = srcPx * (1. - opacity) + overlayPx * opacity;
}
}
}
memcpy(dstImage, src1AR32.data, w*h*4);
}
}
|
8153220cca53e710b9787b695b2193dc3519528b | 11d021d531b9fec3fa782131e89233c8d2e3169d | /sokoban-cpp/DeadlockDetection.cpp | 1349b8a4f544e9dd3bdcc5f941cd25ffec99d645 | [] | no_license | atopion/sokoban | a2992eeaf49a1fbdede6630992696dcdf05cfd89 | bfab7b0f4fc1f18b15b14333c1ddbd9621fbecc2 | refs/heads/master | 2020-04-15T18:52:00.996313 | 2019-04-14T19:44:12 | 2019-04-14T19:44:12 | 164,928,759 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,062 | cpp | DeadlockDetection.cpp | //
// Created by atopi on 27.11.2018.
//
#include <iostream>
#include "DeadlockDetection.h"
DeadlockDetection::DeadlockDetection(int *game_map, int size, int width, int *target_array, int targetCount)
{
DeadlockDetection::game_map = game_map;
DeadlockDetection::target_array = target_array;
DeadlockDetection::size = size;
DeadlockDetection::width = width;
DeadlockDetection::targetCount = targetCount;
DeadlockDetection::deadlock_array = new int[size];
detect_pull();
}
DeadlockDetection::~DeadlockDetection()
{
delete[] deadlock_array;
}
bool DeadlockDetection::lookup(int a)
{
if(a < 0 || a >= size) return true;
return deadlock_array[a] == 1;
}
void DeadlockDetection::detect_pull()
{
int *vi = new int[size];
for(int i = 0; i < size; i++)
vi[i] = 0;
for(int i = 0; i < targetCount; i++)
DeadlockDetection::reku_pull(DeadlockDetection::target_array[i], vi);
for(int i = 0; i < size; i++)
{
if (vi[i] == 0)
DeadlockDetection::deadlock_array[i] = 1;
else
DeadlockDetection::deadlock_array[i] = 0;
}
delete[] vi;
}
void DeadlockDetection::reku_pull(int a, int *visited)
{
if(a < 0 || a > size)
return;
if(visited[a] == 1)
return;
visited[a] = 1;
if(game_map[a] == 4)
return;
if(a+2 < size && game_map[a+1] != 4 && game_map[a+2] != 4)
reku_pull(a+1, visited);
if(a-2 >= 0 && game_map[a-1] != 4 && game_map[a-2] != 4)
reku_pull(a-1, visited);
if(a + 2*width < size && game_map[a+width] != 4 && game_map[a+2*width] != 4)
reku_pull(a+width, visited);
if(a - 2*width >= 0 && game_map[a-width] != 4 && game_map[a-2*width] != 4)
reku_pull(a-width, visited);
}
// DEBUG
void DeadlockDetection::printMap()
{
for(int i = 0; i < size; i++)
{
std::cout << deadlock_array[i];
if(i % width == width -1)
std::cout << std::endl;
}
} |
790dfa4f7044f4d4e35691ce11246d11c680a472 | c732e95f868dfe1b12760a11bab15c15216a27bf | /tools/unscrew/unscrew.cc | e7f806d9b82e7e26d1c3fce618f50a08fc81a49c | [
"MIT"
] | permissive | baulk/baulk | 9fb2414533297cbee62f13a46de5c8a0eb57b200 | a501b7a16f909b39724a8362dba868ca69f66602 | refs/heads/master | 2023-08-03T22:57:14.537212 | 2023-07-30T13:46:50 | 2023-07-30T13:46:50 | 245,962,600 | 354 | 42 | MIT | 2023-07-30T13:46:51 | 2020-03-09T06:44:10 | C | UTF-8 | C++ | false | false | 8,163 | cc | unscrew.cc | #include "unscrew.hpp"
#include <bela/picker.hpp>
#include <bela/parseargv.hpp>
#include <baulk/fs.hpp>
#include <shellapi.h>
#include <ShlObj_core.h>
#include <CommCtrl.h>
#include <Objbase.h>
#include <version.hpp>
namespace baulk {
constexpr auto AppTitle = L"Unscrew - Baulk modern extractor";
class UnscrewProgressBar : public ProgressBar {
public:
UnscrewProgressBar() = default;
UnscrewProgressBar(const UnscrewProgressBar &) = delete;
UnscrewProgressBar &operator=(const UnscrewProgressBar &) = delete;
~UnscrewProgressBar() {
if (bar && initialized) {
bar->StopProgressDialog();
}
}
bool NewProgresBar(bela::error_code &ec) {
if (CoCreateInstance(CLSID_ProgressDialog, nullptr, CLSCTX_INPROC_SERVER, IID_IProgressDialog, (void **)&bar) !=
S_OK) {
ec = bela::make_system_error_code(L"CoCreateInstance ");
return false;
}
return true;
}
bool Title(const std::wstring &title) {
if (bar->SetTitle(title.data()) != S_OK) {
return false;
}
if (!initialized) {
if (bar->StartProgressDialog(nullptr, nullptr, PROGDLG_AUTOTIME, nullptr) != S_OK) {
return false;
}
initialized = true;
}
return true;
}
bool Update(ULONGLONG ullCompleted, ULONGLONG ullTotal) {
// update
return bar->SetProgress64(ullCompleted, ullTotal) == S_OK;
}
bool UpdateLine(DWORD dwLineNum, const std::wstring &text, BOOL fCompactPath) {
//
return bar->SetLine(dwLineNum, text.data(), fCompactPath, nullptr) == S_OK;
}
bool Cancelled() { return bar->HasUserCancelled() == TRUE; }
private:
bela::comptr<IProgressDialog> bar;
bool initialized{false};
};
inline std::wstring_view strip_extension(const std::filesystem::path &filename) {
return baulk::archive::PathStripExtension(filename.native());
}
std::optional<std::filesystem::path> make_unqiue_extracted_destination(const std::filesystem::path &archive_file,
std::filesystem::path &strict_folder) {
std::error_code e;
auto parent_path = archive_file.parent_path();
strict_folder = baulk::archive::PathStripExtension(archive_file.filename().native());
auto d = parent_path / strict_folder;
if (!std::filesystem::exists(d, e)) {
return std::make_optional(std::move(d));
}
for (int i = 1; i < 100; i++) {
d = parent_path / bela::StringCat(strict_folder, L"-(", i, L")");
if (!std::filesystem::exists(d, e)) {
return std::make_optional(std::move(d));
}
}
return std::nullopt;
}
bool Executor::make_flat(const std::filesystem::path &dest) {
if (!flat) {
return true;
}
bela::error_code ec;
return baulk::fs::MakeFlattened(dest, ec);
}
bool Executor::Execute(bela::error_code &ec) {
constexpr bela::filter_t filters[] = {
// archives
{L"Zip Archive (*.zip)", L"*.zip"}, // zip archives
{L"Self-extracting Archive (*.exe;*.com;*.dll)", L"*.exe;*.com;*.dll"},
{L"7-Zip Archive (*.7z)", L"*.7z"},
{L"MSIX Package (*.appx;*.msix;*.msixbundle)", L"*.appx;*.msix;*.msixbundle"}, // msix archives
{L"OpenXML Archive (*.pptx;*.docx;*.xlsx)", L"*.pptx;*.docx;*.xlsx"}, // office archives
{L"NuGet Package (*.nupkg)", L"*.nupkg"}, // nuget
{L"Unix Archive (*.tar;*.gz;*.zstd;*.xz;*.bz2;*.br)", L"*.tar;*.gz;*.zstd;*.xz;*.bz2;*.br"},
{L"Java Archive (*.jar)", L"*.jar"},
{L"Windows Installer Package (*.msi;*.msp)", L"*.msi;*.msp"},
{L"All Files (*.*)", L"*.*"}
//
};
if (archive_files.empty()) {
auto file = bela::FilePicker(nullptr, L"Extract archive", filters);
if (!file) {
return false;
}
archive_files.emplace_back(*file);
}
UnscrewProgressBar bar;
if (!bar.NewProgresBar(ec)) {
return false;
}
std::filesystem::path strict_folder;
if (archive_files.size() == 1) {
if (destination.empty()) {
const auto &archive_file = archive_files[0];
auto d = make_unqiue_extracted_destination(archive_file, strict_folder);
if (!d) {
ec = bela::make_error_code(bela::ErrGeneral, L"destination '", strict_folder, L"' already exists");
return false;
}
destination = std::move(*d);
}
auto e = MakeExtractor(archive_files[0], destination, opts, ec);
if (!e) {
return false;
}
if (!e->Extract(&bar, ec)) {
return false;
}
return make_flat(destination);
}
// Extracting multiple archives will ignore destination
for (const auto &archive_file : archive_files) {
auto destination_ = make_unqiue_extracted_destination(archive_file, strict_folder);
if (!destination_) {
continue;
}
auto e = MakeExtractor(archive_file, *destination_, opts, ec);
if (!e) {
return false;
}
if (!e->Extract(&bar, ec)) {
return false;
}
make_flat(*destination_);
}
return true;
} // namespace baulk
void uncrew_usage() {
constexpr wchar_t usage[] = LR"(Unscrew - Baulk modern extractor
Usage: unscrew [option] ...
-h|--help
Show usage text and quit
-v|--version
Show version number and quit
-V|--verbose
Make the operation more talkative
-d|--destination
Set archive extracted destination (extracting multiple archives will be ignored)
-z|--flat
Make destination folder to flat
)";
bela::BelaMessageBox(nullptr, AppTitle, usage, BAULK_APPLINK, bela::mbs_t::ABOUT);
}
bool Executor::ParseArgv(bela::error_code &ec) {
int Argc = 0;
auto Argv = CommandLineToArgvW(GetCommandLineW(), &Argc);
if (Argv == nullptr) {
ec = bela::make_system_error_code();
return false;
}
auto closer = bela::finally([&] { LocalFree(Argv); });
std::error_code e;
bela::ParseArgv pa(Argc, Argv);
pa.Add(L"help", bela::no_argument, L'h')
.Add(L"version", bela::no_argument, L'v')
.Add(L"verbose", bela::no_argument, L'V')
.Add(L"destination", bela::required_argument, L'd')
.Add(L"flat", bela::no_argument, L'z');
auto ret = pa.Execute(
[&](int val, const wchar_t *oa, const wchar_t *) {
switch (val) {
case 'h':
uncrew_usage();
ExitProcess(0);
case 'v':
bela::BelaMessageBox(nullptr, AppTitle, BAULK_APPVERSION, BAULK_APPLINK, bela::mbs_t::ABOUT);
ExitProcess(0);
case 'V':
debugMode = true;
break;
case 'd':
destination = std::filesystem::absolute(oa, e);
break;
case 'z':
flat = true;
break;
default:
break;
}
return true;
},
ec);
if (!ret) {
return false;
}
for (const auto s : pa.UnresolvedArgs()) {
archive_files.emplace_back(std::filesystem::absolute(s, e));
}
return true;
}
} // namespace baulk
class dot_global_initializer {
public:
dot_global_initializer() {
if (FAILED(::CoInitialize(nullptr))) {
::MessageBoxW(nullptr, L"CoInitialize() failed", L"COM initialize failed", MB_OK | MB_ICONERROR);
ExitProcess(1);
}
}
dot_global_initializer(const dot_global_initializer &) = delete;
dot_global_initializer &operator=(const dot_global_initializer &) = delete;
~dot_global_initializer() { ::CoUninitialize(); }
private:
};
// Main
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int nCmdShow) {
dot_global_initializer di;
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
INITCOMMONCONTROLSEX info = {sizeof(INITCOMMONCONTROLSEX),
ICC_TREEVIEW_CLASSES | ICC_COOL_CLASSES | ICC_LISTVIEW_CLASSES};
InitCommonControlsEx(&info);
baulk::Executor executor;
bela::error_code ec;
if (!executor.ParseArgv(ec)) {
bela::BelaMessageBox(nullptr, baulk::AppTitle, ec.data(), BAULK_APPLINK, bela::mbs_t::FATAL);
return 0;
}
ec.clear();
if (!executor.Execute(ec) && ec && ec != bela::ErrCanceled) {
bela::BelaMessageBox(nullptr, baulk::AppTitle, ec.data(), BAULK_APPLINK, bela::mbs_t::FATAL);
return 1;
}
return 0;
} |
99bbd064fdf9c6452a4051363b85acb37fbba1c7 | ab5b7ba525ab83f7bc42bbb85a24096be8c709c4 | /src/engine/texture.cpp | 85828a6cc9f28ff91a593644cdf9d7140c249e7e | [] | no_license | Antonito/ColdCube | 88effb3c423edf57c8b2aa2fccae8627f6952e57 | b0b3967bb5a63f8a0de59104f182319499aa4293 | refs/heads/master | 2016-09-01T11:09:46.052496 | 2016-04-14T11:16:16 | 2016-04-14T11:16:16 | 54,876,510 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,220 | cpp | texture.cpp | #include "engine/texture.hpp"
#include <cassert>
#include <iostream>
Texture::Texture()
{
m_texture = 0;
m_temp = true;
}
Texture::Texture(const unsigned char *imgData, int width, int height, bool temp)
{
if (imgData == NULL)
{
std::cerr << "Invalid image data: aborting" << std::endl;
exit(1);
}
m_temp = temp;
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgData);
}
Texture::Texture(SDL_Surface *surface)
{
if (surface == NULL)
{
std::cerr << "Invalid SDL_Surface: aborting" << std::endl;
exit(1);
}
m_temp = false;
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
int mode = GL_RGB;
if (surface->format->BytesPerPixel == 4)
mode = GL_RGBA;
glTexImage2D(GL_TEXTURE_2D, 0, mode, surface->w, surface->h, 0, mode, GL_UNSIGNED_BYTE, surface->pixels);
}
Texture::~Texture()
{
if (m_texture && !m_temp)
glDeleteTextures(1, &m_texture);
}
void Texture::Bind(unsigned int unit)
{
assert(unit <= 31);
glActiveTexture(GL_TEXTURE0 + unit);
glBindTexture(GL_TEXTURE_2D, m_texture);
}
|
b659066c76655cb4fb6a79edbc7471431953047a | 33b2774e1098655ba8ba977ea1c176cc53390356 | /Engine/Source/Wolf.DirectX/Wolf.DirectX.Shared/W_GraphicsResource/W_Shaders/W_Shader.h | 07cfa24557ccfbe84c9fd3e11315ee33b570c1bd | [
"MIT"
] | permissive | PeymanTahghighi/WolfEngine | ffae1588142d14582818ab08865f08cf8faf2934 | 12bc0dd5171e296f0b51bad74809cb44d47a0bf9 | refs/heads/master | 2023-04-24T17:45:54.979261 | 2015-05-08T08:57:30 | 2015-05-08T08:57:30 | 40,711,980 | 1 | 0 | null | 2015-08-14T11:35:51 | 2015-08-14T11:35:51 | null | UTF-8 | C++ | false | false | 3,552 | h | W_Shader.h | /*
Project : Wolf PlayOut, powered by Wolf Engine Copyright (c) Pooya Eimandar. https://github.com/PooyaEimandar/WolfEngine
Please direct any bug to hello@WolfStudio.co
File Name : W_Shader.h
File Description : A class which is responsible to manage shaders for materials
Comment :
*/
#pragma once
#include "W_GraphicsDeviceManager.h"
#include "W_GraphicsResource\W_Geometries\W_VertexTypes.h"
#include <W_IO.h>
#include <W_Logger.h>
enum W_ShaderType : byte
{
VertexShader,
PixelShader,
GeometryShader,
DomainShader,
HullShader,
ComputeShader
};
namespace Wolf
{
namespace Graphics
{
class W_Shader : public System::W_Object
{
public:
API W_Shader(const std::shared_ptr<Graphics::W_GraphicsDevice>& gDevice);
API virtual ~W_Shader();
//Create vertex shader from binary file
virtual HRESULT CreateVertexShader(const void* bytes, SIZE_T Length, W_VertexDeclaration VDeclaration);
//create pixel shader from binary file
virtual HRESULT CreatePixelShader(const void* bytes, SIZE_T Length);
//Load a shader from file path
static HRESULT LoadShader(std::wstring path, W_ShaderType shaderType, W_VertexDeclaration vDeclaration, _Inout_ W_Shader* shader);
//Apply shader, this must be called before drawing primitives
void Apply();
virtual ULONG Release() override;
#pragma region Getters
//Get the pixel shader
ID3D11PixelShader* GetPixelShader() const { return this->pShader.Get(); }
#pragma endregion
#pragma region Setters
//Set vertex shader
virtual void SetVertexShader(_In_ ID3D11VertexShader* VS);
//Set pixel shader
virtual void SetPixelShader(_In_ ID3D11PixelShader* PS);
//Set constant buffer
virtual void SetConstantBuffer(UINT startSlot, UINT numBuffer, _In_ ID3D11Buffer* CBuffer);
//Set input layout
virtual void SetInputLayout(ID3D11InputLayout* value);
//Set the shader resource view
virtual void SetSRV(UINT startSLot, UINT numViews, _In_ ID3D11ShaderResourceView* srv);
#pragma endregion
//static Concurrency::task<void> LoadShaderAsync(Platform::String^ path, ShaderType shaderType,
// VertexDeclaration VDeclaration, _Inout_ Shader^ &shader)
//{
// return DX::ReadFileAsync(path)
// .then([shaderType, VDeclaration, shader](Array<byte>^ bytes)
// {
// switch (shaderType)
// {
// case ShaderType::VertexShader:
// shader->CreateVertexShader(bytes->Data, bytes->Length, VDeclaration);
// break;
// case ShaderType::PixelShader:
// shader->CreatePixelShader(bytes->Data, bytes->Length);
// break;
// case ShaderType::HullShader:
// //Not implemented
// break;
// case ShaderType::DomainShader:
// //Not implemented
// break;
// case ShaderType::GeometryShader:
// //Not implemented
// break;
// case ShaderType::ComputeShader:
// //Not implemented
// break;
// default:
// throw ref new Exception(0, "Unknown shader type");
// }
// });
//}
private:
std::shared_ptr<Graphics::W_GraphicsDevice> gDevice;
Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
Microsoft::WRL::ComPtr<ID3D11VertexShader> vShader;
Microsoft::WRL::ComPtr<ID3D11PixelShader> pShader;
HRESULT CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC*, const UINT, const void*, const SIZE_T);
HRESULT ChooseInputLayout(W_VertexDeclaration, const void*, const SIZE_T);
};
}
}
|
df9880fc2b305773de17cd079a8acf0aec7946e8 | 165f53197dec266a2b6727b73a3e6580366eea8e | /src/leveldb/include/leveldb/raw_key_operator.h | ed790b16c0d8d5336ea4c9d41a55526990a79dee | [
"BSD-3-Clause"
] | permissive | bluebore/tera | 6b4c438ea1a84a8c7b0765206650ceb943daf3fc | 22ba0afaca3e5a505e3a461bfa880ec79b52b10c | refs/heads/master | 2021-01-17T07:51:51.010591 | 2017-01-03T05:54:12 | 2017-01-03T05:54:12 | 19,900,391 | 7 | 1 | null | 2015-12-16T01:47:55 | 2014-05-18T01:40:43 | C++ | UTF-8 | C++ | false | false | 1,353 | h | raw_key_operator.h | // Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TERA_LEVELDB_UTILS_RAW_KEY_OPERATOR_H
#define TERA_LEVELDB_UTILS_RAW_KEY_OPERATOR_H
#include <stdint.h>
#include "leveldb/slice.h"
#include "leveldb/tera_key.h"
namespace leveldb {
class RawKeyOperator {
public:
virtual void EncodeTeraKey(const std::string& row_key,
const std::string& family,
const std::string& qualifier,
int64_t timestamp,
TeraKeyType type,
std::string* tera_key) const = 0;
virtual bool ExtractTeraKey(const Slice& tera_key,
Slice* row_key,
Slice* family,
Slice* qualifier,
int64_t* timestamp,
TeraKeyType* type) const = 0;
virtual int Compare(const Slice& key1,
const Slice& key2) const = 0;
};
const RawKeyOperator* ReadableRawKeyOperator();
const RawKeyOperator* BinaryRawKeyOperator();
const RawKeyOperator* KvRawKeyOperator();
} // namespace leveldb
#endif //TERA_LEVELDB_UTILS_RAW_KEY_OPERATOR_H
|
84d70dcb811c8b00875f6963765c8954cbc411fb | 08108ee94bee520603eff660cbef59c041b017c2 | /Desafio_23.1,_Suma_de_Digitos.cpp | 61012890a0679e92953b464691a0a1a51e821c04 | [] | no_license | XarthDaichi/Ejercicios-de-Funda | a29d9c62b247399efd3193a67281f674620ba540 | 216653ebba93d6cc1e629b133bfc46b1ed29b4a1 | refs/heads/main | 2023-06-11T23:16:43.546777 | 2021-07-09T05:14:56 | 2021-07-09T05:14:56 | 356,979,691 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 596 | cpp | Desafio_23.1,_Suma_de_Digitos.cpp | //Diego Quiros A, Andres Gonzalez y Sebastian Peñaranda
/*Escribir una funcion en el Lenguaje C++ que reciba como parametros un numero
entero n y devuelva el valor de la suma de sus digitos.
Por ejemplo, si n es 2464, la suma de sus digitos es 16.
*/
#include <iostream>
using namespace std;
int sumaDeDigitos(int n) {
int suma = 0;
while (n != 0) {
suma += n%10;
n /= 10;
}
return suma;
}
int main(int argc, char *argv[]) {
int numero;
cout << "Cual es el numero? ";
cin >> numero;
cout << "La suma de los digitos son: " << sumaDeDigitos(numero) << endl;
return 0;
}
|
1758c52fa206b5ea8b7744790818c530b49dd0b8 | d03d052c0ca220d06ec17d170e2b272f4e935a0c | /gen/mojo/services/sensors/interfaces/sensors.mojom-common.cc | e9d9bb272c0144a571ed8174b8e6ae64e976b0da | [
"Apache-2.0"
] | permissive | amplab/ray-artifacts | f7ae0298fee371d9b33a40c00dae05c4442dc211 | 6954850f8ef581927df94be90313c1e783cd2e81 | refs/heads/master | 2023-07-07T20:45:43.526694 | 2016-08-06T19:53:55 | 2016-08-06T19:53:55 | 65,099,400 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 39,213 | cc | sensors.mojom-common.cc | // NOTE: This file was generated by the Mojo bindings generator.
#include "mojo/services/sensors/interfaces/sensors.mojom-common.h"
#include <math.h>
#include <ostream>
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
#include "mojo/public/cpp/bindings/lib/map_serialization.h"
#include "mojo/public/cpp/bindings/lib/message_builder.h"
#include "mojo/public/cpp/bindings/lib/message_validation.h"
#include "mojo/public/cpp/bindings/lib/string_serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "mojo/public/cpp/environment/logging.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
namespace sensors {
// --- Constants ---
namespace internal {
// --- Struct definitions ---
// static
SensorData_Data* SensorData_Data::New(mojo::internal::Buffer* buf) {
return new (buf->Allocate(sizeof(SensorData_Data))) SensorData_Data();
}
// static
mojo::internal::ValidationError SensorData_Data::Validate(
const void* data,
mojo::internal::BoundsChecker* bounds_checker,
std::string* err) {
mojo::internal::ValidationError retval;
if (!data)
return mojo::internal::ValidationError::NONE;
retval = ValidateStructHeaderAndClaimMemory(data, bounds_checker, err);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
const SensorData_Data* object = static_cast<const SensorData_Data*>(data);
static const struct {
uint32_t version;
uint32_t num_bytes;
} kVersionSizes[] = {{ 0, 32 }};
if (object->header_.version <=
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].version) {
// Scan in reverse order to optimize for more recent versions.
for (int i = MOJO_ARRAYSIZE(kVersionSizes) - 1; i >= 0; --i) {
if (object->header_.version >= kVersionSizes[i].version) {
if (object->header_.num_bytes == kVersionSizes[i].num_bytes)
break;
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
}
} else if (object->header_.num_bytes <
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].num_bytes) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
{
if (!object->values.offset) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) <<
"null values field in SensorData struct";
return mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER;
}
if (!mojo::internal::ValidateEncodedPointer(&object->values.offset)) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::ILLEGAL_POINTER;
}
const mojo::internal::ArrayValidateParams values_validate_params(
0, false, nullptr);
auto validate_retval =
mojo::Array<float>::Data_::Validate(
mojo::internal::DecodePointerRaw(&object->values.offset),
bounds_checker, &values_validate_params, err);
if (validate_retval != mojo::internal::ValidationError::NONE) {
return validate_retval;
}
}
return mojo::internal::ValidationError::NONE;
}
void SensorData_Data::EncodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
MOJO_CHECK(header_.version == 0);
mojo::internal::Encode(&this->values, handles);
}
void SensorData_Data::DecodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
// NOTE: The memory backing |this| may has be smaller than |sizeof(*this)|, if
// the message comes from an older version.
mojo::internal::Decode(&this->values, handles);
}
SensorData_Data::SensorData_Data() {
header_.num_bytes = sizeof(*this);
header_.version = 0;
}
// --- Union definitions ---
// --- Definitions of the data structs for interface methods ---
// static
SensorListener_OnAccuracyChanged_Params_Data* SensorListener_OnAccuracyChanged_Params_Data::New(mojo::internal::Buffer* buf) {
return new (buf->Allocate(sizeof(SensorListener_OnAccuracyChanged_Params_Data))) SensorListener_OnAccuracyChanged_Params_Data();
}
// static
mojo::internal::ValidationError SensorListener_OnAccuracyChanged_Params_Data::Validate(
const void* data,
mojo::internal::BoundsChecker* bounds_checker,
std::string* err) {
mojo::internal::ValidationError retval;
if (!data)
return mojo::internal::ValidationError::NONE;
retval = ValidateStructHeaderAndClaimMemory(data, bounds_checker, err);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
const SensorListener_OnAccuracyChanged_Params_Data* object = static_cast<const SensorListener_OnAccuracyChanged_Params_Data*>(data);
static const struct {
uint32_t version;
uint32_t num_bytes;
} kVersionSizes[] = {{ 0, 16 }};
if (object->header_.version <=
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].version) {
// Scan in reverse order to optimize for more recent versions.
for (int i = MOJO_ARRAYSIZE(kVersionSizes) - 1; i >= 0; --i) {
if (object->header_.version >= kVersionSizes[i].version) {
if (object->header_.num_bytes == kVersionSizes[i].num_bytes)
break;
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
}
} else if (object->header_.num_bytes <
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].num_bytes) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
return mojo::internal::ValidationError::NONE;
}
void SensorListener_OnAccuracyChanged_Params_Data::EncodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
MOJO_CHECK(header_.version == 0);
}
void SensorListener_OnAccuracyChanged_Params_Data::DecodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
// NOTE: The memory backing |this| may has be smaller than |sizeof(*this)|, if
// the message comes from an older version.
}
SensorListener_OnAccuracyChanged_Params_Data::SensorListener_OnAccuracyChanged_Params_Data() {
header_.num_bytes = sizeof(*this);
header_.version = 0;
}
// static
SensorListener_OnSensorChanged_Params_Data* SensorListener_OnSensorChanged_Params_Data::New(mojo::internal::Buffer* buf) {
return new (buf->Allocate(sizeof(SensorListener_OnSensorChanged_Params_Data))) SensorListener_OnSensorChanged_Params_Data();
}
// static
mojo::internal::ValidationError SensorListener_OnSensorChanged_Params_Data::Validate(
const void* data,
mojo::internal::BoundsChecker* bounds_checker,
std::string* err) {
mojo::internal::ValidationError retval;
if (!data)
return mojo::internal::ValidationError::NONE;
retval = ValidateStructHeaderAndClaimMemory(data, bounds_checker, err);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
const SensorListener_OnSensorChanged_Params_Data* object = static_cast<const SensorListener_OnSensorChanged_Params_Data*>(data);
static const struct {
uint32_t version;
uint32_t num_bytes;
} kVersionSizes[] = {{ 0, 16 }};
if (object->header_.version <=
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].version) {
// Scan in reverse order to optimize for more recent versions.
for (int i = MOJO_ARRAYSIZE(kVersionSizes) - 1; i >= 0; --i) {
if (object->header_.version >= kVersionSizes[i].version) {
if (object->header_.num_bytes == kVersionSizes[i].num_bytes)
break;
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
}
} else if (object->header_.num_bytes <
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].num_bytes) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
{
if (!object->data.offset) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) <<
"null data field in SensorListener_OnSensorChanged_Params struct";
return mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER;
}
if (!mojo::internal::ValidateEncodedPointer(&object->data.offset)) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::ILLEGAL_POINTER;
}
auto validate_retval = SensorData::Data_::Validate(
mojo::internal::DecodePointerRaw(&object->data.offset),
bounds_checker, err);
if (validate_retval != mojo::internal::ValidationError::NONE) {
return validate_retval;
}
}
return mojo::internal::ValidationError::NONE;
}
void SensorListener_OnSensorChanged_Params_Data::EncodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
MOJO_CHECK(header_.version == 0);
mojo::internal::Encode(&this->data, handles);
}
void SensorListener_OnSensorChanged_Params_Data::DecodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
// NOTE: The memory backing |this| may has be smaller than |sizeof(*this)|, if
// the message comes from an older version.
mojo::internal::Decode(&this->data, handles);
}
SensorListener_OnSensorChanged_Params_Data::SensorListener_OnSensorChanged_Params_Data() {
header_.num_bytes = sizeof(*this);
header_.version = 0;
}
// static
SensorService_AddListener_Params_Data* SensorService_AddListener_Params_Data::New(mojo::internal::Buffer* buf) {
return new (buf->Allocate(sizeof(SensorService_AddListener_Params_Data))) SensorService_AddListener_Params_Data();
}
// static
mojo::internal::ValidationError SensorService_AddListener_Params_Data::Validate(
const void* data,
mojo::internal::BoundsChecker* bounds_checker,
std::string* err) {
mojo::internal::ValidationError retval;
if (!data)
return mojo::internal::ValidationError::NONE;
retval = ValidateStructHeaderAndClaimMemory(data, bounds_checker, err);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
const SensorService_AddListener_Params_Data* object = static_cast<const SensorService_AddListener_Params_Data*>(data);
static const struct {
uint32_t version;
uint32_t num_bytes;
} kVersionSizes[] = {{ 0, 24 }};
if (object->header_.version <=
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].version) {
// Scan in reverse order to optimize for more recent versions.
for (int i = MOJO_ARRAYSIZE(kVersionSizes) - 1; i >= 0; --i) {
if (object->header_.version >= kVersionSizes[i].version) {
if (object->header_.num_bytes == kVersionSizes[i].num_bytes)
break;
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
}
} else if (object->header_.num_bytes <
kVersionSizes[MOJO_ARRAYSIZE(kVersionSizes) - 1].num_bytes) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::UNEXPECTED_STRUCT_HEADER;
}
{
const mojo::Handle listener_handle = object->listener.handle;
if (listener_handle.value() == mojo::internal::kEncodedInvalidHandleValue) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "invalid listener field in SensorService_AddListener_Params struct";
return mojo::internal::ValidationError::UNEXPECTED_INVALID_HANDLE;
}
if (!bounds_checker->ClaimHandle(listener_handle)) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "";
return mojo::internal::ValidationError::ILLEGAL_HANDLE;
}
}
return mojo::internal::ValidationError::NONE;
}
void SensorService_AddListener_Params_Data::EncodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
MOJO_CHECK(header_.version == 0);
mojo::internal::EncodeHandle(&this->listener, handles);
}
void SensorService_AddListener_Params_Data::DecodePointersAndHandles(
std::vector<mojo::Handle>* handles) {
// NOTE: The memory backing |this| may has be smaller than |sizeof(*this)|, if
// the message comes from an older version.
mojo::internal::DecodeHandle(&this->listener, handles);
}
SensorService_AddListener_Params_Data::SensorService_AddListener_Params_Data() {
header_.num_bytes = sizeof(*this);
header_.version = 0;
}
} // namespace internal
// --- Request and response validator definitions for interfaces ---
mojo::internal::ValidationError SensorListenerRequestValidator::Validate(
const mojo::Message* message,
std::string* err) {
mojo::internal::ValidationError retval;
if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) {
retval = mojo::internal::ValidateControlRequest(message, err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorListener', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
return mojo::internal::ValidationError::NONE;
}
internal::SensorListener_Base::MessageOrdinals method_ordinal =
static_cast<internal::SensorListener_Base::MessageOrdinals>(message->header()->name);
switch (method_ordinal) {
case internal::SensorListener_Base::MessageOrdinals::OnAccuracyChanged: {
retval = mojo::internal::ValidateMessageIsRequestWithoutResponse(message,
err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorListener', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
retval = mojo::internal::ValidateMessagePayload<
internal::SensorListener_OnAccuracyChanged_Params_Data>(
message, err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorListener', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
return mojo::internal::ValidationError::NONE;
}
case internal::SensorListener_Base::MessageOrdinals::OnSensorChanged: {
retval = mojo::internal::ValidateMessageIsRequestWithoutResponse(message,
err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorListener', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
retval = mojo::internal::ValidateMessagePayload<
internal::SensorListener_OnSensorChanged_Params_Data>(
message, err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorListener', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
return mojo::internal::ValidationError::NONE;
}
default:
break;
}
// Unrecognized message.
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "unknown request message name '"
<< message->header()->name
<< "' for interface "
"'SensorListener'";
ReportValidationError(
mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD, err);
return mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD;
}
mojo::internal::ValidationError SensorServiceRequestValidator::Validate(
const mojo::Message* message,
std::string* err) {
mojo::internal::ValidationError retval;
if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) {
retval = mojo::internal::ValidateControlRequest(message, err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorService', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
return mojo::internal::ValidationError::NONE;
}
internal::SensorService_Base::MessageOrdinals method_ordinal =
static_cast<internal::SensorService_Base::MessageOrdinals>(message->header()->name);
switch (method_ordinal) {
case internal::SensorService_Base::MessageOrdinals::AddListener: {
retval = mojo::internal::ValidateMessageIsRequestWithoutResponse(message,
err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorService', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
retval = mojo::internal::ValidateMessagePayload<
internal::SensorService_AddListener_Params_Data>(
message, err);
if (retval != mojo::internal::ValidationError::NONE) {
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err)
<< "request validation error for interface 'SensorService', "
"message name '" << message->header()->name << "': " <<
(err ? *err : "");
ReportValidationError(retval, err);
return retval;
}
return mojo::internal::ValidationError::NONE;
}
default:
break;
}
// Unrecognized message.
MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err) << "unknown request message name '"
<< message->header()->name
<< "' for interface "
"'SensorService'";
ReportValidationError(
mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD, err);
return mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD;
}
// --- Enums ---
bool SensorType_IsValidValue(SensorType value) {
switch (static_cast<int32_t>(value)) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
return true;
}
return false;
}
std::ostream& operator<<(std::ostream& stream, const SensorType& val) {
return (stream << static_cast<int32_t>(val));
}
// Base interface definitions (Name_, Version_, Constants, Enums)
const uint32_t internal::SensorListener_Base::Version_;
// Constants
// Enums
const char internal::SensorService_Base::Name_[] = "sensors::SensorService";
const uint32_t internal::SensorService_Base::Version_;
// Constants
// Enums
// Struct Constants
// --- Struct builder definitions ---
// static
SensorDataPtr SensorData::New() {
SensorDataPtr rv;
mojo::internal::StructHelper<SensorData>::Initialize(&rv);
return rv;
}
SensorData::SensorData()
: accuracy(),
time_stamp(),
values() {
}
SensorData::~SensorData() {
}
SensorDataPtr SensorData::Clone() const {
SensorDataPtr rv(New());
rv->accuracy = accuracy;
rv->time_stamp = time_stamp;
rv->values = values.Clone();
return rv;
}
bool SensorData::Equals(const SensorData& other) const {
if (!mojo::internal::ValueTraits<int32_t>::Equals(this->accuracy, other.accuracy))
return false;
if (!mojo::internal::ValueTraits<int64_t>::Equals(this->time_stamp, other.time_stamp))
return false;
if (!mojo::internal::ValueTraits<mojo::Array<float>>::Equals(this->values, other.values))
return false;
return true;
}
// --- Union builder definitions ---
// --- Struct Serialization Helpers ---
size_t SensorData::GetSerializedSize() const {
return GetSerializedSize_(*this);
}
bool SensorData::Serialize(void* buf,
size_t buf_size,
size_t* bytes_written) {
MOJO_DCHECK(buf);
mojo::internal::FixedBuffer overlay_buf;
overlay_buf.Initialize(buf, buf_size);
internal::SensorData_Data* output_ptr;
auto err = Serialize_(this, &overlay_buf, &output_ptr);
if (err != mojo::internal::ValidationError::NONE) {
// TODO(vardhan): Once Serialize_() outputs handles that it serialized
// (even partially, if there are failures), we should CHECK fail here if
// handles are non-empty.
MOJO_DLOG(ERROR) << "Could not serialize: " <<
mojo::internal::ValidationErrorToString(err);
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return false;
}
std::vector<mojo::Handle> handles;
output_ptr->EncodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Serialize() does not support handles.";
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return true;
}
bool SensorData::Deserialize(void* buf, size_t buf_size) {
MOJO_DCHECK(buf);
mojo::internal::BoundsChecker checker(buf, buf_size, 0);
std::string* err_str = nullptr;
#if !defined(NDEBUG)
std::string err_str2;
err_str = &err_str2;
#endif
mojo::internal::ValidationError err =
internal::SensorData_Data::Validate(buf, &checker, err_str);
if (err != mojo::internal::ValidationError::NONE) {
MOJO_DLOG(ERROR) << "Deserialization error "
<< mojo::internal::ValidationErrorToString(err)
<< ": " << *err_str;
return false;
}
DeserializeWithoutValidation(buf);
return true;
}
// TODO(vardhan): Make this |buf| a |const void*| once deserialization becomes
// immutable.
void SensorData::DeserializeWithoutValidation(void* buf) {
MOJO_DCHECK(buf);
internal::SensorData_Data* input =
static_cast<internal::SensorData_Data*>(buf);
std::vector<mojo::Handle> handles;
input->DecodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Deserialization does not support handles.";
Deserialize_(input, this);
}
size_t GetSerializedSize_(const SensorData& input) {
size_t size = sizeof(internal::SensorData_Data);
size += GetSerializedSize_(input.values);
return size;
}
mojo::internal::ValidationError Serialize_(
SensorData* input,
mojo::internal::Buffer* buf,
internal::SensorData_Data** output) {
if (input) {
internal::SensorData_Data* result =
internal::SensorData_Data::New(buf);
result->accuracy = input->accuracy;
result->time_stamp = input->time_stamp;
{
const mojo::internal::ArrayValidateParams values_validate_params(
0, false, nullptr);auto retval =mojo::SerializeArray_(&input->values, buf, &result->values.ptr,
&values_validate_params);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
}
if (!result->values.ptr) {
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER, "null values in SensorData struct");
return mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER;
}
*output = result;
} else {
*output = nullptr;
}
return mojo::internal::ValidationError::NONE;
}
void Deserialize_(internal::SensorData_Data* input,
SensorData* result) {
if (input) {
do {
// NOTE: The memory backing |input| may has be smaller than
// |sizeof(*input)| if the message comes from an older version.
result->accuracy = input->accuracy;
result->time_stamp = input->time_stamp;
Deserialize_(input->values.ptr, &result->values);
} while (false);
}
}
// --- Union Serialization Helpers ---
// --- Structs for interface method parameters ---
// static
SensorListener_OnAccuracyChanged_ParamsPtr SensorListener_OnAccuracyChanged_Params::New() {
SensorListener_OnAccuracyChanged_ParamsPtr rv;
mojo::internal::StructHelper<SensorListener_OnAccuracyChanged_Params>::Initialize(&rv);
return rv;
}
SensorListener_OnAccuracyChanged_Params::SensorListener_OnAccuracyChanged_Params()
: accuracy() {
}
SensorListener_OnAccuracyChanged_Params::~SensorListener_OnAccuracyChanged_Params() {
}
SensorListener_OnAccuracyChanged_ParamsPtr SensorListener_OnAccuracyChanged_Params::Clone() const {
SensorListener_OnAccuracyChanged_ParamsPtr rv(New());
rv->accuracy = accuracy;
return rv;
}
bool SensorListener_OnAccuracyChanged_Params::Equals(const SensorListener_OnAccuracyChanged_Params& other) const {
if (!mojo::internal::ValueTraits<int32_t>::Equals(this->accuracy, other.accuracy))
return false;
return true;
}
size_t SensorListener_OnAccuracyChanged_Params::GetSerializedSize() const {
return GetSerializedSize_(*this);
}
bool SensorListener_OnAccuracyChanged_Params::Serialize(void* buf,
size_t buf_size,
size_t* bytes_written) {
MOJO_DCHECK(buf);
mojo::internal::FixedBuffer overlay_buf;
overlay_buf.Initialize(buf, buf_size);
internal::SensorListener_OnAccuracyChanged_Params_Data* output_ptr;
auto err = Serialize_(this, &overlay_buf, &output_ptr);
if (err != mojo::internal::ValidationError::NONE) {
// TODO(vardhan): Once Serialize_() outputs handles that it serialized
// (even partially, if there are failures), we should CHECK fail here if
// handles are non-empty.
MOJO_DLOG(ERROR) << "Could not serialize: " <<
mojo::internal::ValidationErrorToString(err);
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return false;
}
std::vector<mojo::Handle> handles;
output_ptr->EncodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Serialize() does not support handles.";
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return true;
}
bool SensorListener_OnAccuracyChanged_Params::Deserialize(void* buf, size_t buf_size) {
MOJO_DCHECK(buf);
mojo::internal::BoundsChecker checker(buf, buf_size, 0);
std::string* err_str = nullptr;
#if !defined(NDEBUG)
std::string err_str2;
err_str = &err_str2;
#endif
mojo::internal::ValidationError err =
internal::SensorListener_OnAccuracyChanged_Params_Data::Validate(buf, &checker, err_str);
if (err != mojo::internal::ValidationError::NONE) {
MOJO_DLOG(ERROR) << "Deserialization error "
<< mojo::internal::ValidationErrorToString(err)
<< ": " << *err_str;
return false;
}
DeserializeWithoutValidation(buf);
return true;
}
// TODO(vardhan): Make this |buf| a |const void*| once deserialization becomes
// immutable.
void SensorListener_OnAccuracyChanged_Params::DeserializeWithoutValidation(void* buf) {
MOJO_DCHECK(buf);
internal::SensorListener_OnAccuracyChanged_Params_Data* input =
static_cast<internal::SensorListener_OnAccuracyChanged_Params_Data*>(buf);
std::vector<mojo::Handle> handles;
input->DecodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Deserialization does not support handles.";
Deserialize_(input, this);
}
size_t GetSerializedSize_(const SensorListener_OnAccuracyChanged_Params& input) {
size_t size = sizeof(internal::SensorListener_OnAccuracyChanged_Params_Data);
return size;
}
mojo::internal::ValidationError Serialize_(
SensorListener_OnAccuracyChanged_Params* input,
mojo::internal::Buffer* buf,
internal::SensorListener_OnAccuracyChanged_Params_Data** output) {
if (input) {
internal::SensorListener_OnAccuracyChanged_Params_Data* result =
internal::SensorListener_OnAccuracyChanged_Params_Data::New(buf);
result->accuracy = input->accuracy;
*output = result;
} else {
*output = nullptr;
}
return mojo::internal::ValidationError::NONE;
}
void Deserialize_(internal::SensorListener_OnAccuracyChanged_Params_Data* input,
SensorListener_OnAccuracyChanged_Params* result) {
if (input) {
do {
// NOTE: The memory backing |input| may has be smaller than
// |sizeof(*input)| if the message comes from an older version.
result->accuracy = input->accuracy;
} while (false);
}
}
// static
SensorListener_OnSensorChanged_ParamsPtr SensorListener_OnSensorChanged_Params::New() {
SensorListener_OnSensorChanged_ParamsPtr rv;
mojo::internal::StructHelper<SensorListener_OnSensorChanged_Params>::Initialize(&rv);
return rv;
}
SensorListener_OnSensorChanged_Params::SensorListener_OnSensorChanged_Params()
: data() {
}
SensorListener_OnSensorChanged_Params::~SensorListener_OnSensorChanged_Params() {
}
SensorListener_OnSensorChanged_ParamsPtr SensorListener_OnSensorChanged_Params::Clone() const {
SensorListener_OnSensorChanged_ParamsPtr rv(New());
rv->data = data.Clone();
return rv;
}
bool SensorListener_OnSensorChanged_Params::Equals(const SensorListener_OnSensorChanged_Params& other) const {
if (!mojo::internal::ValueTraits<SensorDataPtr>::Equals(this->data, other.data))
return false;
return true;
}
size_t SensorListener_OnSensorChanged_Params::GetSerializedSize() const {
return GetSerializedSize_(*this);
}
bool SensorListener_OnSensorChanged_Params::Serialize(void* buf,
size_t buf_size,
size_t* bytes_written) {
MOJO_DCHECK(buf);
mojo::internal::FixedBuffer overlay_buf;
overlay_buf.Initialize(buf, buf_size);
internal::SensorListener_OnSensorChanged_Params_Data* output_ptr;
auto err = Serialize_(this, &overlay_buf, &output_ptr);
if (err != mojo::internal::ValidationError::NONE) {
// TODO(vardhan): Once Serialize_() outputs handles that it serialized
// (even partially, if there are failures), we should CHECK fail here if
// handles are non-empty.
MOJO_DLOG(ERROR) << "Could not serialize: " <<
mojo::internal::ValidationErrorToString(err);
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return false;
}
std::vector<mojo::Handle> handles;
output_ptr->EncodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Serialize() does not support handles.";
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return true;
}
bool SensorListener_OnSensorChanged_Params::Deserialize(void* buf, size_t buf_size) {
MOJO_DCHECK(buf);
mojo::internal::BoundsChecker checker(buf, buf_size, 0);
std::string* err_str = nullptr;
#if !defined(NDEBUG)
std::string err_str2;
err_str = &err_str2;
#endif
mojo::internal::ValidationError err =
internal::SensorListener_OnSensorChanged_Params_Data::Validate(buf, &checker, err_str);
if (err != mojo::internal::ValidationError::NONE) {
MOJO_DLOG(ERROR) << "Deserialization error "
<< mojo::internal::ValidationErrorToString(err)
<< ": " << *err_str;
return false;
}
DeserializeWithoutValidation(buf);
return true;
}
// TODO(vardhan): Make this |buf| a |const void*| once deserialization becomes
// immutable.
void SensorListener_OnSensorChanged_Params::DeserializeWithoutValidation(void* buf) {
MOJO_DCHECK(buf);
internal::SensorListener_OnSensorChanged_Params_Data* input =
static_cast<internal::SensorListener_OnSensorChanged_Params_Data*>(buf);
std::vector<mojo::Handle> handles;
input->DecodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Deserialization does not support handles.";
Deserialize_(input, this);
}
size_t GetSerializedSize_(const SensorListener_OnSensorChanged_Params& input) {
size_t size = sizeof(internal::SensorListener_OnSensorChanged_Params_Data);
size += input.data.is_null()
? 0
: GetSerializedSize_(*input.data);
return size;
}
mojo::internal::ValidationError Serialize_(
SensorListener_OnSensorChanged_Params* input,
mojo::internal::Buffer* buf,
internal::SensorListener_OnSensorChanged_Params_Data** output) {
if (input) {
internal::SensorListener_OnSensorChanged_Params_Data* result =
internal::SensorListener_OnSensorChanged_Params_Data::New(buf);
{auto retval =Serialize_(input->data.get(),
buf,
&result->data.ptr);
if (retval != mojo::internal::ValidationError::NONE)
return retval;
}
if (!result->data.ptr) {
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER, "null data in SensorListener_OnSensorChanged_Params struct");
return mojo::internal::ValidationError::UNEXPECTED_NULL_POINTER;
}
*output = result;
} else {
*output = nullptr;
}
return mojo::internal::ValidationError::NONE;
}
void Deserialize_(internal::SensorListener_OnSensorChanged_Params_Data* input,
SensorListener_OnSensorChanged_Params* result) {
if (input) {
do {
// NOTE: The memory backing |input| may has be smaller than
// |sizeof(*input)| if the message comes from an older version.
if (input->data.ptr) {
result->data = SensorData::New();
Deserialize_(input->data.ptr, result->data.get());
}
} while (false);
}
}
// static
SensorService_AddListener_ParamsPtr SensorService_AddListener_Params::New() {
SensorService_AddListener_ParamsPtr rv;
mojo::internal::StructHelper<SensorService_AddListener_Params>::Initialize(&rv);
return rv;
}
SensorService_AddListener_Params::SensorService_AddListener_Params()
: type(),
listener() {
}
SensorService_AddListener_Params::~SensorService_AddListener_Params() {
}
bool SensorService_AddListener_Params::Equals(const SensorService_AddListener_Params& other) const {
if (!mojo::internal::ValueTraits<SensorType>::Equals(this->type, other.type))
return false;
if (!mojo::internal::ValueTraits<mojo::InterfaceHandle<SensorListener>>::Equals(this->listener, other.listener))
return false;
return true;
}
size_t SensorService_AddListener_Params::GetSerializedSize() const {
return GetSerializedSize_(*this);
}
bool SensorService_AddListener_Params::Serialize(void* buf,
size_t buf_size,
size_t* bytes_written) {
MOJO_DCHECK(buf);
mojo::internal::FixedBuffer overlay_buf;
overlay_buf.Initialize(buf, buf_size);
internal::SensorService_AddListener_Params_Data* output_ptr;
auto err = Serialize_(this, &overlay_buf, &output_ptr);
if (err != mojo::internal::ValidationError::NONE) {
// TODO(vardhan): Once Serialize_() outputs handles that it serialized
// (even partially, if there are failures), we should CHECK fail here if
// handles are non-empty.
MOJO_DLOG(ERROR) << "Could not serialize: " <<
mojo::internal::ValidationErrorToString(err);
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return false;
}
std::vector<mojo::Handle> handles;
output_ptr->EncodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Serialize() does not support handles.";
if (bytes_written)
*bytes_written = overlay_buf.BytesUsed();
return true;
}
bool SensorService_AddListener_Params::Deserialize(void* buf, size_t buf_size) {
MOJO_DCHECK(buf);
mojo::internal::BoundsChecker checker(buf, buf_size, 0);
std::string* err_str = nullptr;
#if !defined(NDEBUG)
std::string err_str2;
err_str = &err_str2;
#endif
mojo::internal::ValidationError err =
internal::SensorService_AddListener_Params_Data::Validate(buf, &checker, err_str);
if (err != mojo::internal::ValidationError::NONE) {
MOJO_DLOG(ERROR) << "Deserialization error "
<< mojo::internal::ValidationErrorToString(err)
<< ": " << *err_str;
return false;
}
DeserializeWithoutValidation(buf);
return true;
}
// TODO(vardhan): Make this |buf| a |const void*| once deserialization becomes
// immutable.
void SensorService_AddListener_Params::DeserializeWithoutValidation(void* buf) {
MOJO_DCHECK(buf);
internal::SensorService_AddListener_Params_Data* input =
static_cast<internal::SensorService_AddListener_Params_Data*>(buf);
std::vector<mojo::Handle> handles;
input->DecodePointersAndHandles(&handles);
MOJO_CHECK(handles.empty()) << "Deserialization does not support handles.";
Deserialize_(input, this);
}
size_t GetSerializedSize_(const SensorService_AddListener_Params& input) {
size_t size = sizeof(internal::SensorService_AddListener_Params_Data);
return size;
}
mojo::internal::ValidationError Serialize_(
SensorService_AddListener_Params* input,
mojo::internal::Buffer* buf,
internal::SensorService_AddListener_Params_Data** output) {
if (input) {
internal::SensorService_AddListener_Params_Data* result =
internal::SensorService_AddListener_Params_Data::New(buf);
result->type =
static_cast<int32_t>(input->type);
mojo::internal::InterfaceHandleToData(input->listener.Pass(),
&result->listener);
if (!result->listener.handle.is_valid()) {
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(mojo::internal::ValidationError::UNEXPECTED_INVALID_HANDLE, "invalid listener in SensorService_AddListener_Params struct");
return mojo::internal::ValidationError::UNEXPECTED_INVALID_HANDLE;
}
*output = result;
} else {
*output = nullptr;
}
return mojo::internal::ValidationError::NONE;
}
void Deserialize_(internal::SensorService_AddListener_Params_Data* input,
SensorService_AddListener_Params* result) {
if (input) {
do {
// NOTE: The memory backing |input| may has be smaller than
// |sizeof(*input)| if the message comes from an older version.
result->type = static_cast<SensorType>(input->type);
mojo::internal::InterfaceDataToHandle(&input->listener, &result->listener);
} while (false);
}
}
} // namespace sensors
|
afc4376238f91174c6a0d66c3888b2ca640ec9d0 | ddf200f97c24617d2fef7222af03f38401c8b633 | /ThirdParty/Include/Refureku/TypeInfo/Namespace/Namespace.h | b53dcb6429ff6385007a65353911d8a68b1ef2f3 | [] | no_license | jsoysouvanh/RefurekuIntegration | 1061f7481936bfe75b145e1f3cb4395cf4165b78 | 45b7ca9e29beea8340ddaaad7f5e4ce3d60488ba | refs/heads/master | 2023-08-30T06:59:05.653109 | 2021-11-12T14:06:50 | 2021-11-12T14:06:50 | 306,647,737 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,490 | h | Namespace.h | /**
* Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved
*
* This file is part of the Refureku library project which is released under the MIT License.
* See the LICENSE.md file for full license details.
*/
#pragma once
#include "Refureku/TypeInfo/Entity/Entity.h"
#include "Refureku/TypeInfo/Variables/EVarFlags.h"
#include "Refureku/TypeInfo/Functions/EFunctionFlags.h"
#include "Refureku/TypeInfo/Functions/FunctionHelper.h"
namespace rfk
{
//Forward declarations
class Struct;
using Class = Struct;
class Enum;
class Variable;
class Function;
class Archetype;
class Namespace final : public Entity
{
public:
REFUREKU_INTERNAL Namespace(char const* name,
std::size_t id) noexcept;
Namespace(Namespace&&) = delete;
REFUREKU_INTERNAL ~Namespace() noexcept;
/**
* @brief Retrieve a namespace contained in this namespace.
*
* @param name Name of the nested namespace to look for.
*
* @return The found nested namespace if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Namespace const* getNamespaceByName(char const* name) const noexcept;
/**
* @brief Retrieve the first nested namespace satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found namespace satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Namespace const* getNamespaceByPredicate(Predicate<Namespace> predicate,
void* userData) const;
/**
* @brief Retrieve all nested namespaces satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested namespaces satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Namespace const*> getNamespacesByPredicate(Predicate<Namespace> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested namespaces.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachNamespace(Visitor<Namespace> visitor,
void* userData) const;
/**
* @brief Get the number of namespaces nested in this namespace.
*
* @return The number of namespaces nested in this namespace.
*/
REFUREKU_API std::size_t getNamespacesCount() const noexcept;
/**
* @brief Retrieve a struct from this namespace.
*
* @param name Name of the struct to look for.
*
* @return The found struct if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Struct const* getStructByName(char const* name) const noexcept;
/**
* @brief Retrieve the first nested struct satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found struct satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Struct const* getStructByPredicate(Predicate<Struct> predicate,
void* userData) const;
/**
* @brief Retrieve all nested structs satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested structs satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Struct const*> getStructsByPredicate(Predicate<Struct> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested structs.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachStruct(Visitor<Struct> visitor,
void* userData) const;
/**
* @brief Retrieve a class from this namespace.
*
* @param name Name of the class to look for.
*
* @return The found class if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Class const* getClassByName(char const* name) const noexcept;
/**
* @brief Retrieve the first nested class satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found class satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Class const* getClassByPredicate(Predicate<Class> predicate,
void* userData) const;
/**
* @brief Retrieve all nested classes satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested classes satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Class const*> getClassesByPredicate(Predicate<Class> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested classes.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachClass(Visitor<Class> visitor,
void* userData) const;
/**
* @brief Retrieve an enum from this namespace.
*
* @param name Name of the enum to look for.
*
* @return The found enum if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Enum const* getEnumByName(char const* name) const noexcept;
/**
* @brief Retrieve the first nested enum satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found enum satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Enum const* getEnumByPredicate(Predicate<Enum> predicate,
void* userData) const;
/**
* @brief Retrieve all nested enums satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested enums satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Enum const*> getEnumsByPredicate(Predicate<Enum> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested enums.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachEnum(Visitor<Enum> visitor,
void* userData) const;
/**
* @brief Execute the given visitor on all nested archetypes.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially throw from the provided visitor.
*/
REFUREKU_API bool foreachArchetype(Visitor<Archetype> visitor,
void* userData) const;
/**
* @brief Get the number of archetypes nested in this namespace.
*
* @return The number of archetypes nested in this namespace.
*/
REFUREKU_API std::size_t getArchetypesCount() const noexcept;
/**
* @brief Retrieve a variable from this namespace.
*
* @param name The name of the variable.
* @param flags Flags describing the queried variable.
* The result variable will have at least the provided flags.
*
* @return The found variable if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Variable const* getVariableByName(char const* name,
EVarFlags flags = EVarFlags::Default) const noexcept;
/**
* @brief Retrieve the first nested variable satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found variable satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Variable const* getVariableByPredicate(Predicate<Variable> predicate,
void* userData) const;
/**
* @brief Retrieve all nested variables satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested variables satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Variable const*> getVariablesByPredicate(Predicate<Variable> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested variables.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachVariable(Visitor<Variable> visitor,
void* userData) const;
/**
* @brief Get the number of variables nested in this namespace.
*
* @return The number of variables nested in this namespace.
*/
REFUREKU_API std::size_t getVariablesCount() const noexcept;
/**
* @brief Retrieve a function with a given name and signature from this namespace.
*
* @param name The name of the function.
* @param flags Flags describing the queried function.
* The result function will have at least the provided flags.
*
* @return The first function matching the provided name and flags if it exists, else nullptr.
*/
template <typename FunctionSignature>
RFK_NODISCARD Function const* getFunctionByName(char const* name,
EFunctionFlags flags = EFunctionFlags::Default) const noexcept;
/**
* @brief Retrieve a function with a given name from this namespace.
*
* @param name The name of the function.
* @param flags Flags describing the queried function.
* The result function will have at least the provided flags.
*
* @return The first function matching the provided name and flags if it exists, else nullptr.
*/
RFK_NODISCARD REFUREKU_API Function const* getFunctionByName(char const* name,
EFunctionFlags flags = EFunctionFlags::Default) const noexcept;
/**
* @brief Retrieve all functions with a given name from this namespace.
*
* @param name The name of the function.
* @param flags Flags describing the queried function.
* The result function will have at least the provided flags.
*
* @return All functions matching the provided name and flags.
*/
RFK_NODISCARD REFUREKU_API Vector<Function const*> getFunctionsByName(char const* name,
EFunctionFlags flags = EFunctionFlags::Default) const noexcept;
/**
* @brief Retrieve the first nested function satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return The first found function satisfying the predicate if any, else nullptr.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Function const* getFunctionByPredicate(Predicate<Function> predicate,
void* userData) const;
/**
* @brief Retrieve all nested functions satisfying the provided predicate.
*
* @param predicate Predicate defining a valid namespace.
* @param userData User data forwarded to the predicate calls.
*
* @return All nested functions satisfying the provided predicate.
*
* @exception Any exception potentially thrown from the provided predicate.
*/
RFK_NODISCARD REFUREKU_API Vector<Function const*> getFunctionsByPredicate(Predicate<Function> predicate,
void* userData) const;
/**
* @brief Execute the given visitor on all nested functions.
*
* @param visitor Visitor function to call. Return false to abort the foreach loop.
* @param userData Optional user data forwarded to the visitor.
*
* @return The last visitor result before exiting the loop.
* If the visitor is nullptr, return false.
*
* @exception Any exception potentially thrown from the provided visitor.
*/
REFUREKU_API bool foreachFunction(Visitor<Function> visitor,
void* userData) const;
/**
* @brief Get the number of functions nested in this namespace.
*
* @return The number of functions nested in this namespace.
*/
REFUREKU_API std::size_t getFunctionsCount() const noexcept;
/**
* @brief Add a nested namespace to this namespace.
*
* @param nestedNamespace The namespace to add.
*/
REFUREKU_API void addNamespace(Namespace const& nestedNamespace) noexcept;
/**
* @brief Add a nested archetype to this namespace.
*
* @param archetype The archetype to add.
*/
REFUREKU_API void addArchetype(Archetype const& archetype) noexcept;
/**
* @brief Add a nested variable to this namespace.
*
* @param variable The variable to add.
*/
REFUREKU_API void addVariable(Variable const& variable) noexcept;
/**
* @brief Add a nested function to this namespace.
*
* @param function The function to add.
*/
REFUREKU_API void addFunction(Function const& function) noexcept;
/**
* @brief Remove a nested namespace from this namespace.
*
* @param nestedNamespace The namespace to add.
*/
REFUREKU_API void removeNamespace(Namespace const& nestedNamespace) noexcept;
/**
* @brief Remove a nested archetype from this namespace.
*
* @param archetype The archetype to remove.
*/
REFUREKU_API void removeArchetype(Archetype const& archetype) noexcept;
/**
* @brief Remove a nested variable from this namespace.
*
* @param variable The variable to remove.
*/
REFUREKU_API void removeVariable(Variable const& variable) noexcept;
/**
* @brief Remove a nested function from this namespace.
*
* @param function The function to remove.
*/
REFUREKU_API void removeFunction(Function const& function) noexcept;
private:
//Forward declaration
class NamespaceImpl;
RFK_GEN_GET_PIMPL(NamespaceImpl, Entity::getPimpl())
};
REFUREKU_TEMPLATE_API(rfk::Allocator<Namespace const*>);
REFUREKU_TEMPLATE_API(rfk::Vector<Namespace const*, rfk::Allocator<Namespace const*>>);
#include "Refureku/TypeInfo/Namespace/Namespace.inl"
} |
54cd3593657b614e3ca057534ef4a5de371a576d | ea7a4fe7ca1565a62a51fc19d40c12c113fcd60e | /IPCLib/src/IO.h | fbdc5967d313bf38ff9999ed75de4e2e871534ed | [] | no_license | GeeZeeMit/antivirus | 51e3ca6d83e5b3a2ca70c73ac9ce67f873e78879 | 6738f27df6da77ceb526e46f4a9463f33deed70c | refs/heads/master | 2023-04-05T16:46:17.685712 | 2021-03-31T15:01:26 | 2021-03-31T15:01:26 | 341,966,720 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,999 | h | IO.h | #pragma once
#include <Windows.h>
#include <stdint.h>
#include <string>
#include <vector>
#include <memory>
#include "IPC.h"
class Input
{
public:
Input(const std::u16string& path);
Input(const std::shared_ptr<IPC>& ipc);
Input(HANDLE handle) { this->handle = handle; }
~Input() = default;
void close();
inline bool isOpen() { return handle != INVALID_HANDLE_VALUE; }
// signed integers
int8_t readInt8();
int16_t readInt16();
int32_t readInt32();
int64_t readInt64();
// unsigned integers
uint8_t readUInt8();
uint16_t readUInt16();
uint32_t readUInt32();
uint64_t readUInt64();
// string and character
std::u16string readU16String();
char16_t readU16Char();
std::string readASCIIString();
char readASCIIChar();
// floats
float readFloat32();
double readFloat64();
// arrays
std::vector<int8_t> readArrayInt8();
std::vector<int16_t> readArrayInt16();
std::vector<int32_t> readArrayInt32();
std::vector<int64_t> readArrayInt64();
std::vector<uint8_t> readArrayUInt8();
std::vector<uint16_t> readArrayUInt16();
std::vector<uint32_t> readArrayUInt32();
std::vector<uint64_t> readArrayUInt64();
std::vector<float> readArrayFloat32();
std::vector<double> readArrayFloat64();
// struct
template<typename T>
T readStruct()
{
DWORD bytesRead;
T result;
ReadFile(handle, (void*)&result, sizeof(result), &bytesRead, NULL);
return result;
}
private:
HANDLE handle;
};
class Output
{
public:
Output(const std::u16string& path);
Output(const std::shared_ptr<IPC>& ipc);
Output(HANDLE handle) { this->handle = handle; }
~Output() = default;
void close();
// WRITE FUNCTIONS
//signed integers
void writeInt8(int8_t value);
void writeInt16(int16_t value);
void writeInt32(int32_t value);
void writeInt64(int64_t value);
//unsigned integers
void writeUInt8(uint8_t value);
void writeUInt16(uint16_t value);
void writeUInt32(uint32_t value);
void writeUInt64(uint64_t value);
// string and character
void writeU16String(const std::u16string& value);
void writeU16Char(char16_t value);
void writeASCIIString(const std::string& value);
void writeASCIIChar(char value);
// floats
void writeFloat32(float value);
void writeFloat64(double value);
// arrays
void writeArrayInt8(int8_t* values, uint32_t size);
void writeArrayInt16(int16_t* values, uint32_t size);
void writeArrayInt32(int32_t* values, uint32_t size);
void writeArrayInt64(int64_t* values, uint32_t size);
void writeArrayUInt8(uint8_t* values, uint32_t size);
void writeArrayUInt16(uint16_t* values, uint32_t size);
void writeArrayUInt32(uint32_t* values, uint32_t size);
void writeArrayUInt64(uint64_t* values, uint32_t size);
void writeArrayFloat32(float* values, uint32_t size);
void writeArrayFloat64(double* values, uint32_t size);
// struct
template<typename T>
void writeStruct(const T& value)
{
DWORD bytesWritten;
WriteFile(handle, (const void*)&value, sizeof(value), &bytesWritten, NULL);
}
private:
HANDLE handle;
}; |
c3b2e94bbbf79354ef72e192989ec87bdcdf7667 | 440fe90fa0beea25c5185dadbdfee2b2e5b4a8b7 | /src/Player.cpp | d3622d2d27ecd71e34693f7a740b25f57726e24a | [
"MIT"
] | permissive | filipecaixeta/NeonEdgeGame | a5721f61a309172287b3c811143fec8b54177326 | 7dbc825507d731d60a96b4a82975a70e6aa68d7e | refs/heads/master | 2021-01-20T04:49:45.971343 | 2018-01-06T19:54:08 | 2018-01-06T19:54:08 | 89,737,067 | 6 | 5 | MIT | 2018-01-06T19:54:09 | 2017-04-28T19:10:49 | C++ | UTF-8 | C++ | false | false | 6,001 | cpp | Player.cpp | /**
* Copyright (c) 2017 Neon Edge Game
* File Name: Player.cpp
* Header File Name: Player.h
* Class Name: Player
* Objective: manages the behavior of some aspects of the player.
*/
#include "Player.h"
#include "Projectile.h"
#include "Logger.h"
#include <assert.h>
/**
Objective: constructor of the class Player.
@param ItensManager* itemManager
@param int x - coordinate of the player.
@param int y - coordinate of the player.
@return Player - instance of the class Player.
*/
Player::Player(ItemsManager* itemManager, int x, int y): Character(x,y){
inputComponent = nullptr;
this->itemManager = itemManager ;
// Sets the default enabled skills.
skills[0] = false;
skills[1] = false;
skills[2] = true;
skills[3] = true;
skills[4] = true;
skills[5] = false;
skills[6] = false;
skillPoints = 0;
energy = 5; // Sets the energy of the player to 5.
regenCD = 500; // The time of the cool down regeneration in miliseconds.
isCrouching = false; // Default state: standing.
isStading = true;
name = "Player"; // Sets the Player's name.
hitpoints = MAX_HITPOINTS; // Sets the hitpoints of the player to 10.
Log::instance.info("Player builder started!");
}
/**
* Objective: destructor of the class Player.
*
* @param none.
* @return none.
*/
Player::~Player() {
}
/**
* Objective: checks if is a player.
*
* @param none.
* @return bool - returns TRUE.
*/
bool Player::IsPlayer() {
return true;
}
/**
* Objective: gets the energy of player.
*
* @param none.
* @return int energy - returns the amount of energy of the player.
*/
int Player::GetEnergy() {
assert(energy >= 0 && energy <= 5);
return energy;
}
/**
* Objective: performs the action of crouch.
*
* @param: none.
* @return: none.
*/
void Player::Crouch() {
if (isStading) {
isStading = false;
assert(soundComponent != nullptr);
soundComponent->SoundCrouching(); // Performs the crouching sound in case that the player is
// standing.
} else {
Log::instance.info("Player is already crouching");
}
isCrouching = true;
}
/**
* Objective: performs the action of stand.
*
* @param none.
* @return none.
*/
void Player::Stand() {
isCrouching = false;
isStading = true;
}
/**
* Objective: checks if the player is crouching or not.
*
* @param none.
* @return bool crouching - return true if the player is crouching.
*/
bool Player::IsCrouching() {
assert(isCrouching == true || isCrouching == false);
return isCrouching;
}
/**
* Objective: performs an action due to an item used by the player.
*
* @param string itemName - the name of the item.
* @return none.
*/
void Player::EvalItem(std::string itemName) {
assert(itemName != "");
// Heals the hitpoints of the player by 25% of the total.
if (itemName == "Healing Potion 25") {
hitpoints += MAX_HITPOINTS*0.25;
clamp(hitpoints, 0, MAX_HITPOINTS);
} else
// Heals the hitpoints of the player by 50% of the total.
if (itemName == "Healing Potion 50") {
hitpoints += MAX_HITPOINTS*0.5;
clamp(hitpoints, 0, MAX_HITPOINTS);
} else
// Adds 2 energy points.
if (itemName == "Energy Potion 25") {
energy += 2;
clamp(energy, 0, 5);
} else
// Adds 5 energy points.
if (itemName == "Energy Potion 50") {
energy += 5;
clamp(energy, 0, 5);
} else
// Adds 1 point to the skills.
if (itemName == "Skill Coin") {
skillPoints++;
} else {
Log::instance.error("No valid item");
}
}
/**
* Objective: manages the reactions of other objects in collision with the player.
*
* @param GameObject* other - the object that is in collision with the player.
* @return none.
*/
void Player::NotifyObjectCollision(GameObject* other) {
assert(other != nullptr);
Log::instance.info("Collision of objects, NotifyObjectCollision in Player");
Character::NotifyObjectCollision(other);
// The player gets damaged if the object is attacking.
if (other->IsCharacter() && !other->IsPlayer()) {
Character* c = (Character*) other;
if (c->Attacking()) {
Damage(c->Power());
} else {
// It does nothing.
}
} else if (other->Is("Projectile")) {
Projectile* p = (Projectile*) other;
if (!(p->GetOwner() == "Gallahad")) {
Damage(p->Power());
} else {
// It does nothing.
}
} else
// Restores some energy of the player.
if (other->Is("Energy")) {
if (isCrouching && !regenCD.IsRunning()) {
regenCD.Start();
energy += 1;
clamp(energy, 0, 5);
} else {
// It does nothing.
}
} else
// Restores some hitpoints of the player.
if (other->Is("Life")) {
if (isCrouching && !regenCD.IsRunning()) {
regenCD.Start();
hitpoints += 1;
clamp(hitpoints, 0, 10);
} else {
// It does nothing.
}
} else {
Log::instance.error("Collision with Player not expected");
}
}
/**
* Objective: updates the time of the cool down regeneration.
*
* @param float dt - the amount of time to cool down the regeneration.
* @return none.
*/
void Player::UpdateTimers(float dt) {
assert(dt >= FLOAT_MIN_SIZE && dt <= FLOAT_MAX_SIZE);
Character::UpdateTimers(dt);
regenCD.Update(dt);
}
void Player::Update(TileMap* map, float dt) {
assert(dt >= FLOAT_MIN_SIZE && dt <= FLOAT_MAX_SIZE);
assert(map != nullptr);
UpdateTimers(dt);
inputComponent->Update(this, dt);
physicsComponent.Update(this, map, dt);
if (OutOfBounds(map)) {
SetPosition(Vec2(startingX, startingY));
Log::instance.warning("Outdated limits!");
} else {
// It does nothing.
}
graphicsComponent->Update(this, dt);
}
|
21c223c7054987a27447b4e0c0b58dfd76d1a670 | c4089d1590e5802204ed1c1871c0bae2f7d7eab3 | /4. 大作业: System monitor/QT version/chart.cpp | 6a4592e288180c090f544176ebc124211cfd2f9e | [] | no_license | biubiubiiu/hust-OS | 9cb06c5a51ca451572b829f89ad7f7fc819fa778 | ac0871ca7125ca1c94eac6ae10c47925ddf2c6cd | refs/heads/master | 2022-01-06T22:42:49.758476 | 2019-05-05T05:13:40 | 2019-05-05T05:13:40 | 177,756,042 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,738 | cpp | chart.cpp | #include "chart.h"
#include <QtCharts/QAbstractAxis>
#include <QtCharts/QLineSeries>
#include <QtCharts/QValueAxis>
#include <QtCore/QRandomGenerator>
#include <QtCore/QDebug>
Chart::Chart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QChart(QChart::ChartTypeCartesian, parent, wFlags),
m_series(0),
m_axis(new QValueAxis)
{
m_series = new QLineSeries(this);
QPen pen(Qt::green);
pen.setWidth(3);
m_series->setPen(pen);
m_series->append(0, 0);
addSeries(m_series);
createDefaultAxes();
setAxisX(m_axis, m_series);
m_axis->setTickCount(6);
axisX()->setRange(0, 60);
axisY()->setRange(0.0, 100.0);
axisX()->setLabelsVisible(false);
axisY()->setLabelsVisible(false);
// 以下为Chart类的自定义设置
setAnimationOptions(QChart::NoAnimation); // 默认关闭动画效果
legend()->hide(); // 默认不显示图例
setMargins(QMargins(0, 0, 0, 0));
setBackgroundRoundness(0);
setPos(0, 0);
setTheme(QChart::ChartThemeQt);
}
Chart::~Chart()
{
}
void Chart::append(double ratio)
{
// 先判断一下数据有效性,免得出事
if (ratio >= 0 && ratio <= 100)
data << ratio;
}
void Chart::refresh()
{
// 维持数表中不超过60个数据
while (data.size() > 60)
data.removeFirst();
// 更新坐标
m_series->clear();
int size = data.size();
for (int i = size - 1; i >= 0; --i)
{
m_series->append(60 - (size - 1 - i), data.at(i)); // 目的是为了让图像从右向左移动
}
}
|
fff5442508df462e38f96a2be9bbd92bb40fabc6 | 37f45bbf2f38d00d7c61651383ae7e4fef1b3d91 | /Fatimah501.cpp | 57f01a5d8a2ec62d0f435af561440f38d71d0191 | [] | no_license | AhmadAlaarj/GitTest | 3214ffab19c92c614901ec63c5c7d3817496c258 | b3ef7db915a38a4e438716f7af19e69833cb8b21 | refs/heads/main | 2023-02-27T02:59:39.196567 | 2021-02-04T14:25:09 | 2021-02-04T14:25:09 | 335,975,701 | 1 | 0 | null | 2021-02-04T14:16:37 | 2021-02-04T14:16:37 | null | UTF-8 | C++ | false | false | 168 | cpp | Fatimah501.cpp |
#include <iostream>
using namespace std;
int main() {
string x = "I've participated in The Game's developers program!";
cout << x << endl;
return 0;
}
|
9211089e14f61e53e78b9c51c9d465478ac4f030 | 1e636fe0e92256920a5804494b44342e20050285 | /Day3/2_trivial.cpp | 3f5a334c1ab786d292bc3c8a1f49a1030544be23 | [] | no_license | JaeminShim/NCUAdvancedCPP | 4c65e8218bd8c6ef1e4318ad1739739a72a49ae1 | 399c7a805fccc6f1b8eef52cdc717bc87ed539f1 | refs/heads/master | 2021-01-10T16:31:01.431020 | 2015-11-25T08:51:34 | 2015-11-25T08:51:34 | 43,853,480 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 952 | cpp | 2_trivial.cpp | // 2. Trivial - 156 page
// (참고: Inside C++ object 책 - 1996년 출간)
#include <iostream>
using namespace std;
// trivial (자명한) 생성자 : 아무 일도 하지 않는 생성자
// trivial한 생성자의 조건
// 1. 가상 함수가 없고
// 2. 부모가 없거나 부모의 생성자가 trivial 하고
// 3. 객채형 멤버가 없거나 객체형 멤버의 생성자가 trivial하고
// 4. 사용자가 만든 생성자가 없을 때
class A
{
};
// [D]
//class B
class B : public A
{
public:
virtual void foo() {}
// [B]
//virtual void foo() {}
// [C]
//A a;
};
int main()
{
// [A] B의 생성자는 trivial 할까요?
B* p = static_cast<B*>(malloc(sizeof(B)));
//p->foo(); // ERROR
new (p) B; // 생성자 호출 -> vtable 생성
p->foo(); // OK
// [B] 부모 생성자 호출 필요하면 non-trivial
// [C] 멤버 생성자 호출 필요하면 non-trivial
// [D] 생성자 필요코드 없으면 trivial
} |
d2cabee2da570ab28e9e3448efd119667ad59087 | ec2dd7d60c7ea8b97ea957aeed22cd6c9f3488e8 | /devel/.private/kolt/include/kolt/YoloDetect.h | 47f12f73f74e9139054521fe6d8ee11daa163a27 | [] | no_license | svrakiss/ros-stuff | d75d3d02efc2d89a89b619faf22a27c7eb68f91d | 47aae66764749a746e666708fe8fa2f358a3f947 | refs/heads/master | 2020-12-21T21:45:32.246088 | 2020-02-02T15:51:04 | 2020-02-02T15:51:04 | 236,571,090 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,475 | h | YoloDetect.h | // Generated by gencpp from file kolt/YoloDetect.msg
// DO NOT EDIT!
#ifndef KOLT_MESSAGE_YOLODETECT_H
#define KOLT_MESSAGE_YOLODETECT_H
#include <ros/service_traits.h>
#include <kolt/YoloDetectRequest.h>
#include <kolt/YoloDetectResponse.h>
namespace kolt
{
struct YoloDetect
{
typedef YoloDetectRequest Request;
typedef YoloDetectResponse Response;
Request request;
Response response;
typedef Request RequestType;
typedef Response ResponseType;
}; // struct YoloDetect
} // namespace kolt
namespace ros
{
namespace service_traits
{
template<>
struct MD5Sum< ::kolt::YoloDetect > {
static const char* value()
{
return "0c98907c2772621acd431740725bdb9a";
}
static const char* value(const ::kolt::YoloDetect&) { return value(); }
};
template<>
struct DataType< ::kolt::YoloDetect > {
static const char* value()
{
return "kolt/YoloDetect";
}
static const char* value(const ::kolt::YoloDetect&) { return value(); }
};
// service_traits::MD5Sum< ::kolt::YoloDetectRequest> should match
// service_traits::MD5Sum< ::kolt::YoloDetect >
template<>
struct MD5Sum< ::kolt::YoloDetectRequest>
{
static const char* value()
{
return MD5Sum< ::kolt::YoloDetect >::value();
}
static const char* value(const ::kolt::YoloDetectRequest&)
{
return value();
}
};
// service_traits::DataType< ::kolt::YoloDetectRequest> should match
// service_traits::DataType< ::kolt::YoloDetect >
template<>
struct DataType< ::kolt::YoloDetectRequest>
{
static const char* value()
{
return DataType< ::kolt::YoloDetect >::value();
}
static const char* value(const ::kolt::YoloDetectRequest&)
{
return value();
}
};
// service_traits::MD5Sum< ::kolt::YoloDetectResponse> should match
// service_traits::MD5Sum< ::kolt::YoloDetect >
template<>
struct MD5Sum< ::kolt::YoloDetectResponse>
{
static const char* value()
{
return MD5Sum< ::kolt::YoloDetect >::value();
}
static const char* value(const ::kolt::YoloDetectResponse&)
{
return value();
}
};
// service_traits::DataType< ::kolt::YoloDetectResponse> should match
// service_traits::DataType< ::kolt::YoloDetect >
template<>
struct DataType< ::kolt::YoloDetectResponse>
{
static const char* value()
{
return DataType< ::kolt::YoloDetect >::value();
}
static const char* value(const ::kolt::YoloDetectResponse&)
{
return value();
}
};
} // namespace service_traits
} // namespace ros
#endif // KOLT_MESSAGE_YOLODETECT_H
|
caa22024d2276fed79b5fdbd4c573e71e585a808 | c9b431b2f89e1ccb5ce5266962edd8b375e80a96 | /LeetCode/416_PartitionEqualSubsetSum/PartitionEqualSubsetSum.cpp | da0e88334591b6e3906b720959a71d3878fbdedb | [] | no_license | SuperMousse/Interview | 25266b79058f8c649344ff6893682e9061a5ef46 | 09012379d02d5052fc3f7603b2ecbb6980cc405d | refs/heads/master | 2021-07-11T00:36:40.192775 | 2020-11-22T12:45:33 | 2020-11-22T12:45:33 | 215,969,016 | 8 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,324 | cpp | PartitionEqualSubsetSum.cpp | // 解法一: 动态规划
// dp[i][j]表示到第i个位置为止, 和为j的子数组的个数
// dp[i][j]有i-1状态的不同j组成, 所以要将i-1减掉后才退化成前一状态
// dp[i][j] = dp[i-1][j] + dp[i-1][j-nums[i-1]], j >= nums[i-1]
// dp[i][j] = dp[i-1][j], j < nums[i-1]
// leetcode testcase太多, 使用bool表示dp[i][j]表示到第ie个位置为止, 和为je的子数组z是否存在
// 寻找子数组使得sum(P) = sum(all) / 2;
// sum(all)奇数则不存在, 偶数则转化为子数组
bool canPartition(vector<int>& nums) {
if (nums.empty()) {
return true;
}
int sum = 0;
for (auto i : nums) {
sum += i;
}
if (sum & 0x1) {
return false;
}
return helper(nums, sum >> 1);
}
bool helper(vector<int>& nums, int target) {
if (nums.empty()) {
return true;
}
int length = nums.size();
vector<vector<bool> > dp(length + 1, vector<bool>(target + 1, 0));
dp[0][0] = 1;
for (int i = 1; i <= length; ++i) {
for (int j = 0; j <= target; ++j) {
if (j >= nums[i - 1]) {
dp[i][j] = dp[i-1][j] || dp[i-1][j-nums[i-1]];
}
else {
dp[i][j] = dp[i-1][j];
}
}
}
return dp[length][target];
}
// 解法二: 位运算
|
c89242dca2efbd6f22d73b4d7ec3912f9179d316 | 62b5b927b4ef2da18e47651e07838101fe0b06a3 | /main/MainHelper.cpp | b8e6a8212bf85cb7e7db8448d7ed7f935480422b | [
"Apache-2.0",
"MPL-2.0",
"BSD-3-Clause",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"MIT",
"Zlib",
"ISC",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"BSD-2-Clause",
"MIT-0",
"curl",
"CC0-1.0",
"OpenSSL",
"libtiff",
"BSD-1-Clause",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"LicenseRef-scancode-ssleay-windows",
"LicenseRef-scancode-bsd-unchanged",
"LicenseRef-scancode-mit-old-style",
"JSON",
"LicenseRef-scancode-protobuf",
"Libpng",
"bzip2-1.0.6",
"NCSA",
"LicenseRef-scancode-object-form-exception-to-mit"
] | permissive | jdye64/nifi-minifi-cpp | 10245575dac86cc99074bec85a61bb7eadc76211 | 0553df446aefb395b34c1e4e2b5ced31f07a4e04 | refs/heads/main | 2021-12-14T09:28:59.389156 | 2021-12-01T13:23:32 | 2021-12-01T13:26:13 | 154,844,757 | 2 | 0 | Apache-2.0 | 2018-10-26T14:11:04 | 2018-10-26T14:11:04 | null | UTF-8 | C++ | false | false | 6,299 | cpp | MainHelper.cpp | /**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MainHelper.h"
#include "utils/Environment.h"
#include "utils/StringUtils.h"
#include "utils/file/FileUtils.h"
#ifdef WIN32
FILE* __cdecl _imp____iob_func() {
struct _iobuf_VS2012 { // ...\Microsoft Visual Studio 11.0\VC\include\stdio.h #56
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
// VS2015 has FILE = struct {void* _Placeholder}
static struct _iobuf_VS2012 bufs[3];
static char initialized = 0;
if (!initialized) {
bufs[0]._ptr = (char*)stdin->_Placeholder;
bufs[1]._ptr = (char*)stdout->_Placeholder;
bufs[2]._ptr = (char*)stderr->_Placeholder;
initialized = 1;
}
return (FILE*)&bufs;
}
FILE* __cdecl __imp___iob_func() {
struct _iobuf_VS2012 { // ...\Microsoft Visual Studio 11.0\VC\include\stdio.h #56
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
// VS2015 has FILE = struct {void* _Placeholder}
static struct _iobuf_VS2012 bufs[3];
static char initialized = 0;
if (!initialized) {
bufs[0]._ptr = (char*)stdin->_Placeholder;
bufs[1]._ptr = (char*)stdout->_Placeholder;
bufs[2]._ptr = (char*)stderr->_Placeholder;
initialized = 1;
}
return (FILE*)&bufs;
}
#endif
namespace minifi = org::apache::nifi::minifi;
namespace utils = minifi::utils;
namespace logging = minifi::core::logging;
bool validHome(const std::string &home_path) {
const std::string properties_file_path = utils::file::FileUtils::concat_path(home_path, DEFAULT_NIFI_PROPERTIES_FILE);
return utils::file::exists(properties_file_path);
}
void setSyslogLogger() {
std::shared_ptr<logging::LoggerProperties> service_logger = std::make_shared<logging::LoggerProperties>();
service_logger->set("appender.syslog", "syslog");
service_logger->set("logger.root", "INFO,syslog");
logging::LoggerConfiguration::getConfiguration().initialize(service_logger);
}
std::string determineMinifiHome(const std::shared_ptr<logging::Logger>& logger) {
/* Try to determine MINIFI_HOME */
std::string minifiHome = [&logger]() -> std::string {
/* If MINIFI_HOME is set as an environment variable, we will use that */
bool minifiHomeSet = false;
std::string minifiHome;
std::tie(minifiHomeSet, minifiHome) = utils::Environment::getEnvironmentVariable(MINIFI_HOME_ENV_KEY);
if (minifiHomeSet) {
logger->log_info("Found " MINIFI_HOME_ENV_KEY "=%s in environment", minifiHome);
return minifiHome;
} else {
logger->log_info(MINIFI_HOME_ENV_KEY " is not set; trying to infer it");
}
/* Try to determine MINIFI_HOME relative to the location of the minifi executable */
std::string executablePath = utils::file::FileUtils::get_executable_path();
if (executablePath.empty()) {
logger->log_error("Failed to determine location of the minifi executable");
} else {
std::string minifiPath, minifiFileName;
std::tie(minifiPath, minifiFileName) = minifi::utils::file::FileUtils::split_path(executablePath);
logger->log_info("Inferred " MINIFI_HOME_ENV_KEY "=%s based on the minifi executable location %s", minifiPath, executablePath);
return minifiPath;
}
#ifndef WIN32
/* Try to determine MINIFI_HOME relative to the current working directory */
std::string cwd = utils::Environment::getCurrentWorkingDirectory();
if (cwd.empty()) {
logger->log_error("Failed to determine current working directory");
} else {
logger->log_info("Inferred " MINIFI_HOME_ENV_KEY "=%s based on the current working directory %s", cwd, cwd);
return cwd;
}
#endif
return "";
}();
if (minifiHome.empty()) {
logger->log_error("No " MINIFI_HOME_ENV_KEY " could be inferred. "
"Please set " MINIFI_HOME_ENV_KEY " or run minifi from a valid location.");
return "";
}
/* Verify that MINIFI_HOME is valid */
bool minifiHomeValid = false;
if (validHome(minifiHome)) {
minifiHomeValid = true;
} else {
logger->log_info("%s is not a valid " MINIFI_HOME_ENV_KEY ", because there is no " DEFAULT_NIFI_PROPERTIES_FILE " file in it.", minifiHome);
std::string minifiHomeWithoutBin, binDir;
std::tie(minifiHomeWithoutBin, binDir) = minifi::utils::file::FileUtils::split_path(minifiHome);
if (minifiHomeWithoutBin != "" && (binDir == "bin" || binDir == std::string("bin") + minifi::utils::file::FileUtils::get_separator())) {
if (validHome(minifiHomeWithoutBin)) {
logger->log_info("%s is a valid " MINIFI_HOME_ENV_KEY ", falling back to it.", minifiHomeWithoutBin);
minifiHomeValid = true;
minifiHome = std::move(minifiHomeWithoutBin);
} else {
logger->log_info("%s is not a valid " MINIFI_HOME_ENV_KEY ", because there is no " DEFAULT_NIFI_PROPERTIES_FILE " file in it.", minifiHomeWithoutBin);
}
}
}
/* Fail if not */
if (!minifiHomeValid) {
logger->log_error("Cannot find a valid " MINIFI_HOME_ENV_KEY " containing a " DEFAULT_NIFI_PROPERTIES_FILE " file in it. "
"Please set " MINIFI_HOME_ENV_KEY " or run minifi from a valid location.");
return "";
}
/* Set the valid MINIFI_HOME in our environment */
logger->log_info("Using " MINIFI_HOME_ENV_KEY "=%s", minifiHome);
utils::Environment::setEnvironmentVariable(MINIFI_HOME_ENV_KEY, minifiHome.c_str());
return minifiHome;
}
|
e028a620036b968b31be4827a879b04644a81371 | 574f5dab606345a6653e1dc743484237d00545b5 | /Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H | af9372af94944aa05edd4e8f884f13bd5cdc74f9 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"BSD-3-Clause-LBNL"
] | permissive | RemiLehe/WarpX | d432f158707f757aed54cd6149e32f1f3389fee9 | 906a078e1c1817ee2940bc6f0c4a35ce2b9cdac6 | refs/heads/master | 2023-08-31T10:19:27.940439 | 2020-04-30T18:18:27 | 2020-04-30T18:18:27 | 151,156,406 | 1 | 3 | NOASSERTION | 2019-09-09T20:53:06 | 2018-10-01T20:41:14 | C++ | UTF-8 | C++ | false | false | 889 | h | FlushFormatCheckpoint.H | #ifndef WARPX_FLUSHFORMATCHECKPOINT_H_
#define WARPX_FLUSHFORMATCHECKPOINT_H_
#include "FlushFormatPlotfile.H"
class FlushFormatCheckpoint final : public FlushFormatPlotfile
{
/** Flush fields and particles to plotfile */
virtual void WriteToFile (
const amrex::Vector<std::string> varnames,
const amrex::Vector<const amrex::MultiFab*> mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F) const override final;
void CheckpointParticles(const std::string& dir,
const amrex::Vector<ParticleDiag>& particle_diags) const;
};
#endif // WARPX_FLUSHFORMATCHECKPOINT_H_
|
0ddaa9d45e17b0e4ea03663b9343e0359cac647b | 825db217404a1c572744c5a1deb64c4ea1d3cb0c | /base/process/info.cpp | ba666e685545ecb9900963bc1088758b27129089 | [
"BSD-3-Clause"
] | permissive | luciouskami/libbase | 0898937955949307f960942c91ac7b6ecff32583 | 89dc13b0eab4d6a48e74c99254b025a15b875ee0 | refs/heads/main | 2023-08-21T10:20:12.711062 | 2021-10-13T15:11:30 | 2021-10-13T15:11:30 | 416,329,998 | 0 | 0 | BSD-3-Clause | 2021-10-13T15:05:36 | 2021-10-12T12:33:16 | C++ | UTF-8 | C++ | false | false | 5,172 | cpp | info.cpp | // Copyright 2021 The Tapirus-Team 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/universal.inl"
namespace base::process
{
// Reference: https://github.com/chromium/chromium/blob/master/base/process/process_info_win.cc#L30
IntegrityLevel GetProcessIntegrityLevel(_In_ HANDLE process)
{
HANDLE process_token = nullptr;
if (!::OpenProcessToken(process, TOKEN_QUERY, &process_token))
{
return IntegrityLevel::INTEGRITY_UNKNOWN;
}
auto process_token_guard = stdext::scope_resource(
process_token,
[](HANDLE token) { CloseHandle(token); });
DWORD token_info_length = 0;
if (::GetTokenInformation(process_token, TokenIntegrityLevel, nullptr, 0, &token_info_length) ||
::GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
return IntegrityLevel::INTEGRITY_UNKNOWN;
}
auto token_label_bytes = std::make_unique<char[]>(token_info_length);
auto token_label = reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_label_bytes.get());
if (!::GetTokenInformation(process_token, TokenIntegrityLevel, token_label,
token_info_length, &token_info_length))
{
return IntegrityLevel::INTEGRITY_UNKNOWN;
}
DWORD integrity_level = *::GetSidSubAuthority(
token_label->Label.Sid,
static_cast<DWORD>(*::GetSidSubAuthorityCount(token_label->Label.Sid) - 1));
if (integrity_level < SECURITY_MANDATORY_LOW_RID)
return IntegrityLevel::UNTRUSTED_INTEGRITY;
if (integrity_level < SECURITY_MANDATORY_MEDIUM_RID)
return IntegrityLevel::LOW_INTEGRITY;
if (integrity_level < SECURITY_MANDATORY_MEDIUM_PLUS_RID)
return IntegrityLevel::MEDIUM_INTEGRITY;
if (integrity_level < SECURITY_MANDATORY_HIGH_RID)
return IntegrityLevel::MEDIUM_PLUS_INTEGRITY;
if (integrity_level < SECURITY_MANDATORY_SYSTEM_RID)
return IntegrityLevel::HIGH_INTEGRITY;
if (integrity_level < SECURITY_MANDATORY_PROTECTED_PROCESS_RID)
return IntegrityLevel::SYSTEM_INTEGRITY;
else
return IntegrityLevel::PROTECTED_PROCESS_INTEGRITY;
return IntegrityLevel::INTEGRITY_UNKNOWN;
}
// Reference: https://github.com/chromium/chromium/blob/master/base/process/process_info_win.cc#L71
bool IsProcessElevated(_In_ HANDLE process)
{
HANDLE process_token = nullptr;
if (!::OpenProcessToken(process, TOKEN_QUERY, &process_token)) {
false;
}
auto process_token_guard = stdext::scope_resource(
process_token,
[](HANDLE token) { CloseHandle(token); });
// Unlike TOKEN_ELEVATION_TYPE which returns TokenElevationTypeDefault when
// UAC is turned off, TOKEN_ELEVATION returns whether the process is elevated.
DWORD size = 0;
TOKEN_ELEVATION elevation = { 0 };
if (!GetTokenInformation(process_token, TokenElevation, &elevation,
sizeof(elevation), &size))
{
return false;
}
return !!elevation.TokenIsElevated;
}
bool SetProcessPrivilege(_In_ HANDLE token, _In_ LPCWSTR privilege, _In_ BOOL enable)
{
TOKEN_PRIVILEGES tp = { 0 };
LUID luid = { 0 };
if (!::LookupPrivilegeValueW(
nullptr, // lookup privilege on local system
privilege, // privilege to lookup
&luid)) // receives LUID of privilege
{
return false;
}
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
if (enable)
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
else
tp.Privileges[0].Attributes = 0;
// Enable the privilege or disable all privileges.
if (!::AdjustTokenPrivileges(
token,
FALSE,
&tp,
sizeof(TOKEN_PRIVILEGES),
nullptr,
nullptr))
{
return false;
}
if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
{
return false;
}
return true;
}
std::shared_ptr<uint8_t> QueryInformationProcess(
_In_ PROCESSINFOCLASS query_class,
_In_ HANDLE process
)
{
NTSTATUS result = STATUS_SUCCESS;
auto need_bytes = 0ul;
auto information = std::shared_ptr<uint8_t>();
result = ZwQueryInformationProcess(process, query_class, nullptr, 0, &need_bytes);
if (need_bytes == 0) {
return nullptr;
}
need_bytes += 512;
information = std::shared_ptr<uint8_t>(new uint8_t[need_bytes]{});
if (information == nullptr) {
return nullptr;
}
result = ZwQueryInformationProcess(process, query_class, information.get(), need_bytes, &need_bytes);
if (!NT_SUCCESS(result)) {
return nullptr;
}
return information;
}
}
|
1642f71a790ed17b238d836538161fe27f7a5a69 | b30fa1ec4e5d21437ee69ad5cbebf218d67cb101 | /TGE/tween/tgTweens.h | 1b81e6fdd2aa8cf54ddff2b7c9e7be4209cfa561 | [] | no_license | DCubix/TGE | 7753e997a7f59c968f83f79eabae8a7a7caf2694 | aca3d9c4cddec779d6801ed1f3705be4d2b48b56 | refs/heads/master | 2021-01-22T20:40:15.950565 | 2017-04-06T17:19:34 | 2017-04-06T17:19:34 | 85,341,356 | 0 | 0 | null | 2017-03-24T02:04:32 | 2017-03-17T18:06:50 | C | UTF-8 | C++ | false | false | 5,233 | h | tgTweens.h | #ifndef TWEENS_H
#define TWEENS_H
#include <vector>
#include <string>
#include <cmath>
#define PI 3.141592654f
#include "tgTween.h"
#define TG_EASE_FUNC_PARAMS float t, float b, float c, float d
#define TG_EASE_FUNC_DEF(inout, name) \
static float ease##inout##name(TG_EASE_FUNC_PARAMS)
class tgTweens {
public:
static void addTween(tgTween *tween);
static void addTween(float *value, float end, float duration,
std::function<void(void)> const& onComplete = nullptr,
tgEasingFunction const& easing = nullptr);
static void update(float dt);
protected:
static std::vector<tgTween*> m_tweens;
};
namespace tgEasing {
// Quadratic
TG_EASE_FUNC_DEF(In, Quad) {
return c*(t /= d)*t + b;
}
TG_EASE_FUNC_DEF(Out, Quad) {
return -c *(t /= d)*(t - 2) + b;
}
TG_EASE_FUNC_DEF(InOut, Quad) {
if ((t /= d / 2) < 1) return c / 2 * t*t + b;
return -c / 2 * ((--t)*(t - 2) - 1) + b;
}
// Cubic
TG_EASE_FUNC_DEF(In, Cubic) {
return c*(t /= d)*t*t + b;
}
TG_EASE_FUNC_DEF(Out, Cubic) {
return c*((t = t / d - 1)*t*t + 1) + b;
}
TG_EASE_FUNC_DEF(InOut, Cubic) {
if ((t /= d / 2) < 1) return c / 2 * t*t*t + b;
return c / 2 * ((t -= 2)*t*t + 2) + b;
}
// Quartic
TG_EASE_FUNC_DEF(In, Quart) {
return c*(t /= d)*t*t*t + b;
}
TG_EASE_FUNC_DEF(Out, Quart) {
return -c * ((t = t / d - 1)*t*t*t - 1) + b;
}
TG_EASE_FUNC_DEF(InOut, Quart) {
if ((t /= d / 2) < 1) return c / 2 * t*t*t*t + b;
return -c / 2 * ((t -= 2)*t*t*t - 2) + b;
}
// Quintic
TG_EASE_FUNC_DEF(In, Quint) {
return c*(t /= d)*t*t*t*t + b;
}
TG_EASE_FUNC_DEF(Out, Quint) {
return c*((t = t / d - 1)*t*t*t*t + 1) + b;
}
TG_EASE_FUNC_DEF(InOut, Quint) {
if ((t /= d / 2) < 1) return c / 2 * t*t*t*t*t + b;
return c / 2 * ((t -= 2)*t*t*t*t + 2) + b;
}
// Sine
TG_EASE_FUNC_DEF(In, Sine) {
return -c * std::cos(t / d * (PI / 2.0f)) + c + b;
}
TG_EASE_FUNC_DEF(Out, Sine) {
return c * std::sin(t / d * (PI / 2.0f)) + b;
}
TG_EASE_FUNC_DEF(InOut, Sine) {
return -c / 2.0f * (std::cos(PI*t / d) - 1.0f) + b;
}
// Exponential
TG_EASE_FUNC_DEF(In, Exp) {
return (t == 0.0f) ? b : c * std::pow(2.0f, 10.0f * (t / d - 1.0f)) + b;
}
TG_EASE_FUNC_DEF(Out, Exp) {
return (t == d) ? b + c : c * (-std::pow(2.0f, -10.0f * t / d) + 1) + b;
}
TG_EASE_FUNC_DEF(InOut, Exp) {
if (t == 0.0f) return b;
if (t == d) return b + c;
if ((t /= d / 2.0f) < 1.0f) return c / 2.0f * std::pow(2.0f, 10.0f * (t - 1.0f)) + b;
return c / 2.0f * (-std::pow(2.0f, -10.0f * --t) + 2.0f) + b;
}
// Circular
TG_EASE_FUNC_DEF(In, Circular) {
return -c * (std::sqrt(1.0f - (t /= d)*t) - 1.0f) + b;
}
TG_EASE_FUNC_DEF(Out, Circular) {
return c * std::sqrt(1.0f - (t = t / d - 1.0f)*t) + b;
}
TG_EASE_FUNC_DEF(InOut, Circular) {
if ((t /= d / 2.0f) < 1.0f) return -c / 2.0f * (std::sqrt(1 - t*t) - 1.0f) + b;
return c / 2.0f * (std::sqrt(1 - (t -= 2.0f)*t) + 1.0f) + b;
}
// Elastic
TG_EASE_FUNC_DEF(In, Elastic) {
float s = 1.70158f; float p = 0; float a = c;
if (t == 0) return b; if ((t /= d) == 1.0f) return b + c; if (!p) p = d*0.3f;
if (a < std::abs(c)) { a = c; float s = p / 4.0f; } else float s = p / (2.0f * PI) * std::asin(c / a);
return -(a*std::pow(2.0f, 10.0f * (t -= 1)) * std::sin((t*d - s)*(2.0f * PI) / p)) + b;
}
TG_EASE_FUNC_DEF(Out, Elastic) {
float s = 1.70158f; float p = 0; float a = c;
if (t == 0.0f) return b; if ((t /= d) == 1.0f) return b + c; if (!p) p = d*0.3f;
if (a < std::abs(c)) { a = c; float s = p / 4.0f; } else float s = p / (2.0f * PI) * std::asin(c / a);
return a*std::pow(2.0f, -10.0f * t) * std::sin((t*d - s)*(2.0f * PI) / p) + c + b;
}
TG_EASE_FUNC_DEF(InOut, Elastic) {
float s = 1.70158f; float p = 0; float a = c;
if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d*(0.3f*1.5f);
if (a < std::abs(c)) { a = c; float s = p / 4; } else float s = p / (2 * PI) * std::asin(c / a);
if (t < 1) return -0.5f*(a*std::pow(2.0f, 10.0f * (t -= 1)) * std::sin((t*d - s)*(2.0f * PI) / p)) + b;
return a*std::pow(2.0f, -10.0f * (t -= 1.0f)) * std::sin((t*d - s)*(2.0f * PI) / p)*0.5f + c + b;
}
// Back
TG_EASE_FUNC_DEF(In, Back) {
float s = 1.70158f;
return c*(t /= d)*t*((s + 1.0f)*t - s) + b;
}
TG_EASE_FUNC_DEF(Out, Back) {
float s = 1.70158f;
return c*((t = t / d - 1.0f)*t*((s + 1.0f)*t + s) + 1.0f) + b;
}
TG_EASE_FUNC_DEF(InOut, Back) {
float s = 1.70158f;
if ((t /= d / 2) < 1.0f) return c / 2 * (t*t*(((s *= (1.525f)) + 1.0f)*t - s)) + b;
return c / 2 * ((t -= 2.0f)*t*(((s *= (1.525f)) + 1.0f)*t + s) + 2.0f) + b;
}
// Bounce
TG_EASE_FUNC_DEF(Out, Bounce) {
if ((t /= d) < (1.0f / 2.75f)) {
return c*(7.5625f*t*t) + b;
} else if (t < (2.0f / 2.75f)) {
return c*(7.5625f*(t -= (1.5f / 2.75f))*t + 0.75f) + b;
} else if (t < (2.5f / 2.75f)) {
return c*(7.5625f*(t -= (2.25f / 2.75f))*t + 0.9375f) + b;
} else {
return c*(7.5625f*(t -= (2.625f / 2.75f))*t + 0.984375f) + b;
}
}
TG_EASE_FUNC_DEF(In, Bounce) {
return c - easeOutBounce(d - t, 0.0f, c, d) + b;
}
TG_EASE_FUNC_DEF(InOut, Bounce) {
if (t < d * 0.5f) return easeInBounce(t * 2.0f, 0.0f, c, d) * 0.5f + b;
return easeOutBounce(t * 2.0f - d, 0.0f, c, d) * 0.5f + c*0.5f + b;
}
}
#endif |
74fcb7588a819a00a594540de59b0b353f38cdff | 80ad2baf1b70e5b853799ea24720dbdbf874357c | /include/visionaray/math/sphere.h | 7add6b879aa2f16fc51fc48a98e23467e9fef5de | [
"MIT"
] | permissive | cstollw/visionaray | 9f87e1c6069b24b254b378ff1820b88976a4a089 | 2981ee59a3c913a9ebf3221d409eaf2398384bec | refs/heads/master | 2020-12-25T22:47:26.470408 | 2015-04-24T09:48:50 | 2015-04-24T09:48:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 475 | h | sphere.h | // This file is distributed under the MIT license.
// See the LICENSE file for details.
#ifndef VSNRAY_MATH_SPHERE_H
#define VSNRAY_MATH_SPHERE_H
#include "primitive.h"
#include "vector.h"
namespace MATH_NAMESPACE
{
template <typename T, typename P>
class basic_sphere : public primitive<P>
{
public:
typedef T scalar_type;
typedef vector<3, T> vec_type;
vec_type center;
scalar_type radius;
};
} // MATH_NAMESPACE
#endif // VSNRAY_MATH_TRIANGLE_H
|
0f4439cce0a2f0f93cae6676636fe0797f748e11 | ebffd1f7ea9c974890ae82d32aac0e07ab613d0c | /Problem17_07.cc | 5ca9bb7eb3ee1355aa17fe0b36c6b75936e80ab6 | [
"MIT"
] | permissive | ucarlos/Programming-Principles-Chapter17 | 5763438c4fc3a5f0e649bd0a1521155bbe03d7a1 | a3da861da8be79f16466da7fab22f54ab736a4a3 | refs/heads/master | 2023-03-07T18:48:59.067841 | 2021-02-23T19:36:56 | 2021-02-23T19:36:56 | 291,394,687 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 807 | cc | Problem17_07.cc | /*
* -----------------------------------------------------------------------------
* Created by Ulysses Carlos on 01/01/2020
*
* Problem17_07
* Write a program that reads characters from cin into an array that you
* allocate on the free store. Read individual characters until an exclamation
* mark (!) is entered. Do not use a std::string. Do not worry about memory
* exhaustion.
* -----------------------------------------------------------------------------
*/
#include <iostream>
using namespace std;
int main(void){
int val = 100;
char *str = new char[val];
char temp;
int i = 0;
cout << "Please type in some character. To exit, press \"!\""
<< endl;
while ((cin >> temp) && (temp != '!')){
str[i++] = temp;
}
cout << str << endl;
delete[] str;
}
|
eb1bc8ba4bbc3de8cde01613df7941dde2be2520 | 02f9f44328dad647cb08dfdfd033b9d751c70560 | /아두이노 파일_LCD/ver5_16평문_LCD적용/ver5_slave/ver5_slave.ino | ffc12d2078f9f689331df996c95dfe53420f7a0d | [] | no_license | ewha-ende/2019_arduino_JolP | 72c30b79d1eabd1acb2d17bfc6d4ae36ee2b41cd | 665ed5d1b816bd98e553b013c046ab26e4da8137 | refs/heads/master | 2020-04-29T03:11:55.575358 | 2019-11-22T04:34:41 | 2019-11-22T04:34:41 | 175,800,049 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,810 | ino | ver5_slave.ino | #include <uECC.h>
#include <AES.h>
#include <stdarg.h>
#include <EEPROM.h>
#define NUM_ECC_DIGITS 24
AES aes ;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
extern "C" {
int RNG(uint8_t *dest, unsigned size) {
// Use the least-significant bits from the ADC for an unconnected pin (or connected to a source of
// random noise). This can take a long time to generate random data if the result of analogRead(0)
// doesn't change very frequently.
while (size) {
uint8_t val = 0;
for (unsigned i = 0; i < 8; ++i) {
int init = analogRead(0);
int count = 0;
while (analogRead(0) == init) {
++count;
}
if (count == 0) {
val = (val << 1) | (init & 0x01);
} else {
val = (val << 1) | (count & 0x01);
}
}
*dest = val;
++dest;
--size;
}
// NOTE: it would be a good idea to hash the resulting random data using SHA-256 or similar.
return 1;
}
} // extern "C"
void myprintf(char *fmt, ... ){
char tmp[128]; // resulting string limited to 128 chars
va_list args;
va_start (args, fmt );
vsnprintf(tmp, 128, fmt, args);
va_end (args);
Serial.print(tmp);
}
void dump(char *text, uint8_t *d, int leng) {
int i;
myprintf("%-20s", text);
for (i = 0; i < leng; ++i){
myprintf("%02x ", d[i]);
if (i != 0 && i%24 == 0)
Serial.print("\n\t\t");
}
Serial.print("\n");
}
// AES
uint8_t plain[] =
{
0xf3, 0x44, 0x81, 0xec, 0x3c, 0xc6, 0x27, 0xba, 0xcd, 0x5d, 0xc3, 0xfb, 0x08, 0xf2, 0x73, 0xe6,
} ;
uint8_t shuffle_seed[] =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
};
uint8_t my_iv[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
} ;
uint8_t cipher [1*N_BLOCK] ;
uint8_t check [1*N_BLOCK] ;
// generate a value between 0 <= x < n, thus there are n possible outputs
int rand_range(int n)
{
int r, ul;
ul = RAND_MAX - RAND_MAX % n;
while ((r = random(RAND_MAX+1)) >= ul);
//r = random(ul);
return r % n;
}
void shuffle_swap(int index_a, int index_b, byte *array, int size)
{
char *x, *y, tmp[size];
if (index_a == index_b)
return;
x = (char*)array + index_a * size;
y = (char*)array + index_b * size;
memcpy(tmp, x, size);
memcpy(x, y, size);
memcpy(y, tmp, size);
}
// shuffle an array using fisher-yates method, O(n)
void shuffle(byte *array, int nmemb, int size, int seedIndex)
{
int r;
// The index of sufffling seedNumber is predetermined
// for the secret connection
randomSeed((long)shuffle_seed[seedIndex]);
Serial.print("shuffle seed : ");
Serial.println ((long)shuffle_seed[seedIndex],HEX) ;
while (nmemb > 1) {
r = rand_range(nmemb--);
shuffle_swap(nmemb, r, array, size);
}
}
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("[ENDE]");
// set the data rate for the SoftwareSerial port
mySerial.begin(57600);
// mySerial.println("[ENDE]");
uECC_set_rng(&RNG);
// initialize the lcd
lcd.init();
lcd.clear();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Arduino Project");
lcd.setCursor(0,1);
lcd.print("> ENDE");
}
void loop() {
Serial.flush();
mySerial.flush();
if (mySerial.available()) {
uint8_t private2[24];
uint8_t public1[48], public2[48];
uint8_t secret2[24];
// loop시작 알리기
int s = mySerial.read();
Serial.println(s);
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Key 192bits");
lcd.setCursor(0,1);
lcd.print("> START SLAVE");
Serial.println("=====================================================================================================");
Serial.println("=====================================================================================================");
Serial.print("<== Starting the ECDH key generation ==>\n");
Serial.println("=====================================================================================================");
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Key Generation!");
lcd.setCursor(0,1);
lcd.print("> Public&Private");
const struct uECC_Curve_t * curve = uECC_secp192r1(); // select 192 bits key size (24 bytes)
unsigned long a = micros();
uECC_make_key(public2, private2, curve);
unsigned long b = micros();
int puleng = sizeof(public2) / sizeof(public2[0]);
int prleng = sizeof(private2) / sizeof(private2[0]);
Serial.print("ECDH generated key 2 in ");
Serial.print(b-a);Serial.println(" uSec");
dump("ECDH public key 2=>", public2, puleng);
dump("ECDH private key 2=>", private2, prleng);
// 통신 : public2를 보내고 public1을 받아야 함.
//mySerial.flush();
for (int i = 0; i < puleng; i++){
mySerial.write(public2[i]);
}
while(mySerial.available()<puleng){
// wait
}
mySerial.readBytes(public1, puleng);
a = micros();
int r = uECC_shared_secret(public1, private2, secret2, curve);
b = micros();
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Key Generation!");
lcd.setCursor(0,1);
lcd.print(">Shared ECDH Key");
int seleng = sizeof(secret2) / sizeof(secret2[0]);
Serial.println("=====================================================================================================");
Serial.print("ECDH Shared secret key 2 in "); Serial.print(b-a);Serial.println(" uSec");
if (!r) {
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Key Generation!");
lcd.setCursor(0,1);
lcd.print("> Fail");
Serial.print("shared_secret() failed (2)\n");
return;
}
Serial.println("=====================================================================================================");
dump("ECDH public key 1=>", public1, puleng);
dump("ECDH public key 2=>", public2, puleng);
dump("ECDH shared secret key 2=> ", secret2, seleng);
Serial.println("=====================================================================================================");
//
Serial.print("buf : +");
Serial.println(mySerial.available());
for(byte i=0;i<24;i++)
EEPROM.write(i, secret2[i]);
prekey(192,1);
//prekey(192,2);
//prekey(192,8);
}
}
void prekey (int bits, int blocks)
{
uint8_t shuffled_key[24];
uint8_t key[24];
byte iv [N_BLOCK] ;
int myivleng = sizeof(my_iv) / sizeof(my_iv[0]);
for (byte i = 0 ; i < 24 ; i++) {
key[i]=EEPROM.read(i);
}
Serial.println("\n<==== AES with ECDH shared key ====>");
unsigned long t0 = micros() ;
byte succ = aes.set_key (key, bits) ; //key bit length
unsigned long t1 = micros();
int keyleng = sizeof(key) / sizeof(key[0]);
Serial.println("=====================================================================================================");
dump("AES key from ECDH shared key ", key, keyleng);
Serial.println("=====================================================================================================");
Serial.print ("set_key ") ; Serial.print (bits) ;
Serial.print (" ->") ; Serial.print ((int) succ==0?"Done":"Fail") ;
Serial.print (" time ") ; Serial.print (t1-t0) ; Serial.println (" uSec") ;
// seed 받기
mySerial.flush();
int cleng = sizeof(cipher) / sizeof(cipher[0]);
int seedleng = sizeof(shuffle_seed) / sizeof(shuffle_seed[0]);
Serial.print("cipher length : ");
Serial.println(cleng);
Serial.print("seed length : ");
Serial.println(seedleng);
while(mySerial.available()<cleng/2){
// wait
}
mySerial.readBytes(cipher, cleng);
// seed 복호화
t0 = micros () ;
if (blocks == 1)
succ = aes.decrypt (cipher, shuffle_seed) ;
else {
for (byte i = 0 ; i < 16 ; i++)
iv[i] = my_iv[i] ;
succ = aes.cbc_decrypt (cipher, shuffle_seed, blocks, iv) ;
}
t1 = micros () ;
Serial.print ("Decryption ") ; Serial.print ((int) succ==0?"Done":"Fail") ;
Serial.print (" time ") ; Serial.print (t1-t0) ; Serial.println (" uSec") ;
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Shuffle Seed");
lcd.setCursor(0,1);
lcd.print("> Decryption");
//
Serial.print("buf : +");
Serial.println(mySerial.available());
dump("cipher : ", cipher, cleng);
dump("shuffle_seed : ", shuffle_seed, seedleng);
dump("iv : ", iv, 16);
//======================== AES Key Shuffling ======================
for(int mm=1; mm <5; mm++){
//dump("AES key Before Shuffling\n", key , keyleng);
shuffle(key, 24, sizeof(byte), mm);
dump("AES key After Shuffling\n", key, keyleng);
for (byte i = 0 ; i < 24 ; i++) {
EEPROM.write(i+mm*24, key[i]);
}
}
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Key Shuffling");
lcd.setCursor(0,1);
lcd.print("> key 1 -> 4");
double sum =0;
for(int mmm=0;mmm<1;mmm++) {
Serial.print("i : ");
Serial.println(mmm);
for(int i=0;i< 24; i++) {
shuffled_key[i] = EEPROM.read(i+(mmm%4 + 1)*24);
}
/*for(int i=0; i<32; i++){
int arduino_a0_value=analogRead(A0);
plain[i]=map(arduino_a0_value,0,1023,0,255); // data reading from analog port A0
}*/
// myprintf("\n <==%2d ==> Message Decryption with shuffled AES key \n", mmm);
// Serial.println("=====================================================================================================");
// dump("Shuffled AES key=>", shuffled_key,keyleng);
// Serial.println("=====================================================================================================");
t0 = micros () ;
byte succ_shuffle = aes.set_key (shuffled_key, bits) ;
t1 = micros() ;
// Serial.print ("set_key ") ; Serial.print (bits) ; Serial.print (" ->") ; Serial.print ((int) succ_shuffle==0?"Done":"Fail");
// Serial.print (" time ") ; Serial.print (t1-t0) ; Serial.println (" uSec") ;
// ciper 수신
//int cleng = 32;
mySerial.flush();
// Serial.print("cipher length : ");
// Serial.println(cleng);
while(mySerial.available()<cleng/2){
// wait
}
mySerial.readBytes(cipher, cleng);
t0 = micros () ;
if (blocks == 1)
succ = aes.decrypt (cipher, plain) ;
else {
for (byte i = 0 ; i < 16 ; i++)
iv[i] = my_iv[i] ;
succ = aes.cbc_decrypt (cipher, plain, blocks, iv) ;
}
t1 = micros () ;
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Plain (16bits)");
lcd.setCursor(0,1);
lcd.print("> Decrytion");
sum = sum + t1 - t0;
//Serial.print ("decrypt ") ; Serial.print ((int) succ==0?"Done":"Fail") ;
//Serial.print (" took ") ; Serial.print (t1-t0) ; Serial.println (" uSec") ;
int pleng = sizeof(plain) / sizeof(plain[0]);
// dump("cipher : ", cipher, cleng);
dump("plain : ", plain, pleng);
Serial.println();
int cleng = sizeof(cipher) / sizeof(cipher[0]);
Serial.print("cipher length : ");
Serial.println(cleng);
Serial.print("buf : +");
Serial.println(mySerial.available());
// 화면 띄우기
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Slave Plain");
for(int i=0; i<pleng; i++){
Serial.print((char)plain[i]);
lcd.setCursor(i,1);
lcd.print((char)plain[i]);
}
/*
for (byte ph = 0 ; ph < (blocks == 1 ? 3 : 4) ; ph++) {
for (byte i = 0 ; i < (ph < 3 ? blocks*N_BLOCK : N_BLOCK) ; i++) {
byte val = ph == 0 ? plain[i] : ph == 1 ? cipher[i] : ph == 2 ? check[i] : iv[i] ;
Serial.print (val>>4, HEX) ; Serial.print (val&15, HEX) ; Serial.print (" ") ;
}
Serial.println () ;
}
*/
}
Serial.print("total time (DE, Plain 16bytes) : ");
Serial.print(sum/4);
}
|
486d5e84eea1d93c0947f8de9acaf5e93df5408f | 3c0d18b8723d67b8495eb6cb81d95d36341b573b | /Codeforces/present from lena.cpp | 2dd95269c72fd92cd5384c9c52190e1c5de2b07c | [] | no_license | tahmid108/Tahmid-s-Codes | c3128b5b4843ad888e80b57a565739bc742a88ed | ff80ee6d9de4c961a55353b4ded447c6e9bd7431 | refs/heads/master | 2023-02-13T18:10:13.388262 | 2021-01-08T15:38:52 | 2021-01-08T15:38:52 | 327,944,373 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 340 | cpp | present from lena.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int x=n;
for(int j=-n;j<=n;j++)
{
int cnt= n-abs(j);
for(int i=0;i<abs(j);i++)
{
cout << " ";
}
for(int i=0;i<cnt;i++)
{
cout << i <<" ";
}
for(int i=cnt;i>0;i--)
{
cout << i << " ";
}
cout << 0 << endl;
}
}
|
f001334b553f571be519f24835c5d76bbab6051f | 20c4e9987833b4dffe6d0c6802a1dc43b74ac728 | /C and C++/Others/find_minimum_range.cpp | 4937570e728dbd8b43d670092f603a1964b6d78a | [] | no_license | tg9963/CPP_files | c54aa57e3fdf3e3301b228f42a71a95210e71932 | 52e6da1e15c70501d290d955abfe8555261e2a34 | refs/heads/master | 2021-01-19T08:43:15.976534 | 2015-06-10T11:00:25 | 2015-06-10T11:00:25 | 34,978,103 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,029 | cpp | find_minimum_range.cpp | #include<iostream>
#include<stdlib.h>
#include<limits>
#include<algorithm>
#include<stack>
using namespace std;
struct node
{
int data;
int i;
};
void find_minimum_range(struct node arr[],int n,int k)
{
int i=0;
int range;
int min_range=INT_MAX;
int op[3];
for(int i=0;i<n;i++)
{
}
}
int comp(const void* a,const void *b)
{
return ( (*(struct node*)a).data - (*(struct node*)b).data);
}
int main()
{
struct node arr1[]={ {-1,1}, {4,-1},{7,1} };
struct node arr2[]={ {5,2},{9,2}, {15,2}, {23,2}};
struct node arr3[]={ {8,3},{24,3},{29,3},{25,3},{31,3}};
int k=3;
int n1=sizeof(arr1)/sizeof(arr1[0]);
int n2=sizeof(arr2)/sizeof(arr2[0]);
int n3=sizeof(arr3)/sizeof(arr3[0]);
int n=n1+n2+n3;
struct node arr[n];
int count=0;
for(int i=0;i<n1;i++)
{
arr[count++]=arr1[i];
}
for(int i=0;i<n2;i++)
{
arr[count++]=arr2[i];
}
for(int i=0;i<n3;i++)
{
arr[count++]=arr3[i];
}
qsort(arr,n,sizeof(arr[0]),comp);
for(int i=0;i<n;i++)
{
cout<<arr[i].data<<" ";
}
find_minimum_range(arr,n,k);
}
|
a2b1806dfa4440ca4a2c06c020ca967a053eb06d | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /components/allocation_recorder/crash_handler/stream_data_source_factory_unittest.cc | 3c25fb706669f0bbc26ee73b3070be73d6ca6149 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 3,205 | cc | stream_data_source_factory_unittest.cc | // Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/allocation_recorder/crash_handler/stream_data_source_factory.h"
#include <vector>
#include "base/debug/allocation_trace.h"
#include "components/allocation_recorder/crash_handler/memory_operation_report.pb.h"
#include "components/allocation_recorder/internal/internal.h"
#include "components/allocation_recorder/testing/crashpad_fake_objects.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::debug::tracer::AllocationTraceRecorder;
using crashpad::test::BufferExtensionStreamDataSourceDelegate;
namespace allocation_recorder::crash_handler {
namespace {
class StreamDataSourceFactoryTest : public ::testing::Test {
protected:
StreamDataSourceFactory& GetFactory() { return *factory_; }
#if BUILDFLAG(ENABLE_ALLOCATION_STACK_TRACE_RECORDER)
AllocationTraceRecorder& GetRecorder() const { return *operation_trace_; }
#endif
private:
const scoped_refptr<StreamDataSourceFactory> factory_ =
base::MakeRefCounted<StreamDataSourceFactory>();
#if BUILDFLAG(ENABLE_ALLOCATION_STACK_TRACE_RECORDER)
const std::unique_ptr<AllocationTraceRecorder> operation_trace_ =
std::make_unique<AllocationTraceRecorder>();
#endif
};
// Read the message stored in the given stream and return it.
std::string ReadMessageAsString(
const std::unique_ptr<crashpad::MinidumpUserExtensionStreamDataSource>&
stream) {
BufferExtensionStreamDataSourceDelegate stream_data_source_delegate;
stream->ReadStreamData(&stream_data_source_delegate);
const std::vector<uint8_t> message = stream_data_source_delegate.GetMessage();
return std::string(reinterpret_cast<const char*>(message.data()),
message.size());
}
void GetPayloadFromStream(
const std::unique_ptr<crashpad::MinidumpUserExtensionStreamDataSource>&
stream,
allocation_recorder::Payload& payload) {
ASSERT_NE(stream, nullptr);
const auto received_message = ReadMessageAsString(stream);
ASSERT_TRUE(payload.ParseFromString(received_message));
}
} // namespace
TEST_F(StreamDataSourceFactoryTest, VerifyCreateErrorMessage) {
StreamDataSourceFactory& factory = GetFactory();
const char* const error = "A fatal error happened.";
allocation_recorder::Payload payload;
GetPayloadFromStream(factory.CreateErrorMessage(error), payload);
ASSERT_TRUE(payload.has_processing_failures());
EXPECT_EQ(1, payload.processing_failures().messages().size());
EXPECT_EQ(error, payload.processing_failures().messages().at(0));
}
#if BUILDFLAG(ENABLE_ALLOCATION_STACK_TRACE_RECORDER)
TEST_F(StreamDataSourceFactoryTest, VerifyCreateReportStream) {
AllocationTraceRecorder& recorder = GetRecorder();
StreamDataSourceFactory& factory = GetFactory();
allocation_recorder::Payload payload;
GetPayloadFromStream(factory.CreateReportStream(recorder), payload);
EXPECT_TRUE(payload.has_operation_report());
EXPECT_TRUE(payload.operation_report().has_statistics());
EXPECT_EQ(0, payload.operation_report().memory_operations().size());
}
#endif
} // namespace allocation_recorder::crash_handler
|
da1b5fb23bd1c1a58e50cb01627abee5189a82d4 | e34dcb6dbd08c9147672c769f94d15adaf3e83b0 | /Graphics/Src/SceneStuff/TransformNode.cpp | 83f3d11650bef7d911a88b890ead58d0cb2f7e0d | [] | no_license | arorabharat144/WOWGE | 413558b105202db739a3a80c27771a719da502db | e3593cbf82c84ca0472b432ba3e4f1a043669258 | refs/heads/master | 2022-01-07T08:47:46.050012 | 2019-05-11T18:29:23 | 2019-05-11T18:29:23 | 186,168,240 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,315 | cpp | TransformNode.cpp | //====================================================================================================
// Filename: TransformNode.cpp
//====================================================================================================
//====================================================================================================
// Includes
//====================================================================================================
#include "Graphics\Src\Precompiled.h"
#include "Graphics\Inc\SceneStuff\TransformNode.h"
using namespace WOWGE;
using namespace WOWGE::Graphics;
//====================================================================================================
// Class Definitions
//====================================================================================================
TransformNode::TransformNode(MatrixStack& ms)
: mMatrixStack(ms)
{
// Empty
}
//----------------------------------------------------------------------------------------------------
TransformNode::~TransformNode()
{
Terminate();
}
//----------------------------------------------------------------------------------------------------
void TransformNode::Initialize(uint32_t bindIndex)
{
mBindIndex = bindIndex;
mConstantBuffer.Initialize();
}
//----------------------------------------------------------------------------------------------------
void TransformNode::Terminate()
{
mConstantBuffer.Terminate();
}
//----------------------------------------------------------------------------------------------------
void TransformNode::OnUpdate(float deltaTime)
{
}
//----------------------------------------------------------------------------------------------------
void TransformNode::OnPreRender()
{
mMatrixStack.PushMatrix(mTransform.GetTransformMatrix());
}
//----------------------------------------------------------------------------------------------------
void TransformNode::OnRender()
{
ConstantBuffer constants;
constants.matWorld = mMatrixStack.GetMatrixTranspose();
mConstantBuffer.Set(constants);
mConstantBuffer.BindVS(mBindIndex);
mConstantBuffer.BindPS(mBindIndex);
}
//----------------------------------------------------------------------------------------------------
void TransformNode::OnPostRender()
{
mMatrixStack.PopMatrix();
} |
42ec7fe99b6c23458ebef21d8f0122868a2910e8 | 19331b29c6e8a497e070ffa24c4219e0e7ed76d1 | /shadymatrix_square.cpp | 97bab328016892f3ff246e6ca969592b7c851104 | [] | no_license | qm210/shadymatrix | 65947696941d44412c2ea2a692aa4ce7b255501c | e93307352c5b376b14aee60dd643e3632c85423c | refs/heads/master | 2020-11-24T16:52:00.394377 | 2020-04-22T17:08:54 | 2020-04-22T17:08:54 | 228,257,603 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,298 | cpp | shadymatrix_square.cpp | #include <stdio.h>
#include <cmath>
#include <cstring>
#include <SDL2/SDL.h>
#include <SDL2/SDL2_gfxPrimitives.h>
#include <vector>
#include "LED_WS.h"
#include "pixel.h"
#include "helper.h"
#define PI 3.141592
#define numpix P.size()
const float distance_LED_in_cm = 100. / 60.;
const float distance_LED_in_m = 0.01 * distance_LED_in_cm;
const float originOffsetX = 16;
const float originOffsetY = 16;
struct Segment
{
float origin_x;
float origin_y;
float direction; // 0 to 360 degrees
int pixels;
int type = 0;
Segment(float x, float y, float to_x, float to_y) {set(x, y, to_x, to_y);}
Segment(float x, float y, float to_x, float to_y, int _type) {set(x, y, to_x, to_y); type = _type;}
void set(float x, float y, float to_x, float to_y)
{
x += originOffsetX;
y += originOffsetY;
to_x += originOffsetX;
to_y += originOffsetY;
set_origin(x, y);
set_direction_to(to_x, to_y);
set_length_to(to_x, to_y);
}
void set_origin(float x, float y) {origin_x = x; origin_y = y;}
void set_direction(float dir) {direction = fmod(dir + 360., 360.);}
void set_direction_to(float to_x, float to_y) {set_direction(180./PI*atan2(origin_y - to_y, to_x - origin_x));}
void set_length(float l) {pixels = (int)(round((l + 1) / distance_LED_in_cm));}
void set_length_to(float to_x, float to_y) {set_length(sqrt(pow(to_x - origin_x, 2) + pow(to_y - origin_y, 2)));}
float get_length() {return pixels * distance_LED_in_cm;}
vec2 get_pixel(int i)
{
return vec2(
origin_x + i * distance_LED_in_cm * cos(direction * PI/180.),
origin_y - i * distance_LED_in_cm * sin(direction * PI/180.)
);
}
vec2 get_last_pixel_plus_one() {return get_pixel(pixels);}
vec2 get_last_pixel() {return get_pixel(pixels - 1);}
float get_rightmost_x() {return direction > 90 && direction < 270 ? origin_x : get_last_pixel_plus_one().x;}
float get_bottommost_y() {return direction < 180 ? origin_y : get_last_pixel_plus_one().y;}
void move_horizontally(float inc)
{
origin_x += inc;
}
void move_vertically(float inc)
{
origin_y += inc;
}
void turn(float inc)
{
set_direction(direction + inc);
}
void change_length(int inc)
{
pixels = max(pixels + inc, 1);
}
void flip()
{
set_origin(get_last_pixel_plus_one().x, get_last_pixel_plus_one().y);
set_direction(direction + 180.);
}
};
int count_LEDs_in_cross_matrix(int, int);
void init_pattern();
void proceed_pattern(float time);
LED shader(float time, vec2 coord, int pixel, int segment, int type);
void print_all_segments(std::vector<Segment> segments);
bool debug = false;
int main(int argc, char* argv[])
{
SDL_Event e;
std::vector<std::vector<Segment>> figures;
std::vector<Segment> segments;
std::vector<Pixel> P;
const float D = distance_LED_in_cm;
const float N = 80;
const float A = N * D;
const float B = A - D;
float width = 32;
float height = 32;
float margin = 0;
bool circleShape = false;
bool helperLines = false;
bool blurLights = true;
bool drawStripRectangle = false;
float stripWidth = 1.0;
int selected_segment = 0;
int selected_figure = 0;
if (argc > 1)
{
selected_figure = (int)argv[1][0];
}
/// PATTERN
segments.clear();
for (float y = 0; y < height; y += distance_LED_in_cm)
{
segments.push_back(Segment(-originOffsetX, y - originOffsetY, width - originOffsetX, y - originOffsetY));
}
figures.clear();
figures.push_back(segments);
segments = figures[selected_figure];
/// END PATTERN
float meters_required = numpix * distance_LED_in_m;
printf("Pixels: %i\nMeters: %g\nWidth: %g\nHeight: %g\n", numpix, meters_required, width, height);
const float SCALE = N * .3;
const float MARGIN = margin * SCALE;
const float WIDTH = width * SCALE;
const float HEIGHT = height * SCALE;
const float LEDSIZE = .125 * N;
if (SDL_Init(SDL_INIT_VIDEO))
{
printf ("SDL_Init Error: %s", SDL_GetError());
return 1;
}
SDL_Window *window = SDL_CreateWindow("SDL2_gfx test", 800, 100, WIDTH, HEIGHT, SDL_WINDOW_OPENGL);
if (window == NULL)
{
printf ("SDL_CreateWindow Error: %s", SDL_GetError());
SDL_Quit();
return 2;
}
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if (renderer == NULL)
{
SDL_DestroyWindow(window);
printf ("SDL_CreateRenderer Error: %s", SDL_GetError());
SDL_Quit();
return 3;
}
SDL_Rect margin_t, margin_b, margin_l, margin_r;
margin_t.x = 0;
margin_t.y = 0;
margin_b.x = 0;
margin_b.y = HEIGHT - MARGIN;
margin_l.x = 0;
margin_l.y = 0;
margin_r.x = WIDTH - MARGIN;
margin_r.y = 0;
margin_t.w = margin_b.w = WIDTH;
margin_t.h = margin_b.h = MARGIN;
margin_l.w = margin_r.w = MARGIN;
margin_l.h = margin_r.h = HEIGHT;
float new_origin_x, new_origin_y, new_to_x, new_to_y;
int quit = 0;
long time = 0;
bool firstClick = true;
init_pattern();
while (!quit)
{
if (SDL_PollEvent(&e))
{
switch (e.type)
{
case SDL_MOUSEBUTTONDOWN:
int x, y;
SDL_GetMouseState(&x, &y);
if (firstClick)
{
new_origin_x = x / SCALE;
new_origin_y = y / SCALE;
printf("(%g, %g, ...\n", new_origin_x, new_origin_y);
firstClick = false;
}
else
{
new_to_x = x / SCALE;
new_to_y = y / SCALE;
Segment new_seg = Segment(new_origin_x, new_origin_y, new_to_x, new_to_y);
segments.push_back(new_seg);
for (int p = 0; p < new_seg.pixels; p++)
{
P.push_back(Pixel(new_seg.get_pixel(p), segments.size() - 1));
}
meters_required = numpix * distance_LED_in_m;
printf("(%g, %g, %g, %g) Pixels: %i, Meters: %g\n", new_origin_x, new_origin_y, new_to_x, new_to_y, numpix, meters_required);
firstClick = true;
}
break;
case SDL_KEYDOWN:
switch (e.key.keysym.sym)
{
case SDLK_BACKSPACE:
{
Segment last_seg = segments.back();
segments.pop_back();
for (int p = 0; p < last_seg.pixels; p++)
{
P.pop_back();
}
break;
}
case SDLK_SPACE:
segments.clear();
P.clear();
printf("erased everything.\n");
break;
/*
case SDLK_LEFT:
P.pop_back();
break;
*/
case SDLK_w:
segments[selected_segment].move_vertically(-0.1);
break;
case SDLK_s:
segments[selected_segment].move_vertically(+0.1);
break;
case SDLK_d:
segments[selected_segment].move_horizontally(+0.1);
break;
case SDLK_a:
segments[selected_segment].move_horizontally(-0.1);
break;
case SDLK_e:
segments[selected_segment].turn(-1);
break;
case SDLK_q:
segments[selected_segment].turn(+1);
break;
case SDLK_r:
segments[selected_segment].change_length(1);
break;
case SDLK_f:
segments[selected_segment].change_length(-1);
break;
case SDLK_t:
segments[selected_segment].flip();
break;
case SDLK_x:
if (selected_segment == segments.size() - 1)
{
std::swap(segments.front(), segments.back());
selected_segment = 0;
}
else
{
std::swap(segments[selected_segment], segments[selected_segment + 1]);
selected_segment++;
}
print_all_segments(segments);
break;
case SDLK_y:
if (selected_segment == 0)
{
std::swap(segments.front(), segments.back());
selected_segment = segments.size() - 1;
}
else
{
std::swap(segments[selected_segment], segments[selected_segment - 1]);
selected_segment--;
}
print_all_segments(segments);
break;
case SDLK_UP:
selected_segment = (selected_segment + 1) % segments.size();
printf("selected segment %i \t %i pixels \t\t (%.2f, %.2f) (%.2f, %.2f) \t\t ANTI [ (%.2f, %.2f) (%.2f, %.2f) ] \n", selected_segment, segments[selected_segment].pixels,
segments[selected_segment].origin_x - originOffsetX, segments[selected_segment].origin_y - originOffsetY,
segments[selected_segment].get_last_pixel_plus_one().x - originOffsetX, segments[selected_segment].get_last_pixel_plus_one().y - originOffsetY,
width - segments[selected_segment].origin_x - originOffsetX, height - segments[selected_segment].origin_y - originOffsetY,
width - segments[selected_segment].get_last_pixel_plus_one().x - originOffsetX, height - segments[selected_segment].get_last_pixel_plus_one().y - originOffsetY);
break;
case SDLK_DOWN:
selected_segment = (selected_segment - 1 + segments.size()) % segments.size();
printf("selected segment %i \t %i pixels \t\t (%.2f, %.2f) (%.2f, %.2f) \t\t ANTI [ (%.2f, %.2f) (%.2f, %.2f) ] \n", selected_segment, segments[selected_segment].pixels,
segments[selected_segment].origin_x - originOffsetX, segments[selected_segment].origin_y - originOffsetY,
segments[selected_segment].get_last_pixel_plus_one().x - originOffsetX, segments[selected_segment].get_last_pixel_plus_one().y - originOffsetY,
width - segments[selected_segment].origin_x - originOffsetX, height - segments[selected_segment].origin_y - originOffsetY,
width - segments[selected_segment].get_last_pixel_plus_one().x - originOffsetX, height - segments[selected_segment].get_last_pixel_plus_one().y - originOffsetY);
break;
case SDLK_ESCAPE:
quit = 1;
break;
case SDLK_RETURN:
print_all_segments(segments);
break;
}
break;
case SDL_QUIT:
quit = 1;
break;
}
}
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
//////////// MARGIN /////////////
SDL_SetRenderDrawColor(renderer, 20, 20, 20, 255);
SDL_RenderFillRect(renderer, &margin_t);
SDL_RenderFillRect(renderer, &margin_b);
SDL_RenderFillRect(renderer, &margin_l);
SDL_RenderFillRect(renderer, &margin_r);
///////////// OUTLINE ///////////
if (circleShape)
{
filledCircleColor(renderer, .5 * WIDTH, .5 * HEIGHT, .5 * WIDTH, RGB(255, 0, 0) );
filledCircleColor(renderer, .5 * WIDTH, .5 * HEIGHT, .5 * WIDTH - 2, RGB(0, 0, 0) );
}
if (helperLines)
{
filledCircleColor(renderer, .5 * WIDTH, .5 * HEIGHT, .25 * WIDTH, RGB(255, 0, 0) );
filledCircleColor(renderer, .5 * WIDTH, .5 * HEIGHT, .25 * WIDTH - 2, RGB(0, 0, 0) );
SDL_SetRenderDrawColor(renderer, 250, 0, 0, 255);
SDL_RenderDrawLine(renderer, .25 * WIDTH, 0, .25 * WIDTH, HEIGHT);
SDL_RenderDrawLine(renderer, .50 * WIDTH, 0, .50 * WIDTH, HEIGHT);
SDL_RenderDrawLine(renderer, .75 * WIDTH, 0, .75 * WIDTH, HEIGHT);
SDL_RenderDrawLine(renderer, 0, .25 * HEIGHT, WIDTH, .25 * HEIGHT);
SDL_RenderDrawLine(renderer, 0, .50 * HEIGHT, WIDTH, .50 * HEIGHT);
SDL_RenderDrawLine(renderer, 0, .75 * HEIGHT, WIDTH, .75 * HEIGHT);
}
//////////// PATTERN ////////////
P.clear();
for (std::vector<Segment>::iterator iseg = segments.begin(); iseg != segments.end(); ++iseg)
{
int segcount = iseg - segments.begin();
for (int p = 0; p < iseg->pixels; p++)
{
Pixel pixel = Pixel(iseg->get_pixel(p), segcount);
vec2 relative_coord = vec2(pixel.x/width, pixel.y/height);
pixel.L = shader(time, relative_coord, numpix, segcount - selected_segment, iseg->type);
P.push_back(pixel);
}
}
//////////// LIGHTS ////////////
for(int p = 0; p < numpix; p++)
{
if(numpix < 1000 && blurLights)
{
for (int i=0; i<4; i++)
{
float step = 1 + .25 * i;
float intensity = pow(.5, i);
filledCircleColor(renderer, SCALE * P[p].x, SCALE * P[p].y, LEDSIZE * step, LEDColor(P[p].L, intensity));
}
}
}
//////// STRIP RECTANGLE //////////
if (drawStripRectangle)
{
float L2 = .5 * distance_LED_in_cm;
float H2 = .5 * stripWidth;
for (std::vector<Segment>::iterator iseg = segments.begin(); iseg != segments.end(); ++iseg)
{
if (iseg - segments.begin() == selected_segment)
{
SDL_SetRenderDrawColor(renderer, 200, 200, 200, 255);
}
else
{
SDL_SetRenderDrawColor(renderer, 0, 0, 200, 128);
}
float ca = cos(iseg->direction * PI / 180.);
float sa = sin(iseg->direction * PI / 180.);
float corner1x = iseg->origin_x - ca * L2 + sa * H2;
float corner1y = iseg->origin_y + sa * L2 + ca * H2;
float corner2x = iseg->origin_x - ca * L2 - sa * H2;
float corner2y = iseg->origin_y + sa * L2 - ca * H2;
float corner4x = iseg->get_last_pixel().x + ca * L2 + sa * H2;
float corner4y = iseg->get_last_pixel().y - sa * L2 + ca * H2;
float corner3x = iseg->get_last_pixel().x + ca * L2 - sa * H2;
float corner3y = iseg->get_last_pixel().y - sa * L2 - ca * H2;
SDL_RenderDrawLine(renderer, SCALE * corner1x, SCALE * corner1y - 1, SCALE * corner2x, SCALE * corner2y - 1);
SDL_RenderDrawLine(renderer, SCALE * corner2x, SCALE * corner2y - 1, SCALE * corner3x, SCALE * corner3y - 1);
SDL_RenderDrawLine(renderer, SCALE * corner3x, SCALE * corner3y - 1, SCALE * corner4x, SCALE * corner4y - 1);
SDL_RenderDrawLine(renderer, SCALE * corner4x, SCALE * corner4y - 1, SCALE * corner1x, SCALE * corner1y - 1);
//SDL_RenderDrawLine(renderer, SCALE * corner1x + 1, SCALE * corner1y, SCALE * corner2x + 1, SCALE * corner2y);
SDL_RenderDrawLine(renderer, SCALE * corner2x + 1, SCALE * corner2y, SCALE * corner3x + 1, SCALE * corner3y);
SDL_RenderDrawLine(renderer, SCALE * corner3x + 1, SCALE * corner3y, SCALE * corner4x + 1, SCALE * corner4y);
SDL_RenderDrawLine(renderer, SCALE * corner4x + 1, SCALE * corner4y, SCALE * corner1x + 1, SCALE * corner1y);
SDL_RenderDrawLine(renderer, SCALE * corner3x - 1, SCALE * corner3y + 1, SCALE * corner4x - 1, SCALE * corner4y);
}
}
SDL_RenderPresent(renderer);
if (debug)
{
SDL_Delay(5);
}
time++;
proceed_pattern(time);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
float pos[4];
float vel[4];
float ang[4];
float lumi[4];
float white[4];
int counter[3];
int counter_max[3];
#define globalHue 224
#define WATER_HUE globalHue
#define WATER_SCALE .5
#define WATER_SPEED .008
#define WATER_SPEED_RND 0.42
#define WATER_PERIOD_MIN 64
#define WATER_PERIOD_RND 16
#define WATER_BG 0.7
#define WATER_WHITE_MAX 1
#define WATER_WHITE_EXPONENT 2.6
#define WATER_Y_OFFSET 0.47
void init_pattern()
{
for (int s=0; s<4; s++)
{
pos[s] = 0.;
vel[s] = 0.;
ang[s] = 0.;
lumi[s] = 0.;
white[s] = 0.;
}
counter_max[0] = WATER_PERIOD_MIN + random(WATER_PERIOD_RND);
counter_max[1] = WATER_PERIOD_MIN + random(WATER_PERIOD_RND);
counter_max[2] = WATER_PERIOD_MIN + random(WATER_PERIOD_RND);
counter[0] = 0;
counter[1] = -WATER_PERIOD_MIN / 3;
counter[2] = -WATER_PERIOD_MIN * 2 / 3;
}
void proceed_pattern(float time)
{
for(int p=0; p<3; p++)
{
if (counter[p] < counter_max[p])
{
pos[p] = WATER_SPEED * counter[p];
counter[p]++;
}
if (counter[p] == counter_max[p])
{
lumi[p] = WATER_BG + (1 - WATER_BG) * 0.01 * random(100);
white[p] = WATER_WHITE_MAX * pow(0.01 * random(100), WATER_WHITE_EXPONENT);
counter_max[p] = WATER_PERIOD_MIN + random(WATER_PERIOD_RND);
counter[p] = 0;
}
}
// printf("STEP %f %i %i %f\n", pos[0], counter[0], counter_max[0], white[0]);
}
// Reminder: coord is scaled as [0,1] in each dimension.
LED shader(float time, vec2 coord, int pixel, int segment, int type)
{
if (debug)
{
if (segment == 0)
{
return LED(1, 1);
}
return LED(200, .5, 1);
}
if (type == 1) // tie
{
LED led = LED(WATER_HUE, 0, WATER_BG);
for(int p=0; p<3; p++)
{
float ypos = (float)(pos[p] - coord.y + WATER_Y_OFFSET);
if (ypos >= 0)
{
led.mix(LED(WATER_HUE, white[p], lumi[p] * max(0., (1 - ypos / WATER_SCALE))), 1);
}
}
return led;
}
else // leaves
{
LED led = LED(100, 0, .8);
float r = sqrt(pow(coord.x - .5, 2) + pow(coord.y - .5, 2));
float phi = 180./PI * atan2(coord.y - .5, coord.x - .5);
float spiralHue = 100. + 30. * sin(10. * r + 0.01 * phi - 0.2 * time);
LED led_spiral = LED(spiralHue, 0, 1);
// printf("PIXEL %i %f %f %f %f\n", pixel, coord.x, coord.y, r, phi);
return led_spiral;
}
}
void print_all_segments(std::vector<Segment> segments)
{
printf("\n");
printf(" segments.clear();\n");
for (std::vector<Segment>::iterator iseg = segments.begin(); iseg != segments.end(); ++iseg)
{
printf(" segments.push_back(Segment(%.2f, %.2f, %.2f, %.2f)); \t\t\t\t // Segment %i \t Length %.2f \t Pixels: %g \n",
iseg->origin_x, iseg->origin_y, iseg->get_last_pixel_plus_one().x, iseg->get_last_pixel_plus_one().y,
(iseg - segments.begin()), iseg->get_length(), iseg->get_length()/distance_LED_in_cm);
}
printf("\n");
} |
e0dbc239aaafeb02d422023bc34bc9a989b2fd9a | 5509f6980f6b2f741cf3030ceab95cdf6dd16746 | /lap_trinh_huong_doi_tuong/kiem_tra_lan_2/pham_thi_hoai_058_bai_1.cpp | 0b08f3fe858db743042ca37f8352073fa72b410f | [] | no_license | phamhoai0404/Code_Dau | a160c87627d9fd61e8481578448bdf7737fd57cd | 5d9854d18f8cb3b8b323c974dd0620b45a45bc8a | refs/heads/master | 2023-07-14T14:38:29.624652 | 2021-08-12T15:03:48 | 2021-08-12T15:03:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,563 | cpp | pham_thi_hoai_058_bai_1.cpp | #include <iostream>
#include <stdio.h>
#include "conio.h"
#include<windows.h>
using namespace std;
class PHUONGTRINH
{
private:
float a,b;
public:
PHUONGTRINH(float x,float y)
{
a=x;
b=y;
}
PHUONGTRINH()
{
a=0;
b=0;
}
PHUONGTRINH operator-(PHUONGTRINH y);
PHUONGTRINH operator+(PHUONGTRINH y);
friend istream& operator>>(istream& x, PHUONGTRINH &y);
friend ostream& operator<<(ostream& x, PHUONGTRINH y);
};
PHUONGTRINH PHUONGTRINH :: operator+(PHUONGTRINH y)
{
PHUONGTRINH tam;
tam.a=a+y.a;
tam.b=b+y.b;
return tam;
}
PHUONGTRINH PHUONGTRINH:: operator-(PHUONGTRINH y)
{
PHUONGTRINH tam;
tam.a=a-y.a;
tam.b=b-y.b;
return tam;
}
istream&operator>>(istream& x, PHUONGTRINH &y)
{
cout<<"\n \tNhap a: "; x>>y.a;
cout<<"\n \tNhap b: "; x>>y.b;
return x;
}
ostream&operator<<(ostream& x,PHUONGTRINH y)
{
if(y.a==0)x<<y.b;
else{
if(y.b==0)x<<y.a<<"*x";
else{
if(y.b>0)x<<y.a<<"*x + "<<y.b;
else x<<y.a<<"*x "<<y.b;
}
}
return x;
}
int main()
{
PHUONGTRINH a,b;
cout<<" Nhap phuong trinh A co dang (a*x+b): "<<endl;
cin>>a;
cout<<"\n Nhap phuong trinh B co dang (a*x+b): "<<endl;
cin>>b;
PHUONGTRINH T = a+b;
PHUONGTRINH H = a-b;
cout<<"\n Tong A va B: "<<a<<" + "<<b<<" = "<<T<<endl<<endl;
cout<<"\n Hieu A va B: "<<a<<" - ("<<b<<") = "<<H<<endl;
return 0;
}
|
ff66e22e46044c5bcc7a6c9f19d347a8f01970e5 | 85f46313dd8421ff909cd840e9720619e2b30564 | /Earth.cpp | ae2841481ea3d80fcf20ad8608734f0c7bfa8ca0 | [] | no_license | lilCentipede/Philosophers-Stone | 6386903d5e3cd54a9af996e6bf1d92b2499e7050 | 71d0f17a29ccf897be06262388a6ed5bc72ce6cd | refs/heads/master | 2022-07-20T02:14:38.111809 | 2020-05-26T10:20:21 | 2020-05-26T10:20:21 | 266,819,787 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 286 | cpp | Earth.cpp | #include "Earth.h"
bool Earth::reactwithFire() { return true; }
bool Earth::reactwithAir() { return true; }
bool Earth::reactwithWater() { return true; }
bool Earth::reactwithMe(Element* el) {
return el->reactwithEarth();
}
Element* Earth::copy() {
return new Earth(*this);
} |
665343f323d4d70fd627fcc1341bab95c6bd7dec | 33ff3b40100bf04eb2f25ccf924f4ee572da8978 | /BSSN_GR/include/psi4.h | de98749120765ce3a2b43fa6de2d8bb850ff90f0 | [
"MIT"
] | permissive | paralab/Dendro-GR | 59b65fc04cc31e628d44a92ce9b61585c41d09ce | 1316bf3f219557c3c11b8acdd0c446e4e02f72dc | refs/heads/master | 2023-08-18T05:48:03.715725 | 2023-06-29T14:11:52 | 2023-06-29T14:11:52 | 137,814,094 | 40 | 13 | MIT | 2023-06-28T18:55:39 | 2018-06-18T22:41:02 | C | UTF-8 | C++ | false | false | 506 | h | psi4.h | #ifndef PHYSCON_H
#define PHYSCON_H
#include <iostream>
#include "parameters.h"
#include "grUtils.h"
#include "derivs.h"
#define deriv_x deriv42_x
#define deriv_y deriv42_y
#define deriv_z deriv42_z
#define deriv_xx deriv42_xx
#define deriv_yy deriv42_yy
#define deriv_zz deriv42_zz
void psi4( double **uZipConVars, const double **uZipVars,
const unsigned int& offset,
const double *pmin, const double *pmax,
const unsigned int *sz, const unsigned int& bflag);
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.