blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
873d9d8e189bfbc284a5346b82d99ebd6de6f34a
c8e133278da4d716b77ee9cfec9a817132b0531d
/005-4344-百分制成绩/OJ.cpp
134ffe98b577accea885ce6a81473d687f9c3680
[]
no_license
jiguang123/Huawei-OJ
c861ce5d349a665aa477f444f73b7f7697a7b2ac
af7e8acc6484e4f93f9eaf038823350adcae3bb7
refs/heads/master
2021-05-30T19:12:59.675270
2016-02-03T06:06:41
2016-02-03T06:06:41
null
0
0
null
null
null
null
GB18030
C++
false
false
640
cpp
#include <stdlib.h> #include "oj.h" /* 功能: 给出一百分制成绩,要求输出成绩等级‘A’、‘B’、‘C’、‘D’、‘E’。 90分以上为A 80-89分为B 70-79分为C 60-69分为D 60分以下为E 输入: 整数score 输出: 无 返回: 分级结果 分数不在100范围时返回-1 */ int ScoreLevel(int score) { if(score < 0 || score > 100) { return -1; } else if(score >= 90) { return 'A'; } else if(score >= 80) { return 'B'; } else if(score >= 70) { return 'C'; } else if(score >= 60) { return 'D'; } else { return 'E'; } }
[ "shining-glory@qq.com" ]
shining-glory@qq.com
03fca866675efbdf5a76b381f425f106551f709c
ec89e41ca41970c0704a80544f5f579f3fc42cb3
/internal/platform/implementation/apple/condition_variable_test.cc
846ad438b15fbd98c0b20fd8c7f3670cf9c40207
[ "Apache-2.0" ]
permissive
google/nearby
0feeea41a96dd73d9d1b8c06e101622411e770c5
55194622a7b7e9066f80f90675b06eb639612161
refs/heads/main
2023-08-17T01:36:13.900851
2023-08-17T01:11:43
2023-08-17T01:13:11
258,325,401
425
94
Apache-2.0
2023-09-14T16:40:13
2020-04-23T20:41:37
C++
UTF-8
C++
false
false
2,058
cc
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://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 "internal/platform/implementation/apple/condition_variable.h" #include "gtest/gtest.h" #include "absl/time/clock.h" #include "internal/platform/implementation/apple/mutex.h" #include "thread/fiber/fiber.h" namespace nearby { namespace apple { namespace { TEST(ConditionVariableTest, CanCreate) { Mutex mutex{}; ConditionVariable cond{&mutex}; } TEST(ConditionVariableTest, CanWakeupWaiter) { Mutex mutex{}; ConditionVariable cond{&mutex}; bool done = false; bool waiting = false; { thread::Fiber f([&cond, &mutex, &done, &waiting] { mutex.Lock(); waiting = true; cond.Wait(); waiting = false; done = true; mutex.Unlock(); }); while (true) { { mutex.Lock(); if (waiting) { mutex.Unlock(); break; } mutex.Unlock(); } absl::SleepFor(absl::Milliseconds(100)); } { mutex.Lock(); cond.Notify(); EXPECT_FALSE(done); mutex.Unlock(); } f.Join(); } EXPECT_TRUE(done); } TEST(ConditionVariableTest, WaitTerminatesOnTimeoutWithoutNotify) { Mutex mutex{}; ConditionVariable cond{&mutex}; mutex.Lock(); const absl::Duration kWaitTime = absl::Milliseconds(100); absl::Time start = absl::Now(); cond.Wait(kWaitTime); absl::Duration duration = absl::Now() - start; EXPECT_GE(duration, kWaitTime); mutex.Unlock(); } } // namespace } // namespace apple } // namespace nearby
[ "copybara-worker@google.com" ]
copybara-worker@google.com
5fb0edf8efda72c9c35b04ff7fd4ae1937d7d1ee
dc55482c031929bf27917458ac0de2f0db6f0597
/096_bst_set/bstset.h
e39b3deb094aa9a1f6538565e9e9cdcfe868d20a
[]
no_license
nn75/ECE551
1da9712d4bf7379ecc3dd5e8c773cf6ccb8e65e4
c6fac55777a3094f5a6dc9487b770a98777c2b5c
refs/heads/master
2020-07-14T01:39:51.255961
2019-08-29T16:27:30
2019-08-29T16:27:30
205,203,713
0
0
null
null
null
null
UTF-8
C++
false
false
4,745
h
#include <cstdio> #include <cstdlib> #include <iostream> #include "set.h" template<typename T> class BstSet : public Set<T> { private: class Node { public: T key; Node * left; Node * right; Node(const T & k) : key(k), left(NULL), right(NULL) {} }; Node * root; public: BstSet() : root(NULL) {} //Copy constructor. Node * copy(const Node * n) { if (n == NULL) { return NULL; } Node * newNode = new Node(n->key); if (n->left != NULL) { newNode->left = copy(n->left); } if (n->right != NULL) { newNode->right = copy(n->right); } return newNode; } BstSet(const BstSet<T> & rhs) : root(NULL) { root = copy(rhs.root); } BstSet<T> & operator=(const BstSet<T> & rhs) { if (this != &rhs) { destroy(root); root = copy(rhs.root); } return *this; } //Add virtual void add(const T & key) { Node * curr = root; Node * toAdd = new Node(key); while (curr != NULL) { if (key < curr->key) { if (curr->left == NULL) { curr->left = toAdd; return; } else { curr = curr->left; } } else if (key > curr->key) { if (curr->right == NULL) { curr->right = toAdd; return; } else { curr = curr->right; } } else { curr->key = key; delete toAdd; return; } } root = toAdd; } //Lookup virtual bool contains(const T & key) const { Node * curr = root; while (curr != NULL) { if (key == curr->key) { return true; } else if (key < curr->key) { curr = curr->left; } else { curr = curr->right; } } return false; } //Remove virtual void remove(const T & key) { Node * curr = root; Node * parent = root; while (curr != NULL) { if (curr->key < key) { if (curr->right == NULL) { exit(EXIT_FAILURE); } else { parent = curr; curr = curr->right; } } else if (curr->key > key) { if (curr->left == NULL) { exit(EXIT_FAILURE); } else { parent = curr; curr = curr->left; } } else { if (curr->left == NULL && curr->right == NULL) { if (parent->left == curr) { parent->left = NULL; } else if (parent->right == curr) { parent->right = NULL; } else { root = NULL; } delete curr; return; } else if (curr->left == NULL && curr->right != NULL) { if (parent->left == curr) { parent->left = curr->right; } else if (parent->right == curr) { parent->right = curr->right; } else { root = curr->right; } delete curr; return; } else if (curr->left != NULL && curr->right == NULL) { if (parent->right == curr) { parent->right = curr->left; } else if (parent->left == curr) { parent->left = curr->left; } else { root = curr->left; } delete curr; return; } else { Node * temp = curr->left; Node * temp_parent = temp; while (temp->right != NULL) { temp_parent = temp; temp = temp->right; } if (temp_parent == temp) { temp->right = curr->right; if (parent->left == curr) { parent->left = temp; } else if (parent->right == curr) { parent->right = temp; } else { root = temp; } } else { temp_parent->right = temp->left; temp->left = curr->left; temp->right = curr->right; if (parent->left == curr) { parent->left = temp; } else if (parent->right == curr) { parent->right = temp; } else { root = temp; } } delete curr; return; } } } } virtual ~BstSet<T>() { destroy(root); } void destroy(Node * n) { if (n != NULL) { destroy(n->left); destroy(n->right); delete n; } } void printInorder(Node * n) { if (n != NULL) { printInorder(n->left); std::cout << n->key << " " << std::endl; printInorder(n->right); } } Node * getRoot() { return root; } };
[ "nn75@duke.edu" ]
nn75@duke.edu
d317a1a416ed3397ba16e79192e097d7e8f76ded
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
/audio/zita-njbridge/files/patch-zita-j2n.cc
bdeb6c98fb5de12fda471f46b1e80e3698ad1a31
[ "BSD-2-Clause" ]
permissive
freebsd/freebsd-ports
86f2e89d43913412c4f6b2be3e255bc0945eac12
605a2983f245ac63f5420e023e7dce56898ad801
refs/heads/main
2023-08-30T21:46:28.720924
2023-08-30T19:33:44
2023-08-30T19:33:44
1,803,961
916
918
NOASSERTION
2023-09-08T04:06:26
2011-05-26T11:15:35
null
UTF-8
C++
false
false
240
cc
--- zita-j2n.cc.orig 2021-07-02 16:35:56 UTC +++ zita-j2n.cc @@ -25,6 +25,7 @@ #include <getopt.h> #include <math.h> #include <sys/mman.h> +#include <unistd.h> // for usleep #include "jacktx.h" #include "nettx.h" #include "lfqueue.h"
[ "yuri@FreeBSD.org" ]
yuri@FreeBSD.org
833ceea953fb2e1a8f56824853348dc9ebaba6a0
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/Simulation/G4Utilities/G4UserActions/src/LengthIntegratorTool.cxx
61befb4572797d07fc276c376d2550af297153ab
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
1,520
cxx
/* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #include "G4UserActions/LengthIntegratorTool.h" namespace G4UA { //--------------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------------- LengthIntegratorTool::LengthIntegratorTool(const std::string& type, const std::string& name, const IInterface* parent) : ActionToolBase<LengthIntegrator>(type, name, parent), m_hSvc("THistSvc", name) { declareInterface<IG4EventActionTool>(this); declareInterface<IG4SteppingActionTool>(this); declareProperty("HistoSvc", m_hSvc); } //--------------------------------------------------------------------------- // Initialize - temporarily here for debugging //--------------------------------------------------------------------------- StatusCode LengthIntegratorTool::initialize() { ATH_MSG_DEBUG("initialize"); ATH_CHECK( m_hSvc.retrieve() ); return StatusCode::SUCCESS; } //--------------------------------------------------------------------------- // Create the action on request //--------------------------------------------------------------------------- std::unique_ptr<LengthIntegrator> LengthIntegratorTool::makeAction() { ATH_MSG_DEBUG("makeAction"); return std::make_unique<LengthIntegrator>( m_hSvc.name() ); } }
[ "rushioda@lxplus754.cern.ch" ]
rushioda@lxplus754.cern.ch
0b71cf81be79b1be31296ac7166bd4fc3066e092
7b2b8662fa79f9bc425c39faa57dd41f23eb6d77
/Arion/include/Arion/BoundingVolumes.hpp
8ed1beb6634f6d2b9c2155cd0d401e9325949ea3
[ "MIT" ]
permissive
Godlike/Arion
f8cc0f3dbbc837093c45560804626a3a18420f9a
533e59a6bdc7b0b8c6037b328ec2acf5fe647e2c
refs/heads/master
2021-07-12T09:02:22.171884
2018-12-16T04:40:38
2018-12-16T19:32:11
103,935,016
1
1
MIT
2018-12-16T19:32:12
2017-09-18T12:17:29
C++
UTF-8
C++
false
false
6,776
hpp
/* * Copyright (C) 2017-2018 by Godlike * This code is licensed under the MIT license (MIT) * (http://opensource.org/licenses/MIT) */ #ifndef ARION_BOUNDING_VOLUMES_HPP #define ARION_BOUNDING_VOLUMES_HPP #include <Arion/Shape.hpp> #include <Arion/Intersection.hpp> #include <vector> #include <set> namespace arion { namespace volume { /** * @brief Represents an instance of mesh data */ struct Mesh { /** * @brief Constructs mesh data object * @param vertices vertex buffer data * @param indices index buffer data */ Mesh(std::vector<glm::vec3> const& vertices, std::vector<glm::u64vec3> const& indices); std::vector<glm::vec3> const& vertices; std::vector<glm::u64vec3> const& indices; }; /** * @brief Calculates average value of a vertex for the given set of indices * @param mesh vertex and index data * @param indices set of indices for calculation * @return average vertex value */ glm::vec3 CalculateMeanVertex( volume::Mesh const& mesh, std::set<std::size_t> const& indices ); /** * @brief Calculates covariance matrix for the given set of vertices * @param mesh vertex and index data * @param indices set of indices for calculation * @param mean average vertex value for the given set * @return covariance matrix */ glm::mat3 CalculateCovarianceMatrix( volume::Mesh const& mesh, std::set<std::size_t> const& indices, glm::vec3 const& mean ); /** * @brief Calculates extremal vertices for the given set in the given directions * @param basis direction vectors * @param mesh vertex and index data * @param indices set of indices for calculation * @return extremal vertices */ glm::mat3 CalculateExtremalVertices( glm::mat3 const& basis, volume::Mesh const& mesh, std::set<std::size_t> const& indices ); namespace obb { /** * @brief Oriented bounding box calculation algorithm */ class OrientedBoundingBox { public: /** * @brief Stores calculation data */ struct Box { glm::vec3 mean; glm::mat3 covariance; glm::mat3 eigenVectors; glm::mat3 eigenVectorsNormalized; glm::mat3 extremalVertices; glm::mat3 boxAxes; }; /** * @brief Constructs OBB for the given set of vertices in the given mesh * @param mesh vertex and index data * @param indices set of indices for calculation */ OrientedBoundingBox(Mesh const& mesh, std::set<std::size_t> const& indices); /** * @brief Returns pre-calculated OBB shape * @return obb shape */ arion::Box GetVolume() const; private: arion::Box m_boxShape; Box m_box; Mesh const& m_shape; std::set<std::size_t> const& m_indices; }; } // namespace obb namespace aabb { /** * @brief Axis aligned bounding box calculation algorithm */ class AxisAlignedBoundingBox { public: /** * @brief Stores representations of AABB */ struct Box { glm::vec3 xMin; glm::vec3 xMax; glm::vec3 yMin; glm::vec3 yMax; glm::vec3 zMin; glm::vec3 zMax; glm::vec3 extremalMean; glm::vec3 xAxis; glm::vec3 yAxis; glm::vec3 zAxis; }; /** * @brief Constructs AABB for the given set of vertices in the given mesh * @param mesh vertex and index data * @param indices set of indices for calculation */ AxisAlignedBoundingBox(Mesh const& mesh, std::set<std::size_t> const& indices); /** * @brief Returns pre-calculated AABB shape * @return aabb shape */ arion::Box GetVolume() const; private: arion::Box m_boxShape; Box m_box; Mesh const& m_shape; std::set<std::size_t> const& m_indices; /** * @brief Calculates extremal vertices from the given set along the x,y and z axes * @param[in] mesh vertex and index data * @param[in] indices set of indices for calculation * @param[out] box aabb data */ static void CalculateExtremalVetices(Mesh const& mesh, std::set<std::size_t> const& indices, Box& box); /** * @brief Calculates average box vertex * @param[out] box aabb data */ static void CalculateMean(Box& box); /** * @brief Creates shape representation of AABB * @param[in,out] box aabb data */ void CreateBox(Box& box); }; } // namespace aabb namespace sphere { /** * @brief Bounding sphere calculation algorithm */ class BoundingSphere { public: /** * @brief Stores representation of Bounding sphere */ struct Sphere { glm::vec3 mean; glm::mat3 covariance; glm::vec3 eigenValues; glm::mat3 eigenVectors; glm::mat3 eigenVectorsNormalized; }; /** * @brief Calculates bounding sphere for the given set of vertices in the given mesh * * The implementation of the algorithm accounts for the dispersion and density of the * vertex data by calculating covariance matrix and refining initial sphere in the direction * of the maximum spread. * @param mesh vertex and index data * @param indices set of indices for calculation */ BoundingSphere(Mesh const& mesh, std::set<std::size_t> const& indices); /** * @brief Returns pre-calculated Bounding sphere shape * @return bounding sphere shape */ arion::Sphere GetVolume() const; private: arion::Sphere m_sphereShape; Sphere m_sphere; Mesh const& m_shape; std::set<std::size_t> const& m_indices; /** * @brief Calculates initial bounding sphere * * @note: This method requires calculation of the covariance matrix * for the given set of vertices in order to construct initial guess more efficiently. * @param[in] eigenVectors eigenvetors of the covariance matrix * @param[in] eigenValues eigenvalues of the covariance matrix * @param[in] mesh vertex and index data * @param[in] indices set of indices for calculation * @return bounding sphere shape */ static arion::Sphere CalculateInitialBoundingSphere( glm::mat3 const& eigenVectors, glm::vec3 const& eigenValues, Mesh const& mesh, std::set<std::size_t> const& indices ); /** * @brief Iteratively refines sphere * * Refining happens by accounting for the points that are outside of the current bounding sphere * @param[in] sphere initial sphere shape * @param[in] mesh vertex and index data * @param[in] indices set of indices for calculation * @return bounding sphere shape */ static arion::Sphere RefineSphere( arion::Sphere const& sphere, Mesh const& mesh, std::set<std::size_t> const& indices ); }; } // namespace sphere } // namespace volumes } // namespace arion #endif // ARION_BOUNDING_VOLUMES_HPP
[ "ilia.glushchenko@gmail.com" ]
ilia.glushchenko@gmail.com
5404032e2d5b138a9f71d75be16fb65ae7ea13fc
b3be27b4bf494270c5c953cf711088a10f79de81
/src/catalog/plx/ui/window.h
2afd205e70c28267894cabe7af3ddec218c24696
[]
no_license
cpizano/Plex
2973b606933eb14198e337eeb45e725201799e7a
b5ab6224ddb1a1ca0aa59b6f585ec601c913cb15
refs/heads/master
2016-09-05T18:42:34.431460
2016-01-03T21:56:09
2016-01-03T21:56:09
6,571,011
0
0
null
null
null
null
UTF-8
C++
false
false
3,557
h
//#~def plx::Window /////////////////////////////////////////////////////////////////////////////// // plx::Window // namespace plx { template <typename Derived> class Window { HWND window_; plx::DPI dpi_; Window(const Window&) = delete; Window& operator=(const Window&) = delete; public: HWND window() { return window_; } const plx::DPI& dpi() const { return dpi_; } protected: Window() : window_(nullptr) {} HWND create_window(DWORD ex_style, DWORD style, LPCWSTR window_name, HICON small_icon, HICON icon, int x, int y, int width, int height, HWND parent, HMENU menu) { WNDCLASSEX wcex = { sizeof(wcex) }; wcex.hCursor = ::LoadCursor(nullptr, IDC_ARROW); wcex.hInstance = reinterpret_cast<HINSTANCE>(&__ImageBase); wcex.lpszClassName = L"PlexWindowClass"; wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wcex.lpfnWndProc = WndProc; wcex.hIcon = icon; wcex.hIconSm = small_icon; auto atom = ::RegisterClassEx(&wcex); if (!atom) throw plx::User32Exception(__LINE__, plx::User32Exception::wclass); return ::CreateWindowExW(ex_style, MAKEINTATOM(atom), window_name, style, x, y, width, height, parent, menu, wcex.hInstance, this); } static Derived* this_from_window(HWND window) { return reinterpret_cast<Derived*>(GetWindowLongPtr(window, GWLP_USERDATA)); } static LRESULT __stdcall WndProc(HWND window, const UINT message, WPARAM wparam, LPARAM lparam) { if (WM_NCCREATE == message) { auto cs = reinterpret_cast<CREATESTRUCT*>(lparam); auto obj = static_cast<Derived*>(cs->lpCreateParams); if (!obj) throw plx::User32Exception(__LINE__, plx::User32Exception::window); if (obj->window_) throw plx::User32Exception(__LINE__, plx::User32Exception::window); obj->window_ = window; ::SetWindowLongPtrW(window, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(obj)); } else { auto obj = this_from_window(window); if (obj) { if (message == WM_CREATE) { auto monitor = ::MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST); obj->dpi_.set_from_monitor(monitor); auto cs = reinterpret_cast<CREATESTRUCT*>(lparam); if ((cs->cx != CW_USEDEFAULT) && (cs->cy != CW_USEDEFAULT)) { RECT r = { 0, 0, static_cast<long>(obj->dpi_.to_physical_x(cs->cx)), static_cast<long>(obj->dpi_.to_physical_x(cs->cy)) }; ::AdjustWindowRectEx(&r, cs->style, (cs->hMenu != NULL), cs->dwExStyle); ::SetWindowPos(window, nullptr, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); } } else if (message == WM_NCDESTROY) { ::SetWindowLongPtrW(window, GWLP_USERDATA, 0L); obj->window_ = nullptr; } else if (message == WM_DPICHANGED) { obj->dpi_.set_dpi(LOWORD(wparam), HIWORD(wparam)); } return obj->message_handler(message, wparam, lparam); } } return ::DefWindowProc(window, message, wparam, lparam); } }; }
[ "cpu@chromium.org" ]
cpu@chromium.org
4ef4313dacb6ab96f1b065290cc73d340e06ce10
9e3ff9b563d463683b194514f1ddc0ff82129393
/Main/wxWidgets/include/wx/generic/textdlgg.h
2059c7942049daf85e6f3fc2f3906b4f4e0b06df
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sidihamady/Comet
b3d5179ea884b060fc875684a2efdf6a3ad97204
b1711a000aad1d632998e62181fbd7454d345e19
refs/heads/main
2023-05-29T03:14:01.934022
2022-04-17T21:56:39
2022-04-17T21:56:39
482,617,765
4
0
null
null
null
null
UTF-8
C++
false
false
4,312
h
///////////////////////////////////////////////////////////////////////////// // Name: textdlgg.h // Purpose: wxTextEntryDialog class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id: textdlgg.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __TEXTDLGH_G__ #define __TEXTDLGH_G__ #include "wx/defs.h" #if wxUSE_TEXTDLG #include "wx/dialog.h" #if wxUSE_VALIDATORS #include "wx/valtext.h" #endif class WXDLLIMPEXP_FWD_CORE wxTextCtrl; extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[]; extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[]; #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) // ---------------------------------------------------------------------------- // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons // ---------------------------------------------------------------------------- class WXDLLEXPORT wxTextEntryDialog : public wxDialog { public: // [:COMET:]:20150920: add sizeT wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, const wxString& value = wxEmptyString, long style = wxTextEntryDialogStyle, const wxPoint& pos = wxDefaultPosition, const wxSize& sizeT = wxSize(250, wxDefaultCoord)); void SetValue(const wxString& val); wxString GetValue() const { return m_value; } // [:COMET:]:20150920: add SetMaxLength void SetMaxLength(unsigned long len) { if (m_textctrl != NULL) { m_textctrl->SetMaxLength(len); } } #if wxUSE_VALIDATORS void SetTextValidator( const wxTextValidator& validator ); void SetTextValidator( long style = wxFILTER_NONE ); wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } #endif // wxUSE_VALIDATORS // implementation only void OnOK(wxCommandEvent& event); protected: wxTextCtrl *m_textctrl; wxString m_value; long m_dialogStyle; private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) DECLARE_NO_COPY_CLASS(wxTextEntryDialog) }; // ---------------------------------------------------------------------------- // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] // ---------------------------------------------------------------------------- class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog { public: wxPasswordEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetPasswordFromUserPromptStr, const wxString& value = wxEmptyString, long style = wxTextEntryDialogStyle, const wxPoint& pos = wxDefaultPosition); private: DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) }; // ---------------------------------------------------------------------------- // function to get a string from user // ---------------------------------------------------------------------------- wxString WXDLLEXPORT wxGetTextFromUser(const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, const wxString& default_value = wxEmptyString, wxWindow *parent = (wxWindow *) NULL, wxCoord x = wxDefaultCoord, wxCoord y = wxDefaultCoord, bool centre = true); wxString WXDLLEXPORT wxGetPasswordFromUser(const wxString& message, const wxString& caption = wxGetPasswordFromUserPromptStr, const wxString& default_value = wxEmptyString, wxWindow *parent = (wxWindow *) NULL, wxCoord x = wxDefaultCoord, wxCoord y = wxDefaultCoord, bool centre = true); #endif // wxUSE_TEXTDLG #endif // __TEXTDLGH_G__
[ "sidi@lmop-su-e-shp.univ-lorraine.fr" ]
sidi@lmop-su-e-shp.univ-lorraine.fr
9fbb899a09ce3cf2b777be8e08cf25649ff0c34c
3e54595cb3634edb4c60eafdbe7cba0b867281d6
/noiOpenJudge/2.5/1388.cpp
0663eab7910de5afa18d7f7bf676bd90d7d42a97
[]
no_license
Rainboylvx/pcs
1666cc554903827b98d82689fdccc2d76bda8552
5dd54decfc75960194d415c09119d95bef7c27a9
refs/heads/master
2023-08-18T10:02:21.270507
2023-08-13T01:36:52
2023-08-13T01:36:52
219,274,550
0
0
null
2023-07-21T09:19:37
2019-11-03T09:56:59
C++
UTF-8
C++
false
false
938
cpp
#include <bits/stdc++.h> using namespace std; char _map[105][105]; bool vis[105][105]; int n,m; int fx[][2] = { 0,1, 0,-1, 1,0, -1,0, 1,1, -1,1, 1,-1, -1,-1 }; void init(){ memset(vis,0,sizeof(vis)); scanf("%d%d",&n,&m); int i,j; for (i=1;i<=n;i++){ scanf("%s",_map[i]+1); } } int cnt=0; bool in_map(int x,int y){ if( x >=1 && y >=1 && x <= n && y <=m ) return 1; return 0; } void dfs(int x,int y){ vis[x][y] = 1; int i; for (i=0;i<8;i++){ int nx = x + fx[i][0]; int ny = y + fx[i][1]; if( in_map(nx, ny) && !vis[nx][ny] && _map[nx][ny] == 'W'){ dfs(nx,ny); } } } int main(){ init(); int i,j; for (i=1;i<=n;i++){ for (j=1;j<=m;j++){ if( !vis[i][j] && _map[i][j] == 'W'){ cnt++; dfs(i,j); } } } printf("%d\n",cnt); return 0; }
[ "rainboylvx@qq.com" ]
rainboylvx@qq.com
06148c90c38b1b8da663f61eb27819be7841c258
037d518773420f21d74079ee492827212ba6e434
/blazetest/src/mathtest/dmatsmatschur/HHaHCa.cpp
4be62c6354671907defb74873269f5212752282c
[ "BSD-3-Clause" ]
permissive
chkob/forked-blaze
8d228f3e8d1f305a9cf43ceaba9d5fcd603ecca8
b0ce91c821608e498b3c861e956951afc55c31eb
refs/heads/master
2021-09-05T11:52:03.715469
2018-01-27T02:31:51
2018-01-27T02:31:51
112,014,398
0
0
null
null
null
null
UTF-8
C++
false
false
4,130
cpp
//================================================================================================= /*! // \file src/mathtest/dmatsmatschur/HHaHCa.cpp // \brief Source file for the HHaHCa dense matrix/sparse matrix Schur product math test // // Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/CompressedMatrix.h> #include <blaze/math/HermitianMatrix.h> #include <blaze/math/HybridMatrix.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/dmatsmatschur/OperationTest.h> #include <blazetest/system/MathTest.h> //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'HHaHCa'..." << std::endl; using blazetest::mathtest::NumericA; try { // Matrix type definitions typedef blaze::HermitianMatrix< blaze::HybridMatrix<NumericA,128UL,128UL> > HHa; typedef blaze::HermitianMatrix< blaze::CompressedMatrix<NumericA> > HCa; // Creator type definitions typedef blazetest::Creator<HHa> CHHa; typedef blazetest::Creator<HCa> CHCa; // Running tests with small matrices for( size_t i=0UL; i<=6UL; ++i ) { for( size_t j=0UL; j<=i*i; ++j ) { RUN_DMATSMATSCHUR_OPERATION_TEST( CHHa( i ), CHCa( i, j ) ); } } // Running tests with large matrices RUN_DMATSMATSCHUR_OPERATION_TEST( CHHa( 67UL ), CHCa( 67UL, 7UL ) ); RUN_DMATSMATSCHUR_OPERATION_TEST( CHHa( 128UL ), CHCa( 128UL, 16UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during dense matrix/sparse matrix Schur product:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
[ "klaus.iglberger@gmail.com" ]
klaus.iglberger@gmail.com
c7bf1948a41f0d5635c719e0fb71a50d9da2a0c6
c49ee8b93a8c4ced10a9eb6c524b0c68911f826b
/src/imu_grabber.cpp
79a732b111c9f26fbbc5295f71bfa51c364a6865
[]
no_license
bpoebiapl/6dslam-v2
4098a019eb23155a0dbccb778b0b56549671cdcb
ee8b3886299adea84b07067fe3da6fef9d17c977
refs/heads/master
2021-01-10T14:17:58.141192
2014-06-17T11:58:10
2014-06-17T11:58:10
55,106,888
0
1
null
null
null
null
UTF-8
C++
false
false
6,529
cpp
#include <time.h> #include <sys/types.h> #include <sys/time.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #include <phidget21.h> #include "cv.h" #include "highgui.h" #include <opencv.hpp> #include <pcl/point_cloud.h> #include <pcl/point_types.h> #include <pcl/io/openni_grabber.h> #include <pcl/common/time.h> struct timeval start; double getTime(){ struct timeval end; gettimeofday(&end, NULL); double time = (end.tv_sec*1000000+end.tv_usec-(start.tv_sec*1000000+start.tv_usec))/1000000.0f; return time; } CPhidgetSpatialHandle spatial; //callback that will run if the Spatial generates an error int CCONV ErrorHandler(CPhidgetHandle spatial, void *userptr, int ErrorCode, const char *unknown){ printf("IMU:Error handled. %d - %s \n", ErrorCode, unknown); return 0; } int CCONV SpatialDataHandler(CPhidgetSpatialHandle spatial, void *userptr, CPhidgetSpatial_SpatialEventDataHandle *data, int count){ //struct timeval start, end; //gettimeofday(&start, NULL); for(int i = 0; i < count; i++){ float acc_x = data[i]->acceleration[0]; float acc_y = data[i]->acceleration[1]; float acc_z = data[i]->acceleration[2]; float gyro_x = data[i]->angularRate[0]; float gyro_y = data[i]->angularRate[1]; float gyro_z = data[i]->angularRate[2]; float comp_x = data[i]->magneticField[0]; float comp_y = data[i]->magneticField[1]; float comp_z = data[i]->magneticField[2]; struct timeval end; gettimeofday(&end, NULL); float time = (end.tv_sec*1000000+end.tv_usec-(start.tv_sec*1000000+start.tv_usec))/1000000.0f; //printf("time: %f\n",time); printf("%3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f %3.10f\n",time,acc_x,acc_y,acc_z,gyro_x,gyro_y,gyro_z,comp_x,comp_y,comp_z); } return 0; } void connect(){ spatial = 0; int result; const char *err; CPhidgetSpatial_create(&spatial); CPhidget_set_OnError_Handler((CPhidgetHandle)spatial, ErrorHandler, NULL); CPhidgetSpatial_set_OnSpatialData_Handler(spatial, SpatialDataHandler, NULL); //open the spatial object for device connections CPhidget_open((CPhidgetHandle)spatial, -1); //get the program to wait for a spatial device to be attached if((result = CPhidget_waitForAttachment((CPhidgetHandle)spatial, 10000))){ CPhidget_getErrorDescription(result, &err); printf("IMU:Problem waiting for attachment: %s\n", err); exit(0); } CPhidgetSpatial_setDataRate(spatial, 1); } void dissconnect(){ CPhidget_close((CPhidgetHandle)spatial); CPhidget_delete((CPhidgetHandle)spatial); } int total = 0; class SimpleOpenNIProcessor { public: void cloud_cb_ (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr &cloud) { static unsigned count = 0; static double last = pcl::getTime (); if (++count == 1) { double now = pcl::getTime (); //std::cout << "distance of center pixel :" << cloud->points [(cloud->width >> 1) * (cloud->height + 1)].z << " mm. Average framerate: " << double(count)/double(now - last) << " Hz" << std::endl; count = 0; last = now; } total++; IplImage * rgb_img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3); char * rgb_data = (char *)(rgb_img->imageData); IplImage * depth_img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3); //float * depth_data = (float *)depth_img->imageData; //unsigned short * depth_data = (unsigned short *)depth_img->imageData; char * depth_data = (char *)(depth_img->imageData); for(int i = 0; i < 640; i++){ for(int j = 0; j < 480; j++){ int ind = 640*j+i; int r = cloud->points[ind].r; int g = cloud->points[ind].g; int b = cloud->points[ind].b; rgb_data[3*ind+0] = b; rgb_data[3*ind+1] = g; rgb_data[3*ind+2] = r; //depth_data[3*ind+0] = cloud->points[ind].x; //depth_data[3*ind+1] = cloud->points[ind].y; //depth_data[3*ind+2] = cloud->points[ind].z; //printf("%i %i %i\n",i,j,(unsigned short)(1000*cloud->points[ind].z)); unsigned short d = (unsigned short)(1000.0f*cloud->points[ind].z); char * arr = (char *)(&d); char part1 = arr[0]; char part2 = arr[1]; depth_data[3*ind+0] = part1; depth_data[3*ind+1] = part2; depth_data[3*ind+2] = 0; //unsigned short d_rebuild = 0; //char * arr_rebuild = (char *)(&d_rebuild); //arr_rebuild[0] = part1; //arr_rebuild[1] = part2; //printf("d: %i, part1:%i part2:%i -> rebuild: %i\n",d,(unsigned int)part1,(unsigned int)part2,d_rebuild); //depth_data[ind] = d; } } cvNamedWindow("rgb", CV_WINDOW_AUTOSIZE ); cvShowImage("rgb", rgb_img); cvNamedWindow("depth", CV_WINDOW_AUTOSIZE ); cvShowImage("depth", depth_img); double currenttime = getTime(); char buffer[250]; sprintf (buffer, "outputimgs/rgb_%f.jpg", currenttime); //printf ("%s\n",buffer); cvSaveImage(buffer,rgb_img); IplImage * rgb_img_loaded = cvLoadImage(buffer,CV_LOAD_IMAGE_UNCHANGED); sprintf (buffer, "outputimgs/depth_%f.jpg", currenttime); //printf ("%s\n",buffer); cvSaveImage(buffer,depth_img); IplImage * depth_img_loaded = cvLoadImage(buffer,CV_LOAD_IMAGE_UNCHANGED); cvNamedWindow("rgb_loaded", CV_WINDOW_AUTOSIZE ); cvShowImage("rgb_loaded", rgb_img_loaded); cvNamedWindow("depth_loaded", CV_WINDOW_AUTOSIZE ); cvShowImage("depth_loaded", depth_img_loaded); cvWaitKey(50); cvReleaseImage( &rgb_img ); cvReleaseImage( &depth_img ); cvReleaseImage( &rgb_img_loaded ); cvReleaseImage( &depth_img_loaded ); } void run () { // create a new grabber for OpenNI devices pcl::Grabber* interface = new pcl::OpenNIGrabber(); // make callback function from member function boost::function<void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> f = boost::bind (&SimpleOpenNIProcessor::cloud_cb_, this, _1); // connect callback function for desired signal. In this case its a point cloud with color values boost::signals2::connection c = interface->registerCallback (f); // start receiving point clouds interface->start (); // wait until user quits program with Ctrl-C, but no busy-waiting -> sleep (1); while (true) boost::this_thread::sleep (boost::posix_time::seconds (1)); // stop the grabber interface->stop (); } }; int main () { gettimeofday(&start, NULL); connect(); SimpleOpenNIProcessor v; v.run (); return (0); } //int main(int argc, char **argv){ // printf("START\n"); //connect(); //while (true){usleep(1000);} //dissconnect(); // printf("DONE\n"); // return 0; //}
[ "johan.ekekrantz@gmail.com" ]
johan.ekekrantz@gmail.com
2c5b79a0f86d2669ed20ba2577e86bc87cae0864
0921b33b217db1bfc329e24b8ba3120be2a864d8
/Projet/menu.cpp
a0b66f96d10eea12a879e0677a83455893b1d097
[]
no_license
FadiSheh/Projet_C-
e106ca069726fe1f594861b449d8b2d932f7ffdd
c2d8825fd8e0e3e31ad2140db929bd6046ca01a3
refs/heads/main
2023-02-23T11:56:15.543838
2021-01-23T13:40:22
2021-01-23T13:40:22
327,363,075
0
0
null
null
null
null
UTF-8
C++
false
false
1,874
cpp
#include "menu.h" #include "ui_menu.h" #include <QApplication> #include <QMessageBox> Menu::Menu(QWidget *parent) : QDialog(parent), ui(new Ui::Menu) { ui->setupUi(this); //Initialisation interface graphique //On fixe la couleur des frames QPalette pal = palette(); pal.setColor(QPalette::Background,QColor(56,56,56)); ui->niveau_diff->setAutoFillBackground(true); ui->niveau_diff->setPalette(pal); ui->niveau_diff->update(); ui->frame_1->setAutoFillBackground(true); ui->frame_1->setPalette(pal); ui->frame_1->update(); ui->frame_2->setAutoFillBackground(true); ui->frame_2->setPalette(pal); ui->frame_2->update(); } Menu::~Menu() { delete ui; } void Menu::on_cb_amelie_clicked(bool checked) //Si Amélie est checked, il faut uncheck Fadi { ui->cb_fadi->setChecked(!checked); } void Menu::on_cb_fadi_clicked(bool checked) //Si Fadi est checked, il faut uncheck Amélie { ui->cb_amelie->setChecked(!checked); } void Menu::on_cb_facile_clicked(bool checked) { ui->cb_difficile->setChecked(!checked); } void Menu::on_cb_difficile_clicked(bool checked) { ui->cb_facile->setChecked(!checked); } void Menu::on_pb_Demarrer_clicked() //Click sur demarrer avec choix perso (1) Fadi (0) Amélie et niveau de difficulté (1) Hard (0) easy { bool niveau = ui->cb_facile->isChecked()|| ui->cb_difficile->isChecked(); bool perso = ui->cb_fadi->isChecked()|| ui->cb_amelie->isChecked(); this->choix_diff = int(ui->cb_facile->isChecked()); this->choix_perso = int(ui->cb_fadi->isChecked()); if(perso && niveau){ hide();} //Avertissement d'erreur, menu incomplet else if(!niveau){QMessageBox::warning(this,"Erreur","Veuillez choisir un niveau");} else { QMessageBox::warning(this,"Erreur","Veuillez choisir un personnage"); } }
[ "shehadehfadi@orange.fr" ]
shehadehfadi@orange.fr
3100a81cd75c827f84ab6567efc350f230c8dab3
f2a8c5f6f141cace560e846c0fc288a2e44e83ca
/CV/Input.cpp
2ec08096768911a73f14ef53ea8971a7d7cff5ab
[]
no_license
DxsGeorge/CV-Cube
bc812115e249822cb4dca481d08c04d3fdeb644a
2f1b7a64aaeaaa012b5560292164e4eb5992a598
refs/heads/master
2021-04-30T16:42:52.012158
2017-03-20T18:36:58
2017-03-20T18:36:58
80,108,594
1
1
null
null
null
null
UTF-8
C++
false
false
222
cpp
#include "Input.h" #include "Hough_Transform.h" #include <iostream> Mat ReadImage(string name) { Mat src=imread(name); //image path if (src.empty()) { cout << "Cannot load image!" << endl; } return src; }
[ "georgepetrg@gmail.com" ]
georgepetrg@gmail.com
a57d83e41d567138ed2240a0fde3897ac39e4bdf
4da64aceb54c08e9619eeb89197e852fb1f2c453
/sources/main.cpp
9f405e7c74d5570765e879ceea146b496cf80ba1
[ "MIT" ]
permissive
emcev/check
d70ee73c911366d46a5237dcf59c00aa3eabae3c
c5216df7989a1f86202eb7df3d527fbbf6dcc1f5
refs/heads/master
2020-04-20T15:11:32.739839
2019-02-03T07:43:46
2019-02-03T07:43:46
168,921,642
0
0
null
null
null
null
UTF-8
C++
false
false
801
cpp
// Copyright emcev emcev084@gmail.com #include <iostream> #include <string> #include <utility> #include "Function.hpp" int main() { srand(time(0)); std::cout << "investigation:" << std::endl; unsigned number = 1; std::string TravelVariant[] = { "direct", "reverse", "random" }; for (unsigned variant = 0; variant < 3; ++variant) { std::cout << " travel_variant: "; std::cout << TravelVariant[variant] << std::endl; std::cout << " experiments:" << std::endl; for (unsigned i = 0; i < 9; ++i, ++number) { unsigned * array; unsigned * position; if (Experiment(variant, number, i, array, position) == -1) { std::cout << "Error" << std::endl; } delete[]array; delete[]position; } } char c; std::cin >> c; return 0; }
[ "emcev084@gmail.com" ]
emcev084@gmail.com
9d2fc27984522a3231ccc3fbb0d48268788de27f
9214eff4f640e2993d14d5a3854057bfc042bd04
/src/server/core/clientworker.h
9fdf3f912d331dd5668600cceddea10d93ae07fa
[ "BSD-3-Clause", "MIT" ]
permissive
cszawisza/eedb
aeb4af12ed218aea0ab48e8389d1563edf24c50a
f63511d2eb4947af38aaa0406cf858b13eb3d81d
refs/heads/master
2021-01-10T13:16:42.310313
2016-01-24T14:22:09
2016-01-24T14:22:09
36,801,067
2
0
null
2015-11-23T16:51:28
2015-06-03T12:06:17
C++
UTF-8
C++
false
false
1,643
h
#pragma once #include <QObject> #include <QThread> #include <QSharedPointer> #include <QHash> #include "iprocessor.h" #include "clientcache.h" #include "Interfaces/DefinedActions.hpp" /** * @brief The ClientWorker class * Class hes responsibility to process recieved binary messages */ class ClientWorker : public QObject { Q_OBJECT public: explicit ClientWorker(QObject *parent = 0); void processMessage(); signals: /** * @brief beforeProcessing signal emited before worker atempts to parse message */ void beforeProcessing(); /** * @brief afterProcessing signal emmited when worker ends processing data */ void afterProcessing(); /** * @brief binnaryMessageReadyToSend: Signal emmited every time a package can be send * @param data: encapsulated protbuf message */ void binnaryMessageReadyToSend(const QByteArray &data); /** * @brief messageCorrupted signal emmited whed a frame is corrupted */ void messageCorrupted( quint32 msgid ); public slots: /** * @brief processBinnaryMessage: is responsible for handling message * @param frame a protbuf message (MessageFrame) containing Messages with encapsuled information */ void processBinnaryMessage(QByteArray frame); private: void printMessageInfo(const IMessageContainer *request); std::shared_ptr<UserData> m_cache; std::shared_ptr<IServerResponse> m_response; std::shared_ptr<IClientRequest> m_request; QHash<ActionTypeId, QSharedPointer<IMessageProcessingUnit>> m_msgHandlers; QSharedPointer<IMessageProcessingUnit> m_defaultProcessor; };
[ "cszawisza@gmail.com" ]
cszawisza@gmail.com
6a1dedb140023d1cf13b6fc538705593a63c5b6f
7f25ac596812ed201f289248de52d8d616d81b93
/ZZULi0.0/hdu5701.cpp
001a6737b984a207b08bb183f5ada575d1691a24
[]
no_license
AplusB/ACEveryDay
dc6ff890f9926d328b95ff536abf6510cef57eb7
e958245213dcdba8c7134259a831bde8b3d511bb
refs/heads/master
2021-01-23T22:15:34.946922
2018-04-07T01:45:20
2018-04-07T01:45:20
58,846,919
25
49
null
2016-07-14T10:38:25
2016-05-15T06:08:55
C++
UTF-8
C++
false
false
1,686
cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #include <queue> #define LL __int64 using namespace std; const int N = 2*1e4+10; const int MOD = 1e9+7; int nums[N],tmp[N]; int sumcnt[N],lf[N],rt[N]; int main(void) { int n,loc,cur,cnt = 0; while(scanf("%d",&n) != -1) { cnt = 0; for(int i = 1; i <= n; i++) scanf("%d",&nums[i]); for(int j = 1; j <= n; j++) { memset(sumcnt,0,sizeof(sumcnt)); memset(lf,0,sizeof(lf)); memset(rt,0,sizeof(rt)); cur = nums[j]; for(int i = 1; i <= n; i++) tmp[i] = nums[i]; for(int i = 1; i <= n; i++) { if(tmp[i] > cur) tmp[i] = 1; else if(tmp[i] == cur) { tmp[i] = 0; loc = i; } else tmp[i] = -1; } lf[n] = 1; rt[n] = 1; for(int i = loc - 1; i >= 1; i--) { sumcnt[i] = sumcnt[i+1]+tmp[i]; lf[sumcnt[i] + n]++; } for(int i = loc + 1; i <= n; i++) { sumcnt[i] = sumcnt[i-1]+tmp[i]; rt[sumcnt[i] + n]++; } int ans = 0; for(int i = 0; i <= 2*n-1; i++) { ans += lf[i]*rt[2*n-i]; } if(cnt == 0) { printf("%d",ans); cnt = 1; } else printf(" %d",ans); } printf("\n"); } return 0; }
[ "741515435@qq.com" ]
741515435@qq.com
9452fc573781c3a36e401575bd8ba831063fef5a
a9d9086773f10e5b921aaffe7739c347368cc9f0
/of_v0.10.1/apps/of_examples/3.projection/src/ofApp.h
4b8001a10b82d9142053ee4fcb6bedb51cca8453
[]
no_license
UltraCombos/Project_Ultra101
8ad8e0c3ca43bb5043bd649dabb772c2b5d1a1a8
ef37b5d94977eb0ec9312982f5e2aa3f2aee28d2
refs/heads/master
2021-09-08T13:22:33.850139
2021-09-08T08:58:12
2021-09-08T08:58:12
95,423,918
1
0
null
null
null
null
UTF-8
C++
false
false
705
h
#pragma once #include "ofMain.h" class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseEntered(int x, int y); void mouseExited(int x, int y); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void mouseScrolled(int x, int y, float scrollX, float scrollY); private: void update_projection_matrix(); ofTexture _tex; ofMatrix4x4 _proj; float _fovy = 45; };
[ "54way@ultracombos.com" ]
54way@ultracombos.com
00de76e2a537bea402c0c27e489a40a247a0c018
4f307eb085ad9f340aaaa2b6a4aa443b4d3977fe
/smith04.james/assignment2/main.cpp
c446c32fb33d38d461c5c03bf62c96427dd80218
[]
no_license
Connellj99/GameArch
034f4a0f52441d6dde37956a9662dce452a685c7
5c95e9bdfce504c02c73a0c3cb566a010299a9b8
refs/heads/master
2020-12-28T10:29:19.935573
2020-02-04T19:41:09
2020-02-04T19:41:09
238,286,390
0
0
null
null
null
null
UTF-8
C++
false
false
2,759
cpp
#include <iostream> #include <cassert> #include <string> #include <PerformanceTracker.h> #include <MemoryTracker.h> #include <stdlib.h> #include <GraphicsLib.h> #include "Header.h" using namespace std; const string ASSET_PATH = "..\\..\\shared\\assets"; const int FONT_SIZE = 24; const string TEXT = "Curse you Papa Smurf!"; const int NUM_SMURFS = 16; int main() { //initAllegro(); Done in Graphics System PerformanceTracker* pPerformanceTracker = new PerformanceTracker; const string INIT_TRACKER_NAME = "init"; const string DRAW_TRACKER_NAME = "draw"; const string WAIT_TRACKER_NAME = "wait"; const double SLEEP_TIME = 5.0; pPerformanceTracker->startTracking(INIT_TRACKER_NAME); MemoryTracker::getInstance()->reportAllocations(cout); GraphicsSystem* gSys = new GraphicsSystem(); gSys->init(); Color redColor; redColor.setR(255); Color blackColor; blackColor.setB(0); blackColor.setG(0); blackColor.setR(0); GraphicsBuffer* steps = new GraphicsBuffer((ASSET_PATH + "\\steps.png").c_str()); GraphicsBuffer* smurfs = new GraphicsBuffer((ASSET_PATH + "\\smurf_sprites.png").c_str()); GraphicsBuffer* red = new GraphicsBuffer(); Font* font = new Font((ASSET_PATH + "\\cour.ttf").c_str(), FONT_SIZE); red->clearColor(redColor); gSys->writeText(red, 0, 0, font, blackColor, TEXT.c_str()); red->draw(0, 0); steps->drawScaled(150.0, 100.0, 3.0); //Magic numbers because I can't figure out al_draw_scaled_bitmap works //float x, float y, float w, float h, GraphicsBuffer* buff Sprite* smurfList[NUM_SMURFS]; for (int i = 0; i < NUM_SMURFS/4; i++) { for (int j = 0; j < NUM_SMURFS / 4; j++) { smurfList[(i*4) + j] = new Sprite(i * smurfs->getWidth() / 4.0, j * smurfs->getHeight() / 4.0, smurfs->getWidth() / 4.0, smurfs->getHeight() / 4.0, smurfs); smurfList[(i*4) + j]->draw(rand() % 600, rand() % 600); } } gSys->flip(); pPerformanceTracker->stopTracking(DRAW_TRACKER_NAME); pPerformanceTracker->startTracking(WAIT_TRACKER_NAME); al_rest(SLEEP_TIME); pPerformanceTracker->stopTracking(WAIT_TRACKER_NAME); cout << endl << "Time to Init:" << pPerformanceTracker->getElapsedTime(INIT_TRACKER_NAME) << " ms" << endl; cout << endl << "Time to Draw:" << pPerformanceTracker->getElapsedTime(DRAW_TRACKER_NAME) << " ms" << endl; cout << endl << "Time spent waiting:" << pPerformanceTracker->getElapsedTime(WAIT_TRACKER_NAME) << " ms" << endl; delete pPerformanceTracker; delete steps; delete smurfs; delete red; delete font; for (int i = 0; i < NUM_SMURFS / 4; i++) { for (int j = 0; j < NUM_SMURFS / 4; j++) { delete smurfList[(i*4) + j]; } } gSys->cleanup(); delete gSys; MemoryTracker::getInstance()->reportAllocations(cout); system("pause"); return 0; }
[ "john.connelly@mymail.champlain.edu" ]
john.connelly@mymail.champlain.edu
e9a12754944f459e822160f389a0294f3168cdb2
ad7e901feaa95124e40a4a716fa6f68c6b6dc801
/src/StandbyRule.cpp
e894b954bdce9c6985b55d5905a84b26a7174712
[ "BSD-3-Clause" ]
permissive
CreatorDev/w5-domesticHeating
77ea005f5f23995c81517d70d71c7bd8b0b990b5
e09e32f52a69df4f37d6bea2af5708299e75c900
refs/heads/master
2021-01-20T03:46:27.267559
2017-05-08T11:02:31
2017-05-08T11:02:31
89,582,594
0
2
null
2017-05-08T11:02:32
2017-04-27T09:51:00
C++
UTF-8
C++
false
false
1,630
cpp
// // StandbyRule.cpp // ci40-project5 // // Created by Bartłomiej on 10/01/17. // Copyright © 2017 Imagination Systems. All rights reserved. // #include "StandbyRule.hpp" #include "Logic.hpp" #include "SQLiteStorage.hpp" static const time_t STANDBY_TRIGGER_DELAY = 2 * 60 * 60; //in seconds StandbyRule::StandbyRule(shared_ptr<EventWriter> eventWriter, shared_ptr<spdlog::logger> l) : LogicRule(l), eventWriter(eventWriter), lastMovementTime(0) { } void StandbyRule::handleStandbyMode(SensorStatus& sensorStatus, SystemStatus& systemStatus) { if (sensorStatus.movementDetected == false) { return; } systemStatus.standByMode = false; lastMovementTime = time(nullptr); eventWriter->write(seLeavingStandBy); } void StandbyRule::handleActiveMode(SensorStatus& sensorStatus, SystemStatus& systemStatus) { //detect end of movement if (sensorStatus.movementDetected) { lastMovementTime = time(nullptr); } //detect if movement was not seen for some defined time time_t delta = time(nullptr) - lastMovementTime; if (sensorStatus.movementDetected == false && delta > STANDBY_TRIGGER_DELAY) { systemStatus.standByMode = true; eventWriter->write(seEnteringStandBy); } } void StandbyRule::execute(SensorStatus& sensorStatus, SystemStatus& systemStatus, RelaysStatus& relaysStatus) { if (systemStatus.standByMode) { handleStandbyMode(sensorStatus, systemStatus); } else { handleActiveMode(sensorStatus, systemStatus); } logger->debug("[StandbyRule] Movement detected: {}", sensorStatus.movementDetected); }
[ "krzysztof.kocon@imgtec.com" ]
krzysztof.kocon@imgtec.com
bc8e7328d25c18223488391f7dadd17bd919fc09
53630700642f429f2e9f8336115ca19333e50413
/czy umiesz potegowac.cpp
61d4c0a708190dbad70eca989416c3f7b9998a2d
[]
no_license
ptaq/SpojCPPOld
89589e6b045b8b6e598cbd16d56fc54bbb27c8f9
831393e14d993aee156d302185abfdcd04dc20f5
refs/heads/master
2020-06-17T15:00:26.869496
2016-11-28T16:51:39
2016-11-28T16:51:39
74,993,531
0
0
null
null
null
null
UTF-8
C++
false
false
197
cpp
#include <stdio.h> int main() { unsigned T,a,b; for(scanf("%u",&T);T--;printf("%c\n",(10*(b&3)+(a%10))["0161656161012345678901496569410187456329'"])) scanf("%u%u",&a,&b); return 0; }
[ "g.sladowski@wp.pl" ]
g.sladowski@wp.pl
8e94f53fb86bab1ae67d51a078b967af2285b18e
d732c881b57ef5e3c8f8d105b2f2e09b86bcc3fe
/include/gurax/VTypeCustom.h
015fb35c382957da8fbc7ef15d37d3541b49f02c
[]
no_license
gura-lang/gurax
9180861394848fd0be1f8e60322b65a92c4c604d
d9fedbc6e10f38af62c53c1bb8a4734118d14ce4
refs/heads/master
2023-09-01T09:15:36.548730
2023-09-01T08:49:33
2023-09-01T08:49:33
160,017,455
10
0
null
null
null
null
UTF-8
C++
false
false
3,986
h
//============================================================================== // VTypeCustom.h //============================================================================== #ifndef GURAX_VTYPECUSTOM_H #define GURAX_VTYPECUSTOM_H #include "Value.h" namespace Gurax { //------------------------------------------------------------------------------ // VTypeCustom //------------------------------------------------------------------------------ class GURAX_DLLDECLARE VTypeCustom : public VType { public: class ConstructorClass : public Constructor { protected: VTypeCustom& _vtypeCustom; RefPtr<Expr_Block> _pExprBody; const PUnit* _pPUnitBody; public: ConstructorClass(VTypeCustom& vtypeCustom, DeclCallable* pDeclCallable, Expr_Block* pExprBody); public: VTypeCustom& GetVTypeCustom() const { return _vtypeCustom; } public: // Virtual functions of Function virtual const Expr_Block& GetExprBody() const override { return *_pExprBody; } virtual const PUnit* GetPUnitBody() const override { return _pPUnitBody; } virtual Value* DoEval(Processor& processor, Argument& argument) const override; virtual String ToString(const StringStyle& ss = StringStyle::Empty) const override; }; class ConstructorClassDefault : public Constructor { protected: VTypeCustom& _vtypeCustom; public: ConstructorClassDefault(VTypeCustom& vtypeCustom, DeclCallable* pDeclCallable); public: VTypeCustom& GetVTypeCustom() const { return _vtypeCustom; } public: // Virtual functions of Function virtual Value* DoEval(Processor& processor, Argument& argument) const override; virtual String ToString(const StringStyle& ss = StringStyle::Empty) const override; }; class ConstructorStruct : public Constructor { protected: VTypeCustom& _vtypeCustom; RefPtr<PropSlotOwner> _pPropSlotOwner; public: ConstructorStruct(VTypeCustom& vtypeCustom, DeclCallable* pDeclCallable, PropSlotOwner* pPropSlotOwner); public: VTypeCustom& GetVTypeCustom() const { return _vtypeCustom; } const PropSlotOwner& GetPropSlotOwner() const { return *_pPropSlotOwner; } public: // Virtual functions of Function virtual Value* DoEval(Processor& processor, Argument& argument) const override; virtual String ToString(const StringStyle& ss = StringStyle::Empty) const override; }; private: RefPtr<ValueOwner> _pValuesPropOfInstInit; RefPtr<ValueOwner> _pValuesPropOfClass; RefPtr<Function> _pDestructor; RefPtr<Function> _pCastFunction; public: VTypeCustom(); public: void Inherit(); void SetConstructor(Constructor* pConstructor) { _pConstructor.reset(pConstructor); } void SetDestructor(Function* pDestructor) { _pDestructor.reset(pDestructor); } void SetCastFunction(Function* pCastFunction) { _pCastFunction.reset(pCastFunction); } const Function& GetDestructor() const { return *_pDestructor; } const Function& GetCastFunction() const { return *_pCastFunction; } ValueOwner& GetValuesPropOfInstInit() { return *_pValuesPropOfInstInit; } const ValueOwner& GetValuesPropOfInstInit() const { return *_pValuesPropOfInstInit; } ValueOwner& GetValuesPropOfClass() { return *_pValuesPropOfClass; } const ValueOwner& GetValuesPropOfClass() const { return *_pValuesPropOfClass; } bool AssignPropSlot(Processor& processor, const Symbol* pSymbol, VType* pVType, PropSlot::Flags flags, RefPtr<Value> pValueInit); bool AssignPropSlot(Processor& processor, const Symbol* pSymbol, const DottedSymbol& dottedSymbol, PropSlot::Flags flags, RefPtr<Value> pValueInit); void SetCustomPropOfClass(size_t iProp, Value* pValue); Value* GetCustomPropOfClass(size_t iProp) { return GetValuesPropOfClass()[iProp]->Reference(); } public: virtual bool IsCustom() const override { return true; } virtual void PrepareForAssignment(Processor& processor, const Symbol* pSymbol) override; virtual Value* DoCastFrom(const Value& value, DeclArg::Flags flags) const override; virtual bool DoAssignCustomMethod(RefPtr<Function> pFunction) override; }; } #endif
[ "ypsitau@nifty.com" ]
ypsitau@nifty.com
9329970020fea32dbb4594229274f0cec6f6556f
c04af30b48d8373f09e8069c21811d7c220e0655
/Project1sads/Project1sads/test.cpp
102b723b96b6cef921f675c4797ab84550167dff
[]
no_license
mayichaodexiaojinku/DemoofTestByVS2013
2b3673d272b4daa31a672a423d421a1e3555a269
06fff1c02a8bea5dce1985e87ca20cc27c45b11d
refs/heads/master
2022-01-09T06:59:55.180183
2019-06-18T10:10:25
2019-06-18T10:10:25
171,776,322
0
0
null
null
null
null
UTF-8
C++
false
false
7,381
cpp
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string> #include<algorithm> using namespace std; /* int main() { string str; getline(cin, str); reverse(str.begin(), str.end()); auto begin = str.begin(); while (begin != str.end()){ auto end = begin; if (end != str.end() && *end != ' ') end++; reverse(begin, end); if (end != str.end()) begin = end++; else begin = end; } cout << str << endl; return 0; } #include<stdio.h> #include<windows.h> int main() { //char str1[] = "abc"; //char str2[100] = { 'a', 'b', 'c' }; //printf("%d ", sizeof(str1)); //printf("%d ", sizeof(str2)); struct s1 { double c1; char c2; int i; }; struct s2 { char c1; struct s1 s; double i; }; struct s3 { int a:2; int b:5; int c : 10; int d:30; }; struct A{ unsigned a : 19; unsigned b : 11; unsigned c : 4; unsigned d : 29; char index; }; printf("%d",sizeof(unsigned)); system("pause"); return 0; } #include<iostream> #include<string> #include<vector> using namespace std; int main() { string str; cin >> str; string res; vector<string> v; for (int i = 0; i < str.size(); i++){ if (str[i] >= 0 && str[i] <= 9 && str[i + 1] > str[i]){ res += str[i]; } if (str[i + 1] >= 'a' &&str[i + 1] <= 'z' && str[i] >= 0 && str[i] <= 9){ v.push_back(res); res = '\0'; } } for (int i = 0; i < v.size(); i++){ if (v[0].size() < v[i].size()){ v[0].swap(v[i]); } } cout << v[0] << endl; return 0; } #include<vector> #include<iostream> #include<algorithm> using namespace std; int main() { int hash[100] = { 0 }; int num = 0; int n;z while (cin >> n){ hash[n]++; num++; } for (int i = 0; i<sizeof(hash); i++){ if (hash[i] >= num / 2){ cout << i << endl; return 0; } } system("pause"); return 0; } #include<stdio.h> int count = 0; int fib(int i) { count++; if (i == 1) return 1; if (i == 2) return 2; else return fib(i-1) + fib(i-2); } int main() { fib(8); printf("%d",count); return 0; } void fun(char **p) { *p = (char*)malloc(100); } int main() { char * str = NULL; fun(&str); strcpy(str,"asda"); cout << str << endl; return 0; } int main() { int b = 1; int c = 2; int a = b++,c++; cout << a << endl; return 0; #include<iostream> #include<string> #include<vector> using namespace std; int main() { string s1, s2; while (cin >> s1 >> s2){ vector<vector<int>> v(s1.size() + 1, vector<int>(s2.size() + 1,0)); for (int i = 0; i <= s1.size(); i++) v[i][0] = i; for (int i = 0; i <= s2.size(); i++) v[0][i] = i; for (int i = 1; i <= s1.size(); i++){ for (int j = 1; i <= s2.size(); j++){ if (s1[i - 1] == s2[j - 1]) v[i][j] = v[i - 1][j - 1]; else v[i][j] = min(min(v[i - 1][j] + 1, v[i][j - 1] + 1), v[i - 1][j - 1] + 1); } } cout << v[s1.size()][s2.size()] << endl; } return 0; } void exam(char a[]) { printf("%d",sizeof(a)); return; } int main() { char a[] = "dsadasdasd"; exam(a); return 0; } #include<iostream> #include<vector> using namespace std; int N, M; vector<vector<int>> maze; vector<vector<int>> path_temp; vector<vector<int>> path_best; void MazeTrack(int i, int j) { maze[i][j] = 1; path_temp.push_back({ i, j }); if (i == N - 1 && j == M - 1) if (path_best.empty() || path_temp.size() < path_best.size()) path_best = path_temp; if (i - 1 > 0 && maze[i - 1][j] == 0) MazeTrack(i - 1, j); if (i + 1 < N && maze[i + 1][j] == 0) MazeTrack(i + 1, j); if (j - 1 > 0 && maze[i][j - 1] == 0) MazeTrack(i, j - 1); if (j + 1 < M && maze[i][j + 1] == 0) MazeTrack(i, j + 1); maze[i][j] = 0; path_temp.pop_back(); } int main() { while (cin >> N >> M){ maze = vector<vector<int>>(N, vector<int>(M, 0)); path_temp.clear(); path_best.clear(); for (auto &i : maze) for (auto&j : i) cin >> j; MazeTrack(0, 0); for (auto i : path_best) cout << '(' << i[0] << ',' << i[1] << ')' << endl; } return 0; } #include<vector> void oddInOddEvenInEven(vector<int>& arr, int len) { int odd = 0; int even = 1; while (odd < len && even <len){ if (arr[odd] % 2 == 0){ odd += 2; } if (arr[even] % 2 == 1){ even += 2; } if (odd < len && even < len){ if (arr[odd] % 2 == 1 && arr[even] % 2 == 0){ int temp = arr[odd]; arr[odd] = arr[even]; arr[even] = temp; } } } } int main() { vector<int> v; for (int i = 1; i < 10; i++) v.push_back(i); oddInOddEvenInEven(v, 9); for (int i = 0; i < 9; i++) cout << v[i] << " "; return 0; } bool isPalindrome(int x) { if (x < 0) return false; string s; if (s.size() == 1) return true; int left = 0; int right = s.size() - 1; while (left < right){ if (s[left] == s[right]){ left++; right--; } else return false; } return true; } int main() { //cout << isPalindrome(1234321) << endl; cout << 'A'+'5' << endl; return 0; } #include<iostream> #include<vector> #include<math.h> using namespace std; bool Isprime(int n) { for (int i = 2; i < n; i++){ if (n%i == 0) return false; } return true; } int main() { int a; while (cin >> a){ int b = a; vector<int> v; cout << a << " = "; if (Isprime(a)){ cout << 1 << " * " << a << endl; } else{ for (int i = 2; i <= a / 2; i++){ if (Isprime(i) && (a%i == 0)){ while (Isprime(i) && (b%i == 0)){ v.push_back(i); b = b / i; } } } for (int i = 0; i < v.size() - 1; i++) cout << v[i] << " * "; cout << v[v.size() - 1] << endl; } } return 0; } #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { string s; getline(cin, s); int k; cin >> k; string s1; for (int i = 1; i < s.size(); i = i + 2){ s1 += s[i]; } for (int i = 0; i < s1.size()-k; i = i + k){ reverse(s1.begin() + i, s1.begin() + i + k); } return 0; } #include<iostream> #include<string> #include<vector> using namespace std; int main() { int n; while (cin >> n){ cin.get(); vector<string> v(n); for (int i = 0; i < n; i++) getline(cin,v[i]); for (int i = 0; i < n; i++){ if ((v[i].find(' ') == string::npos) && (v[i].find(',') == string::npos)){ if (i == n) cout << v[i] << endl; else cout << v[i] << ','; } else{ if (i == n) cout <<'"' << v[i] << '"' << endl; else cout << '"' << v[i] << '"' << ','; } } } return 0; } #include<iostream> #include<string> using namespace std; int main() { string s1, s2; while (1){ getline(cin, s1); while (s1.size() != 0){ getline(cin, s2); for (int i = 0; i <s1.size(); i++){ int j; for (j = 0; j < s2.size(); j++){ if (s1[i] == '"') i++; if (s1[i] != s2[j]) break; else i++; } if (j == s2.size()) cout << "Improtant!" << endl; } cout << "Ignore" << endl; } } return 0; } #include<iostream> using namespace std; int main() { int n; while (cin >> n){ float res = 0; res = (1.00 / n) * 100; printf("%.2f", res); cout << '%' << endl; } } */ #include<vector> int findMaxGap(vector<int> A, int n) { int res = 0; for (int i = 0; i <= n - 2; i++){ auto maxleft = max(A.begin(), A.begin()+i); auto maxright = max((A.begin()+i+1), A.end()); int num = abs(*maxleft - *maxright); if (num > res) res = num; } return res; } int main() { vector<int> v = {28,75,38,44,66,1}; cout << findMaxGap(v, 6) << endl; return 0; }
[ "www.823122161@qq.com" ]
www.823122161@qq.com
10d399ed53507093e5c706674f9d22eca7dde569
f6439b5ed1614fd8db05fa963b47765eae225eb5
/chrome/browser/ui/app_list/recommended_apps.cc
f25543f061d04c8974966145593f0d4c8ed89ba7
[ "BSD-3-Clause" ]
permissive
aranajhonny/chromium
b8a3c975211e1ea2f15b83647b4d8eb45252f1be
caf5bcb822f79b8997720e589334266551a50a13
refs/heads/master
2021-05-11T00:20:34.020261
2018-01-21T03:31:45
2018-01-21T03:31:45
118,301,142
2
0
null
null
null
null
UTF-8
C++
false
false
4,003
cc
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/app_list/recommended_apps.h" #include <algorithm> #include <vector> #include "base/bind.h" #include "chrome/browser/extensions/extension_ui_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/recommended_apps_observer.h" #include "chrome/common/pref_names.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/pref_names.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" namespace app_list { namespace { struct AppSortInfo { AppSortInfo() : app(NULL) {} AppSortInfo(const extensions::Extension* app, const base::Time& last_launch_time) : app(app), last_launch_time(last_launch_time) {} const extensions::Extension* app; base::Time last_launch_time; }; bool AppLaunchedMoreRecent(const AppSortInfo& app1, const AppSortInfo& app2) { return app1.last_launch_time > app2.last_launch_time; } } // namespace RecommendedApps::RecommendedApps(Profile* profile) : profile_(profile), extension_registry_observer_(this) { extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); pref_change_registrar_.Init(prefs->pref_service()); pref_change_registrar_.Add(extensions::pref_names::kExtensions, base::Bind(&RecommendedApps::Update, base::Unretained(this))); extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); Update(); } RecommendedApps::~RecommendedApps() { } void RecommendedApps::AddObserver(RecommendedAppsObserver* observer) { observers_.AddObserver(observer); } void RecommendedApps::RemoveObserver(RecommendedAppsObserver* observer) { observers_.RemoveObserver(observer); } void RecommendedApps::Update() { extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); std::vector<AppSortInfo> sorted_apps; const extensions::ExtensionSet& extensions = extensions::ExtensionRegistry::Get(profile_)->enabled_extensions(); for (extensions::ExtensionSet::const_iterator app = extensions.begin(); app != extensions.end(); ++app) { if (!extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_)) continue; sorted_apps.push_back( AppSortInfo(app->get(), prefs->GetLastLaunchTime((*app)->id()))); } std::sort(sorted_apps.begin(), sorted_apps.end(), &AppLaunchedMoreRecent); const size_t kMaxRecommendedApps = 4; sorted_apps.resize(std::min(kMaxRecommendedApps, sorted_apps.size())); Apps new_recommends; for (size_t i = 0; i < sorted_apps.size(); ++i) new_recommends.push_back(sorted_apps[i].app); const bool changed = apps_.size() != new_recommends.size() || !std::equal(apps_.begin(), apps_.end(), new_recommends.begin()); if (changed) { apps_.swap(new_recommends); FOR_EACH_OBSERVER( RecommendedAppsObserver, observers_, OnRecommendedAppsChanged()); } } void RecommendedApps::OnExtensionWillBeInstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, bool is_update, bool from_ephemeral, const std::string& old_name) { Update(); } void RecommendedApps::OnExtensionLoaded( content::BrowserContext* browser_context, const extensions::Extension* extension) { Update(); } void RecommendedApps::OnExtensionUnloaded( content::BrowserContext* browser_context, const extensions::Extension* extension, extensions::UnloadedExtensionInfo::Reason reason) { Update(); } void RecommendedApps::OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, extensions::UninstallReason reason) { Update(); } } // namespace app_list
[ "jhonnyjosearana@gmail.com" ]
jhonnyjosearana@gmail.com
259731db712deac7ab265f1e8891b340de369d6d
898aa6f083c05f06e79b8e10b79f27028bbd34b0
/src/Car.hpp
8b91a7902fbfaf7ff0e7b63daa43662439a2f557
[]
no_license
okunator/Hills-Racing
d36086e180bcb727fac071ed83fbb5d1c0f9a06b
6e0a46892669ec3f4cfb85cb88a2addd18c79aed
refs/heads/master
2021-01-24T16:19:21.163537
2018-02-27T21:00:56
2018-02-27T21:00:56
123,182,466
0
0
null
null
null
null
UTF-8
C++
false
false
890
hpp
#pragma once #include <SFML/Graphics.hpp> #include <Box2D/Box2D.h> #include "DEFINITIONS.hpp" #include "Game.hpp" namespace Hills { class Car { public: Car( GameDataRef data, b2World& world ); sf::Sprite& getChassisSprite(); sf::Sprite& getWheelSprite1(); sf::Sprite& getWheelSprite2(); void Reverse(); void Accelerate(); void Brake(); void TiltUp(); void TiltDown(); float GetAngle(); private: GameDataRef _data; b2World& world; sf::Sprite _wheelsprite1; sf::Sprite _wheelsprite2; sf::Sprite _chassissprite; b2Body* car; b2Body* wheel1; b2Body* wheel2; b2WheelJoint* spring1; b2WheelJoint* spring2; float m_hz; float m_zeta; float m_speed; }; }
[ "oskari.lehtonen@aalto.fi" ]
oskari.lehtonen@aalto.fi
59a82e91ff0753b4b755a7cc78c984931347f5d6
8be0c158a6a8c1a7bbe765aaaeae11e211123421
/QuyHoachDong.cpp
e1e98c736467537e21d4d2cac3d402ac719cbc93
[]
no_license
loc4atnt/onktlt21
50fb206ff127336f11176ca7a750558051bf756a
7959652c56c461f2300aeb35a2780dccd21ddd8b
refs/heads/main
2023-07-28T00:30:18.714879
2021-09-11T10:00:49
2021-09-11T10:00:49
396,078,442
0
0
null
null
null
null
UTF-8
C++
false
false
1,489
cpp
#include "QuyHoachDong.h" int sumOfRow(int n, int** T, int m) { int sum = 0; for (int i = 0; i < m; i++) sum += T[n - 1][i]; return sum; } void topDown(int n, int** T, int *a, int m) { int sum = sumOfRow(n, T, m); if (sum >= 0) return; // truong hop co ban for (int i = 0; i < m; i++) { if (a[i] == n) { for (int j = 0; j < m; j++) T[n - 1][j] = 0; T[n - 1][i] = 1; return;// return truong hop co ban. } } // truong hop khong co ban int minSum = n + 1; int toiUu = -1; for (int i = 0; i < m; i++) { if (n < a[i]) break; topDown(n - a[i], T, a, m); sum = sumOfRow(n - a[i], T, m); if (sum > 0 && sum < minSum) { minSum = sum; toiUu = i; } } for (int i = 0; i < m; i++) T[n - 1][i] = 0; if (toiUu > -1) { T[n - 1][toiUu] += 1; for (int i = 0; i < m; i++) T[n - 1][i] += T[n - a[toiUu] - 1][i]; } } void btQuyHoachDong() { int a[] = {2,3,5}; int m = 3; int n = 11; int** T = (int**)malloc(sizeof(int*) * n); for (int i = 0; i < n; i++) { T[i] = (int*)malloc(sizeof(int) * m); for (int j = 0; j < m; j++) T[i][j] = -1;//-1 chua giai } topDown(n, T, a, m); // lay ket qua tu bang tra T roi in ra man hinh if (sumOfRow(n, T, m) == 0) { printf("Khong co dap an cho n = %d\n", n); } else { printf("Dap an cho n = %d\n", n); printf("Loai xu: "); for (int i = 0; i < m; i++) { printf("%d\t", a[i]); } printf("\n"); printf("So xu : "); for (int i = 0; i < m; i++) { printf("%d\t", T[n - 1][i]); } } }
[ "dorakid153@gmail.com" ]
dorakid153@gmail.com
3262e3f77cd3f444f122f72a81786caaf57d3783
21e12db1a741d09d4f71ef9a0387badbb02bd99e
/codes/Coins_in_a_Line.cpp
917ae8ebf0fc6a0d927c0568ae7ddc828d2f1764
[]
no_license
yutianwu/lintcode
48f0bcd1c27d3fbda41eaad99a6f5616db973fdc
4a250cd3bee68f2f44fa8ee969edd60b34374aef
refs/heads/master
2021-01-10T00:58:55.789531
2015-12-03T09:11:25
2015-12-03T09:11:25
36,228,386
2
0
null
null
null
null
UTF-8
C++
false
false
372
cpp
class Solution { public: /** * @param n: an integer * @return: a boolean which equals to true if the first player will win */ bool firstWillWin(int n) { if (n == 0) return false; vector<int> dp(n, true); for (int i = 2; i < n; i++) { dp[i] = !dp[i - 1] || !dp[i - 2]; } return dp[n - 1]; } };
[ "wzxingbupt@gmail.com" ]
wzxingbupt@gmail.com
77a6aa762480d812d303ced6061f144dbcad4bc6
db9fed0381c87260d8b56497b3d0a00c16eb8dda
/week4/solutions/problem1.cpp
6070f4f1c8cbb9d21910b1fac8883b211ce89455
[]
no_license
kanitkameh/SDP-pract
ec81693a6a2885bacdd8eba52abef618a1dea249
ffdcfb1c2cacc94f1e7fbd4d9099539680cd3a21
refs/heads/master
2021-07-23T03:43:01.951203
2020-09-01T16:01:06
2020-09-01T16:01:06
212,807,627
0
0
null
null
null
null
UTF-8
C++
false
false
397
cpp
#include <iostream> #include <queue> using namespace std; int smallestElement(queue<int> q){ int max=q.front(); while(!q.empty()){ int current = q.front(); q.pop(); if(current>max){ max = current; } } return max; } int main(){ int n; cin >> n; queue<int> q; for(int i=0;i<n;i++){ int current; cin >> current; q.push(current); } cout << smallestElement(q); return 0; }
[ "kanitkameh@gmail.com" ]
kanitkameh@gmail.com
d401fc9858b80329e4a12ea794d78b8ae781ad6b
0d74ee5e64ea6900f86d96a083f4d9e9b1816453
/lib/base/util.cpp
71f56ad6163a575233cfb89726bd603f0e208182
[]
no_license
WeirdConstructor/lalrt
822184ca0ea1249cb6a7083488d2ada2f0c78c96
acc07b7e4c770d70999d8d0e31e0de84143718c2
refs/heads/master
2021-01-21T16:35:52.955143
2017-07-05T19:05:53
2017-07-05T19:05:53
91,899,740
0
0
null
null
null
null
UTF-8
C++
false
false
1,914
cpp
/****************************************************************************** * Copyright (C) 2017 Weird Constructor * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ #include <iostream> //--------------------------------------------------------------------------- std::string read_all(std::istream &in) { std::string all; char buf[4096]; while (in.read(buf, sizeof(buf))) all.append(buf, sizeof(buf)); all.append(buf, in.gcount()); return all; } //--------------------------------------------------------------------------- std::string strip_lal_kw(const std::string &s) { if (s[0] == '\xfe' || s[0] == '\xfd') return s.substr(1); return s; } //---------------------------------------------------------------------------
[ "weirdconstructor@gmail.com" ]
weirdconstructor@gmail.com
75e4f76f4eb8aeb8325a8cfa5b02870b24e4500d
2dd4eec32e7eb8aa915d95271e085ce98ffb92d7
/Source/SharedImageWrapper.cpp
f68a4d06aebfe3fef8ae7bb8cc08a3fda1ef5aa1
[ "MIT", "Zlib" ]
permissive
RonYanDaik/Unreal-Unity-VirtualCapture
0c371315f185359a8cb2682cf7ab37d6b3eb284c
4f9c9590a667bbbe3f5af0822a717c66865be745
refs/heads/master
2023-06-16T14:41:47.465739
2021-07-12T15:06:28
2021-07-12T15:06:28
376,342,107
3
0
null
null
null
null
UTF-8
C++
false
false
1,843
cpp
#include "SharedImageWrapper.h" #include "shared.inl" using namespace std; namespace mray { SharedImageWrapper::SharedImageWrapper() { totalTime = 0; m_sender = new SharedImageMemory(1); _start = std::chrono::system_clock::now(); } SharedImageWrapper::~SharedImageWrapper() { delete m_sender; } bool SharedImageWrapper::Ready() { auto now = std::chrono::system_clock::now(); auto diff = now - _prev; long long diffInt = std::chrono::duration_cast<std::chrono::milliseconds>(diff).count(); if (diffInt < 1000 / 30) return false; return true; } bool SharedImageWrapper::SendImage(const unsigned char* data, int width, int height) { if (!Ready()) return false; auto now = std::chrono::system_clock::now(); _prev = now; long long diffInt = std::chrono::duration_cast<std::chrono::milliseconds>(now - _start).count(); //push the captured data to directshow filter HRESULT hr = m_sender->SendUnrl(diffInt, width, height, data); return true; } SharedImageWrapper::ESendResultWr SharedImageWrapper::SendImage2(int width, int height, int stride, DWORD DataSize, EFormatWr format, SharedImageWrapper::EResizeModeWr resizemode, SharedImageWrapper::EMirrorModeWr mirrormode, int timeout, const uint8_t* buffer) { //if (!Ready()) return ESendResultWr::SENDRES_TOOLARGE; //auto now = std::chrono::system_clock::now(); //_prev = now; //long long diffInt = std::chrono::duration_cast<std::chrono::milliseconds>(now - _start).count(); //push the captured data to directshow filter return (SharedImageWrapper::ESendResultWr)m_sender->Send( width, height, stride, DataSize, (SharedImageMemory::EFormat) format, SharedImageMemory::RESIZEMODE_DISABLED, SharedImageMemory::MIRRORMODE_DISABLED, timeout, buffer); //return SharedImageWrapper::ESendResultWr::SENDRES_OK; } }
[ "andronakiy@gmail.com" ]
andronakiy@gmail.com
cd493c3bd88c441538d8923a67e24485d0b13e70
d4347174c9fb7b63ae34cf290112cd9b07ecc5c5
/libphys/sources/PhysixCollider.h
89e6221609b7856a77497adb0b8104b964823c3b
[]
no_license
AzJezebel/GameEngineJVK
ed29b6e942199c1c25c08c41fbbb672a9e9d7573
246ae8d30803cac5b5245e55d3d55ed4cb0b6fc7
refs/heads/master
2023-05-06T06:06:13.880842
2021-05-28T22:17:23
2021-05-28T22:17:23
333,589,028
0
0
null
null
null
null
UTF-8
C++
false
false
5,320
h
#pragma once #include "PTransform.h" #include "Actors/RigidType.h" #include "libphys_Export.h" #include <functional> #include <sstream> #include "Defines.h" #include "PxPhysicsAPI.h" #include "PhysicsMaterial/Material.h" struct ForceMode; class TriangleMesh; struct TriangleMeshDescriptor; namespace physx { class PxRigidActor; } struct StaticActor; struct DynamicActor; class Shape; template <typename> class ColliderDelegate; template <typename rType, typename... Args> class ColliderDelegate<rType(Args ...)> { public: libphys_API ColliderDelegate() = default; template<typename pClass> void Connect(pClass* t, rType(pClass::* method)(Args...)) { m_function = [=](Args ... as) { (t->*method)(std::forward<Args>(as)...); }; } rType operator() (Args... args) { return m_function(std::forward<Args>(args)...); } protected: std::function<rType(Args ...)> m_function = {}; }; namespace Physix { class PhysixCollider { public: libphys_API PhysixCollider() = default; libphys_API PhysixCollider(Shape* shape, RigidType type, const PTransform& transform, size_t entityID); libphys_API PhysixCollider(TriangleMesh& triangleMesh, RigidType type, const PTransform& transform, size_t entityID); libphys_API PhysixCollider(float nx, float ny, float nz, float dist, const PTransform& transform, size_t entityID); libphys_API PhysixCollider(PhysixCollider&& other) noexcept; libphys_API PhysixCollider& operator=(PhysixCollider&& other); ~PhysixCollider(); bool libphys_API operator==(const PhysixCollider& rhs) const; void libphys_API ChangeType(RigidType type); void libphys_API SetKinematic(bool isKinematic) const; void libphys_API Release(); [[nodiscard]] LibMath::Vector3 libphys_API GetLinearVelocity() const; [[nodiscard]] LibMath::Vector3 libphys_API GetAngularVelocity() const; [[nodiscard]] float libphys_API GetMass() const; void libphys_API SetScale(LibMath::Vector3& scale); void libphys_API SetLinearVelocity(const LibMath::Vector3& linVel) const; void libphys_API SetAngularVelocity(const LibMath::Vector3& angVel) const; void libphys_API DisableGravity(bool disable) const; void libphys_API SetMass(float mass) const; void libphys_API SetMassSpaceInertiaTensor(const LibMath::Vector3& mass) const; void libphys_API AddForce(const LibMath::Vector3& force, const ForceMode& mode) const; void libphys_API AddTorque(const LibMath::Vector3& force, const ForceMode& mode) const; void libphys_API SetAngularDamping(float angDamp) const; void libphys_API SetLinearDamping(float linDamp) const; void libphys_API ClearTorque(const ForceMode& mode) const; void libphys_API ClearForce(const ForceMode& mode) const; void libphys_API AddForceAtPos(const LibMath::Vector3& force, const LibMath::Vector3& pos, const ForceMode& mode, bool wakeup = true) const; void libphys_API AddForceAtLocalPos(const LibMath::Vector3& force, const LibMath::Vector3& pos, const ForceMode& mode, bool wakeup = true) const; void libphys_API AddLocalForceAtPos(const LibMath::Vector3& force, const LibMath::Vector3& pos, const ForceMode& mode, bool wakeup = true) const; void libphys_API AddLocalForceAtLocalPos(const LibMath::Vector3& force, const LibMath::Vector3& pos, const ForceMode& mode, bool wakeup = true) const; void libphys_API OnContact(size_t indexOtherActor); void libphys_API EndContact(size_t indexOtherActor); void libphys_API SetName(const char* name) const; const char* GetName() const; physx::PxRigidActor* GetActor() const; template<typename pClass> void BindOnBeginContact(pClass* pclass, void(pClass::* method)(size_t)); template<typename pClass> void BindOnEndContact(pClass* pclass, void(pClass::* method)(size_t)); void libphys_API PutToSleep(); void libphys_API LockRotation(bool lockX, bool lockY, bool lockZ); void libphys_API LockLocation(bool lockX, bool lockY, bool lockZ); //Collision Settings void libphys_API ShapeInShapePairIntersectionTests(bool active); void libphys_API ShapeInSceneQueryTests(bool active); void libphys_API TriggerCollision(bool bisTrigger) const; LibMath::Vector3 libphys_API GetPosition(); LibMath::Quaternion libphys_API GetRotator(); void libphys_API SetPosition(const LibMath::Vector3& pos); void libphys_API SetRotator(const LibMath::Quaternion& rot); void libphys_API UpdateTransform(const LibMath::Vector3& pos, const LibMath::Quaternion& rot); LibMath::Vector3 libphys_API GetScaleShape()const; ColliderDelegate<void(size_t)> m_onBeginContactDelegate; ColliderDelegate<void(size_t)> m_onEndContactDelegate; RigidType m_type = RigidType::STATIC; size_t m_idEntity = INVALID_INDEX; private: Shape* m_shape = nullptr; PTransform m_transform; DynamicActor* m_dynamic = nullptr; StaticActor* m_static = nullptr; Material m_material; bool bSetBeginContact = false; bool bSetEndContact = false; }; template <typename pClass> void PhysixCollider::BindOnBeginContact(pClass* pclass, void( pClass::* method)(size_t)) { m_onBeginContactDelegate.Connect(pclass, method); bSetBeginContact = true; } template <typename pClass> void PhysixCollider::BindOnEndContact(pClass* pclass, void( pClass::* method)(size_t)) { m_onBeginContactDelegate.Connect(pclass, method); bSetBeginContact = true; } }
[ "jezebel.assad@outlook.com" ]
jezebel.assad@outlook.com
f95dfa3f1fa34923f890215a057fbf53e0505b20
d24773c4f1dc664d06836485a1faf0e9d62cc00a
/KSynthGUI/controls/CheckBoxGroup.cpp
55b450097230ab4a8577f64381bf636a4d048803
[ "Apache-2.0" ]
permissive
eriser/KSynth
2f7151f30c25ff084f85db653bd30e4567fe2996
d58147204793dd629a27f77766c0ceee4ed61887
refs/heads/master
2020-07-17T05:03:34.006323
2014-11-22T14:14:44
2014-11-22T14:14:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
758
cpp
#include "CheckBoxGroup.h" CheckBoxGroup::CheckBoxGroup() { ; } void CheckBoxGroup::add(CheckBox* child) { childs.push_back(child); connect(child, SIGNAL(onChange()), this, SLOT(onChange())); if (childs.size() == 1) {childs[0]->setChecked(true);} } void CheckBoxGroup::onChange() { QObject* obj = QObject::sender(); CheckBox* chk = (CheckBox*) obj; static bool running = false; if (running) {return;} running = true; // uncheck all other boxes if (chk->isChecked()) { for (CheckBox* other : childs) { if (other != chk) { bool changed = other->isChecked() != false; other->setChecked(false); if (changed) {emit other->onChange();} } } } else { chk->setChecked(true); emit chk->onChange(); } running = false; }
[ "frank.ebner@web.de" ]
frank.ebner@web.de
581d369e96ec0ec661c263a07669b8805ee06972
66862c422fda8b0de8c4a6f9d24eced028805283
/slambook2/3rdparty/opencv-3.3.0/modules/features2d/misc/python/pyopencv_features2d.hpp
b865e361b6285b7637158d7e98c6c5427dab386c
[ "MIT", "BSD-3-Clause" ]
permissive
zhh2005757/slambook2_in_Docker
57ed4af958b730e6f767cd202717e28144107cdb
f0e71327d196cdad3b3c10d96eacdf95240d528b
refs/heads/main
2023-09-01T03:26:37.542232
2021-10-27T11:45:47
2021-10-27T11:45:47
416,666,234
17
6
MIT
2021-10-13T09:51:00
2021-10-13T09:12:15
null
UTF-8
C++
false
false
98
hpp
#ifdef HAVE_OPENCV_FEATURES2D typedef SimpleBlobDetector::Params SimpleBlobDetector_Params; #endif
[ "594353397@qq.com" ]
594353397@qq.com
694f0597dee010e5fc25c6a47538795cc743848d
dce7bf3f396504d6edc9a698313d14b572c24b01
/DP/THE SUBSET SUM TO TARGET.cpp
d01057a1df7237b3c33606552c3d24f8db97d45b
[]
no_license
rubal2508/CodingBlocks_Hackerblocks_Algo
11bb78d9a14bb024981cfb6242e24a0c3275580a
fd4abda2f53a4f5563352a8691413bbea87080b2
refs/heads/master
2020-06-24T21:00:13.386936
2020-01-30T16:42:49
2020-01-30T16:42:49
199,088,569
0
0
null
null
null
null
UTF-8
C++
false
false
1,170
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int knapsackDP(int arr[], int n, int s){ int dp[1000][50]; for(int i=0; i<1000; i++){ for(int j=0; j<50; j++){ dp[i][j] = -1; } } for(int i=0; i<n; i++) { // if(arr[i]==0 || dp[0][i-1]==1) dp[0][i] = 1 ; // else dp[0][i] = 0 dp[0][i] = 1 ; } for(int i=0; i<=s; i++){ if(i==arr[0]) dp[i][0] = 1; else dp[i][0] = 0; } for(int i=1; i<=s; i++){ for(int j=1; j<n; j++){ if (i>=arr[j]) dp[i][j] = dp[i][j-1] | dp[i-arr[j]][j-1]; // dp[i][j] = max (dp[i][j-1], value[j] + dp[i-size[j]][j]); else dp[i][j] = dp[i][j-1]; } } return dp[s][n-1]; } int main(){ int n,s; cin>>n>>s; int arr[n]; for(int i=0; i<n; i++){ cin>>arr[i]; } // cout << knapsackRec(size,value,n,s) <<endl; cout << knapsackDP(arr,n,s) <<endl; // for(int i=0; i<s; i++){ // for(int j=0; j<n; j++){ // cout << dp[i][j] << "\t"; // } cout << endl; // } }
[ "amangarg25aug@gmail.com" ]
amangarg25aug@gmail.com
7c700ec984fa3e897b43972250e00382147c16cd
9a5eb63c3d7cd20f6e4d07454ad93c400ed37cc8
/src/truncnormal_sample.h
70b938a3f895063127a253f6df25bf53215588e5
[]
no_license
mashedpoteto/bmms
cd493349b090853ea51e87d349deaac81bd6cfe5
94ddd58b8d97134348f91837cbacc9e45c477c7a
refs/heads/master
2020-07-04T17:51:37.861404
2018-11-05T16:48:18
2018-11-05T16:48:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,306
h
//[[Rcpp::plugins(cpp11)]] //[[Rcpp::depends(RcppArmadillo)]] #ifndef truncnormal #define truncnormal #include <RcppArmadillo.h> using namespace std; arma::vec pnorm01_vec(const arma::vec& x, int lower, int logged); arma::vec qnorm01_vec(const arma::vec& x, int lower, int logged); arma::uvec usetdiff(const arma::uvec& x, const arma::uvec& y); arma::vec lnNpr_cpp(const arma::vec& a, const arma::vec& b); arma::field<arma::mat> cholperm_cpp(arma::mat Sig, arma::vec l, arma::vec u); arma::mat gradpsi_cpp(const arma::vec& y, const arma::mat& L, const arma::vec& l, const arma::vec& u, arma::vec& grad); arma::vec armasolve(arma::mat A, arma::vec grad); arma::vec nleq(const arma::vec& l, const arma::vec& u, const arma::mat& L); arma::vec ntail_cpp(const arma::vec& l, const arma::vec& u); arma::vec trnd_cpp(const arma::vec& l, const arma::vec& u); arma::vec tn_cpp(const arma::vec& l, const arma::vec& u); arma::vec trandn_cpp(const arma::vec& l, const arma::vec& u); arma::mat mvnrnd_cpp(int n, const arma::mat& L, const arma::vec& l, const arma::vec& u, arma::vec mu, arma::vec& logpr); double psy_cpp(arma::vec x, const arma::mat& L, arma::vec l, arma::vec u, arma::vec mu); arma::mat mvrandn_cpp(const arma::vec& l_in, const arma::vec& u_in, const arma::mat& Sig, int n); arma::mat rndpp_mvnormal2(int n, const arma::vec& mu, const arma::mat& sigma); arma::mat rndpp_mvnormalnew(int n, const arma::vec &mean, const arma::mat &sigma); arma::mat mvtruncnormal(const arma::vec& mean, const arma::vec& l_in, const arma::vec& u_in, const arma::mat& Sig, int n); arma::mat mvtruncnormal_eye1(const arma::vec& mean, const arma::vec& l_in, const arma::vec& u_in); arma::mat get_S(const arma::vec& y, const arma::mat& X); arma::mat get_Ddiag(const arma::mat& Sigma, const arma::mat& S); arma::mat diag_default_mult(const arma::mat& A, const arma::vec& D); arma::mat diag_custom_mult(const arma::mat& A, const arma::vec& D); arma::mat beta_post_sample(const arma::vec& mu, const arma::mat& Sigma, const arma::mat& S, const arma::vec& Ddiag, int sample_size); #endif
[ "peruzzi@gmail.com" ]
peruzzi@gmail.com
da06f69a30b6eaa5f5e848610636582e696d368e
0517284f941161b5f7d7663d3bc1ab735a5efb9b
/ch04/ex4_29.cc
c38533ef78ba297b87fd08e1d10d31bcedadf147
[]
no_license
LuckyGrx/CppPrimer
874d56efa56aa23278afebb278752ff473835479
6818a2e80d6d343a86fe59bca104652948063abb
refs/heads/master
2021-09-21T17:04:13.800399
2018-08-29T12:49:40
2018-08-29T12:49:40
94,493,037
10
2
null
null
null
null
UTF-8
C++
false
false
556
cc
/// /// @file ex4_29.cc /// @author zack(18357154046@163.com) /// @date 2017-06-16 22:48:55 /// #include <iostream> using std::cout; using std::endl; int main(){//在64位系统下 int x[10]; int* p=x; cout<<sizeof(x)/sizeof(*x)<<endl;//10 cout<<sizeof(p)/sizeof(*p)<<endl;//2 return 0; } //说明: //sizeof(x)是求数组x的大小,为40 //sizeof(*x)是求数组x的第一个元素x[0]的大小,为4 // //sizeof(p)是求指针p的大小,在64位系统下为8,在32位系统下为4 //sizeof(*p)是求int类型的大小,为4
[ "18357154046@163.com" ]
18357154046@163.com
ff97d4aeb34341d2b07e28b7fa0f31fe89193ab9
6e0cdf4d488e9974f8ee88b24c5538da55bcfa8f
/leetcode/editor/cn/225_implement-stack-using-queues.cpp
13bd7d945cbe28eb141f04f359c6eb8d5fdd53c5
[]
no_license
JinyuChata/leetcode_cpp
70b59410e31714d74eb3fabf08604d95ebd6fcfb
2ee7778582b759887f598671585e172d0e3fa5e7
refs/heads/master
2023-08-18T02:30:28.050723
2021-10-14T07:33:37
2021-10-14T07:33:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,699
cpp
//请你仅使用两个队列实现一个后入先出(LIFO)的栈,并支持普通队列的全部四种操作(push、top、pop 和 empty)。 // // 实现 MyStack 类: // // // void push(int x) 将元素 x 压入栈顶。 // int pop() 移除并返回栈顶元素。 // int top() 返回栈顶元素。 // boolean empty() 如果栈是空的,返回 true ;否则,返回 false 。 // // // // // 注意: // // // 你只能使用队列的基本操作 —— 也就是 push to back、peek/pop from front、size 和 is empty 这些操作。 // 你所使用的语言也许不支持队列。 你可以使用 list (列表)或者 deque(双端队列)来模拟一个队列 , 只要是标准的队列操作即可。 // // // // // 示例: // // //输入: //["MyStack", "push", "push", "top", "pop", "empty"] //[[], [1], [2], [], [], []] //输出: //[null, null, null, 2, 2, false] // //解释: //MyStack myStack = new MyStack(); //myStack.push(1); //myStack.push(2); //myStack.top(); // 返回 2 //myStack.pop(); // 返回 2 //myStack.empty(); // 返回 False // // // // // 提示: // // // 1 <= x <= 9 // 最多调用100 次 push、pop、top 和 empty // 每次调用 pop 和 top 都保证栈不为空 // // // // // 进阶:你能否实现每种操作的均摊时间复杂度为 O(1) 的栈?换句话说,执行 n 个操作的总时间复杂度 O(n) ,尽管其中某个操作可能需要比其他操作更长的 //时间。你可以使用两个以上的队列。 // Related Topics 栈 设计 // 👍 332 👎 0 #include "bits/stdc++.h" using namespace std; //leetcode submit region begin(Prohibit modification and deletion) class MyStack { public: queue<int> q1; queue<int> q2; /** Initialize your data structure here. */ MyStack() { } /** Push element x onto stack. */ void push(int x) { q2.push(x); while (!q1.empty()) { q2.push(q1.front()); q1.pop(); } swap(q1,q2); } /** Removes the element on top of the stack and returns that element. */ int pop() { int i = q1.front(); q1.pop(); return i; } /** Get the top element. */ int top() { return q1.front(); } /** Returns whether the stack is empty. */ bool empty() { return q1.empty(); } }; /** * Your MyStack object will be instantiated and called as such: * MyStack* obj = new MyStack(); * obj->push(x); * int param_2 = obj->pop(); * int param_3 = obj->top(); * bool param_4 = obj->empty(); */ //leetcode submit region end(Prohibit modification and deletion) int main() { // Solution s; }
[ "jinyuzhu@smail.nju.edu.cn" ]
jinyuzhu@smail.nju.edu.cn
36ef700a4ae10bac9d8d80bad9eb18d9947fd0a9
7f4ffa7b49096aedf6bf397e7729f1eb80c9b7c2
/win/Button.cpp
b5f2abba2083a1627b187721bea93f4a152695a6
[]
no_license
tuccio/mye
99e8c6016eb4929669a845fc38743763e691af21
dc38ef7ee6192a301645e7bb6f8587557dfdf61d
refs/heads/master
2021-01-10T02:24:42.410134
2015-12-13T21:04:59
2015-12-13T21:04:59
48,071,471
4
0
null
null
null
null
UTF-8
C++
false
false
1,551
cpp
#include "Button.h" #include "Window.h" #include "utils.h" #include <CommCtrl.h> #include <Windowsx.h> using namespace mye::math; using namespace mye::win; Button::Button(void) : Control(CT_BUTTON) { } Button::~Button(void) { } void Button::Create(Window &parent, const mye::core::String &text, const CallbackType &f, const mye::math::Vector2i &position, const mye::math::Vector2i &size) { m_function = f; m_hButton = CreateWindow( WC_BUTTON, text.CString(), WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, position.x(), position.y(), size.x(), size.y(), parent.GetHandle(), (HMENU) m_id, nullptr, nullptr); SendMessage(m_hButton, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), (LPARAM) TRUE); if (!m_hButton) { ShowErrorBox(); } } void Button::Destroy(void) { DestroyWindow(m_hButton); m_hButton = nullptr; } void Button::Show(void) { ShowWindow(m_hButton, SW_SHOW); } void Button::Hide(void) { ShowWindow(m_hButton, SW_HIDE); } void Button::SetPosition(const Vector2i &position) { SetWindowPos(m_hButton, nullptr, position.x(), position.y(), 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW); } void Button::SetSize(const Vector2i &size) { SetWindowPos(m_hButton, nullptr, 0, 0, size.x(), size.y(), SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW); } IDGenerator::ID Button::GetID(void) const { return m_id; } std::string Button::GetText(void) const { char buffer[256] = { 0 }; Button_GetText(m_hButton, buffer, 255); return buffer; }
[ "d.tuccilli@gmail.com" ]
d.tuccilli@gmail.com
2acabdc670b0d704cb880103553878a679803ea6
cbf62f1cd45ead1c0817a81e1f6f3d2f33775a73
/dvm_sys/cdvmh/src/file_ctx.h
1ec55caf3a7e508a2cf9d2acb0dcf766dd70a37b
[ "LicenseRef-scancode-other-permissive" ]
permissive
GumballTheNet/DVM_sys
8b858a64a5282512e5b43e0fec0cd26454fcca51
40f07f86fa7f5d1468e9b43b8f6e9189241af851
refs/heads/master
2023-04-19T22:06:55.840036
2021-05-05T19:23:23
2021-05-05T19:23:23
357,683,874
0
0
null
null
null
null
UTF-8
C++
false
false
9,827
h
#pragma once #include <vector> #include <string> #include <map> #include <algorithm> #include "project_ctx.h" #include "settings.h" #include "pragmas.h" namespace cdvmh { struct HostReq { std::string handlerName; bool doOpenMP; void set(const std::string &name, bool omp) { handlerName = name; doOpenMP = omp; } }; struct CudaReq { std::string handlerName; }; class SourceFileContext { public: std::set<std::string> seenGlobalNames; std::set<std::string> seenMacroNames; public: bool isCompilable() const { return file.isCompilable; } int getLatestPragmaLine(unsigned fid) { return pragmasByLine[fid].second; } ProjectContext &getProjectCtx() const { return projectCtx; } const InputFile &getInputFile() const { return file; } void setHasRegions() { hasRegionsFlag = true; } void setHasLoops() { hasLoopsFlag = true; } void setNeedsAllocator() { needsAllocatorFlag = true; } const std::string &getOmpHandlerType() { ompHandlerTypeRequested = true; return ompHandlerType; } void setConvertedText(const std::string &convText, bool haveChanges) { convertedText = convText; textChanged = haveChanges; } bool isTextChanged() const { return textChanged || !mainTail.empty(); } std::string getConvertedText() const { return convertedText + "\n" + mainTail; } bool hasHostHandlers() const { return !hostHandlers.empty(); } bool hasCudaHandlers() const { return !cudaHandlers.empty() || !cudaTail.empty(); } const std::string getInitGlobName() const { return initGlobName; } const std::string getFinishGlobName() const { return finishGlobName; } const std::string getInitGlobText(bool includeOptional = true) const { return initGlobText + (includeOptional ? initGlobOptionalText : ""); } const std::string getFinishGlobText(bool includeOptional = true) const { return finishGlobText + (includeOptional ? finishGlobOptionalText : ""); } const std::string getHandlersForwardDecls() const { return handlersForwardDecls; } bool hasRegions() const { return hasRegionsFlag; } bool hasLoops() const { return hasLoopsFlag; } bool needsAllocator() const { return needsAllocatorFlag; } bool useTabs() const { return tabbedIndent; } const std::map<std::string, HostReq> &getHostReqMap() const { return hostRequests; } const std::map<std::string, CudaReq> &getCudaReqMap() const { return cudaRequests; } bool isExpansionForced(unsigned fid) const { return forceExpansion.find(fid) != forceExpansion.end(); } bool isUserInclude(unsigned fid) { return userIncludes.find(fid) != userIncludes.end(); } bool isInternalInclude(std::string what) { return internalIncludes.find(what) != internalIncludes.end(); } public: explicit SourceFileContext(ProjectContext &aPrj, int idx); public: std::string dvm0c(const std::string &strV) { dvm0cRequested = true; for (int i = 0; i < dvm0cMaxCount; i++) if (strV == toStr(i)) return dvm0c(i); return dvm0cBase + "(" + strV + ")"; } std::string dvm0c(int v) { dvm0cRequested = true; if (v >= 0 && v < dvm0cMaxCount) { if (v > dvm0cCount - 1) dvm0cCount = v + 1; return dvm0cBase + toStr(v); } else return dvm0cBase + "(" + toStr(v) + ")"; } std::string dvm0cFunc() { dvm0cRequested = true; return dvm0cBase; } DvmPragma *getNextPragma(unsigned fid, int line, DvmPragma::Kind kind1 = DvmPragma::pkNoKind, DvmPragma::Kind kind2 = DvmPragma::pkNoKind, DvmPragma::Kind kind3 = DvmPragma::pkNoKind, DvmPragma::Kind kind4 = DvmPragma::pkNoKind); DvmPragma *getNextDebugPragma(unsigned fid, int line, DvmPragma::Kind kind = DvmPragma::pkNoKind); void addInitGlobText(const std::string &str, bool optional = false) { if (optional) initGlobOptionalText += str; else initGlobText += str; } void addFinishGlobText(const std::string &str, bool optional = false) { if (optional) finishGlobOptionalText = str + finishGlobOptionalText; else finishGlobText = str + finishGlobText;; } void addToForceExpansion(unsigned fid) { forceExpansion.insert(fid); } void addUserInclude(unsigned fid) { userIncludes.insert(fid); } void addHandlerForwardDecl(const std::string &handler) { handlersForwardDecls += handler; } void addToMainTail(const std::string &tail) { mainTail += tail; } void addBlankHandler(const std::string &handler) { blankHandlers.push_back(handler); } void addToHostHeading(const std::string &heading) { hostHeading += heading; } void addHostHandler(const std::string &handler, bool ompFlag) { hostHandlers.push_back(handler); usesOpenMP = usesOpenMP || ompFlag; } void addToHostTail(const std::string &tail) { hostTail += tail; } void addHostHandlerRequest(const std::string &blankName, const std::string &hostName, bool doingOpenMP) { hostRequests[blankName].set(hostName, doingOpenMP); } void addToCudaHeading(const std::string &heading) { cudaHeading += heading; } void addCudaHandler(const std::string &handler, const std::string &info) { cudaHandlers.push_back(std::make_pair(handler, info)); } void addToCudaTail(const std::string &tail) { cudaTail += tail; } void addCudaHandlerRequest(const std::string &blankName, const std::string &cudaName) { cudaRequests[blankName].handlerName = cudaName; } void addPragma(unsigned fid, DvmPragma *curPragma); void setGlobalNames(); std::string genDvm0cText() const; std::string genOmpHandlerTypeText() const; std::string genBlankHandlersText() const; std::string genHostHandlersText(bool withHeading = true) const; std::string genCudaHandlersText() const; std::string genCudaInfoText() const; public: bool isDebugPass; std::map<int, int> loopNumbersByLine; public: ~SourceFileContext(); protected: ProjectContext &projectCtx; const InputFile &file; std::map<unsigned, std::pair<std::map<int, DvmPragma *>, int> > pragmasByLine; std::map<unsigned, std::pair<std::map<int, DvmPragma *>, int> > pragmasForDebug; std::set<unsigned> forceExpansion; std::set<unsigned> userIncludes; std::set<std::string> internalIncludes; std::set<int> occupiedPragmas; void occupyPragma(int line) { occupiedPragmas.insert(line); } bool pragmaIsOccupied(int line) { return occupiedPragmas.find(line) != occupiedPragmas.end(); } int dvm0cCount; bool hasRegionsFlag; bool hasLoopsFlag; bool needsAllocatorFlag; bool tabbedIndent; bool ompHandlerTypeRequested; bool dvm0cRequested; bool usesOpenMP; std::string dvm0cBase; std::string ompHandlerType; std::string initGlobName; // name for special initing function std::string finishGlobName; // name for special finalization function std::string initGlobText; // body for special initing function (w/o outer braces) std::string finishGlobText; // body for special finalization function (w/o outer braces) std::string initGlobOptionalText; // optional statements for special initing function std::string finishGlobOptionalText; // optional statements for special finalization function // Output text and handlers std::string handlersForwardDecls; std::string convertedText; // converted text of the file (main part without handlers) std::string mainTail; // text to be inserted at the end of converted file bool textChanged; // flag of converted text to be not just the input file's text std::string blankHeading; // user-defined types go here std::vector<std::string> blankHandlers; // full texts of definitions of blank handlers std::string hostHeading; // user-defined types go here std::vector<std::string> hostHandlers; // full texts of definitions of host handlers std::string hostTail; // template instantiations go here std::map<std::string, HostReq> hostRequests; std::string cudaHeading; // user-defined types go here std::vector<std::pair<std::string, std::string> > cudaHandlers; // full texts of definitions of cuda handlers + 'info' texts std::string cudaTail; // template instantiations go here std::map<std::string, CudaReq> cudaRequests; }; // Strange place for these classes struct VarState { bool isTemplate; bool isDvmArray; bool isArray; bool isRegular; bool isIncomplete; bool hasDependentBaseType; bool canBeRestrict; int rank; int headerArraySize; std::string name; std::string baseTypeStr; std::vector<MyExpr> sizes; std::vector<bool> constSize; DvmPragma *declPragma; VarState() { init("unknown", "unknown", std::vector<MyExpr>()); } void init(const std::string &varName, const std::string &typeName, const std::vector<MyExpr> &aSizes); void doDvmArray(PragmaDistribArray *curPragma); void doTemplate(PragmaTemplate *curPragma); bool isTemplateLike() const { return isArray && isIncomplete && rank == 1 && baseTypeStr == "void"; } std::string genSizeExpr(int i) const; std::string genHeaderRef(SourceFileContext &fileCtx) const; std::string genHeaderOrScalarRef(SourceFileContext &fileCtx, bool shortForm = true) const; std::string genDecl(const std::string &newName) const; std::string genDecl() const { return genDecl(name); } bool isConstSize() const; unsigned long long getTotalElemCount() const; }; struct LoopVarDesc { std::string name; std::string baseTypeStr; int stepSign; // +1 or -1 std::string constStep; // empty if not const }; }
[ "s02170070@gse.cs.msu.ru" ]
s02170070@gse.cs.msu.ru
e0549a909a65f94e3f0886eeb9a400a06e358897
02b25c69334f74f21ab67283bbfccf4b7a7a727c
/AMT830_2/Handler/MyBasicData.cpp
cb8c7775a51c471f41dea66ef545e287061c1eff
[]
no_license
ybs0111/AMT830_Handler
31c06d1b60fcb6d52e71cafd950df61d1599dca0
c61983e4ca3115ee2dee2080acb2e94fe5aa6da9
refs/heads/master
2020-12-30T14:12:50.885159
2017-06-11T07:44:24
2017-06-11T07:44:24
91,289,816
0
0
null
null
null
null
UHC
C++
false
false
80,281
cpp
// MyBasicData.cpp: implementation of the CMyBasicData class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "handler.h" #include "MyBasicData.h" #include "Ctlbd_Variable.h" #include "PublicFunction.h" #include "FastechPublic_IO.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif CMyBasicData clsBasic; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CMyBasicData::CMyBasicData() { } CMyBasicData::~CMyBasicData() { } void CMyBasicData::OnPassWord_Load(CString strLoadLevel) { CString strPass; CString strLoadFile; TCHAR chPass[25]; (st_other_info.strPassword).Empty(); // 암호 저장 변수 초기화 strLoadFile = st_path_info.strBasic + st_basic_info.strDeviceName; if(strLoadLevel == _T("SysLock")) // SYSTEM LOCK 암호 { :: GetPrivateProfileString(_T("Password"), _T("SysLock"), _T("M"), chPass, 20, strLoadFile); } else if (strLoadLevel == _T("Level1")) // 메인트 암호 { :: GetPrivateProfileString(_T("Password"), _T("Level_1"), _T("M"), chPass, 20, strLoadFile); } else if (strLoadLevel == _T("Level2")) // 티칭 암호 { :: GetPrivateProfileString(_T("Password"), _T("Level_2"), _T("T"), chPass, 20, strLoadFile); } else { return; } strPass.Format(_T("%s"), chPass); strPass.MakeUpper(); // 문자열 대문자로 변경 strPass.TrimLeft(' '); // 좌측 문자열 공백 제거 strPass.TrimRight(' '); // 우측 문자열 공백 제거 st_other_info.strPassword = strPass; // 암호 전역 변수에 설정 } void CMyBasicData::OnPassWord_Save(CString strSaveLevel, CString strPassData) { CString strSaveFile; strSaveFile = st_path_info.strBasic + st_basic_info.strDeviceName; if (strSaveLevel=="SysLock") // SYSTEM LOCK 암호 { :: WritePrivateProfileString(_T("Password"), _T("SysLock"), LPCTSTR(strPassData), strSaveFile); } else if (strSaveLevel=="Level1") // 메인트 암호 { :: WritePrivateProfileString(_T("Password"), _T("Level_1"), LPCTSTR(strPassData), strSaveFile); } else if (strSaveLevel=="Level2") // 티칭 암호 { :: WritePrivateProfileString(_T("Password"), _T("Level_2"), LPCTSTR(strPassData), strSaveFile); } } CString CMyBasicData::OnStep_File_Index_Load() { CString strLoadFile; char chLoad[20]; strLoadFile = st_path_info.strBasic + st_basic_info.strDeviceName; :: GetPrivateProfileString(_T("Thread_Step_file"), _T("File_Index"), _T("00"), (LPWSTR)chLoad, 20, strLoadFile); // sprintf(chLoad,"%S", chLoad); strLoadFile = chLoad; strLoadFile.TrimLeft(' '); strLoadFile.TrimRight(' '); return strLoadFile; // 파일 인덱스 리턴 } void CMyBasicData::OnStep_File_Index_Save(CString strIndex) { CString strSaveFile; strSaveFile = st_path_info.strBasic + st_basic_info.strDeviceName; :: WritePrivateProfileString(_T("Thread_Step_file"), _T("File_Index"), LPCTSTR(strIndex), strSaveFile); } CString CMyBasicData::OnStep_File_Name_Load() { CString strFileName; // 파일명 저장 변수 CString strLoadFile; char chLoad[20]; strLoadFile = st_path_info.strBasic + st_basic_info.strDeviceName; :: GetPrivateProfileString(_T("Thread_Step_file"), _T("File_Name"), _T("DEFAULT"),(LPWSTR)chLoad, 20, strLoadFile); // sprintf(chLoad,"%S", chLoad); strFileName = chLoad; strFileName.TrimLeft(' '); strFileName.TrimRight(' '); return strFileName; // 파일명 리턴 } void CMyBasicData::OnStep_File_Name_Save(CString strFile) { :: WritePrivateProfileString(_T("Thread_Step_file"), _T("File_Name"), LPCTSTR(strFile), st_path_info.strBasic); } void CMyBasicData::OnMotorSpeed_Set_Data_Load() { int nChk=0, i=0; double dChk; CString strTemp; // 임시 저장 변수 CString strMotorName; CString strLoadFile; char chData[20]; for(i = 0; i < MAXMOTOR; i++) { strMotorName.Format(_T("%02d_AXIS_SPEED"), i+1); :: GetPrivateProfileString(strMotorName, _T("ACC"), _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_accel[0] = dChk; st_motor_info[i].d_spd_vel[1] = dChk; :: GetPrivateProfileString(strMotorName, _T("DEC"), _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_decel[0] = dChk; st_motor_info[i].d_spd_vel[2] = dChk; :: GetPrivateProfileString(strMotorName, _T("MAX"), _T("100000"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_spd_max[0] = dChk; :: GetPrivateProfileString(strMotorName, _T("VEL"), _T("1000"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_spd_vel[0] = dChk; :: GetPrivateProfileString(strMotorName, _T("HOME"), _T("500"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_spd_home[0] = dChk; :: GetPrivateProfileString(strMotorName, _T("JOG"), _T("300"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_spd_jog[0] = dChk; :: GetPrivateProfileString(strMotorName, _T("VEL_PER"), _T("50"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_motor_info[i].n_per_vel = nChk; :: GetPrivateProfileString(strMotorName, _T("HOME_PER"), _T("5"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_motor_info[i].n_per_home = nChk; :: GetPrivateProfileString(strMotorName, _T("JOG_PER"), _T("5"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_motor_info[i].n_per_jog = nChk; :: GetPrivateProfileString(strMotorName, _T("ALLOW"), _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_allow = dChk; :: GetPrivateProfileString(strMotorName, _T("LIMIT_M"), _T("0"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_limit_position[0] = dChk; :: GetPrivateProfileString(strMotorName, _T("LIMIT_P"), _T("3000"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); dChk = _wtof(strTemp); st_motor_info[i].d_limit_position[1] = dChk; } //Speed Rate :: GetPrivateProfileString(_T("SPEED_RATE"), _T("RUN"), _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_handler_info.nRunSpeed = nChk; :: GetPrivateProfileString(_T("SPEED_RATE"), _T("MANUAL"), _T("80"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_handler_info.nManualSpeed = nChk; } void CMyBasicData::OnMotorSpeed_Set_Data_Save() { CString strTemp; // 임시 저장 변수 CString strMotorName; CString strSaveFile; // char chBuf[20]; for(int i = 0; i < MAXMOTOR; i++) { strMotorName.Format(_T("%02d_AXIS_SPEED"), i+1); // LPCTSTR(_itoa((int)(st_motor_info[i].d_accel[0]), chBuf, 10)); strTemp.Format(_T("%.3f"), st_motor_info[i].d_accel[0]); :: WritePrivateProfileString(strMotorName, _T("ACC"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_decel[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_decel[0]); :: WritePrivateProfileString(strMotorName, _T("DEC"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_spd_max[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_spd_max[0]); :: WritePrivateProfileString(strMotorName, _T("MAX"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_spd_vel[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_spd_vel[0]); :: WritePrivateProfileString(strMotorName, _T("VEL"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_spd_home[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_spd_home[0]); :: WritePrivateProfileString(strMotorName, _T("HOME"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_spd_jog[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_spd_jog[0]); :: WritePrivateProfileString(strMotorName, _T("JOG"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((st_motor_info[i].n_per_vel), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%d"), st_motor_info[i].n_per_vel); :: WritePrivateProfileString(strMotorName, _T("VEL_PER"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((st_motor_info[i].n_per_home), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%d"), st_motor_info[i].n_per_home); :: WritePrivateProfileString(strMotorName, _T("HOME_PER"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((st_motor_info[i].n_per_jog), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%d"), st_motor_info[i].n_per_jog); :: WritePrivateProfileString(strMotorName, _T("JOG_PER"), LPCTSTR(strTemp), st_path_info.strFileBasic); strTemp.Format(_T("%.2f"), st_motor_info[i].d_allow); :: WritePrivateProfileString(strMotorName, _T("ALLOW"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_limit_position[0]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_limit_position[0]); :: WritePrivateProfileString(strMotorName, _T("LIMIT_M"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_motor_info[i].d_limit_position[1]), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%.3f"), st_motor_info[i].d_limit_position[1]); :: WritePrivateProfileString(strMotorName, _T("LIMIT_P"), LPCTSTR(strTemp), st_path_info.strFileBasic); } // Speed Rate // LPCTSTR(_itoa((int)(st_handler_info.nRunSpeed), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%d"), st_handler_info.nRunSpeed); :: WritePrivateProfileString(_T("SPEED_RATE"), _T("RUN"), LPCTSTR(strTemp), st_path_info.strFileBasic); // LPCTSTR(_itoa((int)(st_handler_info.nManualSpeed), chBuf, 10)); // strTemp = chBuf; strTemp.Format(_T("%d"), st_handler_info.nManualSpeed); :: WritePrivateProfileString(_T("SPEED_RATE"), _T("MANUAL"), LPCTSTR(strTemp), st_path_info.strFileBasic); } void CMyBasicData::OnWaitTime_Data_Load() { CString strTemp, strMsg, strHead; // 임시 저장 변수 CString strLoadFile, strOnName, strOffName, strLimitName; int nChk, i; char chData[20]; for(i=0; i<MAX_WAIT_TIME; i++) { strHead.Format(_T("TIME_[%02d]"), i); strOnName.Format(_T("%s_ON"), strHead); :: GetPrivateProfileString(_T("ON_WAIT_TIME"), strOnName, _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_wait_info.nOnWaitTime[i] = nChk; strOffName.Format(_T("%s_OFF"), strHead); :: GetPrivateProfileString(_T("OFF_WAIT_TIME"), strOffName, _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_wait_info.nOffWaitTime[i] = nChk; strLimitName.Format(_T("%s_LIMIT"), strHead); :: GetPrivateProfileString(_T("LIMIT_TIME"), strLimitName, _T("100"), (LPWSTR)chData, 10, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); st_wait_info.nLimitWaitTime[i] = nChk; } } void CMyBasicData::OnWaitTime_Data_Save() { CString strTemp, strPart; // 로딩 정보 임시 저장 변수 CString strSaveFile; CString strOnName, strOffName, strLimitName; CString strData; int i; for(i=0; i<MAX_WAIT_TIME; i++) { strTemp.Format(_T("TIME_[%02d]"), i); strOnName.Format(_T("%s_ON"), strTemp); strData.Format(_T("%d"), st_wait_info.nOnWaitTime[i]); :: WritePrivateProfileString(_T("ON_WAIT_TIME"), strOnName, LPCTSTR(strData), st_path_info.strFileBasic); strOffName.Format(_T("%s_OFF"), strTemp); strData.Format(_T("%d"), st_wait_info.nOffWaitTime[i]); :: WritePrivateProfileString(_T("OFF_WAIT_TIME"), strOffName, LPCTSTR(strData), st_path_info.strFileBasic); strLimitName.Format(_T("%s_LIMIT"), strTemp); strData.Format(_T("%d"), st_wait_info.nLimitWaitTime[i]); :: WritePrivateProfileString(_T("LIMIT_TIME"), strLimitName, LPCTSTR(strData), st_path_info.strFileBasic); } } void CMyBasicData::OnMaintenance_Data_Load() { CString strTemp, strPart; // 로딩 정보 임시 저장 변수 int nChk; CString strLoadFile; char chData[20]; // ************************************************************************** // 타워 램프 RED 상태 로딩하여 전역 변수에 설정한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** // str_load_file = st_path.str_basic + st_basic.str_device_name; // 티칭 데이터 저장 파일 설정 strLoadFile = st_path_info.strBasic + _T("Maintenance.TXT"); // 티칭 데이터 저장 파일 설정 :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Stop_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[0] = 0; } else { st_lamp_info.nLampR[0] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Run_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[1] = 0; } else { st_lamp_info.nLampR[1] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Alarm_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[2] = 2; } else { st_lamp_info.nLampR[2] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("LotEnd_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[3] = 2; } else { st_lamp_info.nLampR[3] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Initial_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[4] = 2; } else { st_lamp_info.nLampR[4] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Warring_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[5] = 2; } else { st_lamp_info.nLampR[5] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Lock_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[6] = 2; } else { st_lamp_info.nLampR[6] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("SelfCheck_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[7] = 2; } else { st_lamp_info.nLampR[7] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Red"), _T("Idle_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampR[8] = 2; } else { st_lamp_info.nLampR[8] = nChk; } // ************************************************************************** // ************************************************************************** // 타워 램프 YELLOW 상태 로딩하여 전역 변수에 설정한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Stop_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[0] = 0; } else { st_lamp_info.nLampY[0] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Run_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[1] = 1; } else { st_lamp_info.nLampY[1] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Alarm_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[2] = 0; } else { st_lamp_info.nLampY[2] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("LotEnd_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[3] = 2; } else { st_lamp_info.nLampY[3] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Initial_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[4] = 2; } else { st_lamp_info.nLampY[4] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Warring_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[5] = 2; } else { st_lamp_info.nLampY[5] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Lock_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[6] = 2; } else { st_lamp_info.nLampY[6] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("SelfCheck_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[7] = 2; } else { st_lamp_info.nLampY[7] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Yellow"), _T("Idle_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampY[8] = 2; } else { st_lamp_info.nLampY[8] = nChk; } // ************************************************************************** // ************************************************************************** // 타워 램프 GREEN 상태 로딩하여 전역 변수에 설정한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Stop_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[0] = 1; } else { st_lamp_info.nLampG[0] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Run_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[1] = 0; } else { st_lamp_info.nLampG[1] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Alarm_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[2] = 0; } else { st_lamp_info.nLampG[2] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("LotEnd_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[3] = 2; } else { st_lamp_info.nLampG[3] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Initial_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[4] = 2; } else { st_lamp_info.nLampG[4] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Warring_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[5] = 2; } else { st_lamp_info.nLampG[5] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Lock_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[6] = 2; } else { st_lamp_info.nLampG[6] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("SelfCheck_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[7] = 2; } else { st_lamp_info.nLampG[7] = nChk; } :: GetPrivateProfileString(_T("TowerLampData_Green"), _T("Idle_State"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>2) { st_lamp_info.nLampG[8] = 2; } else { st_lamp_info.nLampG[8] = nChk; } // ************************************************************************** // ************************************************************************** // 부저 사용 모드 로딩하여 전역 변수에 설정 // -> 0:사용 1:미사용 // ************************************************************************** :: GetPrivateProfileString(_T("TowerLampData"), _T("n_buzzer_mode"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk<0 || nChk>1) { st_lamp_info.nBuzzerMode = 1; } else { st_lamp_info.nBuzzerMode = nChk; } // ************************************************************************** // ************************************************************************** // 장비 호기 및 장비 코드 로딩하여 전역 변수에 설정 // -> 로딩 정보에서 앞/뒤 공백은 제거한다 // ************************************************************************** :: GetPrivateProfileString(_T("TowerLampData"), _T("str_equip_no"), _T("AMT"), (LPWSTR)chData, 20, strLoadFile); // sprintf(chData,"%S", chData); st_lamp_info.strEquipNo.Format(_T("%s"), chData); (st_lamp_info.strEquipNo).TrimLeft(' '); (st_lamp_info.strEquipNo).TrimRight(' '); :: GetPrivateProfileString(_T("TowerLampData"), _T("str_equip_code"), _T("AMT"), (LPWSTR)chData, 20, strLoadFile); // sprintf(chData,"%S", chData); st_lamp_info.strEquipCode.Format(_T("%s"), chData); (st_lamp_info.strEquipCode).TrimLeft(' '); (st_lamp_info.strEquipCode).TrimRight(' '); // ************************************************************************** // ************************************************************************** // 타워 램프 ON/OFF 대기 시간 로딩하여 전역 변수에 설정 // ************************************************************************** :: GetPrivateProfileString(_T("TowerLampData"), _T("n_lamp_on_time_w"), _T("0"), (LPWSTR)chData, 10, strLoadFile); strTemp.Format(_T("%s"), chData); nChk = _wtoi(strTemp); if (nChk < 1) { st_lamp_info.nLampWaitTime = 500; } else { st_lamp_info.nLampWaitTime = nChk; } // ***************************************************************************/ } void CMyBasicData::OnMaintenance_Data_Save() { CString strTemp, strPart; // 로딩 정보 임시 저장 변수 CString strSaveFile;; // ************************************************************************** // 타워 램프 RED 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** // str_save_file = st_path.str_basic + st_basic.str_device_name; // 티칭 데이터 저장 파일 설정 strSaveFile = st_path_info.strBasic + _T("Maintenance.TXT"); strTemp.Format(_T("%d"), st_lamp_info.nLampR[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 YELLOW 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampY[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 GREEN 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampG[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 부저 사용 모드 로딩하여 전역 변수에 설정 // -> 0:사용 1:미사용 // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nBuzzerMode) ; :: WritePrivateProfileString(_T("TowerLampData"), _T("n_buzzer_mode"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 장비 호기 및 장비 코드 로딩하여 전역 변수에 설정 // -> 로딩 정보에서 앞/뒤 공백은 제거한다 // ************************************************************************** :: WritePrivateProfileString(_T("TowerLampData"), _T("str_equip_no"), LPCTSTR(st_lamp_info.strEquipNo), strSaveFile); :: WritePrivateProfileString(_T("TowerLampData"), _T("str_equip_code"), LPCTSTR(st_lamp_info.strEquipCode), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 ON/OFF 대기 시간 로딩하여 전역 변수에 설정 // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampWaitTime); :: WritePrivateProfileString(_T("TowerLampData"), _T("n_lamp_on_time_w"), LPCTSTR(strTemp), strSaveFile); } void CMyBasicData::OnModuleRobot_Teach_Data_Save() { CString strTemp, strMsg, strSaveFail; // 임시 저장 변수 CString strPos; CString strHead, strItem; int i, j; strSaveFail = st_path_info.strFileMotor + st_basic_info.strDeviceName; for(i=0; i<MAXMOTOR; i++) { strHead.Format(_T("Motor%d"),i+1); for(j=0; j<M_MAX_POS; j++) { strItem.Format(_T("%02d_Axis_[%02d]"), i+1, j+1); strTemp.Format(_T("%.3f"), st_motor_info[i].d_pos[j]); :: WritePrivateProfileString(strHead, strItem, LPCTSTR(strTemp), strSaveFail); } } } void CMyBasicData::OnModuleRobot_Teach_Data_Load() { CString strTemp, strMsg, strSaveFail; // 임시 저장 변수 CString strPos; CString strHead, strItem; int i, j; char chData[100]; strSaveFail = st_path_info.strFileMotor + st_basic_info.strDeviceName; for(i=0; i<MAXMOTOR; i++) { strHead.Format(_T("Motor%d"),i+1); for(j=0; j<M_MAX_POS; j++) { strItem.Format(_T("%02d_Axis_[%02d]"), i+1, j+1); :: GetPrivateProfileString(strHead, strItem, _T("0.0"), (LPWSTR)chData, 10, strSaveFail); strTemp.Format(_T("%s"), chData); st_motor_info[i].d_pos[j] = _wtof(strTemp);; } } } void CMyBasicData::OnModuleRobot_Teach_Data_Load(CString strDeviceName) { CString strTemp, strMsg, strSaveFail; // 임시 저장 변수 CString strPos; CString strHead, strItem; int i, j; char chData[100]; strSaveFail = st_path_info.strFileMotor + strDeviceName; for(i=0; i<MAXMOTOR; i++) { strHead.Format(_T("Motor%d"),i+1); for(j=0; j<M_MAX_POS; j++) { strItem.Format(_T("%02d_Axis_[%02d]"), i+1, j+1); :: GetPrivateProfileString(strHead, strItem, _T("0.0"), (LPWSTR)chData, 10, strSaveFail); strTemp.Format(_T("%s"), chData); st_motor_info[i].d_pos[j] = _wtof(strTemp);; } } } void CMyBasicData::OnBasic_Data_Load(int nMode) { CString str_load_device; // 로딩 디바이스명 저장 변수 CString str_load_pgm; // 로딩 디바이스명 저장 변수 CString str_load_file; CString str_chk_ext; // 파일 확장자 저장 변수 CString str_temp, stemp; // 저장할 정보 임시 저장 변수 CString strTemp; CString str_pos; TCHAR chr_data[50], chr_buf[20]; TCHAR chData[50]; int mn_chk, i, j; double md_chk; memset(&chr_data, 0, sizeof(chr_data)); memset(&chr_buf, 0, sizeof(chr_buf)); // 최종 파일명 가져오기 if(st_basic_info.strDeviceName == "") { GetPrivateProfileString(_T("FILE_NAME"), _T("Device_Type"), _T("DEFAULT.TXT"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); st_basic_info.strDeviceName = (LPCTSTR)chr_data; } // 읽을 경로 str_load_file = st_path_info.strBasic + st_basic_info.strDeviceName; // 티칭 데이터 저장 파일 설정 st_basic_info.nCtrlMode = EQP_OFF_LINE; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("strEqp"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); st_basic_info.strEqp = (LPCTSTR)chr_data; if (nMode == 0) { GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeInterface"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeInterface = 1; } else st_basic_info.nModeInterface = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeXgem"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeXgem = 1; } else st_basic_info.nModeXgem = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeXgemInterface"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeXgemInterface = 1; } else st_basic_info.nModeXgemInterface = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeDevice"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeDevice = 1; } else st_basic_info.nModeDevice = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeWork"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeWork = 1; } else st_basic_info.nModeWork = mn_chk; } GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nRetry"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nRetry = 1; } else st_basic_info.nRetry = mn_chk; :: GetPrivateProfileString(_T("BASIC_SCREEN"), _T("strDevice"), _T(""), (LPWSTR)chr_data, 30, st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); st_basic_info.strDevice = str_temp; if (nMode == 0) { GetPrivateProfileString(_T("ALARM"), _T("COUNT"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_alarm_info.nAlarmNum = 0; } else st_alarm_info.nAlarmNum = mn_chk; GetPrivateProfileString(_T("TIME"), _T("RUN_TIME"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_handler_info.tRun = 0; } st_handler_info.tRun = mn_chk; GetPrivateProfileString(_T("TIME"), _T("STOP_TIME"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_handler_info.tStop = 0; } st_handler_info.tStop = mn_chk; GetPrivateProfileString(_T("TIME"), _T("JAM_TIME"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_handler_info.tJam = 0; } st_handler_info.tJam = mn_chk; } int nYear, nMonth, nDay, nHour, nMinute, nSecond; if (nMode == 0) { GetPrivateProfileString(_T("TIME"), _T("CREATE_YEAR"), _T("2014"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nYear = 2014; } else nYear = mn_chk; GetPrivateProfileString(_T("TIME"), _T("CREATE_MONTH"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nMonth = 1; } else nMonth = mn_chk; GetPrivateProfileString(_T("TIME"), _T("CREATE_DAY"), _T("1"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nDay = 1; } else nDay = mn_chk; GetPrivateProfileString(_T("TIME"), _T("CREATE_HOUR"), _T("22"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nHour = 22; } else nHour = mn_chk; GetPrivateProfileString(_T("TIME"), _T("CREATE_MINUTE"), _T("0"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nMinute = 0; } else nMinute = mn_chk; GetPrivateProfileString(_T("TIME"), _T("CREATE_SECOND"), _T("0"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { nSecond = 0; } else nSecond = mn_chk; } GetPrivateProfileString(_T("BASIC_SCREEN"), _T("strPathFtpGms"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); st_path_info.strPathFtpGms.Format(_T("%s"), chr_data); /* if (nMode == 0) { :: GetPrivateProfileString(_T("LOT_INFO"), _T("LOT_CURR_STATUS"), _T(""), (LPWSTR)chData, 30, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); st_lot_info[LOT_CURR].nLotStatus = _wtoi(strTemp); :: GetPrivateProfileString(_T("LOT_INFO"), _T("LOT_NEXT_STATUS"), _T(""), (LPWSTR)chData, 30, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); st_lot_info[LOT_NEXT].nLotStatus = _wtoi(strTemp); } */ if (nMode == 0) { for (i=0; i<HSSI_MAX_IO; i++) { strTemp.Format(_T("OUT_STATUS_%06d"), i); GetPrivateProfileString(_T("IO_DATA"), strTemp, _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { FAS_IO.n_out[i] = 0; } else FAS_IO.n_out[i] = mn_chk; } } :: GetPrivateProfileString(_T("BASIC"), _T("nUph"), _T(""), (LPWSTR)chData, 30, st_path_info.strFileBasic); strTemp.Format(_T("%s"), chData); st_count_info.nUph = _wtoi(strTemp); if (st_count_info.nUph < 0) st_count_info.nUph = 0; //str_load_file] if (nMode == 0) { for (i=0; i<2; i++) { for (j=0; j<2; j++) { strTemp.Format(_T("COUNT_IN_%02d_%02d"), i+1, j+1); GetPrivateProfileString(_T("BASIC_SCREEN"), strTemp, _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nInCount[i][j] = 0; } else st_count_info.nInCount[i][j] = mn_chk; strTemp.Format(_T("COUNT_PRIME_%02d_%02d"), i+1, j+1); GetPrivateProfileString(_T("BASIC_SCREEN"), strTemp, _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nPrimeCount[i][j] = 0; } else st_count_info.nPrimeCount[i][j] = mn_chk; strTemp.Format(_T("COUNT_PASS_%02d_%02d"), i+1, j+1); GetPrivateProfileString(_T("BASIC_SCREEN"), strTemp, _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nPassCount[i][j] = 0; } else st_count_info.nPassCount[i][j] = mn_chk; strTemp.Format(_T("COUNT_REJECT_%02d_%02d"), i+1, j+1); GetPrivateProfileString(_T("BASIC_SCREEN"), strTemp, _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nRejectCount[i][j] = 0; } else st_count_info.nRejectCount[i][j] = mn_chk; } } } if (nMode == 0) { // jtkim 20150709 GetPrivateProfileString(_T("BASIC_SCREEN"), _T("UPH_COUNT"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nUph = 0; } else st_count_info.nUph = mn_chk; // jtkim 20150709 GetPrivateProfileString(_T("BASIC_SCREEN"), _T("DAILY_UPH_COUNT"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nDailyUph = 0; } else st_count_info.nDailyUph = mn_chk; // jtkim 20150709 GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nUphCnt"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_count_info.nUphCnt = 0; } else st_count_info.nUphCnt = mn_chk; // jtkim 20150709 GetPrivateProfileString(_T("BASIC_SCREEN"), _T("dHourPer"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_count_info.dHourPer = 0.0f; } else st_count_info.dHourPer = md_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("dDailyPer"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_count_info.dDailyPer = 0.0f; } else st_count_info.dDailyPer = md_chk; } //kwlee 2017.0523 GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeCapRemoveUse"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeCapRemoveUse = 0; } else st_basic_info.nModeCapRemoveUse = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeSorterPickerUse"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeSorterPickerUse = 0; } else st_basic_info.nModeSorterPickerUse = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeModuleDirCheck"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeModuleDirCheck = 0; } else st_basic_info.nModeModuleDirCheck = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nModeHeatSinkDirCheck"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nModeHeatSinkDirCheck = 0; } else st_basic_info.nModeHeatSinkDirCheck = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nPrinterVisionPapper"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nPrinterVisionPapper = 0; } else st_basic_info.nPrinterVisionPapper = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nPrintBinPapper"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nPrintBinPapper = 0; } else st_basic_info.nPrintBinPapper = mn_chk; GetPrivateProfileString(_T("BASIC_SCREEN"), _T("nLabelErrCnt"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nLabelErrCnt = 0; } else st_basic_info.nLabelErrCnt = mn_chk; //kwlee 2017.0611 for (int i = 0; i<4; i++) { str_temp.Format(_T("nShift_Robot_%d_Skip"),i+1); GetPrivateProfileString(_T("BASIC_SCREEN"),str_temp , _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); mn_chk = _wtoi(str_temp); if (mn_chk < 0) { st_basic_info.nShift_Robot_Skip[i] = 0; } else st_basic_info.nShift_Robot_Skip[i] = mn_chk; } } void CMyBasicData::OnBasic_Data_Load(CString strDeviceName) { CString str_load_device; // 로딩 디바이스명 저장 변수 CString str_load_pgm; // 로딩 디바이스명 저장 변수 CString str_load_file; CString str_chk_ext; // 파일 확장자 저장 변수 CString str_temp, stemp; // 저장할 정보 임시 저장 변수 CString str_pos; TCHAR chr_data[50], chr_buf[20]; // int mn_chk; memset(&chr_data, 0, sizeof(chr_data)); memset(&chr_buf, 0, sizeof(chr_buf)); // 읽을 경로 str_load_file = st_path_info.strBasic + strDeviceName; // 티칭 데이터 저장 파일 설정 } void CMyBasicData::OnBasic_Data_Save() { CString mstr_temp; // 저장할 정보 임시 저장 변수 CString str_save_file; CString str_part, str_chk_ext; CString str_pos, str_tmp; COleDateTime time_cur; int i, j; /* ************************************************************************** */ /* 데이터 저장할 파일 설정한다 [파일 확장자 검사] */ /* ************************************************************************** */ :: WritePrivateProfileString(_T("FILE_NAME"), _T("Device_Type"), LPCTSTR(st_basic_info.strDeviceName), st_path_info.strFileBasic); str_save_file = st_path_info.strBasic + st_basic_info.strDeviceName; // 티칭 데이터 저장 파일 설정 :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("strEqp"), LPCTSTR(st_basic_info.strEqp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeInterface); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeInterface"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeXgem); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeXgem"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeXgemInterface); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeXgemInterface"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nCtrlMode); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nCtrlMode"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeDevice); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeDevice"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeWork); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeWork"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("ModelName"), LPCTSTR(st_basic_info.strModelName), str_save_file); mstr_temp.Format(_T("%d"), st_basic_info.nRetry); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nRetry"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("strDevice"), LPCTSTR(st_basic_info.strDevice), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_alarm_info.nAlarmNum); :: WritePrivateProfileString(_T("ALARM"), _T("COUNT"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_handler_info.tRun); :: WritePrivateProfileString(_T("TIME"), _T("RUN_TIME"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_handler_info.tStop); :: WritePrivateProfileString(_T("TIME"), _T("STOP_TIME"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_handler_info.tJam); :: WritePrivateProfileString(_T("TIME"), _T("JAM_TIME"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("strPathFtpGms"), st_path_info.strPathFtpGms, st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_lot_info[LOT_CURR].nLotStatus); :: WritePrivateProfileString(_T("LOT_INFO"), _T("LOT_CURR_STATUS"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_lot_info[LOT_NEXT].nLotStatus); :: WritePrivateProfileString(_T("LOT_INFO"), _T("LOT_NEXT_STATUS"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); for (i=0; i<HSSI_MAX_IO; i++) { str_tmp.Format(_T("OUT_STATUS_%06d"), i); mstr_temp.Format(_T("%d"), FAS_IO.n_out[i]); :: WritePrivateProfileString(_T("IO_DATA"), str_tmp, LPCTSTR(mstr_temp), st_path_info.strFileBasic); } mstr_temp.Format(_T("%d"), st_count_info.nUph); :: WritePrivateProfileString(_T("BASIC"), _T("nUph"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); for (i=0; i<2; i++) { for (j=0; j<2; j++) { mstr_temp.Format(_T("COUNT_IN_%02d_%02d"), i+1, j+1); str_tmp.Format(_T("%d"), st_count_info.nInCount[i][j]); :: WritePrivateProfileString(_T("BASIC_SCREEN"), mstr_temp, str_tmp, st_path_info.strFileBasic); mstr_temp.Format(_T("COUNT_PRIME_%02d_%02d"), i+1, j+1); str_tmp.Format(_T("%d"), st_count_info.nPrimeCount[i][j]); :: WritePrivateProfileString(_T("BASIC_SCREEN"), mstr_temp, str_tmp, st_path_info.strFileBasic); mstr_temp.Format(_T("COUNT_PASS_%02d_%02d"), i+1, j+1); str_tmp.Format(_T("%d"), st_count_info.nPassCount[i][j]); :: WritePrivateProfileString(_T("BASIC_SCREEN"), mstr_temp, str_tmp, st_path_info.strFileBasic); mstr_temp.Format(_T("COUNT_REJECT_%02d_%02d"), i+1, j+1); str_tmp.Format(_T("%d"), st_count_info.nRejectCount[i][j]); :: WritePrivateProfileString(_T("BASIC_SCREEN"), mstr_temp, str_tmp, st_path_info.strFileBasic); } } // jtkim 20150709 str_tmp.Format(_T("%d"), st_count_info.nUph); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("UPH_COUNT"), str_tmp, st_path_info.strFileBasic); // jtkim 20150709 str_tmp.Format(_T("%d"), st_count_info.nDailyUph); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("DAILY_UPH_COUNT"), str_tmp, st_path_info.strFileBasic); // jtkim 20150709 str_tmp.Format(_T("%d"), st_count_info.nUphCnt); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nUphCnt"), str_tmp, st_path_info.strFileBasic); // jtkim 20150709 str_tmp.Format(_T("%.2f"), st_count_info.dHourPer); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("dHourPer"), str_tmp, st_path_info.strFileBasic); str_tmp.Format(_T("%.2f"), st_count_info.dDailyPer); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("dDailyPer"), str_tmp, st_path_info.strFileBasic); //kwlee 2017.0523 mstr_temp.Format(_T("%d"), st_basic_info.nModeCapRemoveUse); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeCapRemoveUse"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeSorterPickerUse); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeSorterPickerUse"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeModuleDirCheck); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeModuleDirCheck"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nModeHeatSinkDirCheck); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nModeHeatSinkDirCheck"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nPrinterVisionPapper); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nPrinterVisionPapper"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nPrintBinPapper); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nPrintBinPapper"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); mstr_temp.Format(_T("%d"), st_basic_info.nLabelErrCnt); :: WritePrivateProfileString(_T("BASIC_SCREEN"), _T("nLabelErrCnt"), LPCTSTR(mstr_temp), st_path_info.strFileBasic); //kwlee 2017.0611 for (int i = 0; i<4; i++) { str_tmp.Format(_T("nShift_Robot_%d_Skip"),i+1); mstr_temp.Format(_T("%d"), st_basic_info.nShift_Robot_Skip[i]); :: WritePrivateProfileString(_T("BASIC_SCREEN"), str_tmp, LPCTSTR(mstr_temp), st_path_info.strFileBasic); } } CString CMyBasicData::OnGet_File_Name() { CString strTemp; // 임시 저장 변수 CString strSaveFile; // 저장 파일 임시 설정 변수 CString strChkExt; // 파일 확장자 저장 변수 CString strPart, strPart2; CString strNewSaveFile; int nPos; // ************************************************************************** // Socket Contact Count 데이터 저장할 파일 설정한다 [파일 확장자 검사] // ************************************************************************** strSaveFile = st_path_info.strPathDvc + st_basic_info.strDeviceName; // 티칭 데이터 저장 파일 설정 nPos = strSaveFile.Find(_T(".")); // 확장자 위치 검사 if (nPos == -1) { strSaveFile += _T(".DAT"); // 확장자 추가 } else { strChkExt = strSaveFile.Mid(nPos); // 파일 확장자 설정 if (strChkExt != _T(".TXT")) { strSaveFile = st_path_info.strPathDvc + _T("DEFAULT.TXT"); // 티칭 데이터 저장 새로운 파일 설정 /* if (st_handler.cwnd_list != NULL) // 리스트 바 화면 존재 { st_other.str_abnormal_msg = _T("[DEVICE FILE] The error happened at a file extension."); sprintf(st_other.c_abnormal_msg, st_other.str_abnormal_msg); st_handler.cwnd_list->PostMessage(WM_LIST_DATA, 0, ABNORMAL_MSG); // 오류 출력 요청 }*/ } } // ************************************************************************** return strSaveFile; // 파일명 리턴 } void CMyBasicData::OnDeviec_Folder_Load() { } void CMyBasicData::OnDevice_Folder_Save() { } void CMyBasicData::OnInterface_Data_Load() { int i; CString str_temp, str_name; char ch_data[100]; // char ch_tmp; for(i=0; i<10; i++) { str_name.Format(_T("%02d_CLIENT_IP"), i); :: GetPrivateProfileString(_T("INTERFACE_SCREEN"), str_name, _T(""), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); // sprintf(ch_data,"%S", ch_data); // clsFunc.OnCharToString(ch_data, 100); str_temp.Format(_T("%s"), ch_data); st_client_info[i].strIp = str_temp; str_name.Format(_T("%02d_CLIENT_PORT"), i); :: GetPrivateProfileString(_T("INTERFACE_SCREEN"), str_name, _T(""), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_client_info[i].nPort = _wtoi(str_temp); str_name.Format(_T("%02d_SERVER_PORT"), i); :: GetPrivateProfileString(_T("INTERFACE_SCREEN"), str_name, _T(""), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_server_info[i].nPort = _wtoi(str_temp); str_name.Format(_T("PORT_%02d"), i+1); :: GetPrivateProfileString(_T("SERIAL"), str_name, _T("1"), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_serial_info.nSerialPort[i] = _wtoi(str_temp); if(st_serial_info.nSerialPort[i] < 1) st_serial_info.nSerialPort[i] = 1; str_name.Format(_T("BAUDRATE_%02d"), i+1); :: GetPrivateProfileString(_T("SERIAL"), str_name, _T("9600"), (LPWSTR)&ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_serial_info.nSerialBaudrate[i] = _wtoi(str_temp); str_name.Format(_T("DATA_%02d"), i+1); :: GetPrivateProfileString(_T("SERIAL"), str_name, _T("8"), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_serial_info.nSerialData[i] = _wtoi(str_temp); str_name.Format(_T("STOP_%02d"), i+1); :: GetPrivateProfileString(_T("SERIAL"), str_name, _T("1"), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_serial_info.nSerialStop[i] = _wtoi(str_temp); str_name.Format(_T("PARITY_%02d"), i+1); :: GetPrivateProfileString(_T("SERIAL"), str_name, _T("0"), (LPWSTR)ch_data, 100, st_path_info.strFileBasic); str_temp.Format(_T("%s"), ch_data); st_serial_info.nSerialParity[i] = _wtoi(str_temp); } } void CMyBasicData::OnInterface_Data_Save() { int i; CString str_tmp, str_name; for(i=0; i<10; i++) { str_name.Format(_T("%02d_CLIENT_IP"), i); str_tmp.Format(_T("%s"), st_client_info[i].strIp); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("%02d_CLIENT_PORT"), i); str_tmp.Format(_T("%d"), st_client_info[i].nPort); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("%02d_SERVER_PORT"), i); str_tmp.Format(_T("%d"), st_server_info[i].nPort); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("PORT_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialPort[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("BAUDRATE_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialBaudrate[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("DATA_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialData[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("STOP_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialStop[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("PARITY_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialParity[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); } } void CMyBasicData::OnInterface_Data_Save_As(CString strDeviceName) { int i; CString str_tmp, str_name; for(i=0; i<10; i++) { str_name.Format(_T("%02d_CLIENT_IP"), i); str_tmp.Format(_T("%s"), st_client_info[i].strIp); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("%02d_CLIENT_PORT"), i); str_tmp.Format(_T("%d"), st_client_info[i].nPort); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("%02d_SERVER_PORT"), i); str_tmp.Format(_T("%d"), st_server_info[i].nPort); :: WritePrivateProfileString(_T("INTERFACE_SCREEN"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("PORT_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialPort[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("BAUDRATE_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialBaudrate[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("DATA_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialData[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("STOP_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialStop[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); str_name.Format(_T("PARITY_%02d"), i+1); str_tmp.Format(_T("%d"), st_serial_info.nSerialParity[i]); :: WritePrivateProfileString(_T("SERIAL"), str_name, LPCTSTR(str_tmp), st_path_info.strFileBasic); } } void CMyBasicData::OnBasic_Data_Save_As(CString strDeviceName) { CString mstr_temp; // 저장할 정보 임시 저장 변수 CString str_save_file; CString str_part, str_chk_ext; CString str_pos; COleDateTime time_cur; /* ************************************************************************** */ /* 데이터 저장할 파일 설정한다 [파일 확장자 검사] */ /* ************************************************************************** */ :: WritePrivateProfileString(_T("FILE_NAME"), _T("Device_Type"), LPCWSTR(strDeviceName), st_path_info.strFileBasic); //str_save_file = st_path_info.strBasic + strDeviceName; // 티칭 데이터 저장 파일 설정 //kwlee 2017.0511 str_save_file = st_path_info.strPath_Model + strDeviceName; // 티칭 데이터 저장 파일 설정 mstr_temp.Format(_T("%d"), st_basic_info.nModeDevice); :: WritePrivateProfileString(_T("BASIC"), _T("DEVICE_MODE"), LPCWSTR(strDeviceName), str_save_file); } void CMyBasicData::OnMaintenance_Data_Save_As(CString strDevice) { CString strTemp, strPart; // 로딩 정보 임시 저장 변수 // char chBuf[20] ; CString strSaveFile;; // ************************************************************************** // 타워 램프 RED 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** // str_save_file = st_path.str_basic + str_device; // 티칭 데이터 저장 파일 설정 strSaveFile = st_path_info.strBasic + _T("Maintenance.TXT"); strTemp.Format(_T("%d"), st_lamp_info.nLampR[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampR[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Red"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 YELLOW 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampY[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampY[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Yellow"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 GREEN 상태 정보를 파일에 저장한다 // -> STOP = 0, // RUN = 1, // ALARM = 2, // LOTEND = 3, // INIT = 4, // WARRING = 5, // LOCK = 6, // SELFCHECK = 7 // -> 로딩 값 [0:OFF 1:ON 2:FLICKER] // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampG[0]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Stop_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[1]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Run_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[2]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Alarm_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[3]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("LotEnd_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[4]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Initial_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[5]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Warring_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[6]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Lock_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[7]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("SelfCheck_State"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"),st_lamp_info.nLampG[8]) ; :: WritePrivateProfileString(_T("TowerLampData_Green"), _T("Idle_State"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 부저 사용 모드 로딩하여 전역 변수에 설정 // -> 0:사용 1:미사용 // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nBuzzerMode) ; :: WritePrivateProfileString(_T("TowerLampData"), _T("n_buzzer_mode"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** // ************************************************************************** // 장비 호기 및 장비 코드 로딩하여 전역 변수에 설정 // -> 로딩 정보에서 앞/뒤 공백은 제거한다 // ************************************************************************** :: WritePrivateProfileString(_T("TowerLampData"), _T("str_equip_no"), LPCTSTR(st_lamp_info.strEquipNo), strSaveFile); :: WritePrivateProfileString(_T("TowerLampData"), _T("str_equip_code"), LPCTSTR(st_lamp_info.strEquipCode), strSaveFile); // ************************************************************************** // ************************************************************************** // 타워 램프 ON/OFF 대기 시간 로딩하여 전역 변수에 설정 // ************************************************************************** strTemp.Format(_T("%d"),st_lamp_info.nLampWaitTime); :: WritePrivateProfileString(_T("TowerLampData"), _T("n_lamp_on_time_w"), LPCTSTR(strTemp), strSaveFile); // ************************************************************************** } void CMyBasicData::OnModuleRobot_Teach_Data_Save_As(CString strDeviceName) { CString strTemp, strMsg, strSaveFail; // 임시 저장 변수 CString strPos; CString strHead, strItem; int i, j; strSaveFail = st_path_info.strFileMotor + strDeviceName; for(i=0; i<MAXMOTOR; i++) { strHead.Format(_T("Motor%d"),i+1); for(j=0; j<M_MAX_POS; j++) { strItem.Format(_T("%02d_Axis_[%02d]"), i+1, j+1); strTemp.Format(_T("%.3f"), st_motor_info[i].d_pos[j]); :: WritePrivateProfileString(strHead, strItem, LPCTSTR(strTemp), strSaveFail); } } } CString CMyBasicData::GetWaitTimeName(int n_mode) { CString strName; strName = ""; switch(n_mode) { case 0: strName = "0"; break; case 1: strName = "1"; break; case 2: strName = "2"; break; case 3: strName = "3"; break; case 4: strName = "4"; break; case 5: strName = "5"; break; case 6: strName = "6"; break; case 7: strName = "7"; break; case 8: strName = "8"; break; case 9: strName = "9"; break; case 10: strName = "10"; break; case 11: strName = "11"; break; case 12: strName = "12"; break; case 13: strName = "13"; break; case 14: strName = "14"; break; case 15: strName = "15"; break; case 16: strName = "16"; break; case 17: strName = "17"; break; case 18: strName = "18"; break; case 19: strName = "19"; break; } return strName; } void CMyBasicData::OnRecipe_Data_Load() { CString strTemp,str_temp; // 로딩 정보 임시 저장 변수 CString strHead; CString strLoadFile; double md_chk; char chData[200]; TCHAR chr_data[50]; int mn_chk =0; // 읽을 경로 strLoadFile = st_path_info.strBasic + st_basic_info.strDeviceName; //kwlee 2017.0523 :: GetPrivateProfileString(_T("RECIPE"), _T("nTrayY"), _T(""), (LPWSTR)chData, 30, strLoadFile); strTemp.Format(_T("%s"), chData); st_recipe_info.nTrayY = _wtoi(strTemp); :: GetPrivateProfileString(_T("RECIPE"), _T("nTrayX"), _T(""), (LPWSTR)chData, 30, strLoadFile); strTemp.Format(_T("%s"), chData); st_recipe_info.nTrayX = _wtoi(strTemp); GetPrivateProfileString(_T("RECIPE"), _T("dPickGapModuleLoad"), _T(""), chr_data, sizeof(chr_data), strLoadFile); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapModuleLoad = 0.0f; } else st_recipe_info.dPickGapModuleLoad = md_chk; GetPrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkLeft"), _T(""), chr_data, sizeof(chr_data), strLoadFile); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapHeatSinkLeft = 0.0f; } else st_recipe_info.dPickGapHeatSinkLeft = md_chk; GetPrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkRight"), _T(""), chr_data, sizeof(chr_data), strLoadFile); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapHeatSinkRight = 0.0f; } else st_recipe_info.dPickGapHeatSinkRight = md_chk; } void CMyBasicData::OnRecipe_Data_Load(CString strDeviceName) { CString strTemp,str_temp; // 로딩 정보 임시 저장 변수 CString strHead; CString strLoadFile; double md_chk; char chData[200]; TCHAR chr_data[50]; int mn_chk; // 읽을 경로 strLoadFile = st_path_info.strBasic + strDeviceName; //kwlee 2017.0523 :: GetPrivateProfileString(_T("RECIPE"), _T("nTrayY"), _T(""), (LPWSTR)chData, 30, strLoadFile); strTemp.Format(_T("%s"), chData); st_recipe_info.nTrayY = _wtoi(strTemp); :: GetPrivateProfileString(_T("RECIPE"), _T("nTrayX"), _T(""), (LPWSTR)chData, 30, strLoadFile); strTemp.Format(_T("%s"), chData); st_recipe_info.nTrayX = _wtoi(strTemp); GetPrivateProfileString(_T("RECIPE"), _T("dPickGapModuleLoad"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapModuleLoad = 0.0f; } else st_recipe_info.dPickGapModuleLoad = md_chk; GetPrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkLeft"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapHeatSinkLeft = 0.0f; } else st_recipe_info.dPickGapHeatSinkLeft = md_chk; GetPrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkRight"), _T(""), chr_data, sizeof(chr_data), st_path_info.strFileBasic); str_temp.Format(_T("%s"), chr_data); md_chk = _wtof(str_temp); if (mn_chk < 0) { st_recipe_info.dPickGapHeatSinkRight = 0.0f; } else st_recipe_info.dPickGapHeatSinkRight = md_chk; } void CMyBasicData::OnRecipe_Data_Save() { CString strTemp; // 저장할 정보 임시 저장 변수 CString strSaveFile; CString strPart, strChkExt; CString strPos; CString strHead; COleDateTime time_cur; strSaveFile = st_path_info.strBasic + st_basic_info.strDeviceName; // 티칭 데이터 저장 파일 설정 //kwlee 2017.0523 strTemp.Format(_T("%d"), st_recipe_info.nTrayY); :: WritePrivateProfileString(_T("RECIPE"), _T("nTrayY"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"), st_recipe_info.nTrayX); :: WritePrivateProfileString(_T("RECIPE"), _T("nTrayX"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapModuleLoad); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapModuleLoad"), strTemp, strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapHeatSinkLeft); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkLeft"), strTemp, strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapHeatSinkRight); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkRight"), strTemp, strSaveFile); } void CMyBasicData::OnRecipe_Data_Save_As(CString strDeviceName) { CString strTemp; // 저장할 정보 임시 저장 변수 CString strSaveFile; CString strPart, strChkExt; CString strPos; CString strHead; COleDateTime time_cur; strSaveFile = st_path_info.strBasic + strDeviceName; // 티칭 데이터 저장 파일 설정 //kwlee 2017.0523 strTemp.Format(_T("%d"), st_recipe_info.nTrayY); :: WritePrivateProfileString(_T("RECIPE"), _T("nTrayY"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%d"), st_recipe_info.nTrayX); :: WritePrivateProfileString(_T("RECIPE"), _T("nTrayX"), LPCTSTR(strTemp), strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapModuleLoad); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapModuleLoad"), strTemp, strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapHeatSinkLeft); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkLeft"), strTemp, strSaveFile); strTemp.Format(_T("%.2f"), st_recipe_info.dPickGapHeatSinkRight); :: WritePrivateProfileString(_T("RECIPE"), _T("dPickGapHeatSinkRight"), strTemp, strSaveFile); } void CMyBasicData::OnRecoveryDataLoad() { } void CMyBasicData::OnRecoveryDataSave() { } void CMyBasicData::OnAnimateDataLoad() { CString str_load_device; // 로딩 디바이스명 저장 변수 CString str_load_file; CString str_temp, stemp; // 저장할 정보 임시 저장 변수 CString str_pos; TCHAR chr_data[50], chr_buf[20]; memset(&chr_data, 0, sizeof(chr_data)); memset(&chr_buf, 0, sizeof(chr_buf)); // 최종 파일명 가져오기 if(st_basic_info.strDeviceName == "") { GetPrivateProfileString(_T("FILE_NAME"), _T("Device_Type"), _T("DEFAULT.TXT"), chr_data, sizeof(chr_data), st_path_info.strFileBasic); st_basic_info.strDeviceName = (LPCTSTR)chr_data; } // 읽을 경로 str_load_file = st_path_info.strBasic + st_basic_info.strDeviceName; // 티칭 데이터 저장 파일 설정 } void CMyBasicData::OnAnimateDataSave() { }
[ "getouthere5@gmail.com" ]
getouthere5@gmail.com
18f0d704d191711cc09a317ad1c939c9febe4d27
b22c189f38b8da715e70b76be3d9c0f3bb921f63
/DATA STRUCTURES AND ALGORITHMS/Tress/sum_of_nodes.cpp
8a932c1c4452f1004d90bf83433a335446458bcd
[]
no_license
Bikubisw/Coding
108f1048bc54bbd526f2f3abea21bd17bb8e7975
274c50caab15f10663a83ad352fc5ddb04b9e236
refs/heads/master
2023-04-20T11:09:32.555814
2021-05-22T20:29:45
2021-05-22T20:29:45
280,332,695
0
0
null
null
null
null
UTF-8
C++
false
false
1,295
cpp
#include <iostream> using namespace std; #include <vector> template <typename T> class TreeNode { public: T data; vector<TreeNode<T>*> children; TreeNode(T data) { this->data = data; } ~TreeNode() { for (int i = 0; i < children.size(); i++) { delete children[i]; } } }; #include <queue> TreeNode<int>* takeInputLevelWise() { int rootData; cin >> rootData; TreeNode<int>* root = new TreeNode<int>(rootData); queue<TreeNode<int>*> pendingNodes; pendingNodes.push(root); while (pendingNodes.size() != 0) { TreeNode<int>* front = pendingNodes.front(); pendingNodes.pop(); int numChild; cin >> numChild; for (int i = 0; i < numChild; i++) { int childData; cin >> childData; TreeNode<int>* child = new TreeNode<int>(childData); front->children.push_back(child); pendingNodes.push(child); } } return root; } int sumOfNodes(TreeNode<int>* root) { int sum=root->data; for(int i=0;i<root->children.size();i++){ sum+=sumOfNodes(root->children[i]); } return sum; } int main() { TreeNode<int>* root = takeInputLevelWise(); cout << sumOfNodes(root) << endl; }
[ "bikrambiswas043@gmail.com" ]
bikrambiswas043@gmail.com
cb929c61dc48cbf33d8967eb41b26cddc784379b
c3fd8474622099effa06ea96489b534db58ca70b
/Results/Synonym.h
a9257715c3447324bcbb0f31150844c6ee9e43ec
[]
no_license
hominhtri1/Search-Engine
4ca71cc3f4fb1e885c58d7077bed82432fe6c003
e5dc57c9a36cf0f013b89ed70caaac0dd6ab1424
refs/heads/master
2022-06-26T04:16:56.705479
2020-04-17T09:10:09
2020-04-17T09:10:09
256,452,798
0
0
null
null
null
null
UTF-8
C++
false
false
866
h
#ifndef _SYNONYM_H_ #define _SYNONYM_H_ #include "Header.h" #include "BTree.h" class SynonymsArray { public: //synonynm count int wordCount; //Array of those files vector<fixedStr> synonymsArray; }; void writeStrSyn(BNodeStr* cur, fstream& BTree); void splitStrSyn(BNodeStr* cur, int ind, BNodeStr* indCur, int& curInd, fstream& BTree, int tellg); void insertNonFullStrSyn(BNodeStr* cur, fixedStr k, int& curInd, fstream& BTree, int tellg); void insertStrSyn(int& rootInd, fixedStr k, int& curInd, fstream& BTree, int tellg); void prepareBTreeSynonym(); bool isDelimiterSyn(string text, int curPos); //Return a vector! SynonymsArray* getSynonyms(fixedStr k); //Test printing out the results void testSynonym(fixedStr k); void existInNewsFileBTreeSyn(fixedStr k, bool* exist); int* wordPositionsSyn(int newsFile, fixedStr k, int& curCount); #endif
[ "hominhtri0599@gmail.com" ]
hominhtri0599@gmail.com
39c3025afbd8cc90737ad9fcea123fd25ebbc589
09cb957a1a5257008b2829c35c5b73e4d0e6356c
/cwiczenia klasa vec&mat/Matrix.cpp
0f6f30bf8976387cc88324ca30979a0bf873f33d
[]
no_license
pierwiastekzminusjeden/cpp_lab_3sem
e64142ee96468743a8103fd8e8afe56846d32ff9
7258bdd384d9409e03cfa5286e73606dc851d248
refs/heads/master
2021-03-27T14:21:25.595912
2018-07-11T18:41:14
2018-07-11T18:41:14
109,417,995
0
0
null
null
null
null
UTF-8
C++
false
false
318
cpp
#include <iostream> #include "Matrix.h" Matrix::Matrix(Vector row1, Vector row2, Vector row3){ _rows = 3; _cols = 3; _totalSize = _rows *_cols; } Matrix &Matrix::set(int row, int col, double value){ } Vector &Matrix::extractRow(int row) const{ } Vector &Matrix::extractColumn(int column) const{ }
[ "krystian.molenda@gmail.com" ]
krystian.molenda@gmail.com
2afed1614b0bbc69f79ee6255a75724150f52536
2d14aa082e33f3c9d2344ea6811a5b18ec906607
/cpp/src/builders/domain/value.hh
4528e2973a8a4bdcde2af162220027d60777041c
[ "MIT" ]
permissive
walter-bd/scikit-decide
4c0b54b7b2abdf396121cd256d1f931f0539d1bf
d4c5ae70cbe8b4c943eafa8439348291ed07dec1
refs/heads/master
2023-07-30T14:14:28.886267
2021-08-30T14:16:30
2021-09-03T06:46:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
709
hh
/* Copyright (c) AIRBUS and its affiliates. * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #ifndef SKDECIDE_VALUE_HH #define SKDECIDE_VALUE_HH #include "core.hh" namespace skdecide { template <typename Tvalue> class RewardDomain { public : inline virtual bool check_value(const Value<Tvalue>& value) { return true; } }; template <typename Tvalue> class PositiveCostDomain : public RewardDomain<Tvalue> { public : inline virtual bool check_value(const Value<Tvalue>& value) { return value.cost >= 0; } }; } // namespace skdecide #endif // SKDECIDE_VALUE_HH
[ "guillaume.alleon@gmail.com" ]
guillaume.alleon@gmail.com
3f22b4cafc2a4c11ba8f5085b813831685aad871
6f11fdff3b3a15eb059713057660e9e55898a993
/valid_square.cpp
0a09ff96374a0c8db7d9a270286847e180e8ce77
[]
no_license
srishti-negi/LeanIn
cc558e187e4de479ee0329406cd27754fcf11488
9a0a76bce33edd89900122ae5f6991799e9aa822
refs/heads/main
2023-01-24T13:45:51.935787
2020-11-30T18:26:55
2020-11-30T18:26:55
306,854,003
0
0
null
null
null
null
UTF-8
C++
false
false
1,125
cpp
#include <iostream> #include <vector> #include <deque> #include <unordered_map> #include <unordered_set> using namespace std; //https://leetcode.com/problems/valid-square/ class Solution { public: int sq_length (vector <int> p1, vector <int> p2) { return pow((p1[0] - p2[0]), 2) + pow((p1[1] - p2[1]), 2); } bool validSquare(vector<int>& p1, vector<int>& p2, vector<int>& p3, vector<int>& p4) { vector <int> lengths; lengths.push_back(sq_length (p1, p2)); lengths.push_back(sq_length (p2, p3)); lengths.push_back(sq_length (p3, p4)); lengths.push_back(sq_length (p4, p1)); lengths.push_back(sq_length (p1, p3)); lengths.push_back(sq_length (p2, p4)); sort (lengths.begin(), lengths.end()); int h = lengths[0], s = lengths[lengths.size() - 1]; int fh = 0, fs =0; for(int l: lengths) { if (l == h) fh++; else if (l == s) fs++; } return ( (fh == 4 && fs == 2 ) || (fh == 2 && fs == 4) ); } };
[ "srishtinegi249@gmail.com" ]
srishtinegi249@gmail.com
11be595d96f6fd448d9dd836accc759f106782fd
b95eae38aaab80073f3a1b6fe25c7e11419c5508
/practice/smartPointers.cpp
97103cc6c54afb61ba9a40db90c8e006b51703de
[]
no_license
Hannleeee/myWebServer
dbcfe41a90f24c23d74784d822c9374b4a75493a
2cc3a267280fc6577a6a9ccc2cade4141c06dcde
refs/heads/master
2023-08-21T02:58:01.694090
2021-10-28T02:48:22
2021-10-28T02:48:22
393,264,164
0
0
null
null
null
null
UTF-8
C++
false
false
1,811
cpp
#include <iostream> #include <mutex> template<typename T> class mySharedPtr { public: mySharedPtr(T* p = nullptr) : ptr(p), refCount(new size_t(1)), mtx(new std::mutex) {} ~mySharedPtr() { release(); } mySharedPtr(const mySharedPtr &other) : ptr(other.ptr), refCount(other.refCount), mtx(other.mtx) { addRefCount(); } mySharedPtr<T> &operator=(const mySharedPtr &other) { if (other.ptr != ptr) { release(); ptr = other.ptr; refCount = other.refCount; mtx = other.mtx; addRefCount(); } return *this; } T &operator*() { return *ptr; } T *operator->() { return ptr; } int useCount() { return *refCount; } void addRefCount() { mtx->lock(); ++(*refCount); mtx->unlock(); } private: void release() { bool deleteFlag = false; mtx->lock(); if (--(*refCount) == 0) { delete refCount; delete ptr; deleteFlag = true; } mtx->unlock(); if (deleteFlag) delete mtx; } T *ptr; size_t *refCount; std::mutex *mtx; }; template<typename T> class myUniquePtr { public: private: T *ptr; }; struct ListNode { int val; mySharedPtr<ListNode> prev; mySharedPtr<ListNode> next; ~ListNode() { std::cout << "Deconstructing...\n"; } }; int main() { mySharedPtr<ListNode> node1(new ListNode()); mySharedPtr<ListNode> node2(new ListNode()); std::cout << node1.useCount() << std::endl; std::cout << node2.useCount() << std::endl; node1->next = node2; node2->prev = node1; std::cout << node1.useCount() << std::endl; std::cout << node2.useCount() << std::endl; }
[ "lh18801299790@gmail.com" ]
lh18801299790@gmail.com
5f69da0763347ae6c4e6b4aa5b925ce7a3184fa4
20b9d59595115599fc9a07364c9eea71211425d8
/Networking-VS/Server VS/Handmade/Background.cpp
36b08f2d8207880338de58fdd66f426828f1806b
[]
no_license
Silvertooth98/Fight-Foo
340ca7490aef33e2254b822fbe667f8ef7d93f77
a6d3321d964c3d042e6ecd090a217c8c4b0b2189
refs/heads/master
2020-04-07T17:34:48.147512
2018-11-21T16:22:59
2018-11-21T16:22:59
158,575,172
0
0
null
null
null
null
UTF-8
C++
false
false
2,683
cpp
#include "AudioManager.h" #include "Background.h" #include "TextureManager.h" //------------------------------------------------------------------------------------------------------ //constructor that loads and links resources, and assigns all default values //------------------------------------------------------------------------------------------------------ Background::Background(std::string imageFilename, std::string audioFilename) { m_isPlaying = false; //load image and audio resources into memory TheTexture::Instance()->LoadTextureFromFile(imageFilename, imageFilename); TheAudio::Instance()-> LoadFromFile(audioFilename, AudioManager::MUSIC_AUDIO, audioFilename); //link image resource with sprite component m_image.SetTexture(imageFilename); m_image.SetSpriteDimension(1024, 768); m_image.SetTextureDimension(1, 1, 1024, 768); //link audio resource with music component m_music.SetAudio(audioFilename, Audio::MUSIC_AUDIO); m_music.SetVolume(25); //store names of resource tags so that we can remove them in the destructor m_imageName = imageFilename; m_audioName = audioFilename; } //------------------------------------------------------------------------------------------------------ //function that renders the background image on screen //------------------------------------------------------------------------------------------------------ bool Background::Draw() { m_image.Draw(); return true; } //------------------------------------------------------------------------------------------------------ //function that plays the background music //------------------------------------------------------------------------------------------------------ void Background::PlayMusic() { if (!m_isPlaying) { m_music.Play(Audio::PLAY_ENDLESS); m_isPlaying = true; } } //------------------------------------------------------------------------------------------------------ //function that stops the background music from playing //------------------------------------------------------------------------------------------------------ void Background::StopMusic() { m_music.Stop(); m_isPlaying = false; } //------------------------------------------------------------------------------------------------------ //destructor that unloads all resources from memory //------------------------------------------------------------------------------------------------------ Background::~Background() { TheAudio::Instance()-> UnloadFromMemory(AudioManager::MUSIC_AUDIO, AudioManager::CUSTOM_AUDIO, m_audioName); TheTexture::Instance()-> UnloadFromMemory(TextureManager::TEXTURE_DATA, TextureManager::CUSTOM_DATA, m_imageName); }
[ "silvertooth1998@gmail.com" ]
silvertooth1998@gmail.com
e3687d22b748bd9fd9dd3ad024266dcfeb41ee5b
1dbf007249acad6038d2aaa1751cbde7e7842c53
/gaussdbforopengauss/src/v3/model/ListRestorableInstancesResponse.cpp
9c03688d1720cf7d60d939fef1e63eccffb7eace
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
2,593
cpp
#include "huaweicloud/gaussdbforopengauss/v3/model/ListRestorableInstancesResponse.h" namespace HuaweiCloud { namespace Sdk { namespace Gaussdbforopengauss { namespace V3 { namespace Model { ListRestorableInstancesResponse::ListRestorableInstancesResponse() { instancesIsSet_ = false; totalCount_ = 0; totalCountIsSet_ = false; } ListRestorableInstancesResponse::~ListRestorableInstancesResponse() = default; void ListRestorableInstancesResponse::validate() { } web::json::value ListRestorableInstancesResponse::toJson() const { web::json::value val = web::json::value::object(); if(instancesIsSet_) { val[utility::conversions::to_string_t("instances")] = ModelBase::toJson(instances_); } if(totalCountIsSet_) { val[utility::conversions::to_string_t("total_count")] = ModelBase::toJson(totalCount_); } return val; } bool ListRestorableInstancesResponse::fromJson(const web::json::value& val) { bool ok = true; if(val.has_field(utility::conversions::to_string_t("instances"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("instances")); if(!fieldValue.is_null()) { std::vector<InstancesResult> refVal; ok &= ModelBase::fromJson(fieldValue, refVal); setInstances(refVal); } } if(val.has_field(utility::conversions::to_string_t("total_count"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("total_count")); if(!fieldValue.is_null()) { int32_t refVal; ok &= ModelBase::fromJson(fieldValue, refVal); setTotalCount(refVal); } } return ok; } std::vector<InstancesResult>& ListRestorableInstancesResponse::getInstances() { return instances_; } void ListRestorableInstancesResponse::setInstances(const std::vector<InstancesResult>& value) { instances_ = value; instancesIsSet_ = true; } bool ListRestorableInstancesResponse::instancesIsSet() const { return instancesIsSet_; } void ListRestorableInstancesResponse::unsetinstances() { instancesIsSet_ = false; } int32_t ListRestorableInstancesResponse::getTotalCount() const { return totalCount_; } void ListRestorableInstancesResponse::setTotalCount(int32_t value) { totalCount_ = value; totalCountIsSet_ = true; } bool ListRestorableInstancesResponse::totalCountIsSet() const { return totalCountIsSet_; } void ListRestorableInstancesResponse::unsettotalCount() { totalCountIsSet_ = false; } } } } } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
a46b16414075da7cae91ede301204af5003fd4b8
30f3091a91077f1670f409d88c9a16f1e6d51ec3
/API_WORMS/MainMenu.cpp
bafc0271c76c734576bf19d99a4c58614711fdc8
[]
no_license
doo9713/API-WORMS-PROJECT
6d3fce94a6f99d547d8da96dfbcd2da05950ecd0
edf2f8011d97c2e0fb923c46f92ff5e5d8a4cb05
refs/heads/master
2021-07-13T20:41:17.918874
2017-10-12T14:16:30
2017-10-12T14:16:30
104,208,347
0
0
null
null
null
null
UTF-8
C++
false
false
1,942
cpp
#include "MainMenu.h" #include "Obj.h" #include "ObjList.h" #include "TimeManager.h" #include "KeyManager.h" #include "BitmapManager.h" #include "TitleUI.h" #include "StartButton.h" #include "ExitButton.h" CMainMenu::CMainMenu() { } CMainMenu::~CMainMenu() { OBJ.Destroy(); TIME.Destroy(); KEY.Destroy(); BITMAP.Destroy(); } BOOL CMainMenu::Initialize() { FrameTime = 0; // TODO : Initialize Game /* Sound Initialize */ gSndController->Init(4); gSndController->LoadSound("MainSong", "./Resource/Sound/Main.mp3", true); gSndController->LoadSound("ButtonPress", "./Resource/Sound/ButtonPress.mp3"); gSndController->LoadSound("ButtonInto", "./Resource/Sound/ButtonInto.mp3"); gSndController->Play("MainSong"); /* BackGround */ BITMAP.LoadBackground("BG.bmp", { { 0, 0, WINSIZEX, WINSIZEY } }); /* UI */ BITMAP.Load("Title1", "title1.bmp", { { 0, 0, 730, 290 } }); BITMAP.Load("Title2", "title2.bmp", { { 0, 0, 700, 140 } }); BITMAP.Load("btStartIdle", "menu1.bmp", { { 65, 60, 385, 160 } }); BITMAP.Load("btStartInto", "menu2.bmp", { { 65, 60, 385, 160 } }); BITMAP.Load("btExitIdle", "menu1.bmp", { { 100, 200, 355, 295 } }); BITMAP.Load("btExitInto", "menu2.bmp", { { 100, 200, 355, 295 } }); OBJ.Insert(new CTitleUI("Title1", Tag_UI, Layer_UI, MathF::VECTOR(400, 110))); OBJ.Insert(new CTitleUI("Title2", Tag_UI, Layer_UI, MathF::VECTOR(430, 400))); OBJ.Insert(new CStartButton("Start", Tag_UI, Layer_UI, MathF::VECTOR(640, 550), 320, 100)); OBJ.Insert(new CExitButton("Exit", Tag_UI, Layer_UI, MathF::VECTOR(675, 650), 255, 95)); return true; } BOOL CMainMenu::Update() { gSndController->Update(); TIME.Set(); KEY.Set(); OBJ.Update(); return true; } void CMainMenu::Render() { FrameTime += TIME.RealTime(); if (FrameTime >= FRAMETIME) { FrameTime -= FRAMETIME; BITMAP.Clear(); OBJ.Render(); BITMAP.Flip(); } } void CMainMenu::Destroy() { this->~CMainMenu(); }
[ "doo9713@gmail.com" ]
doo9713@gmail.com
abd11e50c6d53252356190749209fdd70c017948
5512cddf8dee09affedbbdc2d9ca97b8cd1ebb8f
/Text Adventure Game/Text_Adventure_Game/Text_Adventure_Game/Source.cpp
f7eb6f8374e23b532e1494fa189c3571852765b4
[]
no_license
jeremybarzas/CPP-Assignments
e706c1447be676f3ccda0780a04b73f352a69948
fddb13f5ec96952bdbf587c84f61df7643be38e5
refs/heads/master
2021-05-30T17:55:53.305077
2015-12-16T19:09:38
2015-12-16T19:09:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,769
cpp
#include "Header.h" newCharacter::newCharacter() { bool roleTest; bool itemTest; cout << "Welcome adventurer! Please type your name?" << endl; cin >> charName; cout << "" << endl; system("pause"); system("cls"); do { cout << "Please enter your role exactly as the option appears." << endl; cout << "" << endl; cout << "Are you a 'mage', 'warrior', or 'thief'?" << endl; cin >> roleName; cout << "" << endl; if (!(roleName == "mage" || roleName == "warrior" || roleName == "thief")) { cout << "Your input doesn't match the listed options." << endl; roleTest = false; } else if (roleName == "mage" || roleName == "warrior" || roleName == "thief") { roleTest = true; cout << charName << " is a " << roleName << endl; cout << "" << endl; } } while (roleTest == false); system("pause"); system("cls"); do { cout << "You are a " << roleName << endl; cout << "" << endl; cout << "Please enter your item exactly as the option appears." << endl; cout << "" << endl; cout << "Do you want bring a 'staff', 'sword', or 'lockpick'?" << endl; cin >> itemName; cout << "" << endl; if (!(itemName == "staff" || itemName == "sword" || itemName == "lockpick")) { cout << "Your input doesn't match the listed options." << endl; itemTest = false; } else if (itemName == "staff" || itemName == "sword" || itemName == "lockpick") { itemTest = true; cout << charName << " the " << roleName << " has chosen a " << itemName << endl; cout << "" << endl; } } while (itemTest == false); system("pause"); system("cls"); } string newCharacter::getRole() { return roleName; } string newCharacter::getName() { return charName; } string newCharacter::getItem() { return itemName; }
[ "jbarzas@yahoo.com" ]
jbarzas@yahoo.com
06e49f54b3525f5aaca8560fb77f51b6118a4a5f
107aec2e166d16d9c824c2a9156f8ac3b2eb4ffa
/kikiGfx/GFXTextureRepository.cpp
9f21810458cbca21797b663235e74557e80b42b6
[]
no_license
realn/Pong
2181ac0a1b451e3b066691c15327380db6c825ea
4f89874a5f5873dbe653196919f222fd2672d57c
refs/heads/master
2021-01-02T08:50:21.943670
2018-08-31T04:54:32
2018-08-31T04:54:32
99,077,216
0
0
null
null
null
null
UTF-8
C++
false
false
801
cpp
#include "stdafx.h" #include "GFXTextureRepository.h" #include <CBIO/Path.h> #include <CBSDL/Surface.h> #include <CBGL/Texture.h> namespace gfx { CTextureRepository::CTextureRepository(cb::string const & assetsDir) : core::CAssetRepository<cb::gl::CTexture>(assetsDir, L"png"s) {} CTextureRepository::~CTextureRepository() {} std::shared_ptr<cb::gl::CTexture> CTextureRepository::Load(cb::string const & name) const { auto path = GetAssetPath(cb::filenamebase(name)); auto surface = cb::sdl::CSurface::Load(path); surface = surface.Convert(cb::sdl::PixelFormat::RGBA32); auto texture = std::make_shared<cb::gl::CTexture>(surface.GetSize(), cb::gl::TextureFormat::RGBA8); texture->SetData(cb::gl::InputFormat::RGBA, surface.GetPixels()); return texture; } }
[ "realnoname@coderulers.info" ]
realnoname@coderulers.info
69f001240b52ee85926ab8102165c6229520bdd1
be0282afa8dd436619c71d6118c9db455eaf1a29
/Intermediate/Build/Win64/Design3D/Inc/Sequencer/ISequencer.generated.h
81f5feeda785a10a2ea7dec0cf12467160fee6af
[]
no_license
Quant2017/Design3D
0f915580b222af40ab911021cceef5c26375d7f9
94a22386be4aa37aa0f546354cc62958820a4bf6
refs/heads/master
2022-04-23T10:44:12.398772
2020-04-22T01:02:39
2020-04-22T01:02:39
262,966,755
1
0
null
2020-05-11T07:12:37
2020-05-11T07:12:36
null
UTF-8
C++
false
false
1,519
h
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/ObjectMacros.h" #include "UObject/ScriptMacros.h" PRAGMA_DISABLE_DEPRECATION_WARNINGS #ifdef SEQUENCER_ISequencer_generated_h #error "ISequencer.generated.h already included, missing '#pragma once' in ISequencer.h" #endif #define SEQUENCER_ISequencer_generated_h #undef CURRENT_FILE_ID #define CURRENT_FILE_ID Engine_Source_Editor_Sequencer_Public_ISequencer_h #define FOREACH_ENUM_EKEYGROUPMODE(op) \ op(EKeyGroupMode::KeyChanged) \ op(EKeyGroupMode::KeyGroup) \ op(EKeyGroupMode::KeyAll) enum class EKeyGroupMode : uint8; template<> SEQUENCER_API UEnum* StaticEnum<EKeyGroupMode>(); #define FOREACH_ENUM_EALLOWEDITSMODE(op) \ op(EAllowEditsMode::AllEdits) \ op(EAllowEditsMode::AllowSequencerEditsOnly) \ op(EAllowEditsMode::AllowLevelEditsOnly) enum class EAllowEditsMode : uint8; template<> SEQUENCER_API UEnum* StaticEnum<EAllowEditsMode>(); #define FOREACH_ENUM_EAUTOCHANGEMODE(op) \ op(EAutoChangeMode::AutoKey) \ op(EAutoChangeMode::AutoTrack) \ op(EAutoChangeMode::All) \ op(EAutoChangeMode::None) enum class EAutoChangeMode : uint8; template<> SEQUENCER_API UEnum* StaticEnum<EAutoChangeMode>(); PRAGMA_ENABLE_DEPRECATION_WARNINGS
[ "Snake_Jenny@126.com" ]
Snake_Jenny@126.com
5f148f12d304707865b9ccc6ca25d702b3d7a7c1
247eb805469638c6d5cbfdfc242c51749b1157a9
/src/test/test_be_memory_indexedbuffer.cpp
375b925b8d5e2d4fb159d47dc676b337c964a550
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
gfiumara/libbiomeval
07317df339a453cca1f2b8fdd859e5c67c9028d7
6c88126fa56492c216a922beed9ee17735c4b647
refs/heads/master
2023-01-24T14:27:44.105396
2023-01-20T15:39:25
2023-01-20T15:39:25
225,938,020
0
0
NOASSERTION
2019-12-04T19:07:01
2019-12-04T19:07:00
null
UTF-8
C++
false
false
3,258
cpp
/* * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. */ #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <sstream> #include <be_error_exception.h> #include <be_memory_indexedbuffer.h> using namespace BiometricEvaluation; using namespace std; void printBuf(string name, Memory::IndexedBuffer &buf) { cout << "Buffer Contents of " << name << endl; for (uint32_t i = 0; i != buf.getSize(); i++) cout << (buf.get()[i]) << " "; cout << endl; } int doTests(Memory::IndexedBuffer &buf) { Memory::IndexedBuffer assign_copy; printBuf("ORIGINAL:", buf); cout << endl; cout << "Making a deep copy of the alphabet with COPY CONSTRUCTOR\n"; Memory::IndexedBuffer copy = buf; printBuf("COPY:", copy); cout << endl; return (0); } int main (int argc, char* argv[]) { char c; uint32_t i; cout << "Testing buffer with unmanaged memory: " << endl; cout << "-------------------------------------" << endl; uint8_t carr[26]; for (c = 'a', i = 0; i < 26; i++, c++) carr[i] = c; Memory::IndexedBuffer buf2(carr, 26); if (doTests(buf2) != 0) return (EXIT_FAILURE); cout << "-------------------------------------" << endl; Memory::uint8Array buf(8); for (i = 0; i < buf.size(); i++) buf[i] = i + 1; Memory::IndexedBuffer buf3(buf); try { cout << "Getting buffer 8-bit values: " << endl; for (i = 0; i < buf3.getSize(); i++) { printf("0x%02x; ", buf3.scanU8Val()); } cout << endl; buf3.setIndex(0); cout << "Getting buffer 16-bit values: " << endl; for (i = 0; i < buf3.getSize()/2; i++) { uint16_t val = buf3.scanU16Val(); uint8_t *p = (uint8_t*)&val; printf("0x%04x (0x%02x%02x); ", val, p[0], p[1]); } cout << endl; buf3.setIndex(0); cout << "Getting buffer 32-bit values: " << endl; for (i = 0; i < buf3.getSize()/4; i++) { uint32_t val = buf3.scanU32Val(); uint8_t *p = (uint8_t*)&val; printf("0x%08x (0x%02x%02x%02x%02x); ", val, p[0], p[1], p[2], p[3]); } cout << endl; buf3.setIndex(0); cout << "Getting buffer 64-bit values: " << endl; for (i = 0; i < buf3.getSize()/8; i++) { uint64_t val = buf3.scanU64Val(); uint8_t *p = (uint8_t*)&val; stringstream output; output << "0x" << hex << setfill('0') << setw(16) << val; output << " (0x"; for (unsigned int j = 0; j < 8; j++) output << setw(2) << hex << (uint16_t)p[j]; output << "); "; cout << output.str(); } cout << endl; } catch (const Error::DataError &e) { cerr << "Caught " << e.what() << endl; } bool success = false; cout << "Attempt to read off end of buffer: "; try { cout << buf3.scanU8Val(); } catch (const Error::DataError&) { success = true; } if (success) cout << "Success." << endl; else cout << "Failure. " << endl; return (EXIT_SUCCESS); }
[ "gregory.fiumara@nist.gov" ]
gregory.fiumara@nist.gov
44248f43c794d779c49351768bc9d40e96e137ae
43fd0131e13309030baa3d186158ab616bce94b6
/engine/timer.hh
ab164d161ae8c14c15a1094ffe4f35e71bfa2df1
[]
no_license
samdoiron/jeshim
54f382282d9922706ed223f0fc6ead1a15888033
be5685068efaff755231ce32e610aab00222f6ab
refs/heads/master
2021-01-11T02:07:57.653518
2016-10-13T11:51:11
2016-10-13T11:51:11
70,801,499
0
0
null
null
null
null
UTF-8
C++
false
false
393
hh
#ifndef JESH_TIMER_H_ #define JESH_TIMER_H_ #include <functional> namespace jesh { class Timer { public: Timer(double); void start(); void onDone(std::function<void()>); void advance(double); private: double timeRunning; double timeToRun; bool isRunning; std::function<void()> func; }; } #endif // JESH_TIMER_H_
[ "samdoiron@fastmail.fm" ]
samdoiron@fastmail.fm
7aba6e33fe982cba9dd59f7c724f344f7a4ea5e0
c0a98386fe55a6c3eb9cad8f22e1b22e55caa31d
/TauAnalysisTools/plugins/TGraphWriter.cc
e10cee0619454949b28575aefee66a014638b019
[]
no_license
cms-tau-pog/TauAnalysisTools
90749dd413b8b6ff927edfa0c16ce6bd75060c7f
092ea5007c50da11228b90c0d2dc25e18c416531
refs/heads/master
2021-01-17T10:23:02.914621
2019-07-10T06:02:55
2019-07-10T06:02:55
16,484,357
3
5
null
2017-08-22T08:18:35
2014-02-03T16:05:41
Python
UTF-8
C++
false
false
2,313
cc
#include "TauAnalysisTools/TauAnalysisTools/plugins/TGraphWriter.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/PhysicsToolsObjects/interface/PhysicsTGraphPayload.h" #include <TFile.h> #include <TGraph.h> TGraphWriter::TGraphWriter(const edm::ParameterSet& cfg) : moduleLabel_(cfg.getParameter<std::string>("@module_label")) { edm::VParameterSet cfgJobs = cfg.getParameter<edm::VParameterSet>("jobs"); for ( edm::VParameterSet::const_iterator cfgJob = cfgJobs.begin(); cfgJob != cfgJobs.end(); ++cfgJob ) { jobEntryType* job = new jobEntryType(*cfgJob); jobs_.push_back(job); } } TGraphWriter::~TGraphWriter() { for ( std::vector<jobEntryType*>::iterator it = jobs_.begin(); it != jobs_.end(); ++it ) { delete (*it); } } void TGraphWriter::analyze(const edm::Event&, const edm::EventSetup&) { std::cout << "<TGraphWriter::analyze (moduleLabel = " << moduleLabel_ << ")>:" << std::endl; for ( std::vector<jobEntryType*>::iterator job = jobs_.begin(); job != jobs_.end(); ++job ) { TFile* inputFile = new TFile((*job)->inputFileName_.data()); std::cout << "reading TGraph = " << (*job)->graphName_ << " from ROOT file = " << (*job)->inputFileName_ << "." << std::endl; const TGraph* graph = dynamic_cast<TGraph*>(inputFile->Get((*job)->graphName_.data())); delete inputFile; if ( !graph ) throw cms::Exception("TGraphWriter") << " Failed to load TGraph = " << (*job)->graphName_.data() << " from file = " << (*job)->inputFileName_ << " !!\n"; edm::Service<cond::service::PoolDBOutputService> dbService; if ( !dbService.isAvailable() ) throw cms::Exception("TGraphWriter") << " Failed to access PoolDBOutputService !!\n"; std::cout << " writing TGraph = " << (*job)->graphName_ << " to SQLlite file, record = " << (*job)->outputRecord_ << "." << std::endl; PhysicsTGraphPayload* graphPayload = new PhysicsTGraphPayload(*graph); delete graph; dbService->writeOne(graphPayload, dbService->beginOfTime(), (*job)->outputRecord_); } std::cout << "done." << std::endl; } #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(TGraphWriter);
[ "Aruna.Nayak@cern.ch" ]
Aruna.Nayak@cern.ch
50deb21a7e62abf8f89bac8f236b2ef33d6e3207
cd5efda40daa7b3fc62da7ac6d1d0fe24f54870f
/Projects/01_Pumpkins/main (1).cpp
0d97ccf9603252eb509d871fdbda29159ce5a72b
[]
no_license
indorif0227/UARK-Spring-2021-Projects
636d1abb5e6d6b8879e573bf94619e8f330029c9
4827570025bdfab075ccd46a5121a7f9e4330359
refs/heads/main
2023-08-29T19:38:40.134250
2021-09-29T19:57:50
2021-09-29T19:57:50
411,811,220
0
0
null
null
null
null
UTF-8
C++
false
false
1,932
cpp
/****************************************************************************** Name: Furqaan Indori Instructor: Lora Streeter Assignment: Homework 1 - Pumpkin farm Description: A program that will determine the number of pumpkins and the worth of the harvest given the area of farmland *******************************************************************************/ //Include Libraries #include <iostream> #include <iomanip> #include <cmath> using namespace std; //Main Function int main(){ //Part 1 cout << "Part 1)\n"; //Obtaining user input float farmWidth; float farmLength; cout << "Farm Width(ft): "; cin >> farmWidth; cout << "Farm Length(ft): "; cin >> farmLength; //Area of Farm float farmArea = farmLength * farmWidth; cout << "Farm Area(sqft): " << farmArea <<endl; //Maintenance Costs float maintenanceCost = 0.06 * farmArea; cout << "Maintenance Cost: $" << fixed << setprecision(2) << maintenanceCost << endl; //Pumpkin Capacity int pumpkinsPerWidth = (farmWidth / 4); int pumpkinsPerLength = (farmLength / 4); int pumpkinCapacity = pumpkinsPerLength * pumpkinsPerWidth; cout << "Pumpkin Capacity: " << pumpkinCapacity << endl; //Part 2 cout << "\nPart 2)\n"; //Yield Volume float pumpkinVolume = (3.14 * (4.0/3.0)); float yieldVolume = pumpkinCapacity * pumpkinVolume; cout << "Yield Volume(ft^3): " << yieldVolume << endl; //Transportation int trailerVolume = 8 * 14 * 6; int tripsRequired = ceil(yieldVolume / trailerVolume); float gasExpenses = tripsRequired * 33.63; cout << "Trips Required: " << tripsRequired << endl; cout << "Gas Expenses: $" << gasExpenses << endl; //Profit float grossProfit = 5.25 * pumpkinCapacity; float netProfit = grossProfit - (gasExpenses + maintenanceCost); cout << "Gross Profit: $" << grossProfit << endl; cout << "Net Profit: $" << netProfit << endl; }
[ "indorif0227@gmail.com" ]
indorif0227@gmail.com
56473ea1c1e584c7f2b1fd9b97caffd1fe9845ba
07327b5e8b2831b12352bf7c6426bfda60129da7
/Include/10.0.14393.0/um/pla.h
ae74c538b19a147d8f5f2300719fdead3e73a3d2
[]
no_license
tpn/winsdk-10
ca279df0fce03f92036e90fb04196d6282a264b7
9b69fd26ac0c7d0b83d378dba01080e93349c2ed
refs/heads/master
2021-01-10T01:56:18.586459
2018-02-19T21:26:31
2018-02-19T21:29:50
44,352,845
218
432
null
null
null
null
UTF-8
C++
false
false
276,533
h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.01.0618 */ /* @@MIDL_FILE_HEADING( ) */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif /* __RPCNDR_H_VERSION__ */ #ifndef __pla_h__ #define __pla_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IDataCollectorSet_FWD_DEFINED__ #define __IDataCollectorSet_FWD_DEFINED__ typedef interface IDataCollectorSet IDataCollectorSet; #endif /* __IDataCollectorSet_FWD_DEFINED__ */ #ifndef __IDataManager_FWD_DEFINED__ #define __IDataManager_FWD_DEFINED__ typedef interface IDataManager IDataManager; #endif /* __IDataManager_FWD_DEFINED__ */ #ifndef __IFolderAction_FWD_DEFINED__ #define __IFolderAction_FWD_DEFINED__ typedef interface IFolderAction IFolderAction; #endif /* __IFolderAction_FWD_DEFINED__ */ #ifndef __IFolderActionCollection_FWD_DEFINED__ #define __IFolderActionCollection_FWD_DEFINED__ typedef interface IFolderActionCollection IFolderActionCollection; #endif /* __IFolderActionCollection_FWD_DEFINED__ */ #ifndef __IDataCollector_FWD_DEFINED__ #define __IDataCollector_FWD_DEFINED__ typedef interface IDataCollector IDataCollector; #endif /* __IDataCollector_FWD_DEFINED__ */ #ifndef __IPerformanceCounterDataCollector_FWD_DEFINED__ #define __IPerformanceCounterDataCollector_FWD_DEFINED__ typedef interface IPerformanceCounterDataCollector IPerformanceCounterDataCollector; #endif /* __IPerformanceCounterDataCollector_FWD_DEFINED__ */ #ifndef __ITraceDataCollector_FWD_DEFINED__ #define __ITraceDataCollector_FWD_DEFINED__ typedef interface ITraceDataCollector ITraceDataCollector; #endif /* __ITraceDataCollector_FWD_DEFINED__ */ #ifndef __IConfigurationDataCollector_FWD_DEFINED__ #define __IConfigurationDataCollector_FWD_DEFINED__ typedef interface IConfigurationDataCollector IConfigurationDataCollector; #endif /* __IConfigurationDataCollector_FWD_DEFINED__ */ #ifndef __IAlertDataCollector_FWD_DEFINED__ #define __IAlertDataCollector_FWD_DEFINED__ typedef interface IAlertDataCollector IAlertDataCollector; #endif /* __IAlertDataCollector_FWD_DEFINED__ */ #ifndef __IApiTracingDataCollector_FWD_DEFINED__ #define __IApiTracingDataCollector_FWD_DEFINED__ typedef interface IApiTracingDataCollector IApiTracingDataCollector; #endif /* __IApiTracingDataCollector_FWD_DEFINED__ */ #ifndef __IDataCollectorCollection_FWD_DEFINED__ #define __IDataCollectorCollection_FWD_DEFINED__ typedef interface IDataCollectorCollection IDataCollectorCollection; #endif /* __IDataCollectorCollection_FWD_DEFINED__ */ #ifndef __IDataCollectorSetCollection_FWD_DEFINED__ #define __IDataCollectorSetCollection_FWD_DEFINED__ typedef interface IDataCollectorSetCollection IDataCollectorSetCollection; #endif /* __IDataCollectorSetCollection_FWD_DEFINED__ */ #ifndef __ITraceDataProvider_FWD_DEFINED__ #define __ITraceDataProvider_FWD_DEFINED__ typedef interface ITraceDataProvider ITraceDataProvider; #endif /* __ITraceDataProvider_FWD_DEFINED__ */ #ifndef __ITraceDataProviderCollection_FWD_DEFINED__ #define __ITraceDataProviderCollection_FWD_DEFINED__ typedef interface ITraceDataProviderCollection ITraceDataProviderCollection; #endif /* __ITraceDataProviderCollection_FWD_DEFINED__ */ #ifndef __ISchedule_FWD_DEFINED__ #define __ISchedule_FWD_DEFINED__ typedef interface ISchedule ISchedule; #endif /* __ISchedule_FWD_DEFINED__ */ #ifndef __IScheduleCollection_FWD_DEFINED__ #define __IScheduleCollection_FWD_DEFINED__ typedef interface IScheduleCollection IScheduleCollection; #endif /* __IScheduleCollection_FWD_DEFINED__ */ #ifndef __IValueMapItem_FWD_DEFINED__ #define __IValueMapItem_FWD_DEFINED__ typedef interface IValueMapItem IValueMapItem; #endif /* __IValueMapItem_FWD_DEFINED__ */ #ifndef __IValueMap_FWD_DEFINED__ #define __IValueMap_FWD_DEFINED__ typedef interface IValueMap IValueMap; #endif /* __IValueMap_FWD_DEFINED__ */ #ifndef __DataCollectorSet_FWD_DEFINED__ #define __DataCollectorSet_FWD_DEFINED__ #ifdef __cplusplus typedef class DataCollectorSet DataCollectorSet; #else typedef struct DataCollectorSet DataCollectorSet; #endif /* __cplusplus */ #endif /* __DataCollectorSet_FWD_DEFINED__ */ #ifndef __TraceSession_FWD_DEFINED__ #define __TraceSession_FWD_DEFINED__ #ifdef __cplusplus typedef class TraceSession TraceSession; #else typedef struct TraceSession TraceSession; #endif /* __cplusplus */ #endif /* __TraceSession_FWD_DEFINED__ */ #ifndef __TraceSessionCollection_FWD_DEFINED__ #define __TraceSessionCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class TraceSessionCollection TraceSessionCollection; #else typedef struct TraceSessionCollection TraceSessionCollection; #endif /* __cplusplus */ #endif /* __TraceSessionCollection_FWD_DEFINED__ */ #ifndef __TraceDataProvider_FWD_DEFINED__ #define __TraceDataProvider_FWD_DEFINED__ #ifdef __cplusplus typedef class TraceDataProvider TraceDataProvider; #else typedef struct TraceDataProvider TraceDataProvider; #endif /* __cplusplus */ #endif /* __TraceDataProvider_FWD_DEFINED__ */ #ifndef __TraceDataProviderCollection_FWD_DEFINED__ #define __TraceDataProviderCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class TraceDataProviderCollection TraceDataProviderCollection; #else typedef struct TraceDataProviderCollection TraceDataProviderCollection; #endif /* __cplusplus */ #endif /* __TraceDataProviderCollection_FWD_DEFINED__ */ #ifndef __DataCollectorSetCollection_FWD_DEFINED__ #define __DataCollectorSetCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class DataCollectorSetCollection DataCollectorSetCollection; #else typedef struct DataCollectorSetCollection DataCollectorSetCollection; #endif /* __cplusplus */ #endif /* __DataCollectorSetCollection_FWD_DEFINED__ */ #ifndef __LegacyDataCollectorSet_FWD_DEFINED__ #define __LegacyDataCollectorSet_FWD_DEFINED__ #ifdef __cplusplus typedef class LegacyDataCollectorSet LegacyDataCollectorSet; #else typedef struct LegacyDataCollectorSet LegacyDataCollectorSet; #endif /* __cplusplus */ #endif /* __LegacyDataCollectorSet_FWD_DEFINED__ */ #ifndef __LegacyDataCollectorSetCollection_FWD_DEFINED__ #define __LegacyDataCollectorSetCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class LegacyDataCollectorSetCollection LegacyDataCollectorSetCollection; #else typedef struct LegacyDataCollectorSetCollection LegacyDataCollectorSetCollection; #endif /* __cplusplus */ #endif /* __LegacyDataCollectorSetCollection_FWD_DEFINED__ */ #ifndef __LegacyTraceSession_FWD_DEFINED__ #define __LegacyTraceSession_FWD_DEFINED__ #ifdef __cplusplus typedef class LegacyTraceSession LegacyTraceSession; #else typedef struct LegacyTraceSession LegacyTraceSession; #endif /* __cplusplus */ #endif /* __LegacyTraceSession_FWD_DEFINED__ */ #ifndef __LegacyTraceSessionCollection_FWD_DEFINED__ #define __LegacyTraceSessionCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class LegacyTraceSessionCollection LegacyTraceSessionCollection; #else typedef struct LegacyTraceSessionCollection LegacyTraceSessionCollection; #endif /* __cplusplus */ #endif /* __LegacyTraceSessionCollection_FWD_DEFINED__ */ #ifndef __ServerDataCollectorSet_FWD_DEFINED__ #define __ServerDataCollectorSet_FWD_DEFINED__ #ifdef __cplusplus typedef class ServerDataCollectorSet ServerDataCollectorSet; #else typedef struct ServerDataCollectorSet ServerDataCollectorSet; #endif /* __cplusplus */ #endif /* __ServerDataCollectorSet_FWD_DEFINED__ */ #ifndef __ServerDataCollectorSetCollection_FWD_DEFINED__ #define __ServerDataCollectorSetCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class ServerDataCollectorSetCollection ServerDataCollectorSetCollection; #else typedef struct ServerDataCollectorSetCollection ServerDataCollectorSetCollection; #endif /* __cplusplus */ #endif /* __ServerDataCollectorSetCollection_FWD_DEFINED__ */ #ifndef __SystemDataCollectorSet_FWD_DEFINED__ #define __SystemDataCollectorSet_FWD_DEFINED__ #ifdef __cplusplus typedef class SystemDataCollectorSet SystemDataCollectorSet; #else typedef struct SystemDataCollectorSet SystemDataCollectorSet; #endif /* __cplusplus */ #endif /* __SystemDataCollectorSet_FWD_DEFINED__ */ #ifndef __SystemDataCollectorSetCollection_FWD_DEFINED__ #define __SystemDataCollectorSetCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class SystemDataCollectorSetCollection SystemDataCollectorSetCollection; #else typedef struct SystemDataCollectorSetCollection SystemDataCollectorSetCollection; #endif /* __cplusplus */ #endif /* __SystemDataCollectorSetCollection_FWD_DEFINED__ */ #ifndef __BootTraceSession_FWD_DEFINED__ #define __BootTraceSession_FWD_DEFINED__ #ifdef __cplusplus typedef class BootTraceSession BootTraceSession; #else typedef struct BootTraceSession BootTraceSession; #endif /* __cplusplus */ #endif /* __BootTraceSession_FWD_DEFINED__ */ #ifndef __BootTraceSessionCollection_FWD_DEFINED__ #define __BootTraceSessionCollection_FWD_DEFINED__ #ifdef __cplusplus typedef class BootTraceSessionCollection BootTraceSessionCollection; #else typedef struct BootTraceSessionCollection BootTraceSessionCollection; #endif /* __cplusplus */ #endif /* __BootTraceSessionCollection_FWD_DEFINED__ */ /* header files for imported files */ #include "unknwn.h" #include "oaidl.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_pla_0000_0000 */ /* [local] */ #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_pla_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_pla_0000_0000_v0_0_s_ifspec; #ifndef __PlaLibrary_LIBRARY_DEFINED__ #define __PlaLibrary_LIBRARY_DEFINED__ /* library PlaLibrary */ /* [control][helpstring][version][uuid] */ typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("03837504-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0001 { plaPerformanceCounter = 0, plaTrace = 1, plaConfiguration = 2, plaAlert = 3, plaApiTrace = 4 } DataCollectorType; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("03837507-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0002 { plaCommaSeparated = 0, plaTabSeparated = 1, plaSql = 2, plaBinary = 3 } FileFormat; typedef /* [public][public][public][public][public][uuid] */ DECLSPEC_UUID("03837508-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0003 { plaNone = 0, plaPattern = 0x1, plaComputer = 0x2, plaMonthDayHour = 0x100, plaSerialNumber = 0x200, plaYearDayOfYear = 0x400, plaYearMonth = 0x800, plaYearMonthDay = 0x1000, plaYearMonthDayHour = 0x2000, plaMonthDayHourMinute = 0x4000 } AutoPathFormat; typedef /* [public][public][uuid] */ DECLSPEC_UUID("0383750a-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0004 { plaStopped = 0, plaRunning = 1, plaCompiling = 2, plaPending = 3, plaUndefined = 4 } DataCollectorSetStatus; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("0383750d-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0005 { plaTimeStamp = 0, plaPerformance = 1, plaSystem = 2, plaCycle = 3 } ClockType; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("0383750e-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0006 { plaFile = 0x1, plaRealTime = 0x2, plaBoth = 0x3, plaBuffering = 0x4 } StreamMode; typedef /* [public][public][uuid] */ DECLSPEC_UUID("0383751f-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0007 { plaCreateNew = 0x1, plaModify = 0x2, plaCreateOrModify = 0x3, plaUpdateRunningInstance = 0x10, plaFlushTrace = 0x20, plaValidateOnly = 0x1000 } CommitMode; typedef /* [public][public][public][public][public][uuid] */ DECLSPEC_UUID("03837535-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0008 { plaIndex = 1, plaFlag = 2, plaFlagArray = 3, plaValidation = 4 } ValueMapType; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("0383753b-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0009 { plaRunOnce = 0, plaSunday = 0x1, plaMonday = 0x2, plaTuesday = 0x4, plaWednesday = 0x8, plaThursday = 0x10, plaFriday = 0x20, plaSaturday = 0x40, plaEveryday = 0x7f } WeekDays; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("0383753f-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0010 { plaDeleteLargest = 0, plaDeleteOldest = 1 } ResourcePolicy; typedef /* [public][public][uuid] */ DECLSPEC_UUID("03837540-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0011 { plaCreateReport = 0x1, plaRunRules = 0x2, plaCreateHtml = 0x4, plaFolderActions = 0x8, plaResourceFreeing = 0x10 } DataManagerSteps; typedef /* [public][public][public][uuid] */ DECLSPEC_UUID("03837542-098b-11d8-9414-505054503030") enum __MIDL___MIDL_itf_pla_0001_0041_0012 { plaCreateCab = 0x1, plaDeleteData = 0x2, plaSendCab = 0x4, plaDeleteCab = 0x8, plaDeleteReport = 0x10 } FolderActionSteps; #define PLA_FUNCTION HRESULT __stdcall PLA_FUNCTION PlaExpandTaskArguments( VARIANT vDataSet, _Out_ BSTR* args ); #define PLA_CAPABILITY_LOCAL 0x10000000 #define PLA_CAPABILITY_V1_SVC 0x00000001 #define PLA_CAPABILITY_V1_SESSION 0x00000002 #define PLA_CAPABILITY_V1_SYSTEM 0x00000004 #define PLA_CAPABILITY_LEGACY_SESSION 0x00000008 #define PLA_CAPABILITY_LEGACY_SVC 0x00000010 #define PLA_CAPABILITY_AUTOLOGGER 0x00000020 #define PLAL_ALERT_CMD_LINE_SINGLE ((DWORD)0x00000100) #define PLAL_ALERT_CMD_LINE_A_NAME ((DWORD)0x00000200) #define PLAL_ALERT_CMD_LINE_C_NAME ((DWORD)0x00000400) #define PLAL_ALERT_CMD_LINE_D_TIME ((DWORD)0x00000800) #define PLAL_ALERT_CMD_LINE_L_VAL ((DWORD)0x00001000) #define PLAL_ALERT_CMD_LINE_M_VAL ((DWORD)0x00002000) #define PLAL_ALERT_CMD_LINE_U_TEXT ((DWORD)0x00004000) #define PLAL_ALERT_CMD_LINE_MASK ((DWORD)0x00007F00) PLA_FUNCTION PlaGetServerCapabilities( _In_opt_ BSTR Server, _Out_ PDWORD Capabilites ); PLA_FUNCTION PlaGetLegacyAlertActionsStringFromFlags( _In_ DWORD dwFlags, _Out_ BSTR *pbstrAlertStr ); PLA_FUNCTION PlaGetLegacyAlertActionsFlagsFromString( _In_ PCWSTR pszArguments, _Out_ LPDWORD pdwFlags ); typedef VOID (*PLA_CABEXTRACT_CALLBACK)(PCWSTR FileName, PVOID Context); HRESULT PlaExtractCabinet( _In_ PCWSTR CabFileName, _In_ PCWSTR DestPath, _In_opt_ PLA_CABEXTRACT_CALLBACK Callback, _In_opt_ PVOID Context ); HRESULT PlaDeleteReport( _In_ PCWSTR Folder ); EXTERN_C const IID LIBID_PlaLibrary; #ifndef __IDataCollectorSet_INTERFACE_DEFINED__ #define __IDataCollectorSet_INTERFACE_DEFINED__ /* interface IDataCollectorSet */ /* [oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IDataCollectorSet; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837520-098b-11d8-9414-505054503030") IDataCollectorSet : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataCollectors( /* [retval][out] */ __RPC__deref_out_opt IDataCollectorCollection **collectors) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Duration( /* [retval][out] */ __RPC__out unsigned long *seconds) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Duration( /* [in] */ unsigned long seconds) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description( /* [retval][out] */ __RPC__deref_out_opt BSTR *description) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Description( /* [in] */ __RPC__in BSTR description) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DescriptionUnresolved( /* [retval][out] */ __RPC__deref_out_opt BSTR *Descr) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayName( /* [retval][out] */ __RPC__deref_out_opt BSTR *DisplayName) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DisplayName( /* [in] */ __RPC__in BSTR DisplayName) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayNameUnresolved( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Keywords( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *keywords) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Keywords( /* [in] */ __RPC__in SAFEARRAY * keywords) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LatestOutputLocation( /* [retval][out] */ __RPC__deref_out_opt BSTR *path) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LatestOutputLocation( /* [in] */ __RPC__in BSTR path) = 0; virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OutputLocation( /* [retval][out] */ __RPC__deref_out_opt BSTR *path) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RootPath( /* [retval][out] */ __RPC__deref_out_opt BSTR *folder) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RootPath( /* [in] */ __RPC__in BSTR folder) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Segment( /* [retval][out] */ __RPC__out VARIANT_BOOL *segment) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Segment( /* [in] */ VARIANT_BOOL segment) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SegmentMaxDuration( /* [retval][out] */ __RPC__out unsigned long *seconds) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SegmentMaxDuration( /* [in] */ unsigned long seconds) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SegmentMaxSize( /* [retval][out] */ __RPC__out unsigned long *size) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SegmentMaxSize( /* [in] */ unsigned long size) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SerialNumber( /* [retval][out] */ __RPC__out unsigned long *index) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SerialNumber( /* [in] */ unsigned long index) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Server( /* [retval][out] */ __RPC__deref_out_opt BSTR *server) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Status( /* [retval][out] */ __RPC__out DataCollectorSetStatus *status) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Subdirectory( /* [retval][out] */ __RPC__deref_out_opt BSTR *folder) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Subdirectory( /* [in] */ __RPC__in BSTR folder) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubdirectoryFormat( /* [retval][out] */ __RPC__out AutoPathFormat *format) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubdirectoryFormat( /* [in] */ AutoPathFormat format) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubdirectoryFormatPattern( /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubdirectoryFormatPattern( /* [in] */ __RPC__in BSTR pattern) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Task( /* [retval][out] */ __RPC__deref_out_opt BSTR *task) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Task( /* [in] */ __RPC__in BSTR task) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskRunAsSelf( /* [retval][out] */ __RPC__out VARIANT_BOOL *RunAsSelf) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskRunAsSelf( /* [in] */ VARIANT_BOOL RunAsSelf) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskArguments( /* [retval][out] */ __RPC__deref_out_opt BSTR *task) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskArguments( /* [in] */ __RPC__in BSTR task) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskUserTextArguments( /* [retval][out] */ __RPC__deref_out_opt BSTR *UserText) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskUserTextArguments( /* [in] */ __RPC__in BSTR UserText) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Schedules( /* [retval][out] */ __RPC__deref_out_opt IScheduleCollection **ppSchedules) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SchedulesEnabled( /* [retval][out] */ __RPC__out VARIANT_BOOL *enabled) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SchedulesEnabled( /* [in] */ VARIANT_BOOL enabled) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UserAccount( /* [retval][out] */ __RPC__deref_out_opt BSTR *user) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml( /* [retval][out] */ __RPC__deref_out_opt BSTR *xml) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Security( /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrSecurity) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Security( /* [in] */ __RPC__in BSTR bstrSecurity) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StopOnCompletion( /* [retval][out] */ __RPC__out VARIANT_BOOL *Stop) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_StopOnCompletion( /* [in] */ VARIANT_BOOL Stop) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataManager( /* [retval][out] */ __RPC__deref_out_opt IDataManager **DataManager) = 0; virtual HRESULT STDMETHODCALLTYPE SetCredentials( __RPC__in BSTR user, __RPC__in BSTR password) = 0; virtual HRESULT STDMETHODCALLTYPE Query( /* [in] */ __RPC__in BSTR name, /* [unique][in] */ __RPC__in_opt BSTR server) = 0; virtual HRESULT STDMETHODCALLTYPE Commit( /* [in] */ __RPC__in BSTR name, /* [unique][in] */ __RPC__in_opt BSTR server, CommitMode mode, /* [retval][out] */ __RPC__deref_out_opt IValueMap **validation) = 0; virtual HRESULT STDMETHODCALLTYPE Delete( void) = 0; virtual HRESULT STDMETHODCALLTYPE Start( /* [in] */ VARIANT_BOOL Synchronous) = 0; virtual HRESULT STDMETHODCALLTYPE Stop( /* [in] */ VARIANT_BOOL Synchronous) = 0; virtual HRESULT STDMETHODCALLTYPE SetXml( /* [in] */ __RPC__in BSTR xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **validation) = 0; virtual HRESULT STDMETHODCALLTYPE SetValue( __RPC__in BSTR key, __RPC__in BSTR value) = 0; virtual HRESULT STDMETHODCALLTYPE GetValue( __RPC__in BSTR key, /* [retval][out] */ __RPC__deref_out_opt BSTR *value) = 0; }; #else /* C style interface */ typedef struct IDataCollectorSetVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDataCollectorSet * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDataCollectorSet * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDataCollectorSet * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDataCollectorSet * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDataCollectorSet * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectors )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorCollection **collectors); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out unsigned long *seconds); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( __RPC__in IDataCollectorSet * This, /* [in] */ unsigned long seconds); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *description); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Description )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR description); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DescriptionUnresolved )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Descr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayName )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *DisplayName); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DisplayName )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR DisplayName); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayNameUnresolved )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Keywords )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *keywords); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Keywords )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in SAFEARRAY * keywords); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR path); /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RootPath )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *folder); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RootPath )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR folder); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Segment )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *segment); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Segment )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL segment); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SegmentMaxDuration )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out unsigned long *seconds); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SegmentMaxDuration )( __RPC__in IDataCollectorSet * This, /* [in] */ unsigned long seconds); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SegmentMaxSize )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out unsigned long *size); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SegmentMaxSize )( __RPC__in IDataCollectorSet * This, /* [in] */ unsigned long size); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SerialNumber )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out unsigned long *index); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SerialNumber )( __RPC__in IDataCollectorSet * This, /* [in] */ unsigned long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Server )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *server); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out DataCollectorSetStatus *status); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Subdirectory )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *folder); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Subdirectory )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR folder); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubdirectoryFormat )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubdirectoryFormat )( __RPC__in IDataCollectorSet * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubdirectoryFormatPattern )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubdirectoryFormatPattern )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Task )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *task); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Task )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR task); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskRunAsSelf )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *RunAsSelf); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskRunAsSelf )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL RunAsSelf); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskArguments )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *task); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskArguments )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR task); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskUserTextArguments )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *UserText); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskUserTextArguments )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR UserText); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Schedules )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt IScheduleCollection **ppSchedules); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SchedulesEnabled )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *enabled); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SchedulesEnabled )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL enabled); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UserAccount )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *user); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *xml); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Security )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrSecurity); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Security )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR bstrSecurity); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StopOnCompletion )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *Stop); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_StopOnCompletion )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL Stop); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataManager )( __RPC__in IDataCollectorSet * This, /* [retval][out] */ __RPC__deref_out_opt IDataManager **DataManager); HRESULT ( STDMETHODCALLTYPE *SetCredentials )( __RPC__in IDataCollectorSet * This, __RPC__in BSTR user, __RPC__in BSTR password); HRESULT ( STDMETHODCALLTYPE *Query )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR name, /* [unique][in] */ __RPC__in_opt BSTR server); HRESULT ( STDMETHODCALLTYPE *Commit )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR name, /* [unique][in] */ __RPC__in_opt BSTR server, CommitMode mode, /* [retval][out] */ __RPC__deref_out_opt IValueMap **validation); HRESULT ( STDMETHODCALLTYPE *Delete )( __RPC__in IDataCollectorSet * This); HRESULT ( STDMETHODCALLTYPE *Start )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL Synchronous); HRESULT ( STDMETHODCALLTYPE *Stop )( __RPC__in IDataCollectorSet * This, /* [in] */ VARIANT_BOOL Synchronous); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IDataCollectorSet * This, /* [in] */ __RPC__in BSTR xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **validation); HRESULT ( STDMETHODCALLTYPE *SetValue )( __RPC__in IDataCollectorSet * This, __RPC__in BSTR key, __RPC__in BSTR value); HRESULT ( STDMETHODCALLTYPE *GetValue )( __RPC__in IDataCollectorSet * This, __RPC__in BSTR key, /* [retval][out] */ __RPC__deref_out_opt BSTR *value); END_INTERFACE } IDataCollectorSetVtbl; interface IDataCollectorSet { CONST_VTBL struct IDataCollectorSetVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDataCollectorSet_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDataCollectorSet_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDataCollectorSet_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDataCollectorSet_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDataCollectorSet_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDataCollectorSet_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDataCollectorSet_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IDataCollectorSet_get_DataCollectors(This,collectors) \ ( (This)->lpVtbl -> get_DataCollectors(This,collectors) ) #define IDataCollectorSet_get_Duration(This,seconds) \ ( (This)->lpVtbl -> get_Duration(This,seconds) ) #define IDataCollectorSet_put_Duration(This,seconds) \ ( (This)->lpVtbl -> put_Duration(This,seconds) ) #define IDataCollectorSet_get_Description(This,description) \ ( (This)->lpVtbl -> get_Description(This,description) ) #define IDataCollectorSet_put_Description(This,description) \ ( (This)->lpVtbl -> put_Description(This,description) ) #define IDataCollectorSet_get_DescriptionUnresolved(This,Descr) \ ( (This)->lpVtbl -> get_DescriptionUnresolved(This,Descr) ) #define IDataCollectorSet_get_DisplayName(This,DisplayName) \ ( (This)->lpVtbl -> get_DisplayName(This,DisplayName) ) #define IDataCollectorSet_put_DisplayName(This,DisplayName) \ ( (This)->lpVtbl -> put_DisplayName(This,DisplayName) ) #define IDataCollectorSet_get_DisplayNameUnresolved(This,name) \ ( (This)->lpVtbl -> get_DisplayNameUnresolved(This,name) ) #define IDataCollectorSet_get_Keywords(This,keywords) \ ( (This)->lpVtbl -> get_Keywords(This,keywords) ) #define IDataCollectorSet_put_Keywords(This,keywords) \ ( (This)->lpVtbl -> put_Keywords(This,keywords) ) #define IDataCollectorSet_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IDataCollectorSet_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IDataCollectorSet_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IDataCollectorSet_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IDataCollectorSet_get_RootPath(This,folder) \ ( (This)->lpVtbl -> get_RootPath(This,folder) ) #define IDataCollectorSet_put_RootPath(This,folder) \ ( (This)->lpVtbl -> put_RootPath(This,folder) ) #define IDataCollectorSet_get_Segment(This,segment) \ ( (This)->lpVtbl -> get_Segment(This,segment) ) #define IDataCollectorSet_put_Segment(This,segment) \ ( (This)->lpVtbl -> put_Segment(This,segment) ) #define IDataCollectorSet_get_SegmentMaxDuration(This,seconds) \ ( (This)->lpVtbl -> get_SegmentMaxDuration(This,seconds) ) #define IDataCollectorSet_put_SegmentMaxDuration(This,seconds) \ ( (This)->lpVtbl -> put_SegmentMaxDuration(This,seconds) ) #define IDataCollectorSet_get_SegmentMaxSize(This,size) \ ( (This)->lpVtbl -> get_SegmentMaxSize(This,size) ) #define IDataCollectorSet_put_SegmentMaxSize(This,size) \ ( (This)->lpVtbl -> put_SegmentMaxSize(This,size) ) #define IDataCollectorSet_get_SerialNumber(This,index) \ ( (This)->lpVtbl -> get_SerialNumber(This,index) ) #define IDataCollectorSet_put_SerialNumber(This,index) \ ( (This)->lpVtbl -> put_SerialNumber(This,index) ) #define IDataCollectorSet_get_Server(This,server) \ ( (This)->lpVtbl -> get_Server(This,server) ) #define IDataCollectorSet_get_Status(This,status) \ ( (This)->lpVtbl -> get_Status(This,status) ) #define IDataCollectorSet_get_Subdirectory(This,folder) \ ( (This)->lpVtbl -> get_Subdirectory(This,folder) ) #define IDataCollectorSet_put_Subdirectory(This,folder) \ ( (This)->lpVtbl -> put_Subdirectory(This,folder) ) #define IDataCollectorSet_get_SubdirectoryFormat(This,format) \ ( (This)->lpVtbl -> get_SubdirectoryFormat(This,format) ) #define IDataCollectorSet_put_SubdirectoryFormat(This,format) \ ( (This)->lpVtbl -> put_SubdirectoryFormat(This,format) ) #define IDataCollectorSet_get_SubdirectoryFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_SubdirectoryFormatPattern(This,pattern) ) #define IDataCollectorSet_put_SubdirectoryFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_SubdirectoryFormatPattern(This,pattern) ) #define IDataCollectorSet_get_Task(This,task) \ ( (This)->lpVtbl -> get_Task(This,task) ) #define IDataCollectorSet_put_Task(This,task) \ ( (This)->lpVtbl -> put_Task(This,task) ) #define IDataCollectorSet_get_TaskRunAsSelf(This,RunAsSelf) \ ( (This)->lpVtbl -> get_TaskRunAsSelf(This,RunAsSelf) ) #define IDataCollectorSet_put_TaskRunAsSelf(This,RunAsSelf) \ ( (This)->lpVtbl -> put_TaskRunAsSelf(This,RunAsSelf) ) #define IDataCollectorSet_get_TaskArguments(This,task) \ ( (This)->lpVtbl -> get_TaskArguments(This,task) ) #define IDataCollectorSet_put_TaskArguments(This,task) \ ( (This)->lpVtbl -> put_TaskArguments(This,task) ) #define IDataCollectorSet_get_TaskUserTextArguments(This,UserText) \ ( (This)->lpVtbl -> get_TaskUserTextArguments(This,UserText) ) #define IDataCollectorSet_put_TaskUserTextArguments(This,UserText) \ ( (This)->lpVtbl -> put_TaskUserTextArguments(This,UserText) ) #define IDataCollectorSet_get_Schedules(This,ppSchedules) \ ( (This)->lpVtbl -> get_Schedules(This,ppSchedules) ) #define IDataCollectorSet_get_SchedulesEnabled(This,enabled) \ ( (This)->lpVtbl -> get_SchedulesEnabled(This,enabled) ) #define IDataCollectorSet_put_SchedulesEnabled(This,enabled) \ ( (This)->lpVtbl -> put_SchedulesEnabled(This,enabled) ) #define IDataCollectorSet_get_UserAccount(This,user) \ ( (This)->lpVtbl -> get_UserAccount(This,user) ) #define IDataCollectorSet_get_Xml(This,xml) \ ( (This)->lpVtbl -> get_Xml(This,xml) ) #define IDataCollectorSet_get_Security(This,pbstrSecurity) \ ( (This)->lpVtbl -> get_Security(This,pbstrSecurity) ) #define IDataCollectorSet_put_Security(This,bstrSecurity) \ ( (This)->lpVtbl -> put_Security(This,bstrSecurity) ) #define IDataCollectorSet_get_StopOnCompletion(This,Stop) \ ( (This)->lpVtbl -> get_StopOnCompletion(This,Stop) ) #define IDataCollectorSet_put_StopOnCompletion(This,Stop) \ ( (This)->lpVtbl -> put_StopOnCompletion(This,Stop) ) #define IDataCollectorSet_get_DataManager(This,DataManager) \ ( (This)->lpVtbl -> get_DataManager(This,DataManager) ) #define IDataCollectorSet_SetCredentials(This,user,password) \ ( (This)->lpVtbl -> SetCredentials(This,user,password) ) #define IDataCollectorSet_Query(This,name,server) \ ( (This)->lpVtbl -> Query(This,name,server) ) #define IDataCollectorSet_Commit(This,name,server,mode,validation) \ ( (This)->lpVtbl -> Commit(This,name,server,mode,validation) ) #define IDataCollectorSet_Delete(This) \ ( (This)->lpVtbl -> Delete(This) ) #define IDataCollectorSet_Start(This,Synchronous) \ ( (This)->lpVtbl -> Start(This,Synchronous) ) #define IDataCollectorSet_Stop(This,Synchronous) \ ( (This)->lpVtbl -> Stop(This,Synchronous) ) #define IDataCollectorSet_SetXml(This,xml,validation) \ ( (This)->lpVtbl -> SetXml(This,xml,validation) ) #define IDataCollectorSet_SetValue(This,key,value) \ ( (This)->lpVtbl -> SetValue(This,key,value) ) #define IDataCollectorSet_GetValue(This,key,value) \ ( (This)->lpVtbl -> GetValue(This,key,value) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDataCollectorSet_INTERFACE_DEFINED__ */ #ifndef __IDataManager_INTERFACE_DEFINED__ #define __IDataManager_INTERFACE_DEFINED__ /* interface IDataManager */ /* [oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IDataManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837541-098b-11d8-9414-505054503030") IDataManager : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( /* [retval][out] */ __RPC__out VARIANT_BOOL *pfEnabled) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( /* [in] */ VARIANT_BOOL fEnabled) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CheckBeforeRunning( /* [retval][out] */ __RPC__out VARIANT_BOOL *pfCheck) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_CheckBeforeRunning( /* [in] */ VARIANT_BOOL fCheck) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinFreeDisk( /* [retval][out] */ __RPC__out ULONG *MinFreeDisk) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MinFreeDisk( /* [in] */ ULONG MinFreeDisk) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaxSize( /* [retval][out] */ __RPC__out ULONG *pulMaxSize) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MaxSize( /* [in] */ ULONG ulMaxSize) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaxFolderCount( /* [retval][out] */ __RPC__out ULONG *pulMaxFolderCount) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MaxFolderCount( /* [in] */ ULONG ulMaxFolderCount) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourcePolicy( /* [retval][out] */ __RPC__out ResourcePolicy *pPolicy) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ResourcePolicy( /* [in] */ ResourcePolicy Policy) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FolderActions( /* [retval][out] */ __RPC__deref_out_opt IFolderActionCollection **Actions) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ReportSchema( /* [retval][out] */ __RPC__deref_out_opt BSTR *ReportSchema) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ReportSchema( /* [in] */ __RPC__in BSTR ReportSchema) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ReportFileName( /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrFilename) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ReportFileName( /* [in] */ __RPC__in BSTR pbstrFilename) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuleTargetFileName( /* [retval][out] */ __RPC__deref_out_opt BSTR *Filename) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RuleTargetFileName( /* [in] */ __RPC__in BSTR Filename) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventsFileName( /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrFilename) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_EventsFileName( /* [in] */ __RPC__in BSTR pbstrFilename) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Rules( /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrXml) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Rules( /* [in] */ __RPC__in BSTR bstrXml) = 0; virtual HRESULT STDMETHODCALLTYPE Run( /* [in] */ DataManagerSteps Steps, /* [in] */ __RPC__in BSTR bstrFolder, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Errors) = 0; virtual HRESULT STDMETHODCALLTYPE Extract( /* [in] */ __RPC__in BSTR CabFilename, /* [in] */ __RPC__in BSTR DestinationPath) = 0; }; #else /* C style interface */ typedef struct IDataManagerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDataManager * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDataManager * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDataManager * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDataManager * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDataManager * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDataManager * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDataManager * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Enabled )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *pfEnabled); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Enabled )( __RPC__in IDataManager * This, /* [in] */ VARIANT_BOOL fEnabled); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CheckBeforeRunning )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *pfCheck); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_CheckBeforeRunning )( __RPC__in IDataManager * This, /* [in] */ VARIANT_BOOL fCheck); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinFreeDisk )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out ULONG *MinFreeDisk); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinFreeDisk )( __RPC__in IDataManager * This, /* [in] */ ULONG MinFreeDisk); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxSize )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out ULONG *pulMaxSize); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MaxSize )( __RPC__in IDataManager * This, /* [in] */ ULONG ulMaxSize); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxFolderCount )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out ULONG *pulMaxFolderCount); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MaxFolderCount )( __RPC__in IDataManager * This, /* [in] */ ULONG ulMaxFolderCount); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourcePolicy )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__out ResourcePolicy *pPolicy); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ResourcePolicy )( __RPC__in IDataManager * This, /* [in] */ ResourcePolicy Policy); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FolderActions )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt IFolderActionCollection **Actions); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReportSchema )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *ReportSchema); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ReportSchema )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR ReportSchema); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReportFileName )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrFilename); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ReportFileName )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR pbstrFilename); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuleTargetFileName )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Filename); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RuleTargetFileName )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR Filename); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventsFileName )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrFilename); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventsFileName )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR pbstrFilename); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rules )( __RPC__in IDataManager * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrXml); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Rules )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR bstrXml); HRESULT ( STDMETHODCALLTYPE *Run )( __RPC__in IDataManager * This, /* [in] */ DataManagerSteps Steps, /* [in] */ __RPC__in BSTR bstrFolder, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Errors); HRESULT ( STDMETHODCALLTYPE *Extract )( __RPC__in IDataManager * This, /* [in] */ __RPC__in BSTR CabFilename, /* [in] */ __RPC__in BSTR DestinationPath); END_INTERFACE } IDataManagerVtbl; interface IDataManager { CONST_VTBL struct IDataManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDataManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDataManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDataManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDataManager_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDataManager_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDataManager_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDataManager_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IDataManager_get_Enabled(This,pfEnabled) \ ( (This)->lpVtbl -> get_Enabled(This,pfEnabled) ) #define IDataManager_put_Enabled(This,fEnabled) \ ( (This)->lpVtbl -> put_Enabled(This,fEnabled) ) #define IDataManager_get_CheckBeforeRunning(This,pfCheck) \ ( (This)->lpVtbl -> get_CheckBeforeRunning(This,pfCheck) ) #define IDataManager_put_CheckBeforeRunning(This,fCheck) \ ( (This)->lpVtbl -> put_CheckBeforeRunning(This,fCheck) ) #define IDataManager_get_MinFreeDisk(This,MinFreeDisk) \ ( (This)->lpVtbl -> get_MinFreeDisk(This,MinFreeDisk) ) #define IDataManager_put_MinFreeDisk(This,MinFreeDisk) \ ( (This)->lpVtbl -> put_MinFreeDisk(This,MinFreeDisk) ) #define IDataManager_get_MaxSize(This,pulMaxSize) \ ( (This)->lpVtbl -> get_MaxSize(This,pulMaxSize) ) #define IDataManager_put_MaxSize(This,ulMaxSize) \ ( (This)->lpVtbl -> put_MaxSize(This,ulMaxSize) ) #define IDataManager_get_MaxFolderCount(This,pulMaxFolderCount) \ ( (This)->lpVtbl -> get_MaxFolderCount(This,pulMaxFolderCount) ) #define IDataManager_put_MaxFolderCount(This,ulMaxFolderCount) \ ( (This)->lpVtbl -> put_MaxFolderCount(This,ulMaxFolderCount) ) #define IDataManager_get_ResourcePolicy(This,pPolicy) \ ( (This)->lpVtbl -> get_ResourcePolicy(This,pPolicy) ) #define IDataManager_put_ResourcePolicy(This,Policy) \ ( (This)->lpVtbl -> put_ResourcePolicy(This,Policy) ) #define IDataManager_get_FolderActions(This,Actions) \ ( (This)->lpVtbl -> get_FolderActions(This,Actions) ) #define IDataManager_get_ReportSchema(This,ReportSchema) \ ( (This)->lpVtbl -> get_ReportSchema(This,ReportSchema) ) #define IDataManager_put_ReportSchema(This,ReportSchema) \ ( (This)->lpVtbl -> put_ReportSchema(This,ReportSchema) ) #define IDataManager_get_ReportFileName(This,pbstrFilename) \ ( (This)->lpVtbl -> get_ReportFileName(This,pbstrFilename) ) #define IDataManager_put_ReportFileName(This,pbstrFilename) \ ( (This)->lpVtbl -> put_ReportFileName(This,pbstrFilename) ) #define IDataManager_get_RuleTargetFileName(This,Filename) \ ( (This)->lpVtbl -> get_RuleTargetFileName(This,Filename) ) #define IDataManager_put_RuleTargetFileName(This,Filename) \ ( (This)->lpVtbl -> put_RuleTargetFileName(This,Filename) ) #define IDataManager_get_EventsFileName(This,pbstrFilename) \ ( (This)->lpVtbl -> get_EventsFileName(This,pbstrFilename) ) #define IDataManager_put_EventsFileName(This,pbstrFilename) \ ( (This)->lpVtbl -> put_EventsFileName(This,pbstrFilename) ) #define IDataManager_get_Rules(This,pbstrXml) \ ( (This)->lpVtbl -> get_Rules(This,pbstrXml) ) #define IDataManager_put_Rules(This,bstrXml) \ ( (This)->lpVtbl -> put_Rules(This,bstrXml) ) #define IDataManager_Run(This,Steps,bstrFolder,Errors) \ ( (This)->lpVtbl -> Run(This,Steps,bstrFolder,Errors) ) #define IDataManager_Extract(This,CabFilename,DestinationPath) \ ( (This)->lpVtbl -> Extract(This,CabFilename,DestinationPath) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDataManager_INTERFACE_DEFINED__ */ #ifndef __IFolderAction_INTERFACE_DEFINED__ #define __IFolderAction_INTERFACE_DEFINED__ /* interface IFolderAction */ /* [oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IFolderAction; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837543-098b-11d8-9414-505054503030") IFolderAction : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Age( /* [retval][out] */ __RPC__out ULONG *pulAge) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Age( /* [in] */ ULONG ulAge) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size( /* [retval][out] */ __RPC__out ULONG *pulAge) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Size( /* [in] */ ULONG ulAge) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Actions( /* [retval][out] */ __RPC__out FolderActionSteps *Steps) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Actions( /* [in] */ FolderActionSteps Steps) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SendCabTo( /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDestination) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SendCabTo( /* [in] */ __RPC__in BSTR bstrDestination) = 0; }; #else /* C style interface */ typedef struct IFolderActionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IFolderAction * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IFolderAction * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IFolderAction * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IFolderAction * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IFolderAction * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IFolderAction * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IFolderAction * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Age )( __RPC__in IFolderAction * This, /* [retval][out] */ __RPC__out ULONG *pulAge); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Age )( __RPC__in IFolderAction * This, /* [in] */ ULONG ulAge); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )( __RPC__in IFolderAction * This, /* [retval][out] */ __RPC__out ULONG *pulAge); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Size )( __RPC__in IFolderAction * This, /* [in] */ ULONG ulAge); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Actions )( __RPC__in IFolderAction * This, /* [retval][out] */ __RPC__out FolderActionSteps *Steps); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Actions )( __RPC__in IFolderAction * This, /* [in] */ FolderActionSteps Steps); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SendCabTo )( __RPC__in IFolderAction * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDestination); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SendCabTo )( __RPC__in IFolderAction * This, /* [in] */ __RPC__in BSTR bstrDestination); END_INTERFACE } IFolderActionVtbl; interface IFolderAction { CONST_VTBL struct IFolderActionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IFolderAction_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IFolderAction_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IFolderAction_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IFolderAction_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IFolderAction_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IFolderAction_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IFolderAction_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IFolderAction_get_Age(This,pulAge) \ ( (This)->lpVtbl -> get_Age(This,pulAge) ) #define IFolderAction_put_Age(This,ulAge) \ ( (This)->lpVtbl -> put_Age(This,ulAge) ) #define IFolderAction_get_Size(This,pulAge) \ ( (This)->lpVtbl -> get_Size(This,pulAge) ) #define IFolderAction_put_Size(This,ulAge) \ ( (This)->lpVtbl -> put_Size(This,ulAge) ) #define IFolderAction_get_Actions(This,Steps) \ ( (This)->lpVtbl -> get_Actions(This,Steps) ) #define IFolderAction_put_Actions(This,Steps) \ ( (This)->lpVtbl -> put_Actions(This,Steps) ) #define IFolderAction_get_SendCabTo(This,pbstrDestination) \ ( (This)->lpVtbl -> get_SendCabTo(This,pbstrDestination) ) #define IFolderAction_put_SendCabTo(This,bstrDestination) \ ( (This)->lpVtbl -> put_SendCabTo(This,bstrDestination) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IFolderAction_INTERFACE_DEFINED__ */ #ifndef __IFolderActionCollection_INTERFACE_DEFINED__ #define __IFolderActionCollection_INTERFACE_DEFINED__ /* interface IFolderActionCollection */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IFolderActionCollection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837544-098b-11d8-9414-505054503030") IFolderActionCollection : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out ULONG *Count) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT Index, /* [retval][out] */ __RPC__deref_out_opt IFolderAction **Action) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **Enum) = 0; virtual HRESULT STDMETHODCALLTYPE Add( __RPC__in_opt IFolderAction *Action) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT Index) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt IFolderActionCollection *Actions) = 0; virtual HRESULT STDMETHODCALLTYPE CreateFolderAction( /* [retval][out] */ __RPC__deref_out_opt IFolderAction **FolderAction) = 0; }; #else /* C style interface */ typedef struct IFolderActionCollectionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IFolderActionCollection * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IFolderActionCollection * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IFolderActionCollection * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IFolderActionCollection * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IFolderActionCollection * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IFolderActionCollection * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IFolderActionCollection * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in IFolderActionCollection * This, /* [retval][out] */ __RPC__out ULONG *Count); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in IFolderActionCollection * This, /* [in] */ VARIANT Index, /* [retval][out] */ __RPC__deref_out_opt IFolderAction **Action); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in IFolderActionCollection * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **Enum); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in IFolderActionCollection * This, __RPC__in_opt IFolderAction *Action); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in IFolderActionCollection * This, VARIANT Index); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in IFolderActionCollection * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in IFolderActionCollection * This, __RPC__in_opt IFolderActionCollection *Actions); HRESULT ( STDMETHODCALLTYPE *CreateFolderAction )( __RPC__in IFolderActionCollection * This, /* [retval][out] */ __RPC__deref_out_opt IFolderAction **FolderAction); END_INTERFACE } IFolderActionCollectionVtbl; interface IFolderActionCollection { CONST_VTBL struct IFolderActionCollectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IFolderActionCollection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IFolderActionCollection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IFolderActionCollection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IFolderActionCollection_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IFolderActionCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IFolderActionCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IFolderActionCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IFolderActionCollection_get_Count(This,Count) \ ( (This)->lpVtbl -> get_Count(This,Count) ) #define IFolderActionCollection_get_Item(This,Index,Action) \ ( (This)->lpVtbl -> get_Item(This,Index,Action) ) #define IFolderActionCollection_get__NewEnum(This,Enum) \ ( (This)->lpVtbl -> get__NewEnum(This,Enum) ) #define IFolderActionCollection_Add(This,Action) \ ( (This)->lpVtbl -> Add(This,Action) ) #define IFolderActionCollection_Remove(This,Index) \ ( (This)->lpVtbl -> Remove(This,Index) ) #define IFolderActionCollection_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define IFolderActionCollection_AddRange(This,Actions) \ ( (This)->lpVtbl -> AddRange(This,Actions) ) #define IFolderActionCollection_CreateFolderAction(This,FolderAction) \ ( (This)->lpVtbl -> CreateFolderAction(This,FolderAction) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IFolderActionCollection_INTERFACE_DEFINED__ */ #ifndef __IDataCollector_INTERFACE_DEFINED__ #define __IDataCollector_INTERFACE_DEFINED__ /* interface IDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_IDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("038374ff-098b-11d8-9414-505054503030") IDataCollector : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataCollectorSet( /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_DataCollectorSet( /* [in] */ __RPC__in_opt IDataCollectorSet *group) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataCollectorType( /* [retval][out] */ __RPC__out DataCollectorType *type) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileName( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileName( /* [in] */ __RPC__in BSTR name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileNameFormat( /* [retval][out] */ __RPC__out AutoPathFormat *format) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileNameFormat( /* [in] */ AutoPathFormat format) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileNameFormatPattern( /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileNameFormatPattern( /* [in] */ __RPC__in BSTR pattern) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LatestOutputLocation( /* [retval][out] */ __RPC__deref_out_opt BSTR *path) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LatestOutputLocation( /* [in] */ __RPC__in BSTR path) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogAppend( /* [retval][out] */ __RPC__out VARIANT_BOOL *append) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogAppend( /* [in] */ VARIANT_BOOL append) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogCircular( /* [retval][out] */ __RPC__out VARIANT_BOOL *circular) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogCircular( /* [in] */ VARIANT_BOOL circular) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogOverwrite( /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogOverwrite( /* [in] */ VARIANT_BOOL overwrite) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Name( /* [in] */ __RPC__in BSTR name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OutputLocation( /* [retval][out] */ __RPC__deref_out_opt BSTR *path) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Index( /* [retval][out] */ __RPC__out long *index) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_Index( /* [in] */ long index) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml( /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml) = 0; virtual HRESULT STDMETHODCALLTYPE SetXml( /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation) = 0; virtual HRESULT STDMETHODCALLTYPE CreateOutputLocation( /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location) = 0; }; #else /* C style interface */ typedef struct IDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in IDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in IDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in IDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in IDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in IDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in IDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); END_INTERFACE } IDataCollectorVtbl; interface IDataCollector { CONST_VTBL struct IDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define IDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define IDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define IDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define IDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define IDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define IDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define IDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define IDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define IDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define IDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define IDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define IDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define IDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define IDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define IDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define IDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define IDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define IDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define IDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define IDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDataCollector_INTERFACE_DEFINED__ */ #ifndef __IPerformanceCounterDataCollector_INTERFACE_DEFINED__ #define __IPerformanceCounterDataCollector_INTERFACE_DEFINED__ /* interface IPerformanceCounterDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_IPerformanceCounterDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837506-098b-11d8-9414-505054503030") IPerformanceCounterDataCollector : public IDataCollector { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataSourceName( /* [retval][out] */ __RPC__deref_out_opt BSTR *dsn) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DataSourceName( /* [in] */ __RPC__in BSTR dsn) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PerformanceCounters( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *counters) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PerformanceCounters( /* [in] */ __RPC__in SAFEARRAY * counters) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogFileFormat( /* [retval][out] */ __RPC__out FileFormat *format) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogFileFormat( /* [in] */ FileFormat format) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SampleInterval( /* [retval][out] */ __RPC__out unsigned long *interval) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SampleInterval( /* [in] */ unsigned long interval) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SegmentMaxRecords( /* [retval][out] */ __RPC__out unsigned long *records) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SegmentMaxRecords( /* [in] */ unsigned long records) = 0; }; #else /* C style interface */ typedef struct IPerformanceCounterDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IPerformanceCounterDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IPerformanceCounterDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IPerformanceCounterDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IPerformanceCounterDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataSourceName )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *dsn); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataSourceName )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in BSTR dsn); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PerformanceCounters )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *counters); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PerformanceCounters )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * counters); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogFileFormat )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out FileFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogFileFormat )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ FileFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SampleInterval )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *interval); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SampleInterval )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ unsigned long interval); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SegmentMaxRecords )( __RPC__in IPerformanceCounterDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *records); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SegmentMaxRecords )( __RPC__in IPerformanceCounterDataCollector * This, /* [in] */ unsigned long records); END_INTERFACE } IPerformanceCounterDataCollectorVtbl; interface IPerformanceCounterDataCollector { CONST_VTBL struct IPerformanceCounterDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IPerformanceCounterDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IPerformanceCounterDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IPerformanceCounterDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IPerformanceCounterDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IPerformanceCounterDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IPerformanceCounterDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IPerformanceCounterDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IPerformanceCounterDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define IPerformanceCounterDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define IPerformanceCounterDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define IPerformanceCounterDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define IPerformanceCounterDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define IPerformanceCounterDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define IPerformanceCounterDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define IPerformanceCounterDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define IPerformanceCounterDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define IPerformanceCounterDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IPerformanceCounterDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IPerformanceCounterDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define IPerformanceCounterDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define IPerformanceCounterDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define IPerformanceCounterDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define IPerformanceCounterDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define IPerformanceCounterDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define IPerformanceCounterDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IPerformanceCounterDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define IPerformanceCounterDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IPerformanceCounterDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define IPerformanceCounterDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define IPerformanceCounterDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define IPerformanceCounterDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define IPerformanceCounterDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #define IPerformanceCounterDataCollector_get_DataSourceName(This,dsn) \ ( (This)->lpVtbl -> get_DataSourceName(This,dsn) ) #define IPerformanceCounterDataCollector_put_DataSourceName(This,dsn) \ ( (This)->lpVtbl -> put_DataSourceName(This,dsn) ) #define IPerformanceCounterDataCollector_get_PerformanceCounters(This,counters) \ ( (This)->lpVtbl -> get_PerformanceCounters(This,counters) ) #define IPerformanceCounterDataCollector_put_PerformanceCounters(This,counters) \ ( (This)->lpVtbl -> put_PerformanceCounters(This,counters) ) #define IPerformanceCounterDataCollector_get_LogFileFormat(This,format) \ ( (This)->lpVtbl -> get_LogFileFormat(This,format) ) #define IPerformanceCounterDataCollector_put_LogFileFormat(This,format) \ ( (This)->lpVtbl -> put_LogFileFormat(This,format) ) #define IPerformanceCounterDataCollector_get_SampleInterval(This,interval) \ ( (This)->lpVtbl -> get_SampleInterval(This,interval) ) #define IPerformanceCounterDataCollector_put_SampleInterval(This,interval) \ ( (This)->lpVtbl -> put_SampleInterval(This,interval) ) #define IPerformanceCounterDataCollector_get_SegmentMaxRecords(This,records) \ ( (This)->lpVtbl -> get_SegmentMaxRecords(This,records) ) #define IPerformanceCounterDataCollector_put_SegmentMaxRecords(This,records) \ ( (This)->lpVtbl -> put_SegmentMaxRecords(This,records) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IPerformanceCounterDataCollector_INTERFACE_DEFINED__ */ #ifndef __ITraceDataCollector_INTERFACE_DEFINED__ #define __ITraceDataCollector_INTERFACE_DEFINED__ /* interface ITraceDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_ITraceDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0383750b-098b-11d8-9414-505054503030") ITraceDataCollector : public IDataCollector { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BufferSize( /* [retval][out] */ __RPC__out unsigned long *size) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BufferSize( /* [in] */ unsigned long size) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuffersLost( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_BuffersLost( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuffersWritten( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_BuffersWritten( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClockType( /* [retval][out] */ __RPC__out ClockType *clock) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ClockType( /* [in] */ ClockType clock) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventsLost( /* [retval][out] */ __RPC__out unsigned long *events) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_EventsLost( /* [in] */ unsigned long events) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ExtendedModes( /* [retval][out] */ __RPC__out unsigned long *mode) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ExtendedModes( /* [in] */ unsigned long mode) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FlushTimer( /* [retval][out] */ __RPC__out unsigned long *seconds) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FlushTimer( /* [in] */ unsigned long seconds) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FreeBuffers( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_FreeBuffers( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Guid( /* [retval][out] */ __RPC__out GUID *guid) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Guid( /* [in] */ GUID guid) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsKernelTrace( /* [retval][out] */ __RPC__out VARIANT_BOOL *kernel) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaximumBuffers( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MaximumBuffers( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinimumBuffers( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MinimumBuffers( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfBuffers( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_NumberOfBuffers( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PreallocateFile( /* [retval][out] */ __RPC__out VARIANT_BOOL *allocate) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PreallocateFile( /* [in] */ VARIANT_BOOL allocate) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProcessMode( /* [retval][out] */ __RPC__out VARIANT_BOOL *process) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ProcessMode( /* [in] */ VARIANT_BOOL process) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RealTimeBuffersLost( /* [retval][out] */ __RPC__out unsigned long *buffers) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_RealTimeBuffersLost( /* [in] */ unsigned long buffers) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SessionId( /* [retval][out] */ __RPC__out ULONG64 *id) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_SessionId( /* [in] */ ULONG64 id) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SessionName( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SessionName( /* [in] */ __RPC__in BSTR name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SessionThreadId( /* [retval][out] */ __RPC__out unsigned long *tid) = 0; virtual /* [restricted][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_SessionThreadId( /* [in] */ unsigned long tid) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StreamMode( /* [retval][out] */ __RPC__out StreamMode *mode) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_StreamMode( /* [in] */ StreamMode mode) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TraceDataProviders( /* [retval][out] */ __RPC__deref_out_opt ITraceDataProviderCollection **providers) = 0; }; #else /* C style interface */ typedef struct ITraceDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ITraceDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ITraceDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in ITraceDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in ITraceDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( ITraceDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in ITraceDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in ITraceDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferSize )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *size); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferSize )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long size); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuffersLost )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BuffersLost )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuffersWritten )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BuffersWritten )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClockType )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out ClockType *clock); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ClockType )( __RPC__in ITraceDataCollector * This, /* [in] */ ClockType clock); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventsLost )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *events); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventsLost )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long events); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExtendedModes )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *mode); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ExtendedModes )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long mode); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FlushTimer )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *seconds); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FlushTimer )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long seconds); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FreeBuffers )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FreeBuffers )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out GUID *guid); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Guid )( __RPC__in ITraceDataCollector * This, /* [in] */ GUID guid); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsKernelTrace )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *kernel); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaximumBuffers )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MaximumBuffers )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinimumBuffers )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinimumBuffers )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfBuffers )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_NumberOfBuffers )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PreallocateFile )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *allocate); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PreallocateFile )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL allocate); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProcessMode )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *process); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ProcessMode )( __RPC__in ITraceDataCollector * This, /* [in] */ VARIANT_BOOL process); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RealTimeBuffersLost )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *buffers); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_RealTimeBuffersLost )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long buffers); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SessionId )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out ULONG64 *id); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SessionId )( __RPC__in ITraceDataCollector * This, /* [in] */ ULONG64 id); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SessionName )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SessionName )( __RPC__in ITraceDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SessionThreadId )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *tid); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SessionThreadId )( __RPC__in ITraceDataCollector * This, /* [in] */ unsigned long tid); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamMode )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__out StreamMode *mode); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_StreamMode )( __RPC__in ITraceDataCollector * This, /* [in] */ StreamMode mode); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TraceDataProviders )( __RPC__in ITraceDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt ITraceDataProviderCollection **providers); END_INTERFACE } ITraceDataCollectorVtbl; interface ITraceDataCollector { CONST_VTBL struct ITraceDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define ITraceDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ITraceDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ITraceDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ITraceDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define ITraceDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define ITraceDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define ITraceDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define ITraceDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define ITraceDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define ITraceDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define ITraceDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define ITraceDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define ITraceDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define ITraceDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define ITraceDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define ITraceDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define ITraceDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define ITraceDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define ITraceDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define ITraceDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define ITraceDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define ITraceDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define ITraceDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define ITraceDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define ITraceDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define ITraceDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define ITraceDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define ITraceDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define ITraceDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define ITraceDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define ITraceDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define ITraceDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #define ITraceDataCollector_get_BufferSize(This,size) \ ( (This)->lpVtbl -> get_BufferSize(This,size) ) #define ITraceDataCollector_put_BufferSize(This,size) \ ( (This)->lpVtbl -> put_BufferSize(This,size) ) #define ITraceDataCollector_get_BuffersLost(This,buffers) \ ( (This)->lpVtbl -> get_BuffersLost(This,buffers) ) #define ITraceDataCollector_put_BuffersLost(This,buffers) \ ( (This)->lpVtbl -> put_BuffersLost(This,buffers) ) #define ITraceDataCollector_get_BuffersWritten(This,buffers) \ ( (This)->lpVtbl -> get_BuffersWritten(This,buffers) ) #define ITraceDataCollector_put_BuffersWritten(This,buffers) \ ( (This)->lpVtbl -> put_BuffersWritten(This,buffers) ) #define ITraceDataCollector_get_ClockType(This,clock) \ ( (This)->lpVtbl -> get_ClockType(This,clock) ) #define ITraceDataCollector_put_ClockType(This,clock) \ ( (This)->lpVtbl -> put_ClockType(This,clock) ) #define ITraceDataCollector_get_EventsLost(This,events) \ ( (This)->lpVtbl -> get_EventsLost(This,events) ) #define ITraceDataCollector_put_EventsLost(This,events) \ ( (This)->lpVtbl -> put_EventsLost(This,events) ) #define ITraceDataCollector_get_ExtendedModes(This,mode) \ ( (This)->lpVtbl -> get_ExtendedModes(This,mode) ) #define ITraceDataCollector_put_ExtendedModes(This,mode) \ ( (This)->lpVtbl -> put_ExtendedModes(This,mode) ) #define ITraceDataCollector_get_FlushTimer(This,seconds) \ ( (This)->lpVtbl -> get_FlushTimer(This,seconds) ) #define ITraceDataCollector_put_FlushTimer(This,seconds) \ ( (This)->lpVtbl -> put_FlushTimer(This,seconds) ) #define ITraceDataCollector_get_FreeBuffers(This,buffers) \ ( (This)->lpVtbl -> get_FreeBuffers(This,buffers) ) #define ITraceDataCollector_put_FreeBuffers(This,buffers) \ ( (This)->lpVtbl -> put_FreeBuffers(This,buffers) ) #define ITraceDataCollector_get_Guid(This,guid) \ ( (This)->lpVtbl -> get_Guid(This,guid) ) #define ITraceDataCollector_put_Guid(This,guid) \ ( (This)->lpVtbl -> put_Guid(This,guid) ) #define ITraceDataCollector_get_IsKernelTrace(This,kernel) \ ( (This)->lpVtbl -> get_IsKernelTrace(This,kernel) ) #define ITraceDataCollector_get_MaximumBuffers(This,buffers) \ ( (This)->lpVtbl -> get_MaximumBuffers(This,buffers) ) #define ITraceDataCollector_put_MaximumBuffers(This,buffers) \ ( (This)->lpVtbl -> put_MaximumBuffers(This,buffers) ) #define ITraceDataCollector_get_MinimumBuffers(This,buffers) \ ( (This)->lpVtbl -> get_MinimumBuffers(This,buffers) ) #define ITraceDataCollector_put_MinimumBuffers(This,buffers) \ ( (This)->lpVtbl -> put_MinimumBuffers(This,buffers) ) #define ITraceDataCollector_get_NumberOfBuffers(This,buffers) \ ( (This)->lpVtbl -> get_NumberOfBuffers(This,buffers) ) #define ITraceDataCollector_put_NumberOfBuffers(This,buffers) \ ( (This)->lpVtbl -> put_NumberOfBuffers(This,buffers) ) #define ITraceDataCollector_get_PreallocateFile(This,allocate) \ ( (This)->lpVtbl -> get_PreallocateFile(This,allocate) ) #define ITraceDataCollector_put_PreallocateFile(This,allocate) \ ( (This)->lpVtbl -> put_PreallocateFile(This,allocate) ) #define ITraceDataCollector_get_ProcessMode(This,process) \ ( (This)->lpVtbl -> get_ProcessMode(This,process) ) #define ITraceDataCollector_put_ProcessMode(This,process) \ ( (This)->lpVtbl -> put_ProcessMode(This,process) ) #define ITraceDataCollector_get_RealTimeBuffersLost(This,buffers) \ ( (This)->lpVtbl -> get_RealTimeBuffersLost(This,buffers) ) #define ITraceDataCollector_put_RealTimeBuffersLost(This,buffers) \ ( (This)->lpVtbl -> put_RealTimeBuffersLost(This,buffers) ) #define ITraceDataCollector_get_SessionId(This,id) \ ( (This)->lpVtbl -> get_SessionId(This,id) ) #define ITraceDataCollector_put_SessionId(This,id) \ ( (This)->lpVtbl -> put_SessionId(This,id) ) #define ITraceDataCollector_get_SessionName(This,name) \ ( (This)->lpVtbl -> get_SessionName(This,name) ) #define ITraceDataCollector_put_SessionName(This,name) \ ( (This)->lpVtbl -> put_SessionName(This,name) ) #define ITraceDataCollector_get_SessionThreadId(This,tid) \ ( (This)->lpVtbl -> get_SessionThreadId(This,tid) ) #define ITraceDataCollector_put_SessionThreadId(This,tid) \ ( (This)->lpVtbl -> put_SessionThreadId(This,tid) ) #define ITraceDataCollector_get_StreamMode(This,mode) \ ( (This)->lpVtbl -> get_StreamMode(This,mode) ) #define ITraceDataCollector_put_StreamMode(This,mode) \ ( (This)->lpVtbl -> put_StreamMode(This,mode) ) #define ITraceDataCollector_get_TraceDataProviders(This,providers) \ ( (This)->lpVtbl -> get_TraceDataProviders(This,providers) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ITraceDataCollector_INTERFACE_DEFINED__ */ #ifndef __IConfigurationDataCollector_INTERFACE_DEFINED__ #define __IConfigurationDataCollector_INTERFACE_DEFINED__ /* interface IConfigurationDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_IConfigurationDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837514-098b-11d8-9414-505054503030") IConfigurationDataCollector : public IDataCollector { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileMaxCount( /* [retval][out] */ __RPC__out unsigned long *count) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileMaxCount( /* [in] */ unsigned long count) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileMaxRecursiveDepth( /* [retval][out] */ __RPC__out unsigned long *depth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileMaxRecursiveDepth( /* [in] */ unsigned long depth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileMaxTotalSize( /* [retval][out] */ __RPC__out unsigned long *size) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FileMaxTotalSize( /* [in] */ unsigned long size) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Files( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *Files) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Files( /* [in] */ __RPC__in SAFEARRAY * Files) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ManagementQueries( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *Queries) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ManagementQueries( /* [in] */ __RPC__in SAFEARRAY * Queries) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryNetworkAdapters( /* [retval][out] */ __RPC__out VARIANT_BOOL *network) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryNetworkAdapters( /* [in] */ VARIANT_BOOL network) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RegistryKeys( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *query) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RegistryKeys( /* [in] */ __RPC__in SAFEARRAY * query) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RegistryMaxRecursiveDepth( /* [retval][out] */ __RPC__out unsigned long *depth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RegistryMaxRecursiveDepth( /* [in] */ unsigned long depth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SystemStateFile( /* [retval][out] */ __RPC__deref_out_opt BSTR *FileName) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SystemStateFile( /* [in] */ __RPC__in BSTR FileName) = 0; }; #else /* C style interface */ typedef struct IConfigurationDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IConfigurationDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IConfigurationDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IConfigurationDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IConfigurationDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IConfigurationDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in IConfigurationDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in IConfigurationDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in IConfigurationDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in IConfigurationDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in IConfigurationDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in IConfigurationDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileMaxCount )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *count); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileMaxCount )( __RPC__in IConfigurationDataCollector * This, /* [in] */ unsigned long count); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileMaxRecursiveDepth )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *depth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileMaxRecursiveDepth )( __RPC__in IConfigurationDataCollector * This, /* [in] */ unsigned long depth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileMaxTotalSize )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *size); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileMaxTotalSize )( __RPC__in IConfigurationDataCollector * This, /* [in] */ unsigned long size); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Files )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *Files); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Files )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * Files); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ManagementQueries )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *Queries); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ManagementQueries )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * Queries); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryNetworkAdapters )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *network); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryNetworkAdapters )( __RPC__in IConfigurationDataCollector * This, /* [in] */ VARIANT_BOOL network); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RegistryKeys )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *query); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RegistryKeys )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * query); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RegistryMaxRecursiveDepth )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *depth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RegistryMaxRecursiveDepth )( __RPC__in IConfigurationDataCollector * This, /* [in] */ unsigned long depth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SystemStateFile )( __RPC__in IConfigurationDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *FileName); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SystemStateFile )( __RPC__in IConfigurationDataCollector * This, /* [in] */ __RPC__in BSTR FileName); END_INTERFACE } IConfigurationDataCollectorVtbl; interface IConfigurationDataCollector { CONST_VTBL struct IConfigurationDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IConfigurationDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IConfigurationDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IConfigurationDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IConfigurationDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IConfigurationDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IConfigurationDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IConfigurationDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IConfigurationDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define IConfigurationDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define IConfigurationDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define IConfigurationDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define IConfigurationDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define IConfigurationDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define IConfigurationDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define IConfigurationDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define IConfigurationDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define IConfigurationDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IConfigurationDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IConfigurationDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define IConfigurationDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define IConfigurationDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define IConfigurationDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define IConfigurationDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define IConfigurationDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define IConfigurationDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IConfigurationDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define IConfigurationDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IConfigurationDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define IConfigurationDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define IConfigurationDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define IConfigurationDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define IConfigurationDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #define IConfigurationDataCollector_get_FileMaxCount(This,count) \ ( (This)->lpVtbl -> get_FileMaxCount(This,count) ) #define IConfigurationDataCollector_put_FileMaxCount(This,count) \ ( (This)->lpVtbl -> put_FileMaxCount(This,count) ) #define IConfigurationDataCollector_get_FileMaxRecursiveDepth(This,depth) \ ( (This)->lpVtbl -> get_FileMaxRecursiveDepth(This,depth) ) #define IConfigurationDataCollector_put_FileMaxRecursiveDepth(This,depth) \ ( (This)->lpVtbl -> put_FileMaxRecursiveDepth(This,depth) ) #define IConfigurationDataCollector_get_FileMaxTotalSize(This,size) \ ( (This)->lpVtbl -> get_FileMaxTotalSize(This,size) ) #define IConfigurationDataCollector_put_FileMaxTotalSize(This,size) \ ( (This)->lpVtbl -> put_FileMaxTotalSize(This,size) ) #define IConfigurationDataCollector_get_Files(This,Files) \ ( (This)->lpVtbl -> get_Files(This,Files) ) #define IConfigurationDataCollector_put_Files(This,Files) \ ( (This)->lpVtbl -> put_Files(This,Files) ) #define IConfigurationDataCollector_get_ManagementQueries(This,Queries) \ ( (This)->lpVtbl -> get_ManagementQueries(This,Queries) ) #define IConfigurationDataCollector_put_ManagementQueries(This,Queries) \ ( (This)->lpVtbl -> put_ManagementQueries(This,Queries) ) #define IConfigurationDataCollector_get_QueryNetworkAdapters(This,network) \ ( (This)->lpVtbl -> get_QueryNetworkAdapters(This,network) ) #define IConfigurationDataCollector_put_QueryNetworkAdapters(This,network) \ ( (This)->lpVtbl -> put_QueryNetworkAdapters(This,network) ) #define IConfigurationDataCollector_get_RegistryKeys(This,query) \ ( (This)->lpVtbl -> get_RegistryKeys(This,query) ) #define IConfigurationDataCollector_put_RegistryKeys(This,query) \ ( (This)->lpVtbl -> put_RegistryKeys(This,query) ) #define IConfigurationDataCollector_get_RegistryMaxRecursiveDepth(This,depth) \ ( (This)->lpVtbl -> get_RegistryMaxRecursiveDepth(This,depth) ) #define IConfigurationDataCollector_put_RegistryMaxRecursiveDepth(This,depth) \ ( (This)->lpVtbl -> put_RegistryMaxRecursiveDepth(This,depth) ) #define IConfigurationDataCollector_get_SystemStateFile(This,FileName) \ ( (This)->lpVtbl -> get_SystemStateFile(This,FileName) ) #define IConfigurationDataCollector_put_SystemStateFile(This,FileName) \ ( (This)->lpVtbl -> put_SystemStateFile(This,FileName) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IConfigurationDataCollector_INTERFACE_DEFINED__ */ #ifndef __IAlertDataCollector_INTERFACE_DEFINED__ #define __IAlertDataCollector_INTERFACE_DEFINED__ /* interface IAlertDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_IAlertDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837516-098b-11d8-9414-505054503030") IAlertDataCollector : public IDataCollector { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AlertThresholds( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *alerts) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AlertThresholds( /* [in] */ __RPC__in SAFEARRAY * alerts) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventLog( /* [retval][out] */ __RPC__out VARIANT_BOOL *log) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_EventLog( /* [in] */ VARIANT_BOOL log) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SampleInterval( /* [retval][out] */ __RPC__out unsigned long *interval) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SampleInterval( /* [in] */ unsigned long interval) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Task( /* [retval][out] */ __RPC__deref_out_opt BSTR *task) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Task( /* [in] */ __RPC__in BSTR task) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskRunAsSelf( /* [retval][out] */ __RPC__out VARIANT_BOOL *RunAsSelf) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskRunAsSelf( /* [in] */ VARIANT_BOOL RunAsSelf) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskArguments( /* [retval][out] */ __RPC__deref_out_opt BSTR *task) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskArguments( /* [in] */ __RPC__in BSTR task) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TaskUserTextArguments( /* [retval][out] */ __RPC__deref_out_opt BSTR *task) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TaskUserTextArguments( /* [in] */ __RPC__in BSTR task) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TriggerDataCollectorSet( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TriggerDataCollectorSet( /* [in] */ __RPC__in BSTR name) = 0; }; #else /* C style interface */ typedef struct IAlertDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IAlertDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IAlertDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IAlertDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IAlertDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IAlertDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in IAlertDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in IAlertDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AlertThresholds )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *alerts); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AlertThresholds )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * alerts); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventLog )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *log); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventLog )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL log); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SampleInterval )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out unsigned long *interval); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SampleInterval )( __RPC__in IAlertDataCollector * This, /* [in] */ unsigned long interval); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Task )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *task); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Task )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR task); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskRunAsSelf )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *RunAsSelf); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskRunAsSelf )( __RPC__in IAlertDataCollector * This, /* [in] */ VARIANT_BOOL RunAsSelf); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskArguments )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *task); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskArguments )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR task); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TaskUserTextArguments )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *task); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TaskUserTextArguments )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR task); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TriggerDataCollectorSet )( __RPC__in IAlertDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TriggerDataCollectorSet )( __RPC__in IAlertDataCollector * This, /* [in] */ __RPC__in BSTR name); END_INTERFACE } IAlertDataCollectorVtbl; interface IAlertDataCollector { CONST_VTBL struct IAlertDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IAlertDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IAlertDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IAlertDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IAlertDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IAlertDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IAlertDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IAlertDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IAlertDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define IAlertDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define IAlertDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define IAlertDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define IAlertDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define IAlertDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define IAlertDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define IAlertDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define IAlertDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define IAlertDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IAlertDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IAlertDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define IAlertDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define IAlertDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define IAlertDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define IAlertDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define IAlertDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define IAlertDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IAlertDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define IAlertDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IAlertDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define IAlertDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define IAlertDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define IAlertDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define IAlertDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #define IAlertDataCollector_get_AlertThresholds(This,alerts) \ ( (This)->lpVtbl -> get_AlertThresholds(This,alerts) ) #define IAlertDataCollector_put_AlertThresholds(This,alerts) \ ( (This)->lpVtbl -> put_AlertThresholds(This,alerts) ) #define IAlertDataCollector_get_EventLog(This,log) \ ( (This)->lpVtbl -> get_EventLog(This,log) ) #define IAlertDataCollector_put_EventLog(This,log) \ ( (This)->lpVtbl -> put_EventLog(This,log) ) #define IAlertDataCollector_get_SampleInterval(This,interval) \ ( (This)->lpVtbl -> get_SampleInterval(This,interval) ) #define IAlertDataCollector_put_SampleInterval(This,interval) \ ( (This)->lpVtbl -> put_SampleInterval(This,interval) ) #define IAlertDataCollector_get_Task(This,task) \ ( (This)->lpVtbl -> get_Task(This,task) ) #define IAlertDataCollector_put_Task(This,task) \ ( (This)->lpVtbl -> put_Task(This,task) ) #define IAlertDataCollector_get_TaskRunAsSelf(This,RunAsSelf) \ ( (This)->lpVtbl -> get_TaskRunAsSelf(This,RunAsSelf) ) #define IAlertDataCollector_put_TaskRunAsSelf(This,RunAsSelf) \ ( (This)->lpVtbl -> put_TaskRunAsSelf(This,RunAsSelf) ) #define IAlertDataCollector_get_TaskArguments(This,task) \ ( (This)->lpVtbl -> get_TaskArguments(This,task) ) #define IAlertDataCollector_put_TaskArguments(This,task) \ ( (This)->lpVtbl -> put_TaskArguments(This,task) ) #define IAlertDataCollector_get_TaskUserTextArguments(This,task) \ ( (This)->lpVtbl -> get_TaskUserTextArguments(This,task) ) #define IAlertDataCollector_put_TaskUserTextArguments(This,task) \ ( (This)->lpVtbl -> put_TaskUserTextArguments(This,task) ) #define IAlertDataCollector_get_TriggerDataCollectorSet(This,name) \ ( (This)->lpVtbl -> get_TriggerDataCollectorSet(This,name) ) #define IAlertDataCollector_put_TriggerDataCollectorSet(This,name) \ ( (This)->lpVtbl -> put_TriggerDataCollectorSet(This,name) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IAlertDataCollector_INTERFACE_DEFINED__ */ #ifndef __IApiTracingDataCollector_INTERFACE_DEFINED__ #define __IApiTracingDataCollector_INTERFACE_DEFINED__ /* interface IApiTracingDataCollector */ /* [dual][uuid][object] */ EXTERN_C const IID IID_IApiTracingDataCollector; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0383751a-098b-11d8-9414-505054503030") IApiTracingDataCollector : public IDataCollector { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogApiNamesOnly( /* [retval][out] */ __RPC__out VARIANT_BOOL *logapinames) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogApiNamesOnly( /* [in] */ VARIANT_BOOL logapinames) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogApisRecursively( /* [retval][out] */ __RPC__out VARIANT_BOOL *logrecursively) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogApisRecursively( /* [in] */ VARIANT_BOOL logrecursively) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ExePath( /* [retval][out] */ __RPC__deref_out_opt BSTR *exepath) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ExePath( /* [in] */ __RPC__in BSTR exepath) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogFilePath( /* [retval][out] */ __RPC__deref_out_opt BSTR *logfilepath) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_LogFilePath( /* [in] */ __RPC__in BSTR logfilepath) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IncludeModules( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *includemodules) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IncludeModules( /* [in] */ __RPC__in SAFEARRAY * includemodules) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IncludeApis( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *includeapis) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IncludeApis( /* [in] */ __RPC__in SAFEARRAY * includeapis) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ExcludeApis( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *excludeapis) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ExcludeApis( /* [in] */ __RPC__in SAFEARRAY * excludeapis) = 0; }; #else /* C style interface */ typedef struct IApiTracingDataCollectorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IApiTracingDataCollector * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IApiTracingDataCollector * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IApiTracingDataCollector * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IApiTracingDataCollector * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IApiTracingDataCollector * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorSet )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **group); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataCollectorSet )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in_opt IDataCollectorSet *group); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataCollectorType )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out DataCollectorType *type); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileName )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileName )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormat )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out AutoPathFormat *format); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormat )( __RPC__in IApiTracingDataCollector * This, /* [in] */ AutoPathFormat format); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileNameFormatPattern )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *pattern); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FileNameFormatPattern )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR pattern); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LatestOutputLocation )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LatestOutputLocation )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogAppend )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *append); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogAppend )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL append); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogCircular )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *circular); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogCircular )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL circular); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogOverwrite )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *overwrite); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogOverwrite )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL overwrite); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Name )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputLocation )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *path); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out long *index); /* [restricted][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Index )( __RPC__in IApiTracingDataCollector * This, /* [in] */ long index); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *Xml); HRESULT ( STDMETHODCALLTYPE *SetXml )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR Xml, /* [retval][out] */ __RPC__deref_out_opt IValueMap **Validation); HRESULT ( STDMETHODCALLTYPE *CreateOutputLocation )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL Latest, /* [retval][out] */ __RPC__deref_out_opt BSTR *Location); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogApiNamesOnly )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *logapinames); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogApiNamesOnly )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL logapinames); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogApisRecursively )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *logrecursively); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogApisRecursively )( __RPC__in IApiTracingDataCollector * This, /* [in] */ VARIANT_BOOL logrecursively); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExePath )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *exepath); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ExePath )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR exepath); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LogFilePath )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *logfilepath); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_LogFilePath )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in BSTR logfilepath); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IncludeModules )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *includemodules); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IncludeModules )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * includemodules); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IncludeApis )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *includeapis); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IncludeApis )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * includeapis); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExcludeApis )( __RPC__in IApiTracingDataCollector * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *excludeapis); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ExcludeApis )( __RPC__in IApiTracingDataCollector * This, /* [in] */ __RPC__in SAFEARRAY * excludeapis); END_INTERFACE } IApiTracingDataCollectorVtbl; interface IApiTracingDataCollector { CONST_VTBL struct IApiTracingDataCollectorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IApiTracingDataCollector_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IApiTracingDataCollector_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IApiTracingDataCollector_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IApiTracingDataCollector_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IApiTracingDataCollector_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IApiTracingDataCollector_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IApiTracingDataCollector_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IApiTracingDataCollector_get_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> get_DataCollectorSet(This,group) ) #define IApiTracingDataCollector_put_DataCollectorSet(This,group) \ ( (This)->lpVtbl -> put_DataCollectorSet(This,group) ) #define IApiTracingDataCollector_get_DataCollectorType(This,type) \ ( (This)->lpVtbl -> get_DataCollectorType(This,type) ) #define IApiTracingDataCollector_get_FileName(This,name) \ ( (This)->lpVtbl -> get_FileName(This,name) ) #define IApiTracingDataCollector_put_FileName(This,name) \ ( (This)->lpVtbl -> put_FileName(This,name) ) #define IApiTracingDataCollector_get_FileNameFormat(This,format) \ ( (This)->lpVtbl -> get_FileNameFormat(This,format) ) #define IApiTracingDataCollector_put_FileNameFormat(This,format) \ ( (This)->lpVtbl -> put_FileNameFormat(This,format) ) #define IApiTracingDataCollector_get_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> get_FileNameFormatPattern(This,pattern) ) #define IApiTracingDataCollector_put_FileNameFormatPattern(This,pattern) \ ( (This)->lpVtbl -> put_FileNameFormatPattern(This,pattern) ) #define IApiTracingDataCollector_get_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> get_LatestOutputLocation(This,path) ) #define IApiTracingDataCollector_put_LatestOutputLocation(This,path) \ ( (This)->lpVtbl -> put_LatestOutputLocation(This,path) ) #define IApiTracingDataCollector_get_LogAppend(This,append) \ ( (This)->lpVtbl -> get_LogAppend(This,append) ) #define IApiTracingDataCollector_put_LogAppend(This,append) \ ( (This)->lpVtbl -> put_LogAppend(This,append) ) #define IApiTracingDataCollector_get_LogCircular(This,circular) \ ( (This)->lpVtbl -> get_LogCircular(This,circular) ) #define IApiTracingDataCollector_put_LogCircular(This,circular) \ ( (This)->lpVtbl -> put_LogCircular(This,circular) ) #define IApiTracingDataCollector_get_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> get_LogOverwrite(This,overwrite) ) #define IApiTracingDataCollector_put_LogOverwrite(This,overwrite) \ ( (This)->lpVtbl -> put_LogOverwrite(This,overwrite) ) #define IApiTracingDataCollector_get_Name(This,name) \ ( (This)->lpVtbl -> get_Name(This,name) ) #define IApiTracingDataCollector_put_Name(This,name) \ ( (This)->lpVtbl -> put_Name(This,name) ) #define IApiTracingDataCollector_get_OutputLocation(This,path) \ ( (This)->lpVtbl -> get_OutputLocation(This,path) ) #define IApiTracingDataCollector_get_Index(This,index) \ ( (This)->lpVtbl -> get_Index(This,index) ) #define IApiTracingDataCollector_put_Index(This,index) \ ( (This)->lpVtbl -> put_Index(This,index) ) #define IApiTracingDataCollector_get_Xml(This,Xml) \ ( (This)->lpVtbl -> get_Xml(This,Xml) ) #define IApiTracingDataCollector_SetXml(This,Xml,Validation) \ ( (This)->lpVtbl -> SetXml(This,Xml,Validation) ) #define IApiTracingDataCollector_CreateOutputLocation(This,Latest,Location) \ ( (This)->lpVtbl -> CreateOutputLocation(This,Latest,Location) ) #define IApiTracingDataCollector_get_LogApiNamesOnly(This,logapinames) \ ( (This)->lpVtbl -> get_LogApiNamesOnly(This,logapinames) ) #define IApiTracingDataCollector_put_LogApiNamesOnly(This,logapinames) \ ( (This)->lpVtbl -> put_LogApiNamesOnly(This,logapinames) ) #define IApiTracingDataCollector_get_LogApisRecursively(This,logrecursively) \ ( (This)->lpVtbl -> get_LogApisRecursively(This,logrecursively) ) #define IApiTracingDataCollector_put_LogApisRecursively(This,logrecursively) \ ( (This)->lpVtbl -> put_LogApisRecursively(This,logrecursively) ) #define IApiTracingDataCollector_get_ExePath(This,exepath) \ ( (This)->lpVtbl -> get_ExePath(This,exepath) ) #define IApiTracingDataCollector_put_ExePath(This,exepath) \ ( (This)->lpVtbl -> put_ExePath(This,exepath) ) #define IApiTracingDataCollector_get_LogFilePath(This,logfilepath) \ ( (This)->lpVtbl -> get_LogFilePath(This,logfilepath) ) #define IApiTracingDataCollector_put_LogFilePath(This,logfilepath) \ ( (This)->lpVtbl -> put_LogFilePath(This,logfilepath) ) #define IApiTracingDataCollector_get_IncludeModules(This,includemodules) \ ( (This)->lpVtbl -> get_IncludeModules(This,includemodules) ) #define IApiTracingDataCollector_put_IncludeModules(This,includemodules) \ ( (This)->lpVtbl -> put_IncludeModules(This,includemodules) ) #define IApiTracingDataCollector_get_IncludeApis(This,includeapis) \ ( (This)->lpVtbl -> get_IncludeApis(This,includeapis) ) #define IApiTracingDataCollector_put_IncludeApis(This,includeapis) \ ( (This)->lpVtbl -> put_IncludeApis(This,includeapis) ) #define IApiTracingDataCollector_get_ExcludeApis(This,excludeapis) \ ( (This)->lpVtbl -> get_ExcludeApis(This,excludeapis) ) #define IApiTracingDataCollector_put_ExcludeApis(This,excludeapis) \ ( (This)->lpVtbl -> put_ExcludeApis(This,excludeapis) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IApiTracingDataCollector_INTERFACE_DEFINED__ */ #ifndef __IDataCollectorCollection_INTERFACE_DEFINED__ #define __IDataCollectorCollection_INTERFACE_DEFINED__ /* interface IDataCollectorCollection */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IDataCollectorCollection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837502-098b-11d8-9414-505054503030") IDataCollectorCollection : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out long *retVal) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **collector) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal) = 0; virtual HRESULT STDMETHODCALLTYPE Add( __RPC__in_opt IDataCollector *collector) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT collector) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt IDataCollectorCollection *collectors) = 0; virtual HRESULT STDMETHODCALLTYPE CreateDataCollectorFromXml( /* [in] */ __RPC__in BSTR bstrXml, /* [out] */ __RPC__deref_out_opt IValueMap **pValidation, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **pCollector) = 0; virtual HRESULT STDMETHODCALLTYPE CreateDataCollector( /* [in] */ DataCollectorType Type, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **Collector) = 0; }; #else /* C style interface */ typedef struct IDataCollectorCollectionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDataCollectorCollection * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDataCollectorCollection * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDataCollectorCollection * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDataCollectorCollection * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDataCollectorCollection * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDataCollectorCollection * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDataCollectorCollection * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in IDataCollectorCollection * This, /* [retval][out] */ __RPC__out long *retVal); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in IDataCollectorCollection * This, /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **collector); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in IDataCollectorCollection * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in IDataCollectorCollection * This, __RPC__in_opt IDataCollector *collector); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in IDataCollectorCollection * This, VARIANT collector); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in IDataCollectorCollection * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in IDataCollectorCollection * This, __RPC__in_opt IDataCollectorCollection *collectors); HRESULT ( STDMETHODCALLTYPE *CreateDataCollectorFromXml )( __RPC__in IDataCollectorCollection * This, /* [in] */ __RPC__in BSTR bstrXml, /* [out] */ __RPC__deref_out_opt IValueMap **pValidation, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **pCollector); HRESULT ( STDMETHODCALLTYPE *CreateDataCollector )( __RPC__in IDataCollectorCollection * This, /* [in] */ DataCollectorType Type, /* [retval][out] */ __RPC__deref_out_opt IDataCollector **Collector); END_INTERFACE } IDataCollectorCollectionVtbl; interface IDataCollectorCollection { CONST_VTBL struct IDataCollectorCollectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDataCollectorCollection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDataCollectorCollection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDataCollectorCollection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDataCollectorCollection_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDataCollectorCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDataCollectorCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDataCollectorCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IDataCollectorCollection_get_Count(This,retVal) \ ( (This)->lpVtbl -> get_Count(This,retVal) ) #define IDataCollectorCollection_get_Item(This,index,collector) \ ( (This)->lpVtbl -> get_Item(This,index,collector) ) #define IDataCollectorCollection_get__NewEnum(This,retVal) \ ( (This)->lpVtbl -> get__NewEnum(This,retVal) ) #define IDataCollectorCollection_Add(This,collector) \ ( (This)->lpVtbl -> Add(This,collector) ) #define IDataCollectorCollection_Remove(This,collector) \ ( (This)->lpVtbl -> Remove(This,collector) ) #define IDataCollectorCollection_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define IDataCollectorCollection_AddRange(This,collectors) \ ( (This)->lpVtbl -> AddRange(This,collectors) ) #define IDataCollectorCollection_CreateDataCollectorFromXml(This,bstrXml,pValidation,pCollector) \ ( (This)->lpVtbl -> CreateDataCollectorFromXml(This,bstrXml,pValidation,pCollector) ) #define IDataCollectorCollection_CreateDataCollector(This,Type,Collector) \ ( (This)->lpVtbl -> CreateDataCollector(This,Type,Collector) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDataCollectorCollection_INTERFACE_DEFINED__ */ #ifndef __IDataCollectorSetCollection_INTERFACE_DEFINED__ #define __IDataCollectorSetCollection_INTERFACE_DEFINED__ /* interface IDataCollectorSetCollection */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IDataCollectorSetCollection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837524-098b-11d8-9414-505054503030") IDataCollectorSetCollection : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out long *retVal) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **set) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal) = 0; virtual HRESULT STDMETHODCALLTYPE Add( __RPC__in_opt IDataCollectorSet *set) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT set) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt IDataCollectorSetCollection *sets) = 0; virtual HRESULT STDMETHODCALLTYPE GetDataCollectorSets( /* [unique][in] */ __RPC__in_opt BSTR server, /* [unique][in] */ __RPC__in_opt BSTR filter) = 0; }; #else /* C style interface */ typedef struct IDataCollectorSetCollectionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDataCollectorSetCollection * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDataCollectorSetCollection * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDataCollectorSetCollection * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDataCollectorSetCollection * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDataCollectorSetCollection * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDataCollectorSetCollection * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDataCollectorSetCollection * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in IDataCollectorSetCollection * This, /* [retval][out] */ __RPC__out long *retVal); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in IDataCollectorSetCollection * This, /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IDataCollectorSet **set); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in IDataCollectorSetCollection * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in IDataCollectorSetCollection * This, __RPC__in_opt IDataCollectorSet *set); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in IDataCollectorSetCollection * This, VARIANT set); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in IDataCollectorSetCollection * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in IDataCollectorSetCollection * This, __RPC__in_opt IDataCollectorSetCollection *sets); HRESULT ( STDMETHODCALLTYPE *GetDataCollectorSets )( __RPC__in IDataCollectorSetCollection * This, /* [unique][in] */ __RPC__in_opt BSTR server, /* [unique][in] */ __RPC__in_opt BSTR filter); END_INTERFACE } IDataCollectorSetCollectionVtbl; interface IDataCollectorSetCollection { CONST_VTBL struct IDataCollectorSetCollectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDataCollectorSetCollection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDataCollectorSetCollection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDataCollectorSetCollection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDataCollectorSetCollection_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDataCollectorSetCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDataCollectorSetCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDataCollectorSetCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IDataCollectorSetCollection_get_Count(This,retVal) \ ( (This)->lpVtbl -> get_Count(This,retVal) ) #define IDataCollectorSetCollection_get_Item(This,index,set) \ ( (This)->lpVtbl -> get_Item(This,index,set) ) #define IDataCollectorSetCollection_get__NewEnum(This,retVal) \ ( (This)->lpVtbl -> get__NewEnum(This,retVal) ) #define IDataCollectorSetCollection_Add(This,set) \ ( (This)->lpVtbl -> Add(This,set) ) #define IDataCollectorSetCollection_Remove(This,set) \ ( (This)->lpVtbl -> Remove(This,set) ) #define IDataCollectorSetCollection_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define IDataCollectorSetCollection_AddRange(This,sets) \ ( (This)->lpVtbl -> AddRange(This,sets) ) #define IDataCollectorSetCollection_GetDataCollectorSets(This,server,filter) \ ( (This)->lpVtbl -> GetDataCollectorSets(This,server,filter) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDataCollectorSetCollection_INTERFACE_DEFINED__ */ #ifndef __ITraceDataProvider_INTERFACE_DEFINED__ #define __ITraceDataProvider_INTERFACE_DEFINED__ /* interface ITraceDataProvider */ /* [dual][uuid][object] */ EXTERN_C const IID IID_ITraceDataProvider; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837512-098b-11d8-9414-505054503030") ITraceDataProvider : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayName( /* [retval][out] */ __RPC__deref_out_opt BSTR *name) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DisplayName( /* [in] */ __RPC__in BSTR name) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Guid( /* [retval][out] */ __RPC__out GUID *guid) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Guid( /* [in] */ GUID guid) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Level( /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppLevel) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KeywordsAny( /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppKeywords) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KeywordsAll( /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppKeywords) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Properties( /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppProperties) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FilterEnabled( /* [retval][out] */ __RPC__out VARIANT_BOOL *FilterEnabled) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FilterEnabled( /* [in] */ VARIANT_BOOL FilterEnabled) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FilterType( /* [retval][out] */ __RPC__out ULONG *pulType) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FilterType( /* [in] */ ULONG ulType) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FilterData( /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppData) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FilterData( /* [in] */ __RPC__in SAFEARRAY * pData) = 0; virtual HRESULT STDMETHODCALLTYPE Query( /* [in] */ __RPC__in BSTR bstrName, /* [unique][in] */ __RPC__in_opt BSTR bstrServer) = 0; virtual HRESULT STDMETHODCALLTYPE Resolve( /* [in] */ __RPC__in_opt IDispatch *pFrom) = 0; virtual HRESULT STDMETHODCALLTYPE SetSecurity( /* [in] */ __RPC__in BSTR Sddl) = 0; virtual HRESULT STDMETHODCALLTYPE GetSecurity( /* [in] */ ULONG SecurityInfo, /* [retval][out] */ __RPC__deref_out_opt BSTR *Sddl) = 0; virtual HRESULT STDMETHODCALLTYPE GetRegisteredProcesses( /* [out] */ __RPC__deref_out_opt IValueMap **Processes) = 0; }; #else /* C style interface */ typedef struct ITraceDataProviderVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ITraceDataProvider * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ITraceDataProvider * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in ITraceDataProvider * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in ITraceDataProvider * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( ITraceDataProvider * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayName )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *name); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DisplayName )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in BSTR name); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__out GUID *guid); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Guid )( __RPC__in ITraceDataProvider * This, /* [in] */ GUID guid); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Level )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppLevel); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeywordsAny )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppKeywords); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeywordsAll )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppKeywords); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Properties )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt IValueMap **ppProperties); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FilterEnabled )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *FilterEnabled); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FilterEnabled )( __RPC__in ITraceDataProvider * This, /* [in] */ VARIANT_BOOL FilterEnabled); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FilterType )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__out ULONG *pulType); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FilterType )( __RPC__in ITraceDataProvider * This, /* [in] */ ULONG ulType); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FilterData )( __RPC__in ITraceDataProvider * This, /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppData); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FilterData )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in SAFEARRAY * pData); HRESULT ( STDMETHODCALLTYPE *Query )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in BSTR bstrName, /* [unique][in] */ __RPC__in_opt BSTR bstrServer); HRESULT ( STDMETHODCALLTYPE *Resolve )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in_opt IDispatch *pFrom); HRESULT ( STDMETHODCALLTYPE *SetSecurity )( __RPC__in ITraceDataProvider * This, /* [in] */ __RPC__in BSTR Sddl); HRESULT ( STDMETHODCALLTYPE *GetSecurity )( __RPC__in ITraceDataProvider * This, /* [in] */ ULONG SecurityInfo, /* [retval][out] */ __RPC__deref_out_opt BSTR *Sddl); HRESULT ( STDMETHODCALLTYPE *GetRegisteredProcesses )( __RPC__in ITraceDataProvider * This, /* [out] */ __RPC__deref_out_opt IValueMap **Processes); END_INTERFACE } ITraceDataProviderVtbl; interface ITraceDataProvider { CONST_VTBL struct ITraceDataProviderVtbl *lpVtbl; }; #ifdef COBJMACROS #define ITraceDataProvider_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ITraceDataProvider_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ITraceDataProvider_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ITraceDataProvider_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define ITraceDataProvider_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define ITraceDataProvider_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define ITraceDataProvider_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define ITraceDataProvider_get_DisplayName(This,name) \ ( (This)->lpVtbl -> get_DisplayName(This,name) ) #define ITraceDataProvider_put_DisplayName(This,name) \ ( (This)->lpVtbl -> put_DisplayName(This,name) ) #define ITraceDataProvider_get_Guid(This,guid) \ ( (This)->lpVtbl -> get_Guid(This,guid) ) #define ITraceDataProvider_put_Guid(This,guid) \ ( (This)->lpVtbl -> put_Guid(This,guid) ) #define ITraceDataProvider_get_Level(This,ppLevel) \ ( (This)->lpVtbl -> get_Level(This,ppLevel) ) #define ITraceDataProvider_get_KeywordsAny(This,ppKeywords) \ ( (This)->lpVtbl -> get_KeywordsAny(This,ppKeywords) ) #define ITraceDataProvider_get_KeywordsAll(This,ppKeywords) \ ( (This)->lpVtbl -> get_KeywordsAll(This,ppKeywords) ) #define ITraceDataProvider_get_Properties(This,ppProperties) \ ( (This)->lpVtbl -> get_Properties(This,ppProperties) ) #define ITraceDataProvider_get_FilterEnabled(This,FilterEnabled) \ ( (This)->lpVtbl -> get_FilterEnabled(This,FilterEnabled) ) #define ITraceDataProvider_put_FilterEnabled(This,FilterEnabled) \ ( (This)->lpVtbl -> put_FilterEnabled(This,FilterEnabled) ) #define ITraceDataProvider_get_FilterType(This,pulType) \ ( (This)->lpVtbl -> get_FilterType(This,pulType) ) #define ITraceDataProvider_put_FilterType(This,ulType) \ ( (This)->lpVtbl -> put_FilterType(This,ulType) ) #define ITraceDataProvider_get_FilterData(This,ppData) \ ( (This)->lpVtbl -> get_FilterData(This,ppData) ) #define ITraceDataProvider_put_FilterData(This,pData) \ ( (This)->lpVtbl -> put_FilterData(This,pData) ) #define ITraceDataProvider_Query(This,bstrName,bstrServer) \ ( (This)->lpVtbl -> Query(This,bstrName,bstrServer) ) #define ITraceDataProvider_Resolve(This,pFrom) \ ( (This)->lpVtbl -> Resolve(This,pFrom) ) #define ITraceDataProvider_SetSecurity(This,Sddl) \ ( (This)->lpVtbl -> SetSecurity(This,Sddl) ) #define ITraceDataProvider_GetSecurity(This,SecurityInfo,Sddl) \ ( (This)->lpVtbl -> GetSecurity(This,SecurityInfo,Sddl) ) #define ITraceDataProvider_GetRegisteredProcesses(This,Processes) \ ( (This)->lpVtbl -> GetRegisteredProcesses(This,Processes) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ITraceDataProvider_INTERFACE_DEFINED__ */ #ifndef __ITraceDataProviderCollection_INTERFACE_DEFINED__ #define __ITraceDataProviderCollection_INTERFACE_DEFINED__ /* interface ITraceDataProviderCollection */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_ITraceDataProviderCollection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837510-098b-11d8-9414-505054503030") ITraceDataProviderCollection : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out long *retVal) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt ITraceDataProvider **ppProvider) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal) = 0; virtual HRESULT STDMETHODCALLTYPE Add( __RPC__in_opt ITraceDataProvider *pProvider) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT vProvider) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt ITraceDataProviderCollection *providers) = 0; virtual HRESULT STDMETHODCALLTYPE CreateTraceDataProvider( /* [retval][out] */ __RPC__deref_out_opt ITraceDataProvider **Provider) = 0; virtual HRESULT STDMETHODCALLTYPE GetTraceDataProviders( /* [unique][in] */ __RPC__in_opt BSTR server) = 0; virtual HRESULT STDMETHODCALLTYPE GetTraceDataProvidersByProcess( /* [unique][in] */ __RPC__in_opt BSTR Server, /* [in] */ ULONG Pid) = 0; }; #else /* C style interface */ typedef struct ITraceDataProviderCollectionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ITraceDataProviderCollection * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ITraceDataProviderCollection * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ITraceDataProviderCollection * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in ITraceDataProviderCollection * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in ITraceDataProviderCollection * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in ITraceDataProviderCollection * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( ITraceDataProviderCollection * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in ITraceDataProviderCollection * This, /* [retval][out] */ __RPC__out long *retVal); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in ITraceDataProviderCollection * This, /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt ITraceDataProvider **ppProvider); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in ITraceDataProviderCollection * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in ITraceDataProviderCollection * This, __RPC__in_opt ITraceDataProvider *pProvider); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in ITraceDataProviderCollection * This, VARIANT vProvider); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in ITraceDataProviderCollection * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in ITraceDataProviderCollection * This, __RPC__in_opt ITraceDataProviderCollection *providers); HRESULT ( STDMETHODCALLTYPE *CreateTraceDataProvider )( __RPC__in ITraceDataProviderCollection * This, /* [retval][out] */ __RPC__deref_out_opt ITraceDataProvider **Provider); HRESULT ( STDMETHODCALLTYPE *GetTraceDataProviders )( __RPC__in ITraceDataProviderCollection * This, /* [unique][in] */ __RPC__in_opt BSTR server); HRESULT ( STDMETHODCALLTYPE *GetTraceDataProvidersByProcess )( __RPC__in ITraceDataProviderCollection * This, /* [unique][in] */ __RPC__in_opt BSTR Server, /* [in] */ ULONG Pid); END_INTERFACE } ITraceDataProviderCollectionVtbl; interface ITraceDataProviderCollection { CONST_VTBL struct ITraceDataProviderCollectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define ITraceDataProviderCollection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ITraceDataProviderCollection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ITraceDataProviderCollection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ITraceDataProviderCollection_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define ITraceDataProviderCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define ITraceDataProviderCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define ITraceDataProviderCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define ITraceDataProviderCollection_get_Count(This,retVal) \ ( (This)->lpVtbl -> get_Count(This,retVal) ) #define ITraceDataProviderCollection_get_Item(This,index,ppProvider) \ ( (This)->lpVtbl -> get_Item(This,index,ppProvider) ) #define ITraceDataProviderCollection_get__NewEnum(This,retVal) \ ( (This)->lpVtbl -> get__NewEnum(This,retVal) ) #define ITraceDataProviderCollection_Add(This,pProvider) \ ( (This)->lpVtbl -> Add(This,pProvider) ) #define ITraceDataProviderCollection_Remove(This,vProvider) \ ( (This)->lpVtbl -> Remove(This,vProvider) ) #define ITraceDataProviderCollection_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define ITraceDataProviderCollection_AddRange(This,providers) \ ( (This)->lpVtbl -> AddRange(This,providers) ) #define ITraceDataProviderCollection_CreateTraceDataProvider(This,Provider) \ ( (This)->lpVtbl -> CreateTraceDataProvider(This,Provider) ) #define ITraceDataProviderCollection_GetTraceDataProviders(This,server) \ ( (This)->lpVtbl -> GetTraceDataProviders(This,server) ) #define ITraceDataProviderCollection_GetTraceDataProvidersByProcess(This,Server,Pid) \ ( (This)->lpVtbl -> GetTraceDataProvidersByProcess(This,Server,Pid) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ITraceDataProviderCollection_INTERFACE_DEFINED__ */ #ifndef __ISchedule_INTERFACE_DEFINED__ #define __ISchedule_INTERFACE_DEFINED__ /* interface ISchedule */ /* [dual][uuid][object] */ EXTERN_C const IID IID_ISchedule; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0383753a-098b-11d8-9414-505054503030") ISchedule : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StartDate( /* [retval][out] */ __RPC__out VARIANT *start) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_StartDate( /* [in] */ VARIANT start) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EndDate( /* [retval][out] */ __RPC__out VARIANT *end) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_EndDate( /* [in] */ VARIANT end) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StartTime( /* [retval][out] */ __RPC__out VARIANT *start) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_StartTime( /* [in] */ VARIANT start) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Days( /* [retval][out] */ __RPC__out WeekDays *days) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Days( /* [in] */ WeekDays days) = 0; }; #else /* C style interface */ typedef struct IScheduleVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISchedule * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISchedule * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISchedule * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in ISchedule * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in ISchedule * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in ISchedule * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( ISchedule * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartDate )( __RPC__in ISchedule * This, /* [retval][out] */ __RPC__out VARIANT *start); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_StartDate )( __RPC__in ISchedule * This, /* [in] */ VARIANT start); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EndDate )( __RPC__in ISchedule * This, /* [retval][out] */ __RPC__out VARIANT *end); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_EndDate )( __RPC__in ISchedule * This, /* [in] */ VARIANT end); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartTime )( __RPC__in ISchedule * This, /* [retval][out] */ __RPC__out VARIANT *start); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_StartTime )( __RPC__in ISchedule * This, /* [in] */ VARIANT start); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Days )( __RPC__in ISchedule * This, /* [retval][out] */ __RPC__out WeekDays *days); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Days )( __RPC__in ISchedule * This, /* [in] */ WeekDays days); END_INTERFACE } IScheduleVtbl; interface ISchedule { CONST_VTBL struct IScheduleVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISchedule_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISchedule_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISchedule_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISchedule_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define ISchedule_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define ISchedule_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define ISchedule_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define ISchedule_get_StartDate(This,start) \ ( (This)->lpVtbl -> get_StartDate(This,start) ) #define ISchedule_put_StartDate(This,start) \ ( (This)->lpVtbl -> put_StartDate(This,start) ) #define ISchedule_get_EndDate(This,end) \ ( (This)->lpVtbl -> get_EndDate(This,end) ) #define ISchedule_put_EndDate(This,end) \ ( (This)->lpVtbl -> put_EndDate(This,end) ) #define ISchedule_get_StartTime(This,start) \ ( (This)->lpVtbl -> get_StartTime(This,start) ) #define ISchedule_put_StartTime(This,start) \ ( (This)->lpVtbl -> put_StartTime(This,start) ) #define ISchedule_get_Days(This,days) \ ( (This)->lpVtbl -> get_Days(This,days) ) #define ISchedule_put_Days(This,days) \ ( (This)->lpVtbl -> put_Days(This,days) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISchedule_INTERFACE_DEFINED__ */ #ifndef __IScheduleCollection_INTERFACE_DEFINED__ #define __IScheduleCollection_INTERFACE_DEFINED__ /* interface IScheduleCollection */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IScheduleCollection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0383753d-098b-11d8-9414-505054503030") IScheduleCollection : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out long *retVal) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt ISchedule **ppSchedule) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **ienum) = 0; virtual HRESULT STDMETHODCALLTYPE Add( __RPC__in_opt ISchedule *pSchedule) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT vSchedule) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt IScheduleCollection *pSchedules) = 0; virtual HRESULT STDMETHODCALLTYPE CreateSchedule( /* [retval][out] */ __RPC__deref_out_opt ISchedule **Schedule) = 0; }; #else /* C style interface */ typedef struct IScheduleCollectionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IScheduleCollection * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IScheduleCollection * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IScheduleCollection * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IScheduleCollection * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IScheduleCollection * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IScheduleCollection * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IScheduleCollection * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in IScheduleCollection * This, /* [retval][out] */ __RPC__out long *retVal); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in IScheduleCollection * This, /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt ISchedule **ppSchedule); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in IScheduleCollection * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **ienum); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in IScheduleCollection * This, __RPC__in_opt ISchedule *pSchedule); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in IScheduleCollection * This, VARIANT vSchedule); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in IScheduleCollection * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in IScheduleCollection * This, __RPC__in_opt IScheduleCollection *pSchedules); HRESULT ( STDMETHODCALLTYPE *CreateSchedule )( __RPC__in IScheduleCollection * This, /* [retval][out] */ __RPC__deref_out_opt ISchedule **Schedule); END_INTERFACE } IScheduleCollectionVtbl; interface IScheduleCollection { CONST_VTBL struct IScheduleCollectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IScheduleCollection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IScheduleCollection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IScheduleCollection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IScheduleCollection_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IScheduleCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IScheduleCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IScheduleCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IScheduleCollection_get_Count(This,retVal) \ ( (This)->lpVtbl -> get_Count(This,retVal) ) #define IScheduleCollection_get_Item(This,index,ppSchedule) \ ( (This)->lpVtbl -> get_Item(This,index,ppSchedule) ) #define IScheduleCollection_get__NewEnum(This,ienum) \ ( (This)->lpVtbl -> get__NewEnum(This,ienum) ) #define IScheduleCollection_Add(This,pSchedule) \ ( (This)->lpVtbl -> Add(This,pSchedule) ) #define IScheduleCollection_Remove(This,vSchedule) \ ( (This)->lpVtbl -> Remove(This,vSchedule) ) #define IScheduleCollection_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define IScheduleCollection_AddRange(This,pSchedules) \ ( (This)->lpVtbl -> AddRange(This,pSchedules) ) #define IScheduleCollection_CreateSchedule(This,Schedule) \ ( (This)->lpVtbl -> CreateSchedule(This,Schedule) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IScheduleCollection_INTERFACE_DEFINED__ */ #ifndef __IValueMapItem_INTERFACE_DEFINED__ #define __IValueMapItem_INTERFACE_DEFINED__ /* interface IValueMapItem */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IValueMapItem; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837533-098b-11d8-9414-505054503030") IValueMapItem : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description( /* [retval][out] */ __RPC__deref_out_opt BSTR *description) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Description( /* [in] */ __RPC__in BSTR description) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( /* [retval][out] */ __RPC__out VARIANT_BOOL *enabled) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( /* [in] */ VARIANT_BOOL enabled) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Key( /* [retval][out] */ __RPC__deref_out_opt BSTR *key) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Key( /* [in] */ __RPC__in BSTR key) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value( /* [retval][out] */ __RPC__out VARIANT *Value) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Value( /* [in] */ VARIANT Value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ValueMapType( /* [retval][out] */ __RPC__out ValueMapType *type) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ValueMapType( /* [in] */ ValueMapType type) = 0; }; #else /* C style interface */ typedef struct IValueMapItemVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IValueMapItem * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IValueMapItem * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IValueMapItem * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IValueMapItem * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IValueMapItem * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IValueMapItem * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IValueMapItem * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )( __RPC__in IValueMapItem * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *description); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Description )( __RPC__in IValueMapItem * This, /* [in] */ __RPC__in BSTR description); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Enabled )( __RPC__in IValueMapItem * This, /* [retval][out] */ __RPC__out VARIANT_BOOL *enabled); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Enabled )( __RPC__in IValueMapItem * This, /* [in] */ VARIANT_BOOL enabled); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Key )( __RPC__in IValueMapItem * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *key); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Key )( __RPC__in IValueMapItem * This, /* [in] */ __RPC__in BSTR key); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )( __RPC__in IValueMapItem * This, /* [retval][out] */ __RPC__out VARIANT *Value); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Value )( __RPC__in IValueMapItem * This, /* [in] */ VARIANT Value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ValueMapType )( __RPC__in IValueMapItem * This, /* [retval][out] */ __RPC__out ValueMapType *type); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ValueMapType )( __RPC__in IValueMapItem * This, /* [in] */ ValueMapType type); END_INTERFACE } IValueMapItemVtbl; interface IValueMapItem { CONST_VTBL struct IValueMapItemVtbl *lpVtbl; }; #ifdef COBJMACROS #define IValueMapItem_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IValueMapItem_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IValueMapItem_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IValueMapItem_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IValueMapItem_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IValueMapItem_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IValueMapItem_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IValueMapItem_get_Description(This,description) \ ( (This)->lpVtbl -> get_Description(This,description) ) #define IValueMapItem_put_Description(This,description) \ ( (This)->lpVtbl -> put_Description(This,description) ) #define IValueMapItem_get_Enabled(This,enabled) \ ( (This)->lpVtbl -> get_Enabled(This,enabled) ) #define IValueMapItem_put_Enabled(This,enabled) \ ( (This)->lpVtbl -> put_Enabled(This,enabled) ) #define IValueMapItem_get_Key(This,key) \ ( (This)->lpVtbl -> get_Key(This,key) ) #define IValueMapItem_put_Key(This,key) \ ( (This)->lpVtbl -> put_Key(This,key) ) #define IValueMapItem_get_Value(This,Value) \ ( (This)->lpVtbl -> get_Value(This,Value) ) #define IValueMapItem_put_Value(This,Value) \ ( (This)->lpVtbl -> put_Value(This,Value) ) #define IValueMapItem_get_ValueMapType(This,type) \ ( (This)->lpVtbl -> get_ValueMapType(This,type) ) #define IValueMapItem_put_ValueMapType(This,type) \ ( (This)->lpVtbl -> put_ValueMapType(This,type) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IValueMapItem_INTERFACE_DEFINED__ */ #ifndef __IValueMap_INTERFACE_DEFINED__ #define __IValueMap_INTERFACE_DEFINED__ /* interface IValueMap */ /* [nonextensible][oleautomation][dual][uuid][object] */ EXTERN_C const IID IID_IValueMap; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("03837534-098b-11d8-9414-505054503030") IValueMap : public IDispatch { public: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ __RPC__out long *retVal) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IValueMapItem **value) = 0; virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description( /* [retval][out] */ __RPC__deref_out_opt BSTR *description) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Description( /* [in] */ __RPC__in BSTR description) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value( /* [retval][out] */ __RPC__out VARIANT *Value) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Value( /* [in] */ VARIANT Value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ValueMapType( /* [retval][out] */ __RPC__out ValueMapType *type) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ValueMapType( /* [in] */ ValueMapType type) = 0; virtual HRESULT STDMETHODCALLTYPE Add( VARIANT value) = 0; virtual HRESULT STDMETHODCALLTYPE Remove( VARIANT value) = 0; virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; virtual HRESULT STDMETHODCALLTYPE AddRange( __RPC__in_opt IValueMap *map) = 0; virtual HRESULT STDMETHODCALLTYPE CreateValueMapItem( /* [retval][out] */ __RPC__deref_out_opt IValueMapItem **Item) = 0; }; #else /* C style interface */ typedef struct IValueMapVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IValueMap * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IValueMap * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IValueMap * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IValueMap * This, /* [out] */ __RPC__out UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IValueMap * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IValueMap * This, /* [in] */ __RPC__in REFIID riid, /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IValueMap * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__out long *retVal); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( __RPC__in IValueMap * This, /* [in] */ VARIANT index, /* [retval][out] */ __RPC__deref_out_opt IValueMapItem **value); /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__deref_out_opt IUnknown **retVal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__deref_out_opt BSTR *description); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Description )( __RPC__in IValueMap * This, /* [in] */ __RPC__in BSTR description); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__out VARIANT *Value); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Value )( __RPC__in IValueMap * This, /* [in] */ VARIANT Value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ValueMapType )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__out ValueMapType *type); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ValueMapType )( __RPC__in IValueMap * This, /* [in] */ ValueMapType type); HRESULT ( STDMETHODCALLTYPE *Add )( __RPC__in IValueMap * This, VARIANT value); HRESULT ( STDMETHODCALLTYPE *Remove )( __RPC__in IValueMap * This, VARIANT value); HRESULT ( STDMETHODCALLTYPE *Clear )( __RPC__in IValueMap * This); HRESULT ( STDMETHODCALLTYPE *AddRange )( __RPC__in IValueMap * This, __RPC__in_opt IValueMap *map); HRESULT ( STDMETHODCALLTYPE *CreateValueMapItem )( __RPC__in IValueMap * This, /* [retval][out] */ __RPC__deref_out_opt IValueMapItem **Item); END_INTERFACE } IValueMapVtbl; interface IValueMap { CONST_VTBL struct IValueMapVtbl *lpVtbl; }; #ifdef COBJMACROS #define IValueMap_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IValueMap_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IValueMap_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IValueMap_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IValueMap_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IValueMap_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IValueMap_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IValueMap_get_Count(This,retVal) \ ( (This)->lpVtbl -> get_Count(This,retVal) ) #define IValueMap_get_Item(This,index,value) \ ( (This)->lpVtbl -> get_Item(This,index,value) ) #define IValueMap_get__NewEnum(This,retVal) \ ( (This)->lpVtbl -> get__NewEnum(This,retVal) ) #define IValueMap_get_Description(This,description) \ ( (This)->lpVtbl -> get_Description(This,description) ) #define IValueMap_put_Description(This,description) \ ( (This)->lpVtbl -> put_Description(This,description) ) #define IValueMap_get_Value(This,Value) \ ( (This)->lpVtbl -> get_Value(This,Value) ) #define IValueMap_put_Value(This,Value) \ ( (This)->lpVtbl -> put_Value(This,Value) ) #define IValueMap_get_ValueMapType(This,type) \ ( (This)->lpVtbl -> get_ValueMapType(This,type) ) #define IValueMap_put_ValueMapType(This,type) \ ( (This)->lpVtbl -> put_ValueMapType(This,type) ) #define IValueMap_Add(This,value) \ ( (This)->lpVtbl -> Add(This,value) ) #define IValueMap_Remove(This,value) \ ( (This)->lpVtbl -> Remove(This,value) ) #define IValueMap_Clear(This) \ ( (This)->lpVtbl -> Clear(This) ) #define IValueMap_AddRange(This,map) \ ( (This)->lpVtbl -> AddRange(This,map) ) #define IValueMap_CreateValueMapItem(This,Item) \ ( (This)->lpVtbl -> CreateValueMapItem(This,Item) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IValueMap_INTERFACE_DEFINED__ */ EXTERN_C const CLSID CLSID_DataCollectorSet; #ifdef __cplusplus class DECLSPEC_UUID("03837521-098b-11d8-9414-505054503030") DataCollectorSet; #endif EXTERN_C const CLSID CLSID_TraceSession; #ifdef __cplusplus class DECLSPEC_UUID("0383751c-098b-11d8-9414-505054503030") TraceSession; #endif EXTERN_C const CLSID CLSID_TraceSessionCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837530-098b-11d8-9414-505054503030") TraceSessionCollection; #endif EXTERN_C const CLSID CLSID_TraceDataProvider; #ifdef __cplusplus class DECLSPEC_UUID("03837513-098b-11d8-9414-505054503030") TraceDataProvider; #endif EXTERN_C const CLSID CLSID_TraceDataProviderCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837511-098b-11d8-9414-505054503030") TraceDataProviderCollection; #endif EXTERN_C const CLSID CLSID_DataCollectorSetCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837525-098b-11d8-9414-505054503030") DataCollectorSetCollection; #endif EXTERN_C const CLSID CLSID_LegacyDataCollectorSet; #ifdef __cplusplus class DECLSPEC_UUID("03837526-098b-11d8-9414-505054503030") LegacyDataCollectorSet; #endif EXTERN_C const CLSID CLSID_LegacyDataCollectorSetCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837527-098b-11d8-9414-505054503030") LegacyDataCollectorSetCollection; #endif EXTERN_C const CLSID CLSID_LegacyTraceSession; #ifdef __cplusplus class DECLSPEC_UUID("03837528-098b-11d8-9414-505054503030") LegacyTraceSession; #endif EXTERN_C const CLSID CLSID_LegacyTraceSessionCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837529-098b-11d8-9414-505054503030") LegacyTraceSessionCollection; #endif EXTERN_C const CLSID CLSID_ServerDataCollectorSet; #ifdef __cplusplus class DECLSPEC_UUID("03837531-098b-11d8-9414-505054503030") ServerDataCollectorSet; #endif EXTERN_C const CLSID CLSID_ServerDataCollectorSetCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837532-098b-11d8-9414-505054503030") ServerDataCollectorSetCollection; #endif EXTERN_C const CLSID CLSID_SystemDataCollectorSet; #ifdef __cplusplus class DECLSPEC_UUID("03837546-098b-11d8-9414-505054503030") SystemDataCollectorSet; #endif EXTERN_C const CLSID CLSID_SystemDataCollectorSetCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837547-098b-11d8-9414-505054503030") SystemDataCollectorSetCollection; #endif EXTERN_C const CLSID CLSID_BootTraceSession; #ifdef __cplusplus class DECLSPEC_UUID("03837538-098b-11d8-9414-505054503030") BootTraceSession; #endif EXTERN_C const CLSID CLSID_BootTraceSessionCollection; #ifdef __cplusplus class DECLSPEC_UUID("03837539-098b-11d8-9414-505054503030") BootTraceSessionCollection; #endif #endif /* __PlaLibrary_LIBRARY_DEFINED__ */ /* interface __MIDL_itf_pla_0000_0001 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion extern RPC_IF_HANDLE __MIDL_itf_pla_0000_0001_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_pla_0000_0001_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
[ "trent@trent.me" ]
trent@trent.me
779d217ae617c31d5c3e78688d0e96395c5415a5
716c5937830c8ce5f39b1225d946ed53ee9abe46
/Source/Messaging/MsgSound.h
d86110f34495ccae7967d748188634748e002d10
[ "MIT" ]
permissive
ensq/PACMANIA
3b130741aedc62b608c5f495a3e7ef903efa68d1
f3ab4e512d781c3511c8bc2621db871d30e164c7
refs/heads/master
2022-09-11T19:08:25.500275
2014-03-24T17:45:37
2014-03-24T17:45:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
427
h
#ifndef MSGSOUND_H #define MSGSOUND_H #include "../SoundEffect.h" class MsgSound : public Msg { private: SoundEffect effect; bool loop; protected: public: MsgSound(SoundEffect effect) : Msg(SOUND) { this->effect = effect; } MsgSound(MsgSound* msgSound) : Msg(SOUND) { effect = msgSound->getSoundEffect(); } virtual ~MsgSound() { } SoundEffect getSoundEffect() { return effect; } }; #endif //MSGSOUND_H
[ "davidgrelsson@gmail.com" ]
davidgrelsson@gmail.com
7341ef41d5b22b28aac22425d1af2226c7d087de
cfb6898c22dafe01fe3ccce6e7ef70a10a0d0cbc
/gammac/src/token.cpp
88adae5092fef93ad81d53a0296e779c63a065f0
[]
no_license
cdeguet/gamma
e74a9bf8d901afa0a637f45c8a0aabde27b3e0a9
dec5606d1589acc9fcc324027b4139e52c90f541
refs/heads/master
2021-08-28T11:35:39.362909
2017-09-08T15:04:05
2017-09-08T15:04:05
99,370,555
1
0
null
2021-08-20T12:13:35
2017-08-04T18:38:46
C++
UTF-8
C++
false
false
851
cpp
/* * Copyright (C) 2017 Cyril Deguet <cyril.deguet@gmail.com> * * 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 "token.hpp" std::ostream &operator<<(std::ostream &os, const Token &token) { return os << "<'" << token.lexeme << "'," << token.kind << "> at " << token.start.line << ":" << token.start.column; }
[ "cdeguet@amadeus.com" ]
cdeguet@amadeus.com
2bc522a23ce9e23e169d2eccd78a64ef6b7ed787
e8389dfaf892a410909f9fa975a30e8c83689b38
/engines/ep/src/collections/vbucket_manifest_handles.h
d8a7c4ac76cfbafa2a9c84ef68bc188b81dc9700
[ "Apache-2.0" ]
permissive
daverigby/kv_engine
9c03f13d6388e1f564a37eff125fda733d0caff8
82f8b20bcd3851bf31c196bd0f228b8c45eb0632
refs/heads/master
2022-12-10T12:36:36.917117
2020-08-05T10:18:24
2020-09-09T10:55:49
91,691,505
0
2
BSD-3-Clause
2019-10-11T14:02:25
2017-05-18T12:37:22
C++
UTF-8
C++
false
false
21,363
h
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2020 Couchbase, Inc * * 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. */ #pragma once #include "collections/vbucket_manifest.h" namespace Collections::VB { struct PersistedStats; /** * RAII read locking for access to the Manifest. */ class ReadHandle { public: /** * To keep the RAII style locking but also allow us to avoid extra * memory allocations we can provide a default constructor giving us * an unlocked ReadHandle and assign locked/default constructed * ReadHandles where required to lock/unlock a given manifest. Note, * a default constructed ReadHandle doesn't point to any manifest so * no other function in the ReadHandle should be called. */ ReadHandle() = default; ReadHandle(const Manifest* m, Manifest::mutex_type& lock) : readLock(lock), manifest(m) { } ReadHandle(ReadHandle&& rhs) : readLock(std::move(rhs.readLock)), manifest(rhs.manifest) { } ReadHandle& operator=(ReadHandle&& other) { readLock = std::move(other.readLock); manifest = std::move(other.manifest); return *this; } /** * Does the key contain a valid collection? * * - If the key applies to the default collection, the default * collection must exist. * * - If the key applies to a collection, the collection must exist and * must not be in the process of deletion. */ bool doesKeyContainValidCollection(DocKey key) const { return manifest->doesKeyContainValidCollection(key); } /** * Does the manifest know of the scope? * * @param scopeID the scopeID * @return true if it the scope is known */ bool isScopeValid(ScopeID scopeID) const { return manifest->isScopeValid(scopeID); } /** * Given a key and it's seqno, the manifest can determine if that key * is logically deleted - that is part of a collection which is in the * process of being erased. * * @return true if the key belongs to a deleted collection. */ bool isLogicallyDeleted(DocKey key, int64_t seqno) const { return manifest->isLogicallyDeleted(key, seqno); } /** * @returns true/false if _default exists */ bool doesDefaultCollectionExist() const { return manifest->doesDefaultCollectionExist(); } /** * @returns optional vector of CollectionIDs associated with the * scope. Returns uninitialized if the scope does not exist */ std::optional<std::vector<CollectionID>> getCollectionsForScope( ScopeID identifier) const { return manifest->getCollectionsForScope(identifier); } /** * @return true if the collection exists in the internal container */ bool exists(CollectionID identifier) const { return manifest->exists(identifier); } /** * @return scope-id of the collection if it exists */ std::optional<ScopeID> getScopeID(CollectionID identifier) const { return manifest->getScopeID(identifier); } /// @return the manifest UID that last updated this vb::manifest ManifestUid getManifestUid() const { return manifest->getManifestUid(); } uint64_t getItemCount(CollectionID collection) const { return manifest->getItemCount(collection); } uint64_t getHighSeqno(CollectionID collection) const { return manifest->getHighSeqno(collection); } uint64_t getPersistedHighSeqno(CollectionID collection) const { return manifest->getPersistedHighSeqno(collection); } /** * Set the persisted high seqno of the given colletion to the given * value * * @param collection The collection to update * @param value The value to update the persisted high seqno to * @param noThrow Should we suppress exceptions if we can't find the * collection? */ void setPersistedHighSeqno(CollectionID collection, uint64_t value, bool noThrow = false) const { manifest->setPersistedHighSeqno(collection, value, noThrow); } void setHighSeqno(CollectionID collection, uint64_t value) const { manifest->setHighSeqno(collection, value); } void incrementDiskCount(CollectionID collection) const { manifest->incrementDiskCount(collection); } void decrementDiskCount(CollectionID collection) const { manifest->decrementDiskCount(collection); } bool addCollectionStats(Vbid vbid, const void* cookie, const AddStatFn& add_stat) const { return manifest->addCollectionStats(vbid, cookie, add_stat); } bool addScopeStats(Vbid vbid, const void* cookie, const AddStatFn& add_stat) const { return manifest->addScopeStats(vbid, cookie, add_stat); } void updateSummary(Summary& summary) const { manifest->updateSummary(summary); } /** * @return true if a collection drop is in-progress, at least 1 * collection is in the state isDeleting */ bool isDropInProgress() const { return manifest->isDropInProgress(); } /** * Dump this VB::Manifest to std::cerr */ void dump() const; /** * We may wish to keep hold of a ReadHandle without actually keeping * hold of the lock to avoid unnecessary locking, in particular in * the PagingVisitor. To make the code more explicit (rather than * simply assigning a default constructed, unlocked ReadHandle, allow a * user to manually unlock the ReadHandle, after which it should not * be used. */ void unlock() { readLock.unlock(); manifest = nullptr; } /** * @return the number of system events that exist (as items) */ size_t getSystemEventItemCount() const { return manifest->getSystemEventItemCount(); } protected: friend std::ostream& operator<<(std::ostream& os, const ReadHandle& readHandle); Manifest::mutex_type::ReadHolder readLock{nullptr}; const Manifest* manifest{nullptr}; }; /** * CachingReadHandle provides a limited set of functions to allow various * functional paths in KV-engine to perform multiple collection 'legality' * checks with one map lookup. * * The pattern is that the caller creates a CachingReadHandle and during * creation of the object, the collection entry is located (or not) and * the data cached * * The caller next can check if the read handle represents a valid * collection, allowing code to return 'unknown_collection'. * * Finally a caller can pass a seqno into the isLogicallyDeleted function * to test if that seqno is a logically deleted key. The seqno should have * been found by searching for the key used during in construction. * * Privately inherited from ReadHandle so we have a readlock/manifest * without exposing the ReadHandle public methods that don't quite fit in * this class. */ class CachingReadHandle : private ReadHandle { public: /** * @param m Manifest object to use for lookups * @param lock which to pass to parent ReadHandle * @param key the key to use for lookups, if the key is a system key * the collection-id is extracted from the key * @param tag to differentiate from more common construction below */ CachingReadHandle(const Manifest* m, Manifest::mutex_type& lock, DocKey key, Manifest::AllowSystemKeys tag) : ReadHandle(m, lock), itr(m->getManifestEntry(key, tag)), key(key) { } CachingReadHandle(const Manifest* m, Manifest::mutex_type& lock, DocKey key) : ReadHandle(m, lock), itr(m->getManifestEntry(key)), key(key) { } /** * @return true if the key used in construction is associated with a * valid and open collection. */ bool valid() const { return itr != manifest->end(); } /** * @return the key used in construction */ DocKey getKey() const { return key; } /** * @param a seqno to check, the seqno should belong to the document * identified by the key returned by ::getKey() * @return true if the key@seqno is logically deleted. */ bool isLogicallyDeleted(int64_t seqno) const { return manifest->isLogicallyDeleted(itr, seqno); } /// @return the manifest UID that last updated this vb::manifest ManifestUid getManifestUid() const { return manifest->getManifestUid(); } /** * This increment is possible via this CachingReadHandle, which has * shared access to the Manifest, because the read-lock only ensures * that the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the item count, hence this * method is marked const because the manifest is const. * * increment the key's collection item count by 1 */ void incrementDiskCount() const { // We may be flushing keys written to a dropped collection so can // have an invalid iterator or the id is not mapped (system) if (!valid()) { return; } return manifest->incrementDiskCount(itr); } /** * This decrement is possible via this CachingReadHandle, which has * shared access to the Manifest, because the read-lock only ensures * that the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the item count, hence this * method is marked const because the manifest is const. * * decrement the key's collection item count by 1 */ void decrementDiskCount() const { // We may be flushing keys written to a dropped collection so can // have an invalid iterator or the id is not mapped (system) if (!valid()) { return; } return manifest->decrementDiskCount(itr); } /** * This update is possible via this CachingReadHandle, which has * shared access to the Manifest, because the read-lock only ensures * that the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the on disk size, hence this * method is marked const because the manifest is const. * * Adjust the tracked total on disk size for the collection by the * given delta. */ void updateDiskSize(ssize_t delta) const { // We may be flushing keys written to a dropped collection so can // have an invalid iterator or the id is not mapped (system) if (!valid()) { return; } return manifest->updateDiskSize(itr, delta); } /** * This set is possible via this CachingReadHandle, which has shared * access to the Manifest, because the read-lock only ensures that * the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the item count, hence this * method is marked const because the manifest is const. * * set the high seqno of the collection if the new value is * higher */ void setHighSeqno(uint64_t value) const { // We may be flushing keys written to a dropped collection so can // have an invalid iterator or the id is not mapped (system) if (!valid()) { return; } manifest->setHighSeqno(itr, value); } /** * This set is possible via this CachingReadHandle, which has shared * access to the Manifest, because the read-lock only ensures that * the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the item count, hence this * method is marked const because the manifest is const. * * set the persisted high seqno of the collection if the new value is * higher */ bool setPersistedHighSeqno(uint64_t value) const { // We may be flushing keys written to a dropped collection so can // have an invalid iterator if (!valid()) { return false; } return manifest->setPersistedHighSeqno(itr, value); } /** * This set is possible via this CachingReadHandle, which has shared * access to the Manifest, because the read-lock only ensures that * the underlying collection map doesn't change. Data inside the * collection entry maybe mutable, such as the item count, hence this * method is marked const because the manifest is const. * * reset the persisted high seqno of the collection to the new value, * regardless of if it is greater than the current value */ void resetPersistedHighSeqno(uint64_t value) const { manifest->resetPersistedHighSeqno(itr, value); } /** * Check the Item's exptime against its collection config. * If the collection defines a maxTTL and the Item has no expiry or * an exptime which exceeds the maxTTL, set the expiry of the Item * based on the collection maxTTL. * * @param itm The reference to the Item to check and change if needed * @param bucketTtl the value of the bucket's maxTTL, 0 being none */ void processExpiryTime(Item& itm, std::chrono::seconds bucketTtl) const { manifest->processExpiryTime(itr, itm, bucketTtl); } /** * t represents an absolute expiry time and this method returns t or a * limited expiry time, based on the values of the bucketTtl and the * collection's maxTTL. * * @param t an expiry time to process * @param bucketTtl the value of the bucket's maxTTL, 0 being none * @returns t or now + appropriate limit */ time_t processExpiryTime(time_t t, std::chrono::seconds bucketTtl) const { return manifest->processExpiryTime(itr, t, bucketTtl); } /** * @return the scopeID of the collection associated with the handle */ ScopeID getScopeID() const { return itr->second.getScopeID(); } void incrementOpsStore() const { if (!valid()) { return; } return itr->second.incrementOpsStore(); } void incrementOpsDelete() const { if (!valid()) { return; } return itr->second.incrementOpsDelete(); } void incrementOpsGet() const { if (!valid()) { return; } return itr->second.incrementOpsGet(); } /** * Dump this VB::Manifest to std::cerr */ void dump(); protected: friend std::ostream& operator<<(std::ostream& os, const CachingReadHandle& readHandle); /** * An iterator for the key's collection, or end() if the key has no * valid collection. */ Manifest::container::const_iterator itr; /** * The key used in construction of this handle. */ DocKey key; }; /** * RAII read locking for access to the manifest stats */ class StatsReadHandle : private ReadHandle { public: StatsReadHandle(const Manifest* m, Manifest::mutex_type& lock, CollectionID cid) : ReadHandle(m, lock), itr(m->getManifestIterator(cid)) { } PersistedStats getPersistedStats() const; bool valid() const { return itr != manifest->end(); } void dump(); protected: friend std::ostream& operator<<(std::ostream& os, const CachingReadHandle& readHandle); /** * An iterator for the key's collection, or end() if the key has no * valid collection. */ Manifest::container::const_iterator itr; }; /** * RAII write locking for access and updates to the Manifest. */ class WriteHandle { public: WriteHandle(Manifest& m, Manifest::mutex_type& lock) : writeLock(lock), manifest(m) { } WriteHandle(WriteHandle&& rhs) : writeLock(std::move(rhs.writeLock)), manifest(rhs.manifest) { } WriteHandle(Manifest& m, Manifest::mutex_type::UpgradeHolder&& upgradeHolder) : writeLock(std::move(upgradeHolder)), manifest(m) { } /** * Add a collection for a replica VB, this is for receiving * collection updates via DCP and the collection already has a start * seqno assigned. * * @param vb The vbucket to add the collection to. * @param manifestUid the uid of the manifest which made the change * @param identifiers ScopeID and CollectionID pair * @param collectionName name of the added collection * @param maxTtl An optional maxTtl for the collection * @param startSeqno The start-seqno assigned to the collection. */ void replicaAdd(::VBucket& vb, ManifestUid manifestUid, ScopeCollectionPair identifiers, std::string_view collectionName, cb::ExpiryLimit maxTtl, int64_t startSeqno) { manifest.addCollection(*this, vb, manifestUid, identifiers, collectionName, maxTtl, OptionalSeqno{startSeqno}); } /** * Drop collection for a replica VB, this is for receiving * collection updates via DCP and the collection already has an end * seqno assigned. * * @param vb The vbucket to drop collection from * @param manifestUid the uid of the manifest which made the change * @param cid CollectionID to drop * @param endSeqno The end-seqno assigned to the end collection. */ void replicaDrop(::VBucket& vb, ManifestUid manifestUid, CollectionID cid, int64_t endSeqno) { manifest.dropCollection( *this, vb, manifestUid, cid, OptionalSeqno{endSeqno}); } /** * Add a scope for a replica VB * * @param vb The vbucket to add the scope to * @param manifestUid the uid of the manifest which made the change * @param sid ScopeID of the new scope * @param scopeName name of the added scope * @param startSeqno The start-seqno assigned to the scope */ void replicaAddScope(::VBucket& vb, ManifestUid manifestUid, ScopeID sid, std::string_view scopeName, int64_t startSeqno) { manifest.addScope(*this, vb, manifestUid, sid, scopeName, OptionalSeqno{startSeqno}); } /** * Drop a scope for a replica VB * * @param vb The vbucket to drop the scope from * @param manifestUid the uid of the manifest which made the change * @param sid ScopeID to drop * @param endSeqno The end-seqno assigned to the scope drop */ void replicaDropScope(::VBucket& vb, ManifestUid manifestUid, ScopeID sid, int64_t endSeqno) { manifest.dropScope( *this, vb, manifestUid, sid, OptionalSeqno{endSeqno}); } /** * When we create system events we do so under a WriteHandle. To * properly increment the high seqno of the collection for a given * system event we need to be able to do so using this handle. * * Function is const as constness refers to the state of the manifest, * not the state of the manifest entries within it. * * @param collection the collection ID of the manifest entry to update * @param value the new high seqno */ void setHighSeqno(CollectionID collection, uint64_t value) const { manifest.setHighSeqno(collection, value); } /// @return iterator to the beginning of the underlying collection map Manifest::container::iterator begin() { return manifest.begin(); } /// @return iterator to the end of the underlying collection map Manifest::container::iterator end() { return manifest.end(); } /** * Dump this VB::Manifest to std::cerr */ void dump(); private: Manifest::mutex_type::WriteHolder writeLock; Manifest& manifest; }; } // namespace Collections::VB
[ "daver@couchbase.com" ]
daver@couchbase.com
7bcd9c925c0ca2d2443eb5aa490f7fe75fbb9f82
35f8526b274760e72d35d426600b6bf435b91e50
/src/component/propertydef.cpp
107b62731674dbde4cc51e0be7bf32c2614d9882
[]
no_license
madeso/pwn-engine
f9ca6a4551edbad719ff2c6999e5fc9e97b6a211
c4767e5d798d5768e1bbf8a9ac73b6fb186ae497
refs/heads/master
2021-01-20T04:31:06.326355
2020-06-14T13:31:36
2020-06-14T13:31:36
33,419,254
0
0
null
null
null
null
UTF-8
C++
false
false
82
cpp
#include <pwn/component/propertydef.h> namespace pwn { namespace component { } }
[ "sir.gustav.the.coder@gmail.com" ]
sir.gustav.the.coder@gmail.com
0a8a163b3046075bb5724c40baf0809c21e264d9
695d54ab3e8b432f9687c1475206731d9a4c0211
/RPC/RPC2017-6/H.cpp
186b823659e74dd0e0fa07df6887daec7e233046
[]
no_license
JuanPabloRN30/Competitive_Programming
74c388f3a38235858818cff68ab1ff36d2262518
65394a531cc300a503356b1e09a4e9987310cf82
refs/heads/master
2020-07-09T04:38:25.785834
2017-09-29T19:26:10
2017-09-29T19:26:10
66,211,726
0
0
null
null
null
null
UTF-8
C++
false
false
1,269
cpp
#include <iostream> #include <vector> using namespace std; #define INF 1e9 unsigned long long inv; void merge(int arr[], int low, int mid, int high) { int n1 = mid - low + 1; int n2 = high - mid; vector < int > left( n1+1, 0 ); vector < int > right( n2+1, 0 ); for( int i = 0 ; i < n1 ; i++ ) { left[ i ] = arr[ low + i ]; } for( int i = 0 ; i < n2 ; i++ ) { right[ i ] = arr[ mid + i + 1]; } left[ n1 ] = INF; right[ n2 ] = INF; int i,j; i = j = 0; for( int k = low ; k <= high ; k++ ) { if( left[ i ] <= right[ j ] ) { arr[ k ] = left[ i ]; i++; } else { arr[ k ] = right[ j ]; j++; inv = inv + n1 - i; } } } void mergesort( int arr[], int low , int high ) { if( low < high ) { int mid = (low + high) >> 1; mergesort( arr, low, mid ); mergesort( arr, mid + 1, high ); merge( arr,low, mid, high ); } } int main() { int n; ios::sync_with_stdio(0); cin.tie(0); while( cin >> n && n) { inv = 0; int arr[ n ]; for( int i = 0 ; i < n ; i++ ) cin >> arr[ i ]; mergesort( arr, 0, n-1 ); // for( int i = 0 ; i < n ; i++ ) // cout << arr[ i ] << '\n'; cout << inv << '\n'; } return 0; }
[ "juanpablorn30@gmail.com" ]
juanpablorn30@gmail.com
2ed31d4cb83e799a10b3574fb347da6ee71042d0
6f2b6e9d77fc4dd5e1dae8ba6e5a66eb7c7ae849
/sstd_boost/sstd/boost/geometry/algorithms/detail/overlay/assign_parents.hpp
67af1892a4e222ba87e16a6075b2cfda641f241b
[ "BSL-1.0" ]
permissive
KqSMea8/sstd_library
9e4e622e1b01bed5de7322c2682539400d13dd58
0fcb815f50d538517e70a788914da7fbbe786ce1
refs/heads/master
2020-05-03T21:07:01.650034
2019-04-01T00:10:47
2019-04-01T00:10:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,116
hpp
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017. // Modifications copyright (c) 2017 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSIGN_PARENTS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSIGN_PARENTS_HPP #include <sstd/boost/range.hpp> #include <sstd/boost/geometry/algorithms/area.hpp> #include <sstd/boost/geometry/algorithms/envelope.hpp> #include <sstd/boost/geometry/algorithms/expand.hpp> #include <sstd/boost/geometry/algorithms/detail/partition.hpp> #include <sstd/boost/geometry/algorithms/detail/overlay/get_ring.hpp> #include <sstd/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp> #include <sstd/boost/geometry/algorithms/covered_by.hpp> #include <sstd/boost/geometry/geometries/box.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace overlay { template < typename Item, typename InnerGeometry, typename Geometry1, typename Geometry2, typename RingCollection, typename Strategy > static inline bool within_selected_input(Item const& item2, InnerGeometry const& inner_geometry, ring_identifier const& outer_id, Geometry1 const& geometry1, Geometry2 const& geometry2, RingCollection const& collection, Strategy const& strategy) { typedef typename geometry::tag<Geometry1>::type tag1; typedef typename geometry::tag<Geometry2>::type tag2; // NOTE: range_in_geometry first checks the item2.point and then // if this point is on boundary it checks points of inner_geometry // ring until a point inside/outside other geometry ring is found switch (outer_id.source_index) { // covered_by case 0 : return range_in_geometry(item2.point, inner_geometry, get_ring<tag1>::apply(outer_id, geometry1), strategy) >= 0; case 1 : return range_in_geometry(item2.point, inner_geometry, get_ring<tag2>::apply(outer_id, geometry2), strategy) >= 0; case 2 : return range_in_geometry(item2.point, inner_geometry, get_ring<void>::apply(outer_id, collection), strategy) >= 0; } return false; } template < typename Item, typename Geometry1, typename Geometry2, typename RingCollection, typename Strategy > static inline bool within_selected_input(Item const& item2, ring_identifier const& inner_id, ring_identifier const& outer_id, Geometry1 const& geometry1, Geometry2 const& geometry2, RingCollection const& collection, Strategy const& strategy) { typedef typename geometry::tag<Geometry1>::type tag1; typedef typename geometry::tag<Geometry2>::type tag2; switch (inner_id.source_index) { case 0 : return within_selected_input(item2, get_ring<tag1>::apply(inner_id, geometry1), outer_id, geometry1, geometry2, collection, strategy); case 1 : return within_selected_input(item2, get_ring<tag2>::apply(inner_id, geometry2), outer_id, geometry1, geometry2, collection, strategy); case 2 : return within_selected_input(item2, get_ring<void>::apply(inner_id, collection), outer_id, geometry1, geometry2, collection, strategy); } return false; } template <typename Point, typename AreaType> struct ring_info_helper { ring_identifier id; AreaType real_area; AreaType abs_area; model::box<Point> envelope; inline ring_info_helper() : real_area(0), abs_area(0) {} inline ring_info_helper(ring_identifier i, AreaType const& a) : id(i), real_area(a), abs_area(geometry::math::abs(a)) {} }; struct ring_info_helper_get_box { template <typename Box, typename InputItem> static inline void apply(Box& total, InputItem const& item) { geometry::expand(total, item.envelope); } }; struct ring_info_helper_ovelaps_box { template <typename Box, typename InputItem> static inline bool apply(Box const& box, InputItem const& item) { return ! geometry::detail::disjoint::disjoint_box_box(box, item.envelope); } }; template < typename Geometry1, typename Geometry2, typename Collection, typename RingMap, typename Strategy > struct assign_visitor { typedef typename RingMap::mapped_type ring_info_type; Geometry1 const& m_geometry1; Geometry2 const& m_geometry2; Collection const& m_collection; RingMap& m_ring_map; Strategy const& m_strategy; bool m_check_for_orientation; inline assign_visitor(Geometry1 const& g1, Geometry2 const& g2, Collection const& c, RingMap& map, Strategy const& strategy, bool check) : m_geometry1(g1) , m_geometry2(g2) , m_collection(c) , m_ring_map(map) , m_strategy(strategy) , m_check_for_orientation(check) {} template <typename Item> inline bool apply(Item const& outer, Item const& inner, bool first = true) { if (first && outer.abs_area < inner.abs_area) { // Apply with reversed arguments apply(inner, outer, false); return true; } if (m_check_for_orientation || (math::larger(outer.real_area, 0) && math::smaller(inner.real_area, 0))) { ring_info_type& inner_in_map = m_ring_map[inner.id]; if (geometry::covered_by(inner_in_map.point, outer.envelope) && within_selected_input(inner_in_map, inner.id, outer.id, m_geometry1, m_geometry2, m_collection, m_strategy) ) { // Assign a parent if there was no earlier parent, or the newly // found parent is smaller than the previous one if (inner_in_map.parent.source_index == -1 || outer.abs_area < inner_in_map.parent_area) { inner_in_map.parent = outer.id; inner_in_map.parent_area = outer.abs_area; } } } return true; } }; template < overlay_type OverlayType, typename Geometry1, typename Geometry2, typename RingCollection, typename RingMap, typename Strategy > inline void assign_parents(Geometry1 const& geometry1, Geometry2 const& geometry2, RingCollection const& collection, RingMap& ring_map, Strategy const& strategy) { static bool const is_difference = OverlayType == overlay_difference; static bool const is_buffer = OverlayType == overlay_buffer; static bool const is_dissolve = OverlayType == overlay_dissolve; static bool const check_for_orientation = is_buffer || is_dissolve; typedef typename geometry::tag<Geometry1>::type tag1; typedef typename geometry::tag<Geometry2>::type tag2; typedef typename RingMap::mapped_type ring_info_type; typedef typename ring_info_type::point_type point_type; typedef model::box<point_type> box_type; typedef typename Strategy::template area_strategy < point_type >::type::template result_type<point_type>::type area_result_type; typedef typename RingMap::iterator map_iterator_type; { typedef ring_info_helper<point_type, area_result_type> helper; typedef std::vector<helper> vector_type; typedef typename boost::range_iterator<vector_type const>::type vector_iterator_type; std::size_t count_total = ring_map.size(); std::size_t count_positive = 0; std::size_t index_positive = 0; // only used if count_positive>0 std::size_t index = 0; // Copy to vector (with new approach this might be obsolete as well, using the map directly) vector_type vector(count_total); for (map_iterator_type it = boost::begin(ring_map); it != boost::end(ring_map); ++it, ++index) { vector[index] = helper(it->first, it->second.get_area()); helper& item = vector[index]; switch(it->first.source_index) { case 0 : geometry::envelope(get_ring<tag1>::apply(it->first, geometry1), item.envelope, strategy.get_envelope_strategy()); break; case 1 : geometry::envelope(get_ring<tag2>::apply(it->first, geometry2), item.envelope, strategy.get_envelope_strategy()); break; case 2 : geometry::envelope(get_ring<void>::apply(it->first, collection), item.envelope, strategy.get_envelope_strategy()); break; } // Expand envelope slightly expand_by_epsilon(item.envelope); if (item.real_area > 0) { count_positive++; index_positive = index; } } if (! check_for_orientation) { if (count_positive == count_total) { // Optimization for only positive rings // -> no assignment of parents or reversal necessary, ready here. return; } if (count_positive == 1 && ! is_difference && ! is_dissolve) { // Optimization for one outer ring // -> assign this as parent to all others (all interior rings) // In unions, this is probably the most occuring case and gives // a dramatic improvement (factor 5 for star_comb testcase) // In difference or other cases where interior rings might be // located outside the outer ring, this cannot be done ring_identifier id_of_positive = vector[index_positive].id; ring_info_type& outer = ring_map[id_of_positive]; index = 0; for (vector_iterator_type it = boost::begin(vector); it != boost::end(vector); ++it, ++index) { if (index != index_positive) { ring_info_type& inner = ring_map[it->id]; inner.parent = id_of_positive; outer.children.push_back(it->id); } } return; } } assign_visitor < Geometry1, Geometry2, RingCollection, RingMap, Strategy > visitor(geometry1, geometry2, collection, ring_map, strategy, check_for_orientation); geometry::partition < box_type >::apply(vector, visitor, ring_info_helper_get_box(), ring_info_helper_ovelaps_box()); } if (check_for_orientation) { for (map_iterator_type it = boost::begin(ring_map); it != boost::end(ring_map); ++it) { ring_info_type& info = it->second; if (geometry::math::equals(info.get_area(), 0)) { info.discarded = true; } else if (info.parent.source_index >= 0) { const ring_info_type& parent = ring_map[info.parent]; bool const pos = math::larger(info.get_area(), 0); bool const parent_pos = math::larger(parent.area, 0); bool const double_neg = is_dissolve && ! pos && ! parent_pos; if ((pos && parent_pos) || double_neg) { // Discard positive inner ring with positive parent // Also, for some cases (dissolve), negative inner ring // with negative parent should be discarded info.discarded = true; } if (pos || info.discarded) { // Remove parent ID from any positive or discarded inner rings info.parent.source_index = -1; } } else if (info.parent.source_index < 0 && math::smaller(info.get_area(), 0)) { // Reverse negative ring without parent info.reversed = true; } } } // Assign childlist for (map_iterator_type it = boost::begin(ring_map); it != boost::end(ring_map); ++it) { if (it->second.parent.source_index >= 0) { ring_map[it->second.parent].children.push_back(it->first); } } } // Version for one geometry (called by buffer/dissolve) template < overlay_type OverlayType, typename Geometry, typename RingCollection, typename RingMap, typename Strategy > inline void assign_parents(Geometry const& geometry, RingCollection const& collection, RingMap& ring_map, Strategy const& strategy) { // Call it with an empty geometry as second geometry (source_id == 1) // (ring_map should be empty for source_id==1) Geometry empty; assign_parents<OverlayType>(geometry, empty, collection, ring_map, strategy); } }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL }} // namespace geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSIGN_PARENTS_HPP
[ "zhaixueqiang@hotmail.com" ]
zhaixueqiang@hotmail.com
c7e55d59d6690ca601b4594610dc22f1e99ab61d
778df5c394d2ecdf2aad84ce3730d8ac5f6a5d6f
/Exercise/6.Arrays/LinearSearch/stdafx.cpp
b50e1ec3a1619ad463d12703b1e2a04152af833a
[]
no_license
prasadtelkikar/C-How-To-Program-by-Deitel
f918cb6e167afffb540fcc870d2abb7758040a02
8a4d5939381b2b1677e26b1cea10e00b5a63ab79
refs/heads/master
2020-04-06T04:26:38.831772
2017-06-20T17:10:47
2017-06-20T17:10:47
82,921,177
3
1
null
2017-05-03T12:36:48
2017-02-23T11:34:38
C++
UTF-8
C++
false
false
291
cpp
// stdafx.cpp : source file that includes just the standard includes // LinearSearch.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
[ "telkikar.prasad@gmail.com" ]
telkikar.prasad@gmail.com
c865f652a85691c528d257633af41df5c1dd6286
8669adfe56247b9634e8cfa43a1123b30e9cbdd2
/CardType/powerpc/codemcwi/modules/prj_bts/layer3/tVoice/SRC/localSa9.cpp
bb7bae71c60ef027216d3eaa592070a309b12b78
[]
no_license
wl1244648145/xinwei
308f1c4f64da89ba978f5bf7eb52b6ba121e01c6
6a2e4c85ac59eda78de5a5192de14995dee9e1fb
refs/heads/master
2022-12-03T15:24:12.398873
2020-08-23T04:16:04
2020-08-23T04:16:04
null
0
0
null
null
null
null
GB18030
C++
false
false
18,641
cpp
/******************************************************************************* * Copyright (c) 2010 by Beijing AP Co.Ltd.All Rights Reserved * File Name : localSagSrvCfgFile.cpp * Create Date : 24-Jan-2010 * programmer :fb * description : * functions : * Modify History : *******************************************************************************/ #include "localSag.h" #include "localSagCfg.h" #include "voiceToolFunc.h" #include "stdio.h" bool CSAG::isUserInACL(UINT32 uid, UINT32 pid) { map<UINT32, UINT32, less<UINT32> >::iterator it = m_AccessLst.find(uid); return (it==m_AccessLst.end()) ? false: ((*it).second==pid); } void CSAG::addACLUser(UINT32 uid, UINT32 pid) { if(INVALID_UID==uid ||0==uid || NO_EID==pid || 0==pid) return ; map<UINT32, UINT32, less<UINT32> >::iterator it = m_AccessLst.find(uid); if(m_AccessLst.end()!=it) { LOG4(LOG_SEVERE, LOGNO(SAG, EC_L3VOICE_NORMAL), "{uid[0x%08X] pid[0x%08X]} already in ACL when adding {uid[0x%08X] pid[0x%08X]}!!!", (*it).first, (*it).second, uid, pid); } else { m_AccessLst.insert(map<UINT32, UINT32, less<UINT32> >::value_type(uid,pid)); } } void CSAG::delACLUser(UINT32 uid) { if(INVALID_UID==uid || 0==uid) return; map<UINT32, UINT32, less<UINT32> >::iterator it = m_AccessLst.find(uid); if(m_AccessLst.end()!=it) m_AccessLst.erase(it); } bool CSAG::findUserInfoByUID(UINT32 uid, map<UINT32, userInfo, less<UINT32> >::iterator& itFound) { map<UINT32, userInfo, less<UINT32> >::iterator it = m_UserInfoTbl.find(uid); if(m_UserInfoTbl.end()==it) { return false; } else { itFound = it; return true; } } void CSAG::addUserInfo(UINT32 uid, UINT32 pid, char* telNO, UINT8 prio) { if(INVALID_UID==uid || 0==uid || NO_EID==pid || 0==pid) return; map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(!findUserInfoByUID(uid, itFound)) { userInfo UserInfo(uid, pid, prio, telNO); m_UserInfoTbl.insert(map<UINT32,userInfo,less<UINT32> >::value_type(uid, UserInfo)); } else { LOG4(LOG_SEVERE, LOGNO(SAG, EC_L3VOICE_NORMAL), "{uid[0x%08X] pid[0x%08X] } already in ACL when adding {uid[0x%08X] pid[0x%08X] }!!!", (*itFound).second.uid, (*itFound).second.pid, uid, pid); } } void CSAG::delUserInfo(UINT32 uid) { if(INVALID_UID==uid || 0==uid) return; map<UINT32, userInfo, less<UINT32> >::iterator it = m_UserInfoTbl.find(uid); if(m_UserInfoTbl.end()!=it) { (*it).second.grpUserInfoTbl.clear(); m_UserInfoTbl.erase(it); } } void CSAG::showACL(UINT32 uid) { VPRINT("\nshowXXX(AAA), AAA=0 means showAllXXX\n"); map<UINT32, UINT32 >::iterator itUID; //show ALL if(0==uid || INVALID_UID==uid) { VPRINT("\n===================================================================="); VPRINT("\n----------ACL Size[%d] Format[ UID , PID ]-------", m_AccessLst.size()); int count = 0; for(itUID=m_AccessLst.begin();itUID!=m_AccessLst.end();itUID++) { if(!(count++ & 0x03)) { VPRINT("\n"); } VPRINT("0x%08X,0x%08X|", (*itUID).first, (*itUID).second); } VPRINT("\n====================================================================\n"); } //show the one wanted else { itUID = m_AccessLst.find(uid); if(itUID!=m_AccessLst.end()) { VPRINT("\n [ 0x%08X , 0x%08X ] in ACL...\n", (*itUID).first, (*itUID).second); } else { VPRINT("\nUID[0x%08X] not in ACL...\n", uid); } } } UINT32 CSAG::saveACLToFile(char *pBuf, UINT32 *pSize) { if(NULL==pBuf || NULL==pSize) return 0; char *pNow = pBuf; UINT32 nLen = 0; nLen = sprintf(pNow, "PID,UID\n"); pNow += nLen; map<UINT32, UINT32 >::iterator itUID; for(itUID=m_AccessLst.begin();itUID!=m_AccessLst.end();itUID++) { nLen = sprintf(pNow, "0x%08X,0x%08X\n", (*itUID).second, (*itUID).first); pNow +=nLen; } return (*pSize = (pNow-pBuf+1)); } void CSAG::clearACL() { m_AccessLst.clear(); } void CSAG::initACLFromFile(char *pBuf, UINT32 size) { m_AccessLst.clear(); //long lines=0; long lineLen=0; long spaceLen=0; char line[256]; long LeftLen=size; char *pReadBuf = pBuf; char *pEnd = pBuf + size; while(pReadBuf<pEnd) { pReadBuf = jumpSpaces(pReadBuf, LeftLen, &spaceLen); LeftLen -= spaceLen; if(0==pReadBuf[0]) { return; } if(1==sscanf(pReadBuf,"%s",line)) { lineLen = strlen(line); LeftLen -= lineLen; pReadBuf += lineLen; //VPRINT("\n[%d] line[%s] len[%d]", ++lines, line, lineLen); //PID,UID UINT32 pid,uid; if(2==sscanf(line, "%x,%x", &pid, &uid)) { addACLUser(uid, pid); } else { //skip useless lines } } else { //error } } } extern bool sagStatusFlag; bool CSAG::ifAllowUserAccess(UINT32 pid, UINT32 uid) { //使用用户列表文件意味着故障弱化时只允许文件中的用户接入 if(g_blUseUserListFile) { if(!sagStatusFlag) { bool ret = isUserInACL(uid, pid); if(ret) { return true; } else { LOG2(LOG_DEBUG3, LOGNO(SAG, EC_L3VOICE_NORMAL), "PID[0x%08X] UID[0x%08X] not in ACL when using localSag.", pid, uid); return false; } } } return true; } extern "C" bool ifCpeCanAccess(UINT32 pid, UINT32 uid) { return CSAG::getSagInstance()->ifAllowUserAccess(pid, uid); } void CSAG::initUserInfoFromFile(char *pBuf, UINT32 size) { clearAllUserInfo(); //long lines=0; long lineLen=0; long spaceLen=0; char line[256]; long LeftLen=size; char *pReadBuf = pBuf; char *pEnd = pBuf + size; while(pReadBuf<pEnd) { pReadBuf = jumpSpaces(pReadBuf, LeftLen, &spaceLen); LeftLen -= spaceLen; if(0==pReadBuf[0]) { return; } if(1==sscanf(pReadBuf,"%s",line)) { lineLen = strlen(line); LeftLen -= lineLen; pReadBuf += lineLen; //VPRINT("\n[%d] line[%s] len[%d]", ++lines, line, lineLen); //PID,UID,电话号码,个呼优先级 char sep[]=","; UINT32 pid,uid; UINT8 prio; char telNO[M_MAX_PHONE_NUMBER_LEN]; char *pNext = NULL; char *pItem = NULL; pItem = own_strtok_r(line, sep, &pNext); pid = strtoul(pItem, NULL, 16); if(0==pid || 0xffffffff==pid) continue; pItem = own_strtok_r(NULL, sep, &pNext); uid = strtoul(pItem, NULL, 16); if(0==uid || 0xffffffff==uid) continue; pItem = own_strtok_r(NULL, sep, &pNext); strcpy(telNO, pItem); pItem = own_strtok_r(NULL, sep, &pNext); prio = strtoul(pItem, NULL, 16) & 0xff; //add user info addUserInfo(uid, pid, telNO, prio); } else { //error or end } } } void CSAG::addUserGrpInfo(UINT32 uid, UINT16 gid, UINT8 prioInGrp) { if(INVALID_UID==uid ||0==uid || M_INVALID_GID==gid || 0==gid) return ; map<UINT16, grpInfo, less<UINT16> >::iterator itFoundGrp; if(!findGrpInfoByGID(gid, itFoundGrp)) { LOG2(LOG_WARN, LOGNO(SAG, EC_L3VOICE_NORMAL), "GrpInfo not found when addUserGrpInfo {uid[0x%08X] gid[0x%04X]}!!!", uid, gid); return; } map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(findUserInfoByUID(uid, itFound)) { map<UINT16,grpUserInfo,less<UINT16> >::iterator it = (*itFound).second.grpUserInfoTbl.find(gid); if((*itFound).second.grpUserInfoTbl.end()!=it) { LOG4(LOG_SEVERE, LOGNO(SAG, EC_L3VOICE_NORMAL), "{uid[0x%08X] gid[0x%04X]} already in grpUserInfoTbl when adding {uid[0x%08X] gid[0x%04X]}!!!", (*itFound).second.uid, (*it).second.gid, uid, gid); } else { grpUserInfo grpUserInfoItem(gid, prioInGrp); (*itFound).second.grpUserInfoTbl.insert(map<UINT16, grpUserInfo, less<UINT16> >::value_type(gid,grpUserInfoItem)); } } else { LOG2(LOG_WARN, LOGNO(SAG, EC_L3VOICE_NORMAL), "userInfo not found when addUserGrpInfo {uid[0x%08X] gid[0x%04X]}!!!", uid, gid); } } void CSAG::delUserGrpInfo(UINT32 uid, UINT16 gid) { map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(findUserInfoByUID(uid, itFound)) { map<UINT16,grpUserInfo,less<UINT16> >::iterator it = (*itFound).second.grpUserInfoTbl.find(gid); if((*itFound).second.grpUserInfoTbl.end()!=it) { (*itFound).second.grpUserInfoTbl.erase(it); } else { LOG2(LOG_DEBUG3, LOGNO(SAG, EC_L3VOICE_NORMAL), "delUserGrpInfo,uid[0x%08X] gid[0x%04X], user not in group!!!", uid, gid); } } else { LOG2(LOG_DEBUG3, LOGNO(SAG, EC_L3VOICE_NORMAL), "userInfo not found when delUserGrpInfo {uid[0x%08X] gid[0x%04X]}!!!", uid, gid); } } void CSAG::clearUserGrpInfo(UINT32 uid) { map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(findUserInfoByUID(uid, itFound)) { (*itFound).second.grpUserInfoTbl.clear(); } } bool CSAG::findGrpInfoByGID(UINT16 gid, map<UINT16, grpInfo, less<UINT16> >::iterator& itFound) { map<UINT16, grpInfo, less<UINT16> >::iterator it = m_GrpInfoTbl.find(gid); if(m_GrpInfoTbl.end()==it) { return false; } else { itFound = it; return true; } } void CSAG::addGrpInfo(UINT16 gid, char* grpName, UINT8 grpPrio) { if(M_INVALID_GID==gid || 0==gid) return; map<UINT16, grpInfo, less<UINT16> >::iterator itFound; if(!findGrpInfoByGID(gid, itFound)) { grpInfo GrpInfo(gid, grpPrio, grpName); m_GrpInfoTbl.insert(map<UINT16,grpInfo,less<UINT16> >::value_type(gid, GrpInfo)); } else { LOG4(LOG_SEVERE, LOGNO(SAG, EC_L3VOICE_NORMAL), "{gid[0x%08X] grpPrio[0x%08X] } already in ACL when adding {gid[0x%08X] grpPrio[0x%08X] }!!!", (*itFound).second.gid, (*itFound).second.grpPrio, gid, grpPrio); } } void CSAG::delGrpInfo(UINT16 gid) { if(M_INVALID_GID==gid || 0==gid) return; map<UINT16, grpInfo, less<UINT16> >::iterator it = m_GrpInfoTbl.find(gid); if(m_GrpInfoTbl.end()!=it) { m_GrpInfoTbl.erase(it); } } void CSAG::initGrpInfoFromFile(char *pBuf, UINT32 size) { m_GrpInfoTbl.clear(); //long lines=0; long lineLen=0; long spaceLen=0; char line[256]; long LeftLen=size; char *pReadBuf = pBuf; char *pEnd = pBuf + size; while(pReadBuf<pEnd) { pReadBuf = jumpSpaces(pReadBuf, LeftLen, &spaceLen); LeftLen -= spaceLen; if(0==pReadBuf[0]) { return; } if(1==sscanf(pReadBuf,"%s",line)) { lineLen = strlen(line); LeftLen -= lineLen; pReadBuf += lineLen; //VPRINT("\n[%d] line[%s] len[%d]", ++lines, line, lineLen); //GID,GrpName,组优先级 char sep[]=","; UINT16 gid; UINT8 prio; char grpName[20]; char *pNext = NULL; char *pItem = NULL; pItem = own_strtok_r(line, sep, &pNext); gid = strtoul(pItem, NULL, 16); if(0==gid || 0xffff==gid) continue; pItem = own_strtok_r(NULL, sep, &pNext); strcpy(grpName, pItem); pItem = own_strtok_r(NULL, sep, &pNext); prio = strtoul(pItem, NULL, 16) & 0xff; //add grp info grpInfo GrpInfo(gid, prio, grpName); m_GrpInfoTbl.insert(map<UINT16,grpInfo,less<UINT16> >::value_type(gid, GrpInfo)); } else { //error or end } } } void CSAG::initGrpUserInfoFromFile(char *pBuf, UINT32 size) { //long lines=0; long lineLen=0; long spaceLen=0; char line[256]; long LeftLen=size; char *pReadBuf = pBuf; char *pEnd = pBuf + size; while(pReadBuf<pEnd) { pReadBuf = jumpSpaces(pReadBuf, LeftLen, &spaceLen); LeftLen -= spaceLen; if(0==pReadBuf[0]) { return; } if(1==sscanf(pReadBuf,"%s",line)) { lineLen = strlen(line); LeftLen -= lineLen; pReadBuf += lineLen; //VPRINT("\n[%d] line[%s] len[%d]", ++lines, line, lineLen); //GID,UID,组内优先级 char sep[]=","; UINT16 gid; UINT32 uid; UINT8 prio; char *pNext = NULL; char *pItem = NULL; pItem = own_strtok_r(line, sep, &pNext); gid = strtoul(pItem, NULL, 16); if(0==gid || 0xffff==gid) continue; pItem = own_strtok_r(NULL, sep, &pNext); uid = strtoul(pItem, NULL, 16); if(0==uid || 0xffffffff==uid) continue; pItem = own_strtok_r(NULL, sep, &pNext); prio = strtoul(pItem, NULL, 16) & 0xff; //add user-grp info addUserGrpInfo(uid, gid, prio); } else { //error or end } } } bool CSAG::ifAllowGrpSetup(UINT16 gid, UINT32 uid) { if(g_blUseLocalGrpInfoFile) { //gid in gidList map<UINT16, grpInfo, less<UINT16> >::iterator itFound; if(findGrpInfoByGID(gid, itFound)) { if(g_blUseLocalUserInfoFile) { //uid belongs to gid if(isUserInGroup(uid, gid)) { return true; } else { return false; } } else { return true; } } else { return false; } } else { return true; } } bool CSAG::isUserInGroup(UINT32 uid, UINT16 gid) { if(g_blUseLocalUserInfoFile) { map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(findUserInfoByUID(uid, itFound)) { map<UINT16,grpUserInfo,less<UINT16> >::iterator it = (*itFound).second.grpUserInfoTbl.find(gid); if((*itFound).second.grpUserInfoTbl.end()!=it) { return true; } else { return false; } } else { return false; } } else { return true; } } UINT16 CSAG::formatUserGrpListInfo(char*buf, UINT16& len, UINT8& grpNum, UINT32 uid) { len = 0; grpNum = 0; if(NULL==buf) { return 0; } if(0==uid || INVALID_UID==uid) { len = 0; return 0; } map<UINT32, userInfo, less<UINT32> >::iterator itFound; if(findUserInfoByUID(uid, itFound)) { grpNum = (*itFound).second.grpUserInfoTbl.size(); map<UINT16, grpUserInfo>::iterator itGID; for(itGID=(*itFound).second.grpUserInfoTbl.begin();itGID!=(*itFound).second.grpUserInfoTbl.end();itGID++) { UINT16 tmpGid = (*itGID).first; map<UINT16, grpInfo, less<UINT16> >::iterator itGrpFound; UINT8 GrpNameLen; //GIDx VSetU16BitVal((UINT8*)&buf[len], tmpGid); len += sizeof(UINT16); //GNAMEx & grpPrio UINT16 tmpGrpPrio; if(findGrpInfoByGID(tmpGid, itGrpFound)) { GrpNameLen = (*itGrpFound).second.grpName.size()+1; strcpy(&buf[len+1], (*itGrpFound).second.grpName.c_str()); tmpGrpPrio = (*itGrpFound).second.grpPrio; } else { GrpNameLen = 1; tmpGrpPrio = 7;//最低组优先级,避免异常 } buf[len] = GrpNameLen; len++; buf[len+GrpNameLen-1]=0; len+=GrpNameLen; //PRIOx buf[len]=tmpGrpPrio; len++; } return len; } else { len = 0; return 0; } } void CSAG::clearAllUserInfo() { map<UINT32, userInfo>::iterator itUID; map<UINT16, grpUserInfo>::iterator itGID; for(itUID=m_UserInfoTbl.begin();itUID!=m_UserInfoTbl.end();itUID++) { (*itUID).second.grpUserInfoTbl.clear(); } m_UserInfoTbl.clear(); } void CSAG::clearAllGrpInfo() { m_GrpInfoTbl.clear(); } void CSAG::showUserInfo(UINT32 uid) { VPRINT("\nshowXXX(AAA), AAA=0 means showAllXXX\n"); map<UINT32, userInfo>::iterator itUID; map<UINT16, grpUserInfo>::iterator itGID; //show ALL if(0==uid || INVALID_UID==uid) { VPRINT("\n===================================================================="); VPRINT("\n--UserInfoTable Size[%d] Format[UID,PID,telNO,prio,GrpInfo(GID1,prio1;GID2,prio2;...) ]--", m_UserInfoTbl.size()); for(itUID=m_UserInfoTbl.begin();itUID!=m_UserInfoTbl.end();itUID++) { VPRINT("\n[0x%08X,0x%08X,\"%s\",0x%02X,GrpInfo(", (*itUID).first, (*itUID).second.pid, (*itUID).second.telNO.c_str(), (*itUID).second.prio); for(itGID=(*itUID).second.grpUserInfoTbl.begin();itGID!=(*itUID).second.grpUserInfoTbl.end();itGID++) { VPRINT("0x%04X,0x%02X;", (*itGID).first, (*itGID).second.prio); } VPRINT(")]"); } VPRINT("\n====================================================================\n"); } //show the one wanted else { itUID = m_UserInfoTbl.find(uid); if(itUID!=m_UserInfoTbl.end()) { VPRINT("\n [ 0x%08X, 0x%08X, \"%s\", 0x%02X, GrpInfo(", (*itUID).first, (*itUID).second.pid, (*itUID).second.telNO.c_str(), (*itUID).second.prio); for(itGID=(*itUID).second.grpUserInfoTbl.begin();itGID!=(*itUID).second.grpUserInfoTbl.end();itGID++) { VPRINT("0x%04X,%02X;", (*itGID).first, (*itGID).second.prio); } VPRINT(") ]"); } else { VPRINT("\nUID[0x%08X] not in UserInfoTable...\n", uid); } } } void CSAG::showGrpInfo(UINT16 gid) { VPRINT("\nshowXXX(AAA), AAA=0 means showAllXXX\n"); map<UINT16, grpInfo>::iterator itGID; //show ALL if(0==gid || M_INVALID_GID==gid) { VPRINT("\n===================================================================="); VPRINT("\n----------GrpInfoTable Size[%d] Format[ GID, GrpName, prio ]-------", m_GrpInfoTbl.size()); for(itGID=m_GrpInfoTbl.begin();itGID!=m_GrpInfoTbl.end();itGID++) { VPRINT("\n [ 0x%04X, \"%s\", 0x%02X ]", (*itGID).first, (*itGID).second.grpName.c_str(), (*itGID).second.grpPrio); } VPRINT("\n====================================================================\n"); } //show the one wanted else { itGID = m_GrpInfoTbl.find(gid); if(itGID!=m_GrpInfoTbl.end()) { VPRINT("\n [ 0x%04X, \"%s\", 0x%02X ]", (*itGID).first, (*itGID).second.grpName.c_str(), (*itGID).second.grpPrio); } else { VPRINT("\nGID[0x%04X] not in GrpInfoTable...\n", gid); } } } UINT32 CSAG::saveGrpInfoToFile(char *pBuf, UINT32 *pSize) { if(NULL==pBuf || NULL==pSize) return 0; char *pNow = pBuf; UINT32 nLen = 0; nLen = sprintf(pNow, "GID,GrpName,GrpPiro\n"); pNow += nLen; map<UINT16, grpInfo>::iterator itGID; for(itGID=m_GrpInfoTbl.begin();itGID!=m_GrpInfoTbl.end();itGID++) { if( (*itGID).second.grpName.size()>0 ) { nLen = sprintf(pNow, "0x%04X,%s,0x%02X\n", (*itGID).second.gid, (*itGID).second.grpName.c_str(), (*itGID).second.grpPrio); } else { nLen = sprintf(pNow, "0x%04X,0x%04X,0x%02X\n", (*itGID).second.gid, (*itGID).second.gid, (*itGID).second.grpPrio); } pNow +=nLen; } return (*pSize = (pNow-pBuf+1)); } UINT32 CSAG::saveUserInfoToFile(char *pBuf, UINT32 *pSize) { if(NULL==pBuf || NULL==pSize) return 0; char *pNow = pBuf; UINT32 nLen = 0; nLen = sprintf(pNow, "PID,UID,TelNO,Piro\n"); pNow += nLen; map<UINT32, userInfo>::iterator itUID; for(itUID=m_UserInfoTbl.begin();itUID!=m_UserInfoTbl.end();itUID++) { nLen = sprintf(pNow, "0x%08X,0x%08X,%s,0x%02X\n", (*itUID).second.pid, (*itUID).second.uid, (*itUID).second.telNO.c_str(), (*itUID).second.prio); pNow +=nLen; } return (*pSize = (pNow-pBuf+1)); } UINT32 CSAG::saveUserGrpInfoToFile(char *pBuf, UINT32 *pSize) { if(NULL==pBuf || NULL==pSize) return 0; char *pNow = pBuf; UINT32 nLen = 0; nLen = sprintf(pNow, "GID,UID,Piro \n"); pNow += nLen; map<UINT32, userInfo>::iterator itUID; for(itUID=m_UserInfoTbl.begin();itUID!=m_UserInfoTbl.end();itUID++) { map<UINT16, grpUserInfo>::iterator itGID; for(itGID=(*itUID).second.grpUserInfoTbl.begin();itGID!=(*itUID).second.grpUserInfoTbl.end();itGID++) { nLen = sprintf(pNow, "0x%04X,0x%08X,0x%02X\n", (*itGID).second.gid, (*itUID).first, (*itGID).second.prio); pNow +=nLen; } } return (*pSize = (pNow-pBuf+1)); }
[ "hrbeu_xq@163.com" ]
hrbeu_xq@163.com
93e69e53af0dac6f0e9c3f762fb9dd8ec0de3c29
1bf8b46afad5402fe6fa74293b464e1ca5ee5fd7
/Demo/Shenmue3SDK/SDK/BP_ShadowDistanceTrigger_parameters.h
dbeabf5374c76eeda8ffdedf6d09af7797fa4004
[]
no_license
LemonHaze420/ShenmueIIISDK
a4857eebefc7e66dba9f667efa43301c5efcdb62
47a433b5e94f171bbf5256e3ff4471dcec2c7d7e
refs/heads/master
2021-06-30T17:33:06.034662
2021-01-19T20:33:33
2021-01-19T20:33:33
214,824,713
4
0
null
null
null
null
UTF-8
C++
false
false
4,346
h
#pragma once #include "../SDK.h" // Name: S3Demo, Version: 0.90.0 #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- // Parameters //--------------------------------------------------------------------------- // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.ChangeDistance struct ABP_ShadowDistanceTrigger_C_ChangeDistance_Params { bool Original; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.UserConstructionScript struct ABP_ShadowDistanceTrigger_C_UserConstructionScript_Params { }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.ReceiveBeginPlay struct ABP_ShadowDistanceTrigger_C_ReceiveBeginPlay_Params { }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.ReceiveEndPlay struct ABP_ShadowDistanceTrigger_C_ReceiveEndPlay_Params { TEnumAsByte<EEndPlayReason>* EndPlayReason; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.BndEvt__CollisionComponent_K2Node_ComponentBoundEvent_0_ComponentBeginOverlapSignature__DelegateSignature struct ABP_ShadowDistanceTrigger_C_BndEvt__CollisionComponent_K2Node_ComponentBoundEvent_0_ComponentBeginOverlapSignature__DelegateSignature_Params { class UPrimitiveComponent* OverlappedComponent; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData) class AActor* OtherActor; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) class UPrimitiveComponent* OtherComp; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData) int OtherBodyIndex; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) bool bFromSweep; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) struct FHitResult SweepResult; // (ConstParm, BlueprintVisible, BlueprintReadOnly, Parm, OutParm, ReferenceParm, IsPlainOldData) }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.BndEvt__CollisionComponent_K2Node_ComponentBoundEvent_1_ComponentEndOverlapSignature__DelegateSignature struct ABP_ShadowDistanceTrigger_C_BndEvt__CollisionComponent_K2Node_ComponentBoundEvent_1_ComponentEndOverlapSignature__DelegateSignature_Params { class UPrimitiveComponent* OverlappedComponent; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData) class AActor* OtherActor; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) class UPrimitiveComponent* OtherComp; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData) int OtherBodyIndex; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) }; // Function BP_ShadowDistanceTrigger.BP_ShadowDistanceTrigger_C.ExecuteUbergraph_BP_ShadowDistanceTrigger struct ABP_ShadowDistanceTrigger_C_ExecuteUbergraph_BP_ShadowDistanceTrigger_Params { int EntryPoint; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "35783139+LemonHaze420@users.noreply.github.com" ]
35783139+LemonHaze420@users.noreply.github.com
8943af52e82cc58d8bce0915bd5aef038083d4c4
844d52192673a3dff0cf923f2d51e888e5db3677
/CustomizePage1.cpp
70500481059177435ca21b03c94a71235079c0c9
[]
no_license
usgs-coupled/phreeqci
fcf318e0306b2b82f460339922768578cedd93ce
77c03fe463d1ff3b592a07438d59ba38aa9dea27
refs/heads/master
2023-08-31T08:15:27.412480
2023-08-25T15:36:21
2023-08-25T15:36:21
308,477,384
1
1
null
null
null
null
UTF-8
C++
false
false
7,956
cpp
// CustomizePage1.cpp : implementation file // // $Id$ ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "resource.h" #include "CustomizePage1.h" #include "phreeqci2.h" #include <Htmlhelp.h> #include "SaveCurrentDirectory.h" #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif IMPLEMENT_DYNCREATE(CCustomizePage1, baseCustomizePage1) IMPLEMENT_DYNCREATE(CCustomizePage2, baseCustomizePage2) ///////////////////////////////////////////////////////////////////////////// // CCustomizePage1 property page CCustomizePage1::CCustomizePage1() : baseCustomizePage1(CCustomizePage1::IDD) { //{{AFX_DATA_INIT(CCustomizePage1) m_strDefaultDatabase = _T(""); m_bApplyOpen = FALSE; m_bApplyOnlyDef = FALSE; //}}AFX_DATA_INIT } CCustomizePage1::~CCustomizePage1() { } void CCustomizePage1::DoDataExchange(CDataExchange* pDX) { baseCustomizePage1::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCustomizePage1) DDX_Control(pDX, IDC_CB_DB, m_cboDatabase); DDX_Check(pDX, IDC_B_APPLY_OPEN, m_bApplyOpen); DDX_Check(pDX, IDC_APPLY_ONLY_DEF, m_bApplyOnlyDef); //}}AFX_DATA_MAP if (pDX->m_bSaveAndValidate) { DDX_CBString(pDX, IDC_CB_DB, m_strDefaultDatabase); m_strDefaultDatabase.TrimLeft(); m_strDefaultDatabase.TrimRight(); if (m_strDefaultDatabase.IsEmpty()) { ::AfxMessageBox("Invalid default database."); pDX->Fail(); } if (::GetFileAttributes(m_strDefaultDatabase) == -1) { DWORD dw = GetLastError(); ASSERT( dw == ERROR_FILE_NOT_FOUND || dw == ERROR_PATH_NOT_FOUND || dw == ERROR_INVALID_DRIVE || dw == ERROR_BAD_NETPATH || dw == ERROR_BAD_NET_NAME || dw == ERROR_INVALID_NAME ); // let system display error message LPVOID lpMsgBuf; ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); ::AfxMessageBox((LPCTSTR)lpMsgBuf); LocalFree(lpMsgBuf); pDX->Fail(); } else { // GetStatus cleans up the file name // ie e:\\path\file.ext gets e:\path\file.ext CFileStatus status; VERIFY(CFile::GetStatus(m_strDefaultDatabase, status)); m_strDefaultDatabase = status.m_szFullName; } } else { if (m_bFirstSetActive) { // fill database combo m_cboDatabase.ResetContent(); CRecentFileList* pList = ((CPhreeqciApp*)AfxGetApp())->m_pRecentDBFileList; for (int i = 0; i < pList->GetSize(); ++i) { if ( !((*pList)[i].IsEmpty()) ) m_cboDatabase.AddString((*pList)[i]); } } DDX_CBString(pDX, IDC_CB_DB, m_strDefaultDatabase); UpdateButtons(); } } BEGIN_MESSAGE_MAP(CCustomizePage1, baseCustomizePage1) //{{AFX_MSG_MAP(CCustomizePage1) ON_BN_CLICKED(IDC_B_DB, OnBrowseDb) ON_CBN_EDITCHANGE(IDC_CB_DB, OnEditchangeCbDb) ON_CBN_SELCHANGE(IDC_CB_DB, OnSelchangeCbDb) ON_CBN_EDITUPDATE(IDC_CB_DB, OnEditupdateCbDb) ON_WM_HELPINFO() ON_BN_CLICKED(IDC_B_APPLY_OPEN, OnBApplyOpen) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCustomizePage2 property page CCustomizePage2::CCustomizePage2() : baseCustomizePage2(CCustomizePage2::IDD) { //{{AFX_DATA_INIT(CCustomizePage2) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } CCustomizePage2::~CCustomizePage2() { } void CCustomizePage2::DoDataExchange(CDataExchange* pDX) { baseCustomizePage2::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCustomizePage2) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCustomizePage2, baseCustomizePage2) //{{AFX_MSG_MAP(CCustomizePage2) // NOTE: the ClassWizard will add message map macros here //}}AFX_MSG_MAP END_MESSAGE_MAP() void CCustomizePage1::OnBrowseDb() { CSaveCurrentDirectory scd; CDataExchange dx(this, TRUE); DDX_CBString(&dx, IDC_CB_DB, m_strDefaultDatabase); // Show file Dialog box CFileDialog dlg( TRUE, // bOpenFileDialog NULL, // lpszDefExt m_strDefaultDatabase, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, _T("Database Files (*.dat)|*.dat|All Files (*.*)|*.*||") ); // set dialog caption dlg.m_ofn.lpstrTitle = _T("Select a Database"); if (dlg.DoModal() == IDOK) { m_strDefaultDatabase = dlg.GetPathName(); UpdateData(FALSE); // set window } } void CCustomizePage1::OnEditchangeCbDb() { // save but don't validate m_strDefaultDatabase CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_CB_DB); pBox->GetWindowText(m_strDefaultDatabase); UpdateButtons(); } void CCustomizePage1::OnSelchangeCbDb() { // save but don't validate m_strDefaultDatabase CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_CB_DB); int index = pBox->GetCurSel(); ASSERT(index != CB_ERR); if (index != CB_ERR) { pBox->GetLBText(index, m_strDefaultDatabase); } UpdateButtons(); } void CCustomizePage1::OnEditupdateCbDb() { TRACE("OnEditupdateCbDb\n"); } BOOL CCustomizePage1::OnHelpInfo(HELPINFO* pHelpInfo) { // Add your message handler code here and/or call default if (pHelpInfo->iContextType == HELPINFO_WINDOW) { HH_POPUP myPopup; memset(&myPopup, 0, sizeof(HH_POPUP)); myPopup.cbStruct = sizeof(HH_POPUP); // use default colors myPopup.clrForeground = (COLORREF)-1; myPopup.clrBackground = (COLORREF)-1; myPopup.pt.x = pHelpInfo->MousePos.x; myPopup.pt.y = pHelpInfo->MousePos.y; myPopup.rcMargins.top = -1; myPopup.rcMargins.bottom = -1; myPopup.rcMargins.left = -1; myPopup.rcMargins.right = -1; myPopup.idString = 0; switch (pHelpInfo->iCtrlId) { case IDC_B_APPLY_OPEN : myPopup.pszText = "When selected, all files currently open will be set to use the default database."; ::HtmlHelp(NULL, NULL, HH_DISPLAY_TEXT_POPUP, (DWORD)&myPopup); break; case IDC_APPLY_ONLY_DEF : myPopup.pszText = "When selected, all files currently open will be set to use the default database only if it currently uses the previous default database."; ::HtmlHelp(NULL, NULL, HH_DISPLAY_TEXT_POPUP, (DWORD)&myPopup); break; case IDC_CB_DB : myPopup.pszText = "Enter the database file to be used for new files and files that do not have an associated database."; ::HtmlHelp(NULL, NULL, HH_DISPLAY_TEXT_POPUP, (DWORD)&myPopup); break; case IDC_B_DB : myPopup.pszText = "Click to browse through folders to find the file you want."; ::HtmlHelp(NULL, NULL, HH_DISPLAY_TEXT_POPUP, (DWORD)&myPopup); break; } return TRUE; } return baseCustomizePage1::OnHelpInfo(pHelpInfo); } BOOL CCustomizePage1::OnInitDialog() { baseCustomizePage1::OnInitDialog(); // Add extra initialization here CreateRoot(VERTICAL, 5, 6) << (paneCtrl(IDC_GB_DATABASE, VERTICAL, GREEDY, nDefaultBorder, 16, 15, 40) << (pane(HORIZONTAL, GREEDY) << item(IDC_ST_3, NORESIZE) << item(IDC_CB_DB, ABSOLUTE_VERT) << item(IDC_B_DB, NORESIZE) ) << item(IDC_B_APPLY_OPEN, NORESIZE) << item(IDC_APPLY_ONLY_DEF, NORESIZE) ) ; UpdateLayout(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CCustomizePage1::OnBApplyOpen() { UpdateButtons(); } void CCustomizePage1::UpdateButtons() { CWnd* pWndApplyOpen = GetDlgItem(IDC_B_APPLY_OPEN); CWnd* pWndApplyOnlyDef = GetDlgItem(IDC_APPLY_ONLY_DEF); CString strOrigDB = ((CPhreeqciApp*)AfxGetApp())->m_settings.m_strDefDBPathName; if (m_strDefaultDatabase.IsEmpty() || strOrigDB.CompareNoCase(m_strDefaultDatabase) == 0) { pWndApplyOpen->EnableWindow(FALSE); pWndApplyOnlyDef->EnableWindow(FALSE); } else { pWndApplyOpen->EnableWindow(TRUE); if (((CButton*)pWndApplyOpen)->GetCheck() == BST_CHECKED) { pWndApplyOnlyDef->EnableWindow(TRUE); } else { pWndApplyOnlyDef->EnableWindow(FALSE); } } }
[ "charlton@usgs.gov" ]
charlton@usgs.gov
4bd4e6f85a164c80c23d68316c12eee563f1c337
bd7fa326f931c0440770da5c2a8d9ae4f4bd89ff
/CB/arduino/libraries/Souliss/interfaces/XMLServer_HTTP_uIP.cpp
9865bdafd0bf4b4e16990b7ece1c894bbceef70d
[]
no_license
mcbittech/SoulissDEV
0a1a441d8e6a82ee52f912764c6a170aa535606b
bdf1dd855340d766e10b0175d1b921a0cd017df3
refs/heads/master
2021-01-19T17:42:54.562151
2015-05-01T13:57:04
2015-05-01T13:57:04
34,900,953
0
0
null
null
null
null
UTF-8
C++
false
false
15,741
cpp
/************************************************************************** Souliss Copyright (C) 2012 Veseo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Originally developed by Fulvio Spelta and Dario Di Maio ***************************************************************************/ /*! \file \ingroup */ #include "Typicals.h" #include "Souliss.h" #include "frame/MaCaco/MaCaco.h" #include "frame/vNet/vNet.h" #include "XMLServer.h" #if(XMLSERVER && VNET_MEDIA1_ENABLE && ETH_ENC28J60) #include "ASCIItools.c" String incomingURL = String(HTTP_REQBYTES); // The GET request is stored in incomingURL char buf[HTTP_BUFBYTES]; // Used for temporary operations uint8_t *buff = (uint8_t *)buf; uint8_t indata=0, bufferlen, data_len; // End of HTML request // Send JSON string const char* xml[] = {"<s", ">", "</s", "<id", "</id"}; /************************************************************************** /*! Init the interface */ /**************************************************************************/ void XMLSERVERInit(U8 *memory_map) { // Set an internal subscription in order to collect data from other // nodes in the network MaCaco_InternalSubcription(memory_map); } /************************************************************************** /*! Parse incoming HTTP GET for incoming commands */ /**************************************************************************/ void XMLSERVERInterface(U8 *memory_map) { uint8_t i; // Listen the HTTP port srv_listen(HTTPPORT); // Get the actual used socket uint8_t sock = srvcln_getsocket(HTTPPORT); // Listen for incoming clients if (srvcln_connected(HTTPPORT, sock)) { // Parse the incoming data if(indata) { // Send HTTP Hello char* str[] = {"HTTP/1.1 200 OK\n\rContent-Type: text/plain\n\r\n\r"}; // Load and send data srvcln_load((uint8_t*)str[0], strlen(str[0])); srv_send(sock, SENDDATA); // Send data srv_waitsend(sock); // Handler1, if /force is requested from client // an example command is "GET /force?id=4&slot=2&val=1 " if(incomingURL.startsWith("GET /force") || ((incomingURL.indexOf("GET /force",0) > 0))) { // Include debug functionalities, if required #if(XMLSERVER_DEBUG) XMLSERVER_LOG("(HTTP/XML)<GET /force"); XMLSERVER_LOG(data_len,HEX); XMLSERVER_LOG(">\r\n"); #endif // Find start and end index for callback request U8 force = incomingURL.indexOf("force",0); if(incomingURL.indexOf("?id=",force) > 0) { U8 id = incomingURL.indexOf("?id=",force); U8 slot = incomingURL.indexOf("&slot=", id); U8 val_s = incomingURL.indexOf("&val=", slot); id = incomingURL.substring(id+4, slot).toInt(); // Sum lenght of "?id=" slot = incomingURL.substring(slot+6, val_s).toInt(); // Sum lenght of "&slot=" // This buffer is used to load values U8 vals[MAXVALUES]; for(i=0;i<MAXVALUES;i++) vals[i]=0; // Identify how many values (up to 5) are provided if(incomingURL.indexOf(",", val_s)) { // Buffer used to store offset of values U8 valf[MAXVALUES]; for(i=0;i<MAXVALUES;i++) valf[i]=0; // Get the offset of all values valf[0] = incomingURL.indexOf(",", val_s); for(i=1;i<MAXVALUES;i++) valf[i] = incomingURL.indexOf(",", valf[i-1]+1); vals[0] = incomingURL.substring(val_s+5, valf[0]).toInt(); // Sum lenght of "&val=" for(i=1;i<MAXVALUES;i++) vals[i] = incomingURL.substring(valf[i-1]+1, valf[i]).toInt(); // Sun the lenght of "," } else { // Just one values U8 val_f = incomingURL.indexOf(" ", val_s); // Command should end with a space // Convert to number id = incomingURL.substring(id+4, slot).toInt(); // Sum lenght of "?id=" slot = incomingURL.substring(slot+6, val_s).toInt(); // Sum lenght of "&slot=" vals[0] = incomingURL.substring(val_s+5, val_f).toInt(); // Sum lenght of "&val=" } #if(XMLSERVER_DEBUG) XMLSERVER_LOG("(HTTP/XML)<GET /force"); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<id="); XMLSERVER_LOG(id,DEC); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<slot="); XMLSERVER_LOG(slot,DEC); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<val="); XMLSERVER_LOG(val_s,DEC); XMLSERVER_LOG(">\r\n"); for(i=0;i<MAXVALUES;i++) { XMLSERVER_LOG(vals[i]); XMLSERVER_LOG(">\r\n"); } XMLSERVER_LOG("id="); XMLSERVER_LOG(id); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("slot="); XMLSERVER_LOG(slot); XMLSERVER_LOG(">\r\n"); #endif // Send a command to the node if((id < MaCaco_NODES) && (id != MaCaco_LOCNODE) && (*(U16 *)(memory_map + MaCaco_ADDRESSES_s + 2*id) != 0x0000)) // If is a remote node, the command act as remote input MaCaco_send(*(U16 *)(memory_map + MaCaco_ADDRESSES_s + 2*id), MaCaco_FORCEREGSTR, 0x00, MaCaco_IN_s + slot, MAXVALUES, vals); else if (id == MaCaco_LOCNODE) // If is a local node (me), the command is written back { i = 0; while((vals[i] != 0) && (i < MAXVALUES)) { #if(XMLSERVER_DEBUG) XMLSERVER_LOG(slot); XMLSERVER_LOG(" "); XMLSERVER_LOG(vals[i]); XMLSERVER_LOG(">\r\n"); #endif memory_map[MaCaco_IN_s+slot] = vals[i]; slot++; i++; } } } else if(incomingURL.indexOf("?typ=",force) > 0) { U8 typ_mask; U8 typ = incomingURL.indexOf("?typ=",force); U8 val_s = incomingURL.indexOf("&val=", typ); U8 val_f = incomingURL.indexOf(" ", val_s); // Command should end with a space typ = incomingURL.substring(typ+5, val_s).toInt(); // Sum lenght of "?typ=" val_s = incomingURL.substring(val_s+5, val_f).toInt(); // Sum lenght of "&val=" #if(XMLSERVER_DEBUG) XMLSERVER_LOG("(HTTP/XML)<GET /typ"); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<val="); XMLSERVER_LOG(val_s,DEC); XMLSERVER_LOG(">\r\n"); #endif U8* val_sp = &val_s; // Send a multicast command to all typicals, first identify if the command is issued // for a typical or a typical class if((typ & 0x0F) == 0x00) typ_mask = 0xF0; // We look only to the typical class value else typ_mask = 0xFF; // We look to whole typical value // Look for all slot assigned to this typical and put value in for(U8 id=0;id<MaCaco_NODES;id++) { // Send a command to the node if((id != MaCaco_LOCNODE) && ((*(U16 *)(memory_map + MaCaco_ADDRESSES_s + 2*id)) != 0x0000)) // If is a remote node, the command act as remote input MaCaco_send(*(U16 *)(memory_map + MaCaco_ADDRESSES_s + 2*id), MaCaco_TYP, 0, typ, 1, val_sp); else if (id == MaCaco_LOCNODE) // If is a local node (me), the command is written back { U8 typ_mask; // Identify if the command is issued for a typical or a typical class if((typ & 0x0F) == 0x00) typ_mask = 0xF0; // we look only to the typical class value else typ_mask = 0xFF; // we look to whole typical value for(i=0; i<MaCaco_SLOT; i++) if((*(memory_map + MaCaco_TYP_s + i) & typ_mask) == typ) // Start offset used as typical logic indication *(memory_map+MaCaco_IN_s + i) = val_s; } } } } // Handler2, if /statusrequested from client // an example command is "GET /status?id=0 " if(incomingURL.startsWith("GET /status") || ((incomingURL.indexOf("GET /status",0) > 0))) { U8 id_for=0; // Init the buffer bufferlen=0; // Find start and end index request U8 status = incomingURL.indexOf("status",0); if(incomingURL.indexOf("?id=",status) > 0) { U8 id = incomingURL.indexOf("?id=",status); U8 id_f = incomingURL.indexOf(" ", id); // Command should end with a space // If one ID is requested id_for = incomingURL.substring(id+4, id_f).toInt(); // Sum lenght of "?id=" } #if(!MaCaco_PERSISTANCE) // No support for other nodes is active id_for=0; #endif // The request has a wrong id value if(!(id_for<MaCaco_NODES)) return; #if(XMLSERVER_DEBUG) XMLSERVER_LOG("(HTTP/XML)<GET /status"); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<id="); XMLSERVER_LOG(id_for,DEC); XMLSERVER_LOG(">\r\n"); #endif // Print "<id" memmove(&buf[bufferlen],xml[3],strlen(xml[3])); bufferlen += strlen(xml[3]); // Print id number *(unsigned long*)(buf+bufferlen) = (unsigned long)id_for; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); for(U8 slot=0;slot<MaCaco_SLOT;slot++) { if( memory_map[MaCaco_G_TYP_s+(id_for*MaCaco_TYPLENGHT)+slot] != 0x00 ) { // Print "<s" memmove(&buf[bufferlen],xml[0],strlen(xml[0])); bufferlen += strlen(xml[0]); // Print slot number *(unsigned long*)(buf+bufferlen) = (unsigned long)slot; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); // Typicals in group Souliss_T5n need convertion from half-precision float to string if((memory_map[MaCaco_G_TYP_s+(id_for*MaCaco_TYPLENGHT)+slot] & 0xF0 ) == Souliss_T5n) { float f_val; float32((U16*)(memory_map+(MaCaco_G_OUT_s+(id_for*MaCaco_OUTLENGHT)+slot)), &f_val); ASCII_float2str((float)f_val, 2, &buf[bufferlen], HTTP_BUFBYTES); bufferlen = strlen(buf); } else // All others values are stored as unsigned byte { // Print "val" value *(unsigned long*)(buf+bufferlen) = (unsigned long)memory_map[MaCaco_G_OUT_s+(id_for*MaCaco_OUTLENGHT)+slot]; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); } // Print "</slot" memmove(&buf[bufferlen],xml[2],strlen(xml[2])); bufferlen += strlen(xml[2]); // Print slot number *(unsigned long*)(buf+bufferlen) = (unsigned long)slot; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); } } // Print "</id" memmove(&buf[bufferlen],xml[4],strlen(xml[4])); bufferlen += strlen(xml[4]); // Print id number *(unsigned long*)(buf+bufferlen) = (unsigned long)id_for; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); // Load and send data srvcln_load((uint8_t*)buf, bufferlen); srv_send(sock, SENDDATA); // Send data srv_waitsend(sock); } // Handler3, if /statusrequested from client // an example command is "GET /typicals?id=0 " if(incomingURL.startsWith("GET /typicals") || ((incomingURL.indexOf("GET /typicals",0) > 0))) { U8 id_for=0; // Init the buffer bufferlen=0; // Find start and end index request U8 status = incomingURL.indexOf("typicals",0); if(incomingURL.indexOf("?id=",status) > 0) { U8 id = incomingURL.indexOf("?id=",status); U8 id_f = incomingURL.indexOf(" ", id); // Command should end with a space // If one ID is requested id_for = incomingURL.substring(id+4, id_f).toInt(); // Sum lenght of "?id=" } #if(!MaCaco_PERSISTANCE) // No support for other nodes is active id_for=0; #endif #if(XMLSERVER_DEBUG) XMLSERVER_LOG("(HTTP/XML)<GET /typicals"); XMLSERVER_LOG(">\r\n"); XMLSERVER_LOG("(HTTP/XML)<id="); XMLSERVER_LOG(id_for,DEC); XMLSERVER_LOG(">\r\n"); #endif // The request has a wrong id value if(!(id_for<MaCaco_NODES)) return; // Print "<id" memmove(&buf[bufferlen],xml[3],strlen(xml[3])); bufferlen += strlen(xml[3]); // Print id number *(unsigned long*)(buf+bufferlen) = (unsigned long)id_for; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); for(U8 slot=0;slot<MaCaco_SLOT;slot++) { if( memory_map[MaCaco_G_TYP_s+(id_for*MaCaco_TYPLENGHT)+slot] != 0x00 ) { // Print "<s" memmove(&buf[bufferlen],xml[0],strlen(xml[0])); bufferlen += strlen(xml[0]); // Print slot number *(unsigned long*)(buf+bufferlen) = (unsigned long)slot; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); // Print "val" value *(unsigned long*)(buf+bufferlen) = (unsigned long)memory_map[MaCaco_G_TYP_s+(id_for*MaCaco_TYPLENGHT)+slot]; ASCII_num2str((uint8_t*)(buf+bufferlen), HEX, &bufferlen); // Print "</slot" memmove(&buf[bufferlen],xml[2],strlen(xml[2])); bufferlen += strlen(xml[2]); // Print slot number *(unsigned long*)(buf+bufferlen) = (unsigned long)slot; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); } } // Print "</id" memmove(&buf[bufferlen],xml[4],strlen(xml[4])); bufferlen += strlen(xml[4]); // Print id number *(unsigned long*)(buf+bufferlen) = (unsigned long)id_for; ASCII_num2str((uint8_t*)(buf+bufferlen), DEC, &bufferlen); // Print ">" memmove(&buf[bufferlen],xml[1],strlen(xml[1])); bufferlen += strlen(xml[1]); // Load and send data srvcln_load((uint8_t*)buf, bufferlen); srv_send(sock, SENDDATA); // Send data srv_waitsend(sock); } // Close the connection indata=0; srvcln_stop(sock); srv_waitsend(sock); } } // If there were an incoming message on the HTTP port if(srvcln_lastport(HTTPPORT)) { // Look for available data if (srvcln_dataavailable(HTTPPORT)) { // Move data into the temporary buffer srvcln_retrieve(buff, HTTP_REQBYTES); // Move data into a string for parsing indata=1; incomingURL = ""; for(U8 i=0;i<HTTP_REQBYTES;i++) { // Stop at next space after GET if(incomingURL.startsWith("GET /") && buf[i] == 32) break; incomingURL = incomingURL + buf[i]; } } } } #endif
[ "master.flavio.piccolo@gmail.cpm" ]
master.flavio.piccolo@gmail.cpm
d7f49c81d534cab45eb982a050f4fe5900d5c28f
f96a15f374d4bc4550d2c060f56d8f61d0f694fb
/python/ctypes_example/example.h
49040ed91549f41c2ca169a3f3fcd1013cf05f6c
[ "Apache-2.0" ]
permissive
knowledgebao/language
5abdd36b1fc6de4442ae99ad60fca148372e9df9
eee667c90267bd846f065cc32024bca33dfdfc0c
refs/heads/main
2023-02-07T16:33:04.548385
2021-01-03T14:34:17
2021-01-03T14:34:17
326,325,283
0
1
null
null
null
null
UTF-8
C++
false
false
1,127
h
#pragma once #if defined(_WIN32) # define CDECL __cdecl # define WINAPI __stdcall # define FASTCALL __fastcall # if defined(example_EXPORTS) # define MEG_API __declspec(dllexport) # else # define MEG_API __declspec(dllimport) # endif // defined(example_EXPORTS) #else # define CDECL __attribute__((__cdecl__)) # define WINAPI # define FASTCALL # if example_EXPORTS # define MEG_API __attribute__((visibility("default"))) # else # define MEG_API # endif #endif MEG_API int add_v1(int a, int b, int c); extern "C" { MEG_API int CDECL add_v2(int a, int b, int c); MEG_API int WINAPI add_v3(int a, int b, int c); MEG_API int FASTCALL add_v4(int a, int b, int c); } extern "C" MEG_API int add_v5(int a, int b, int c); class MEG_API AddOp { public: int add_v6(int a, int b, int c); int CDECL add_v7(int a, int b, int c); }; MEG_API int add_v8(int a, int b); MEG_API int add_v8(int a, int b, int c); MEG_API int add_v8(int a, int b, int c, int d); extern "C" { MEG_API int add_v9(int a, int b, int* OUT); MEG_API int sprint(char *buffer, char a, int b, const char* c); }
[ "keke@mail.com" ]
keke@mail.com
c458d1b7cf30545d24672a1c2421ee30e4963696
682a576b5bfde9cf914436ea1b3d6ec7e879630a
/components/material/nodes/button/MaterialButtonIcon.cc
e308d7356f5b64474645ba7a75031b899d22182e
[ "MIT", "BSD-3-Clause" ]
permissive
SBKarr/stappler
6dc914eb4ce45dc8b1071a5822a0f0ba63623ae5
4392852d6a92dd26569d9dc1a31e65c3e47c2e6a
refs/heads/master
2023-04-09T08:38:28.505085
2023-03-25T15:37:47
2023-03-25T15:37:47
42,354,380
10
3
null
2017-04-14T10:53:27
2015-09-12T11:16:09
C++
UTF-8
C++
false
false
3,137
cc
// This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com /** Copyright (c) 2016 Roman Katuntsev <sbkarr@stappler.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ #include "Material.h" #include "MaterialButtonIcon.h" #include "MaterialMenuSource.h" #include "SPDataListener.h" NS_MD_BEGIN bool ButtonIcon::init(IconName name, const TapCallback &tapCallback, const TapCallback &longTapCallback) { if (!Button::init(tapCallback, longTapCallback)) { return false; } auto icon = Rc<IconSprite>::create(name); icon->setAnchorPoint(Anchor::Middle); _icon = _content->addChildNode(icon); setContentSize(_icon->getContentSize()); setPadding(2.0f); return true; } void ButtonIcon::onContentSizeDirty() { Button::onContentSizeDirty(); if (_icon) { auto s = _content->getContentSize(); _icon->setPosition(s.width / 2.0f, s.height / 2.0f); } setBorderRadius(std::min(_contentSize.width - _padding.horizontal(), _contentSize.height - _padding.vertical())); } void ButtonIcon::setIconName(IconName name) { if (_icon) { _icon->setIconName(name); } } IconName ButtonIcon::getIconName() const { if (_icon) { return _icon->getIconName(); } return IconName::Empty; } void ButtonIcon::setIconProgress(float value, float animation) { _icon->animate(value, animation); } float ButtonIcon::getIconProgress() const { return _icon->getProgress(); } void ButtonIcon::setIconColor(const Color &c) { _icon->setColor(c); } const cocos2d::Color3B &ButtonIcon::getIconColor() const { return _icon->getColor(); } void ButtonIcon::setIconOpacity(uint8_t op) { _icon->setOpacity(op); } uint8_t ButtonIcon::getIconOpacity() const { return _icon->getOpacity(); } IconSprite *ButtonIcon::getIcon() const { return _icon; } void ButtonIcon::setSizeHint(IconSprite::SizeHint s) { _icon->setSizeHint(s); setContentSize(_icon->getContentSize()); } void ButtonIcon::updateFromSource() { Button::updateFromSource(); if (_source) { _icon->setIconName(_source->getNameIcon()); } else { _icon->setIconName(IconName::Empty); } } NS_MD_END
[ "sbkarr@stappler.org" ]
sbkarr@stappler.org
aeeb26b6cc45b484e5bdd3ac8a0963f76766910f
d48653e4015f6762e233436c03ca2956869b0885
/Source/AgogCore/Private/AgogCore/AString.cpp
60bf68d9d11312c7a1db844b9d25f5e9554a783d
[]
no_license
marynate/SkookumScript-UnrealEngine-1
2d98b08073e464e247a22ca6cf814f9709c638ac
5dc385b7a1f3fa93b075f8d6ed3ffeb6deceb2ad
refs/heads/master
2021-01-14T08:51:15.354834
2016-01-09T00:47:10
2016-01-09T00:47:10
49,553,362
0
0
null
2016-01-13T06:08:23
2016-01-13T06:08:23
null
UTF-8
C++
false
false
180,532
cpp
//======================================================================================= // Agog Labs C++ library. // Copyright (c) 2000 Agog Labs Inc., // All rights reserved. // // Dynamic AString class definition module // Author(s): Conan Reis // Create Date: 2000-01-06 // Notes: The AString class should be used in the place of standard // C-String character array pointers. //======================================================================================= //======================================================================================= // Includes //======================================================================================= #include <AgogCore/AString.hpp> #ifdef A_INL_IN_CPP #include <AgogCore/AString.inl> #endif #include <AgogCore/APArray.hpp> #include <stdio.h> // Uses: _vsnprintf, _snprintf #include <stdlib.h> // Uses: wcstombs #include <stdarg.h> // Uses: va_start, va_end #include <wchar.h> // Uses: wcslen #ifdef A_PLAT_PC #include "windows.h" // Uses: WideCharToMultiByte() #endif //======================================================================================= // AString Class Data Members //======================================================================================= // Defined in AgogCore/AgogCore.cpp //======================================================================================= // Method Definitions //======================================================================================= //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Converter methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Constructor from character array buffer. Refers to a persistent // null-terminated C-String or makes its own copy of an existing character // array. // Returns: itself // Arg cstr_p - pointer to array of characters. 'cstr_p' should never be nullptr. // 'cstr_p' will usually be a string literal or if 'persistent' is false, // 'cstr_p' may be any C-String that this string should make a copy of. // Arg persistent - Indicates whether the data pointed to by cstr_p will be // available for the lifetime of this string. If 'persistent' is true, the // memory pointed to by 'cstr_p' will be used rather than having this object // allocate its own memory - also the memory pointed to by 'cstr_p' will not // be written to. If 'persistent' is false, then this AString object will // allocate its own memory and copy the contents of 'cstr_p' to it. // (Default true) // See: AString(cstr_p), AString(buffer_p, size, length, deallocate) // Notes: If any modifying methods are called on this string, it will first make // its own unique copy of the C-String before it writes to it. // Author(s): Conan Reis AString::AString( const char * cstr_p, bool persistent ) { //A_ASSERT(cstr_p != nullptr, "Given nullptr instead of valid C-String", ErrId_null_cstr, AString); uint32_t length = uint32_t(::strlen(cstr_p)); m_str_ref_p = ((persistent) && (cstr_p[length] == '\0')) ? AStringRef::pool_new(cstr_p, length, length + 1u, 1u, false, true) : AStringRef::pool_new_copy(cstr_p, length); } //--------------------------------------------------------------------------------------- // Constructor from character array buffer. Refers to a persistent // null-terminated C-String or makes its own copy of an existing character // array. // Returns: itself // Arg cstr_p - pointer to array of characters (does not need to be null // terminated unless length is equal to ALength_calculate). 'cstr_p' should // never be nullptr. 'cstr_p' will usually be a string literal or if // 'persistent' is false, 'cstr_p' may be any C-String that this string // should make a copy of. // Arg length - number of characters to use in 'cstr_p' and the index position to // place a terminating null character. The given length must not be more // than the size of 'cstr_p' and the C-String buffer pointed to by 'cstr_p' // should not have any null characters less then the given length. A null // terminator is placed only if 'persistent' is not true. // 'length' may also be set to ALength_calculate in which case the character // length is calculated by finding the first terminating null character // already present in 'cstr_p'. // Arg persistent - Indicates whether the data pointed to by cstr_p will be // available for the lifetime of this string. If 'persistent' is true, the // memory pointed to by 'cstr_p' will be used rather than having this object // allocate its own memory - also the memory pointed to by 'cstr_p' will not // be written to. If 'persistent' is false, then this AString object will // allocate its own memory and copy the contents of 'cstr_p' to it. // See: AString(cstr_p), AString(buffer_p, size, length, deallocate) // Notes: If any modifying methods are called on this string, it will first make // its own unique copy of the C-String before it writes to it. // Author(s): Conan Reis AString::AString( const char * cstr_p, uint32_t length, bool persistent // = true ) { //A_ASSERT(cstr_p != nullptr, "Given nullptr instead of valid C-String", ErrId_null_cstr, AString); if (length == ALength_calculate) { length = uint32_t(::strlen(cstr_p)); } m_str_ref_p = ((persistent) && (cstr_p[length] == '\0')) ? AStringRef::pool_new(cstr_p, length, length + 1u, 1u, false, true) : AStringRef::pool_new_copy(cstr_p, length); } //--------------------------------------------------------------------------------------- // Constructor from character array buffer. See the description of the // argument 'buffer_p' for the three possible uses of this constructor. // Returns: itself // Arg buffer_p - pointer to array of characters (does not need to be null // terminated unless 'length' is equal to ALength_calculate). If 'buffer_p' // is nullptr, 'length' and 'deallocate' are ignored. There are in general 3 // different types of values that 'buffer_p' will be given: // 1. A temporary buffer which is allocated on the stack or is recovered // by some other means. // 2. A pre-allocated character array that this AString object should take // over responsibility for. // 3. nullptr. This then creates an empty string with a space of 'size' // already allocated including the null terminating character. // Arg size - This is the size in bytes of the memory pointed to by 'buffer_p' // or if 'buffer_p' is nullptr, it is the initial memory size that should be // allocated by this string. Also note that this size must include the null // terminating character, so 'size' should never be less than 1 and it // should always be greater then the length. // Arg length - number of characters to use in 'buffer_p' and the index position // to place a terminating null character. The given length must not be more // than the size of 'buffer_p' and the C-String buffer pointed to by // 'buffer_p' should not have any null characters less then the given length. // 'length' may also be set to ALength_calculate in which case the character // length is calculated by finding the first terminating null character // already present in 'buffer_p'. // Arg deallocate - Indicates whether this string (or more specifically the // AStringRef) should take control of the memory pointed to by buffer_p and // do deallocate it when it is no longer in use. // See: AString(cstr_p), AString(cstr_p, length, persistent) // Notes: To make a copy of a C-String call AString(cstr_p, length, persistent = false). // To reference a C-String literal call AString(cstr_p) or // AString(cstr_p, length, persistent = true) // Author(s): Conan Reis AString::AString( const char * buffer_p, uint32_t size, uint32_t length, bool deallocate // = false ) { if (buffer_p) { if (length == ALength_calculate) { length = uint32_t(::strlen(buffer_p)); } A_ASSERT(size > length, a_cstr_format("Supplied size (%u) is not large enough for supplied length (%u)", size, length), ErrId_null_cstr, AString); m_str_ref_p = AStringRef::pool_new(buffer_p, length, size, 1u, deallocate, false); m_str_ref_p->m_cstr_p[length] = '\0'; // Put in null-terminator } else // nullptr, so create empty AString with specified buffer size { size = AStringRef::request_char_count(size); m_str_ref_p = AStringRef::pool_new(AStringRef::alloc_buffer(size), 0u, size, 1u, true, false); m_str_ref_p->m_cstr_p[0] = '\0'; // Put in null-terminator } } //--------------------------------------------------------------------------------------- // Constructor / converter from a formatted string. // Returns: a reference to itself // Arg max_size - sets the initial character buffer size (not including the null // terminator character). This is essentially the maximum allowable // characters - if the number of the characters in the expanded format // string are larger than 'max_size' then any characters above and beyond // that number will be truncated. // Arg format_str_p - follows the same format as the C printf(), sprintf(), etc. // See the MSDev online help for 'Format Specification Fields' for a // description. // Arg ... - variable length arguments expected by the formatted string. // // #### IMPORTANT #### When using the string format type specifier (%s) in // the format string and a AString object (or a ASymbol object) is passed in // as one of the variable length arguments, use 'str.as_cstr()'. // Variable length arguments do not specify a type to the compiler, instead // the types of the passed arguments are determined via the standard C // string formatting functions - i.e %s, %u, %f, etc. So if a string type // (%s) is specified in the format string and a AString object is passed as // one of the untyped variable length arguments, the compiler will not know // to coerce the AString object to a C-String - it will instead treat the // address of the AString object argument as if it were a C-String character // array with disastrous results. // // Examples: AString begin("The answer"); // Example substring to append // AString str(100u, "%s to %s is %i", begin.as_cstr(), "everything", 42); // // str is equal to "The answer to everything is 42" // // character length is 30, buffer size is 101 // // See: format(), append_format() // Author(s): Conan Reis AString::AString( uint32_t max_size, const char * format_str_p, ... ) { va_list args; // initialize argument list uint32_t size = AStringRef::request_char_count(max_size); char * cstr_p = AStringRef::alloc_buffer(size); // allocate buffer va_start(args, format_str_p); #if defined(A_PLAT_PS3) || defined(A_PLAT_PS4) int length = vsnprintf(cstr_p, size_t(max_size + 1), format_str_p, args); #else int length = _vsnprintf(cstr_p, size_t(max_size), format_str_p, args); #endif va_end(args); // end argument list processing if ((length == -1) || (length == int(max_size))) // More characters than buffer has, so truncate { length = int(max_size); cstr_p[max_size] = '\0'; // Put in null-terminator } m_str_ref_p = AStringRef::pool_new( cstr_p, uint32_t(length), size, 1u, true, false); } //--------------------------------------------------------------------------------------- // Constructor from byte stream info // Arg source_stream_pp - Pointer to address to read byte stream / binary // serialization info from and to increment - previously filled using // as_binary() or a similar mechanism. // See: as_binary(), assign_binary() // Notes: Used in combination with as_binary() // // Binary composition: // 4 bytes - string length // n bytes - string // Author(s): Conan Reis AString::AString(const void ** source_stream_pp) { // 4 bytes - string length uint32_t length = A_BYTE_STREAM_UI32_INC(source_stream_pp); uint32_t size = AStringRef::request_char_count(length); m_str_ref_p = AStringRef::pool_new( AStringRef::alloc_buffer(size), // C-String length, // Length size, // Size 1u, // References true, // Deallocate false); // Not Read-Only // n bytes - string memcpy(m_str_ref_p->m_cstr_p, *(char **)source_stream_pp, length); m_str_ref_p->m_cstr_p[length] = '\0'; (*(uint8_t **)source_stream_pp) += length; } //--------------------------------------------------------------------------------------- // Assignment from byte stream info // Arg source_stream_pp - Pointer to address to read byte stream / binary // serialization info from and to increment - previously filled using // as_binary() or a similar mechanism. // See: as_binary(), assign_binary() // Notes: Used in combination with as_binary() // // Binary composition: // 4 bytes - string length // n bytes - string // Author(s): Conan Reis AString & AString::assign_binary(const void ** source_stream_pp) { // 4 bytes - string length uint32_t length = A_BYTE_STREAM_UI32_INC(source_stream_pp); // n bytes - string set_cstr(*(char **)source_stream_pp, length, false); (*(uint8_t **)source_stream_pp) += length; return *this; } //--------------------------------------------------------------------------------------- // APArrayLogical<AString> constructor. Concatenates all elements with separator // between them. // Returns: itself // Arg strings - Array of AString objects to convert to a single string. Ensure // that none of the pointers are nullptr. // Arg separator - This is the separator to insert between each string of the // array. (Default no separator - all the Strings are squished together) // See: tokenize(), get_token() // Notes: No separator is put in front of the first element. // Author(s): Conan Reis AString::AString( const APArrayLogical<AString> & strings, const AString & separator // = ms_empty ) { uint32_t length = strings.get_length(); if (length) { uint32_t total_length = ((length - 1u) * separator.m_str_ref_p->m_length); // separators AString ** array_p = strings.get_array(); // for faster than class member access AString ** array_end_p = array_p + length; // Accumulate string lengths to pre-allocate sufficient cstr array for (; array_p < array_end_p; array_p++) { total_length += (*array_p)->m_str_ref_p->m_length; } uint32_t size = AStringRef::request_char_count(total_length); char * cstr_p = AStringRef::alloc_buffer(size); m_str_ref_p = AStringRef::pool_new(cstr_p, total_length, size, 1u, true, false); // Accumulate strings total_length = 0u; length = separator.m_str_ref_p->m_length; array_p = strings.get_array(); if (length) { const char * seperator_cstr_p = separator.m_str_ref_p->m_cstr_p; array_end_p = array_p + (length - 1); // Last string is not followed with separator for (; array_p < array_end_p; array_p++) { memcpy(cstr_p + total_length, (*array_p)->m_str_ref_p->m_cstr_p, size_t((*array_p)->m_str_ref_p->m_length)); total_length += (*array_p)->m_str_ref_p->m_length; memcpy(cstr_p + total_length, seperator_cstr_p, size_t(length)); total_length += length; } memcpy(cstr_p + total_length, (*array_p)->m_str_ref_p->m_cstr_p, size_t((*array_p)->m_str_ref_p->m_length + 1u)); } else // No separator { for (; array_p < array_end_p; array_p++) { memcpy(cstr_p + total_length, (*array_p)->m_str_ref_p->m_cstr_p, size_t((*array_p)->m_str_ref_p->m_length)); total_length += (*array_p)->m_str_ref_p->m_length; } m_str_ref_p->m_cstr_p[m_str_ref_p->m_length] = '\0'; } } else // Array strings is empty { m_str_ref_p = AStringRef::get_empty(); m_str_ref_p->m_ref_count++; } } //--------------------------------------------------------------------------------------- // Constructor / converter from a signed integer // Returns: String version of the number // Arg integer - signed integer to convert to a string // Arg base - base (or radix) to use for conversion. 10 is decimal, 16 is // hexadecimal, 2 is binary, etc. // Examples: str = AString::ctor_int(5); // See: as_int32(), as_uint32_t(), as_float64(), AString(max_size, format_str_p, ...) // Modifiers: static // Author(s): Conan Reis AString AString::ctor_int( int integer, uint base // = AString_def_base (10) ) { uint32_t size = AStringRef::request_char_count(AString_int32_max_chars); char * cstr_p = AStringRef::alloc_buffer(size); // $Revisit - CReis Should probably write custom _itoa() // This should only be called during development, so don't worry too much for now. #ifndef A_NO_NUM2STR_FUNCS ::_itoa(integer, cstr_p, int(base)); #else // $Vital - CReis Base is ignored ::_snprintf(cstr_p, AString_int32_max_chars - 1, "%i", integer); #endif return AStringRef::pool_new(cstr_p, uint32_t(::strlen(cstr_p)), size, 0u, true, false); } //--------------------------------------------------------------------------------------- // Constructor / converter from an unsigned integer // Returns: itself // Arg natural - unsigned integer to convert to a string // Arg base - base (or radix) to use for conversion. 10 is decimal, 16 is // hexadecimal, 2 is binary, etc. // Examples: str = AString::ctor_uint(5u); // See: as_int32(), as_uint32_t(), as_float64(), AString(max_size, format_str_p, ...) // Modifiers: static // Author(s): Conan Reis AString AString::ctor_uint( uint32_t natural, uint32_t base // = AString_def_base (10) ) { uint32_t size = AStringRef::request_char_count(AString_int32_max_chars); char * cstr_p = AStringRef::alloc_buffer(size); // $Revisit - CReis Should probably write custom _itoa() // This should only be called during development, so don't worry too much for now. #ifndef A_NO_NUM2STR_FUNCS ::_ultoa(natural, cstr_p, int(base)); #else // $Vital - CReis Base is ignored ::_snprintf(cstr_p, AString_int32_max_chars - 1, "%u", natural); #endif return AStringRef::pool_new(cstr_p, uint32_t(::strlen(cstr_p)), size, 0u, true, false); } //--------------------------------------------------------------------------------------- // Constructor / converter from a f32 (float) // Returns: itself // Arg real - f32 to convert to a string // Arg significant - number of significant digits / characters to attempt to fit // 'real' into. If it can't fit, it will use a scientific notation with a // lowercase 'e'. // Examples: str = AString::ctor_f32(5.0f); // See: as_int32(), as_uint32_t(), as_float64(), AString(max_size, format_str_p, ...) // Modifiers: explicit // Author(s): Conan Reis AString AString::ctor_float( f32 real, uint32_t significant // = AString_float_sig_digits_def ) { uint32_t size = AStringRef::request_char_count(significant + AString_real_extra_chars); char * cstr_p = AStringRef::alloc_buffer(size); // for sign, exponent, etc. #ifndef A_NO_NUM2STR_FUNCS // $Revisit - CReis change this to _fcvt() if _fcvt() is really more efficient for floats - it still takes a f64??? ::_gcvt(real, int(significant), cstr_p); #else _snprintf(cstr_p, significant + AString_real_extra_chars, "%g", f64(real)); #endif uint32_t length = uint32_t(::strlen(cstr_p)); AStringRef * str_ref_p = AStringRef::pool_new(cstr_p, length, size, 0u, true, false); // Ensure that it ends with a digit if (cstr_p[length - 1u] == '.') { cstr_p[length] = '0'; cstr_p[length + 1u] = '\0'; str_ref_p->m_length++; } return str_ref_p; } //--------------------------------------------------------------------------------------- // Constructor / converter from a f64 (double) // Returns: itself // Arg real - f64 to convert to a string // Arg significant - number of significant digits / characters to attempt to fit // 'real' into. If it can't fit, it will use a scientific notation with a // lowercase 'e'. // Examples: str = AString::ctor_f64(5.0); // See: as_int32(), as_uint32_t(), as_float64(), AString(max_size, format_str_p, ...) // Modifiers: static // Author(s): Conan Reis AString AString::ctor_float64( f64 real, uint32_t significant // = AString_double_sig_digits_def ) { uint32_t size = AStringRef::request_char_count(significant + AString_real_extra_chars); char * cstr_p = AStringRef::alloc_buffer(size); // for sign, exponent, etc. #ifndef A_NO_NUM2STR_FUNCS // $Revisit - CReis change this to _fcvt() if _fcvt() is really more efficient for floats - it still takes a f64??? ::_gcvt(real, int(significant), cstr_p); #else _snprintf(cstr_p, significant + AString_real_extra_chars, "%g", real); #endif uint32_t length = uint32_t(::strlen(cstr_p)); AStringRef * str_ref_p = AStringRef::pool_new(cstr_p, length, size, 0u, true, false); // Ensure that it ends with a digit if (cstr_p[length - 1u] == '.') { cstr_p[length] = '0'; cstr_p[length + 1u] = '\0'; str_ref_p->m_length++; } return str_ref_p; } //--------------------------------------------------------------------------------------- // Constructor / converter from stream. // Returns: a reference to itself // Author(s): Conan Reis //AString::AString(strstream & strm) // { // strm << ends; // terminate stream with a null // m_str_ref_p->m_length = uint32_t(::strlen(strm.str())); // get number of characters in stream // m_str_ref_p->m_size = m_str_ref_p->m_length + 1; // calculate size // m_str_ref_p->m_cstr_p = AStringRef::alloc_buffer(m_str_ref_p->m_size); // memcpy(m_str_ref_p->m_cstr_p, strm.str(), size_t(m_str_ref_p->m_length + 1)); // copy characters from stream // } //--------------------------------------------------------------------------------------- // Converter / constructor from wide character (Unicode) C-String. // // Params: // wcstr_p: wide character (unicode) string to convert. // // Author(s): Conan Reis AString::AString(const wchar_t * wcstr_p) { // $Vital - CReis Test this and switch to UTF-8 as soon as possible. if (wcstr_p) { uint32_t length = uint32_t(::wcslen(wcstr_p)); if (length) { uint32_t size = AStringRef::request_char_count(length); char * cstr_p = AStringRef::alloc_buffer(size); #ifdef A_PLAT_PC WideCharToMultiByte(CP_ACP, 0, wcstr_p, length, cstr_p, size, NULL, NULL); #else ::wcstombs(cstr_p, wcstr_p, size_t(length + 1u)); #endif cstr_p[length] = '\0'; // Put in null-terminator m_str_ref_p = AStringRef::pool_new(cstr_p, length, size, 1u, true, false); return; } } m_str_ref_p = AStringRef::get_empty(); m_str_ref_p->m_ref_count++; } //--------------------------------------------------------------------------------------- // Converter / constructor from wide character (Unicode) C-String. // // Params: // wcstr_p: wide character (unicode) string to convert. // length: number of characters - not bytes - in wcstr_p // // Author(s): Conan Reis AString::AString( const wchar_t * wcstr_p, uint32_t length ) { // $Vital - CReis Test this and switch to UTF-8 as soon as possible. if (wcstr_p && length) { uint32_t size = AStringRef::request_char_count(length); char * cstr_p = AStringRef::alloc_buffer(size); #ifdef A_PLAT_PC WideCharToMultiByte(CP_ACP, 0, wcstr_p, length, cstr_p, size, NULL, NULL); #else ::wcstombs(cstr_p, wcstr_p, size_t(length + 1u)); #endif cstr_p[length] = '\0'; // Put in null-terminator m_str_ref_p = AStringRef::pool_new(cstr_p, length, size, 1u, true, false); return; } m_str_ref_p = AStringRef::get_empty(); m_str_ref_p->m_ref_count++; } //#ifdef ASTR_ENABLE_WIDE_CHAR //--------------------------------------------------------------------------------------- // Cast / convert a string to a wide character (Unicode) C-String. // Notes: ***Warning*** returns dynamic data // Author(s): Conan Reis //AString::operator const wchar_t * () const // { // wchar_t * buffer_p = new wchar_t[m_str_ref_p->m_length + 1]; // // A_VERIFY_MEMORY(buffer_p == nullptr, AString); // mbstowcs(buffer_p, m_str_ref_p->m_cstr_p, size_t(m_str_ref_p->m_length + 1)); // return buffer_p; // // $Revisit - CReis Should be something like this so memory is managed: return WString(*this); // // Alternatively use a big reusable buffer for quick and dirty converts. // } //#endif //--------------------------------------------------------------------------------------- // Stream assignment - allows assignment stringization S = S = S // Returns: itself // Arg strstream & strm - // Author(s): Conan Reis //AString & AString::operator=(strstream & strm) // { // strm << ends; // terminate stream with a null // m_str_ref_p->m_length = ::strlen(strm.str()); // get number of characters in stream // ensure_size_buffer(m_str_ref_p->m_length); // memcpy(m_str_ref_p->m_cstr_p, strm.str(), size_t(m_str_ref_p->m_length + 1)); // copy characters from stream // return *this; // } //--------------------------------------------------------------------------------------- // Converter to f64. // Returns: a f64 interpretation of the specified section // Arg start_pos - index position to start parsing string. // Arg stop_pos_p - Address to store the index position where conversion stops. // If it is set to nullptr, it is ignored. (Default nullptr) // Examples: f64 num = num_str.as_float64(); // See: AString(real, significant), as_int32(), as_uint32_t() // Notes: The acceptable string form is as following: // // [whitespace] [sign] [digits] [.digits] [{d | D | e | E} [sign] digits] // // Whitespace may consist of space and tab characters, which are ignored. // sign is either plus (+) or minus (-) and digits are one or more decimal // digits. If no digits appear before the radix character, at least one // must appear after the radix character. The decimal digits can be // followed by an exponent, which consists of an introductory letter // (d, D, e, or E) and an optionally signed integer. If neither an exponent // part nor a radix character appears, a radix character is assumed to // follow the last digit in the string. The first character that does not // fit this form stops the scan. // Author(s): Conan Reis f64 AString::as_float64( uint32_t start_pos, // = 0u uint32_t * stop_pos_p // = nullptr ) const { #ifdef A_BOUNDS_CHECK bounds_check(start_pos, "as_float64"); #endif char * stop_char_p; f64 value = ::strtod(&m_str_ref_p->m_cstr_p[start_pos], &stop_char_p); // convert if (stop_pos_p) { *stop_pos_p = uint32_t(stop_char_p - m_str_ref_p->m_cstr_p); // determine pos where conversion ended } return value; } //--------------------------------------------------------------------------------------- // Converter to f32. // Returns: a f32 interpretation of the specified section // Arg start_pos - index position to start parsing string. // Arg stop_pos_p - Address to store the index position where conversion stops. // If it is set to nullptr, it is ignored. (Default nullptr) // Examples: f32 num = num_str.as_float32(); // See: AString(real, significant), as_int32(), as_uint32_t() // Notes: The acceptable string form is as following: // // [whitespace] [sign] [digits] [.digits] [{d | D | e | E} [sign] digits] // // Whitespace may consist of space and tab characters, which are ignored. // sign is either plus (+) or minus (-) and digits are one or more decimal // digits. If no digits appear before the radix character, at least one // must appear after the radix character. The decimal digits can be // followed by an exponent, which consists of an introductory letter // (d, D, e, or E) and an optionally signed integer. If neither an exponent // part nor a radix character appears, a radix character is assumed to // follow the last digit in the string. The first character that does not // fit this form stops the scan. // Author(s): Conan Reis f32 AString::as_float32( uint32_t start_pos, // = 0u uint32_t * stop_pos_p // = nullptr ) const { #ifdef A_BOUNDS_CHECK bounds_check(start_pos, "as_float64"); #endif // $Revisit - CReis Temp code char * stop_char_p; f32 value = f32(::strtod(&m_str_ref_p->m_cstr_p[start_pos], &stop_char_p)); // convert if (stop_pos_p) { *stop_pos_p = uint32_t(stop_char_p - m_str_ref_p->m_cstr_p); // determine pos where conversion ended } return value; } //--------------------------------------------------------------------------------------- // Converter to int32_t // Returns: a int32_t interpretation of the specified section // Arg start_pos - index position to start parsing string. (Default 0u) // Arg stop_pos_p - Address to store the index position where conversion stops. // If it is set to nullptr, it is ignored. (Default nullptr) // Arg base - (or radix) sets the numerical base that should be expected. // Acceptable values are from 2 to 36. If base is AString_determine_base (0), // the initial characters are used to determine the base. If the first // character is 0 and the second character is not 'x' or 'X', the string is // interpreted as an octal (base 8) integer; otherwise, it is interpreted as // a decimal number. If the first character is '0' and the second character // is 'x' or 'X', the string is interpreted as a hexadecimal integer. If // the first character is '1' through '9', the string is interpreted as a // decimal integer. (Default AString_determine_base) // Examples: int32_t num = num_str.as_int32(); // See: AString(integer, base), as_uint32_t(), as_real64() // Notes: The acceptable string form is as following: // // [whitespace] [{+ | -}] [0 [{ x | X }]] [digits] // // Whitespace may consist of space and tab characters, which are ignored. // digits are one or more decimal digits. The letters 'a' through 'z' // (or 'A' through 'Z') are assigned the values 10 through 35; only letters // whose assigned values are less than 'base' are permitted. A plus (+) or // minus (-) sign is allowed as a prefix; a leading minus sign indicates // that the return value is negated. The first character that does not fit // this form stops the scan. // Author(s): Conan Reis int AString::as_int( uint32_t start_pos, // = 0u uint32_t * stop_pos_p, // = nullptr uint32_t base // = AString_def_base ) const { char * stop_char_p; int32_t value; #ifdef A_BOUNDS_CHECK bounds_check(start_pos, "as_int32"); A_VERIFY(a_is_ordered(AString_determine_base, base, AString_max_base), a_cstr_format("invalid numerical base/radix \nExpected 1-37, but given %u", base), ErrId_invalid_base, AString); #endif value = int32_t(strtol(&m_str_ref_p->m_cstr_p[start_pos], &stop_char_p, int(base))); if (stop_pos_p) { *stop_pos_p = uint32_t(ptrdiff_t(stop_char_p) - ptrdiff_t(m_str_ref_p->m_cstr_p)); // determine pos where conversion ended } return value; } //--------------------------------------------------------------------------------------- // Converter to uint32_t // Returns: a uint32_t interpretation of the specified section // Arg start_pos - index position to start parsing string. (Default 0u) // Arg stop_pos_p - Address to store the index position where conversion stops. // If it is set to nullptr, it is ignored. (Default nullptr) // Arg base - (or radix) sets the numerical base that should be expected. // Acceptable values are from 2 to 36. If base is AString_determine_base (0), // the initial characters are used to determine the base. If the first // character is 0 and the second character is not 'x' or 'X', the string is // interpreted as an octal (base 8) integer; otherwise, it is interpreted as // a decimal number. If the first character is '0' and the second character // is 'x' or 'X', the string is interpreted as a hexadecimal integer. If // the first character is '1' through '9', the string is interpreted as a // decimal integer. (Default AString_determine_base) // Examples: int32_t num = num_str.as_int32(); // Notes: The acceptable string form is as following: // // [whitespace] [0 [{ x | X }]] [digits] // // Whitespace may consist of space and tab characters, which are ignored. // digits are one or more decimal digits. The letters 'a' through 'z' // (or 'A' through 'Z') are assigned the values 10 through 35; only letters // whose assigned values are less than 'base' are permitted. The first // character that does not fit this form stops the scan. // Author(s): Conan Reis uint AString::as_uint( uint32_t start_pos, // = 0u uint32_t * stop_pos_p, // = nullptr uint base // = AString_def_base ) const { char * stop_char_p; uint32_t value; #ifdef A_BOUNDS_CHECK bounds_check(start_pos, "as_uint32_t"); A_VERIFY(a_is_ordered(AString_determine_base, base, AString_max_base), a_cstr_format("invalid numerical base/radix \nExpected 1-37, but given %u", base), ErrId_invalid_base, AString); #endif value = uint32_t(strtoul(&m_str_ref_p->m_cstr_p[start_pos], &stop_char_p, int(base))); if (stop_pos_p) { *stop_pos_p = uint32_t(stop_char_p - m_str_ref_p->m_cstr_p); // determine pos where conversion ended } return value; } //--------------------------------------------------------------------------------------- // Does a case-sensitive comparison of the current string at specified index // to the supplied substring to determine if it is equal to, less than, or // greater than it. // Returns: AEquate_equal, AEquate_less, or AEquate_greater // Arg substr - sub-string to compare // See: icompare_sub() for a case-insensitive version. // Author(s): Conan Reis eAEquate AString::compare_sub( const AString & substr, uint32_t index // = 0u ) const { // $Revisit - CReis This should be profiled, but I believe that the custom code is faster // than the commented out section below. char * str1_p = m_str_ref_p->m_cstr_p + index; char * str1_end_p = str1_p + a_min(m_str_ref_p->m_length + 1u - index, substr.m_str_ref_p->m_length); // compare the # of characters in the shorter sub-string (without null) char * str2_p = substr.m_str_ref_p->m_cstr_p; while (str1_p < str1_end_p) { if (*str1_p != *str2_p) // if characters differ { // select appropriate result return (*str1_p < *str2_p) ? AEquate_less : AEquate_greater; } str1_p++; str2_p++; } return AEquate_equal; // Alternate method using standard library functions. //int result = ::strncmp( // m_str_ref_p->m_cstr_p + index, // substr.m_str_ref_p->m_cstr_p, // a_min(m_str_ref_p->m_length - index, substr.m_str_ref_p->m_length)); // // This is a funky way to convert < 0 to -1, > 0 to 1, and 0 to stay 0 //return static_cast<eAEquate>((result > 0) ? 1 : result >> 31); } //--------------------------------------------------------------------------------------- // Does a case-insensitive comparison of the current string at specified // index to the supplied substring to determine if it is equal to, less than, // or greater than it. // Returns: AEquate_equal, AEquate_less, or AEquate_greater // Arg substr - sub-string to compare // See: compare_sub() for a case-sensitive version. // Author(s): Conan Reis eAEquate AString::icompare_sub( const AString & substr, uint32_t index // = 0u ) const { // $Revisit - CReis This should be profiled, but I believe that the custom code is faster // than the commented out section below. uint8_t * str1_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + index); uint8_t * str1_end_p = str1_p + a_min(m_str_ref_p->m_length + 1u - index, substr.m_str_ref_p->m_length); // compare the # of characters in the shorter sub-string (without null) uint8_t * str2_p = reinterpret_cast<uint8_t *>(substr.m_str_ref_p->m_cstr_p); char ch1, ch2; while (str1_p < str1_end_p) { ch1 = ms_char2lower[*str1_p]; ch2 = ms_char2lower[*str2_p]; if (ch1 != ch2) // if characters differ { // select appropriate result return (ch1 < ch2) ? AEquate_less : AEquate_greater; } str1_p++; str2_p++; } return AEquate_equal; // Alternate method using standard library functions. //int result = ::_strnicmp( // m_str_ref_p->m_cstr_p + index, // substr.m_str_ref_p->m_cstr_p, // a_min(m_str_ref_p->m_length - index, substr.m_str_ref_p->m_length)); // // This is a funky way to convert < 0 to -1, > 0 to 1, and 0 to stay 0 //return static_cast<eAEquate>((result > 0) ? 1 : result >> 31); } //--------------------------------------------------------------------------------------- // Does a case-sensitive comparison of the current string to the supplied // string to determine if they are equal. // Returns: true if equal, false if not // Arg str - string to compare // See: is_equal() for a case-sensitive version. // Author(s): Conan Reis bool AString::is_equal(const AString & str) const { return m_str_ref_p->is_equal(*str.m_str_ref_p); } //--------------------------------------------------------------------------------------- // Does a case-insensitive comparison of the current string to the supplied // string to determine if they are equal. // Returns: true if equal, false if not // Arg str - string to compare // See: is_equal() for a case-sensitive version. // Author(s): Conan Reis bool AString::is_iequal(const AString & str) const { // $Revisit - CReis This should be profiled, but I believe that the custom code is faster // than the standard library calls. uint32_t length = m_str_ref_p->m_length; if (length != str.m_str_ref_p->m_length) { return false; } uint8_t * str1_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p); uint8_t * str1_end_p = str1_p + length; // Don't bother comparing null character uint8_t * str2_p = reinterpret_cast<uint8_t *>(str.m_str_ref_p->m_cstr_p); char ch1, ch2; while (str1_p < str1_end_p) { ch1 = ms_char2lower[*str1_p]; ch2 = ms_char2lower[*str2_p]; if (ch1 != ch2) // if characters differ { // select appropriate result return false; } str1_p++; str2_p++; } return true; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Modifying Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Appends a C-string to the current string. // Returns: itself // Arg cstr_p - pointer to array of characters to append (does not need to be // null terminated unless length is equal to ALength_calculate). 'cstr_p' // should never be nullptr. // Arg length - number of characters to use in 'cstr_p'. // 'length' may also be set to ALength_calculate in which case the character // length is calculated by finding the first terminating null character // already present in the 'cstr_p'. // See: append(str), insert(), set_cstr(), set_buffer(), add(), operator+=(), // operator+(), operator=() // Author(s): Conan Reis void AString::append( const char * cstr_p, uint32_t length // = ALength_calculate ) { A_ASSERT(cstr_p != nullptr, "Given nullptr instead of valid C-String", ErrId_null_cstr, AString); if (length == ALength_calculate) { length = uint32_t(::strlen(cstr_p)); } if (length) { // Calculate total length of string uint32_t total_length = m_str_ref_p->m_length + length; ensure_size(total_length); // concatenate new string memcpy(m_str_ref_p->m_cstr_p + m_str_ref_p->m_length, cstr_p, size_t(length)); m_str_ref_p->m_length = total_length; m_str_ref_p->m_cstr_p[total_length] = '\0'; // Place a terminating character } } //--------------------------------------------------------------------------------------- // Appends the the specified formatted string to the internal C-String. // Arg format_str_p - follows the same format as the C printf(), sprintf(), etc. // See the MSDev online help for 'Format Specification Fields' for a // description. // Arg ... - variable length arguments expected by the formatted string. // // #### IMPORTANT #### Since the variable length arguments do not specify a // type to the compiler the types passes must be determined via the standard // C string formatting functions. So if a AString *object* is passed in as // one of the untyped variable length arguments, the compiler will not know // to coerce it to a C-String the C format functions will then treat the // address of the AString object as if it were a C-String with disastrous // results. When using the string format type specifier (%s) and a AString // object (or a ASymbol object) use 'str.as_cstr()'. // // Examples: AString name("Joe"); // Example substring to append // AString str("Hello"); // character length is 5 buffer size is 6 // str.ensure_size(100u); // character length is 5 buffer size is 101 // str.append_format(" %i you %s %s", 2, name.as_cstr(), "Developer"); // // str is now "Hello 2 you Joe Developer" // // character length is 25 buffer size is 101 // // See: format(), AString(max_size, format_str_p, ...) // Notes: If the sum of the current number of characters and the characters in the // expanded format string are larger than the size of this string's current // character buffer, then any characters above and beyond the buffer size // will be truncated. So it is important that the maximum potential buffer // size has been allocated before this method is called - this can be // easily achieved by calling ensure_size() prior to calling this method. // Author(s): Conan Reis void AString::append_format(const char * format_str_p, ...) { uint32_t length = m_str_ref_p->m_length; uint32_t size = m_str_ref_p->m_size; int free_size = int(size - length) - 1; // excluding null terminator if (free_size > 0) { va_list args; // initialize argument list // Ensure buffer is writable and remains the same size ensure_size(size - 1u); va_start(args, format_str_p); #ifdef A_PLAT_PS3 int fmt_length = vsnprintf(m_str_ref_p->m_cstr_p + length, size_t(free_size + 1), format_str_p, args); #else int fmt_length = _vsnprintf(m_str_ref_p->m_cstr_p + length, size_t(free_size), format_str_p, args); #endif va_end(args); // end argument list processing if ((fmt_length == -1) || (fmt_length == free_size)) // More characters than buffer has, so truncate { fmt_length = free_size; m_str_ref_p->m_cstr_p[length + fmt_length] = '\0'; // Put in null-terminator } m_str_ref_p->m_length += uint32_t(fmt_length); } } //--------------------------------------------------------------------------------------- // Removes all the characters but the substring starting at 'pos' with a // length of 'char_count'. // Arg pos - starting character index position of substring to crop // Arg char_count - number of characters that the remaining substring should // have. If 'char_count' is ALength_remainder, the number of characters is // equal to the 'length of the string' - 'pos'. (Default ALength_remainder) // Examples: AString str(" the quick brown fox "); // // str.crop(3u, 12u); // str is now "he quick bro" // See: crop_quick(), crop(match_type), trim(), truncate(), // remove_all(match_type), find(match_type) // Notes: This method checks if 'pos' and 'char_count' are valid if A_BOUNDS_CHECK // is defined (defined by default in debug builds). // Author(s): Conan Reis void AString::crop( uint32_t pos, uint32_t char_count // = ALength_remainder ) { AStringRef * str_ref_p = m_str_ref_p; if (char_count == ALength_remainder) { char_count = str_ref_p->m_length - pos; } if (char_count) { #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "crop"); #endif crop_quick(pos, char_count); } else { empty(); } } //--------------------------------------------------------------------------------------- // Removes all the characters of match_type from the beginning and the end // of the string until it encounters a character that is not match_type. // Arg match_type - classification of characters to remove. // (Default ACharMatch_white_space) // Examples: AString str(" the quick brown fox "); // // str.crop(); // str is now "the quick brown fox" // See: trim(), truncate(), remove_all(match_type), find(match_type), // not_char_type() // Author(s): Conan Reis AString & AString::crop( eACharMatch match_type // = ACharMatch_white_space ) { uint32_t start_pos; eACharMatch not_type = not_char_type(match_type); if (find(not_type, 1u, &start_pos)) { uint32_t end_pos; find_reverse(not_type, 1u, &end_pos); crop_quick(start_pos, end_pos - start_pos + 1u); } else { empty(); } return *this; } //--------------------------------------------------------------------------------------- // Removes all the characters but the substring starting at 'pos' with a // length of 'char_count'. // Arg pos - starting character index position of substring to crop // Arg char_count - number of characters that the remaining substring should // have - it should be at least 1. // Examples: AString str(" the quick brown fox "); // // str.crop(3u, 12u); // str is now "he quick bro" // See: crop_quick(), crop(match_type), trim(), truncate(), // remove_all(match_type), find(match_type) // Notes: This method does *not* check if 'pos' and 'char_count' are valid even if // A_BOUNDS_CHECK is defined. // Author(s): Conan Reis void AString::crop_quick( uint32_t pos, uint32_t char_count ) { AStringRef * str_ref_p = m_str_ref_p; if (char_count == str_ref_p->m_length) { // Keeping whole string - no need to do anything return; } // If unique and writable if ((str_ref_p->m_ref_count + str_ref_p->m_read_only) == 1u) { if (pos) { // Shift down memmove(str_ref_p->m_cstr_p, str_ref_p->m_cstr_p + pos, char_count); } str_ref_p->m_cstr_p[char_count] = '\0'; str_ref_p->m_length = char_count; } else // Shared or read-only { uint32_t size = AStringRef::request_char_count(char_count + 1u); char * buffer_p = AStringRef::alloc_buffer(size); memcpy(buffer_p, str_ref_p->m_cstr_p + pos, size_t(char_count)); buffer_p[char_count] = '\0'; m_str_ref_p = str_ref_p->reuse_or_new(buffer_p, char_count, size); } } //--------------------------------------------------------------------------------------- // Sets the internal C-String to the specified formatted string. // Arg format_str_p - follows the same format as the C printf(), sprintf(), etc. // See the MSDev online help for 'Format Specification Fields' for a // description. // Arg ... - variable length arguments expected by the formatted string. // // #### IMPORTANT #### When using the string format type specifier (%s) in // the format string and a AString object (or a ASymbol object) is passed in // as one of the variable length arguments, use 'str.as_cstr()'. // Variable length arguments do not specify a type to the compiler, instead // the types of the passed arguments are determined via the standard C // string formatting functions - i.e %s, %u, %f, etc. So if a string type // (%s) is specified in the format string and a AString object is passed as // one of the untyped variable length arguments, the compiler will not know // to coerce the AString object to a C-String - it will instead treat the // address of the AString object argument as if it were a C-String character // array with disastrous results. // Examples: AString begin("The answer"); // Example substring to append // AString str("Hello"); // character length is 5 buffer size is 6 // str.ensure_size(100u); // character length is 5 buffer size is 101 // str.format("%s to %s is %i", begin.as_cstr(), "everything", 42); // // str is now "The answer to everything is 42" // // character length is 30 buffer size is 101 // // See: append_format(), AString(max_size, format_str_p, ...) // Notes: If the number of characters in the expanded format string is larger than // the size of this string's current character buffer, then any characters // above and beyond the buffer size will be truncated. So it is important // that the maximum potential buffer size has been allocated before this // method is called - this can be easily achieved by calling ensure_size() // prior to calling this method. // Author(s): Conan Reis void AString::format(const char * format_str_p, ...) { va_list args; // initialize argument list int char_size = int(m_str_ref_p->m_size) - 1; if (char_size > 0) { // Ensure buffer is writable, but don't bother copying existing data. ensure_size_buffer(char_size); va_start(args, format_str_p); #if defined(A_PLAT_PS3) || defined(A_PLAT_PS4) int length = vsnprintf(m_str_ref_p->m_cstr_p, size_t(char_size + 1), format_str_p, args); #else int length = _vsnprintf(m_str_ref_p->m_cstr_p, size_t(char_size), format_str_p, args); #endif va_end(args); // end argument list processing if ((length == -1) || (length == char_size)) // More characters than buffer has, so truncate { length = int(char_size); m_str_ref_p->m_cstr_p[char_size] = '\0'; // Put in null-terminator } m_str_ref_p->m_length = uint32_t(length); } } //--------------------------------------------------------------------------------------- // Increments any postfixed number by amount specified. If the string does // not have a previously postfixed number then increment_by is appended to // the string padded with zeros if necessary as specified by min_digits. // Returns: Postfixed value. // Arg increment_by - step value / amount to increment by // Arg min_digits - minimum number of digits to use for postfix value. If a // previous postfix value is present, its number of digits is used and this // number is ignored. // Author(s): Conan Reis uint32_t AString::increment( uint32_t increment_by, // = 1u uint32_t min_digits // = 4u ) { uint32_t find_pos = 0u; uint32_t value = 0u; uint32_t length = m_str_ref_p->m_length; // Look for previous value find_reverse(ACharMatch_not_digit, 1u, &find_pos); if ((find_pos + 1u) < length) { // Previous number postfix found find_pos++; value = as_uint(find_pos, nullptr, 10u); min_digits = length - find_pos; // remove old value prefix length -= min_digits; m_str_ref_p->m_length = length; } // Create new value value += increment_by; uint32_t new_digits = value < 10u ? 1u : a_log10ceil(value) + 1u; ensure_size(length + a_max(new_digits, min_digits)); if (new_digits < min_digits) { // Pad with zeros append('0', min_digits - new_digits); } append_format("%d", value); return value; } //--------------------------------------------------------------------------------------- // Indents rows/lines by specified `space_count` spaces from `start_pos` to `end_pos`. // Works on line breaks that are in Unix style `\n` or DOS style `\r\n`. // // Returns: number of line breaks over the range specified // Params: // space_count: number of space characters to indent // start_pos: starting index to begin indentation // end_pos: ending index to stop indentation // // Notes: // - Spaces inserted just prior to first non-space (space or tab) character on each row. // - Rows with no non-space characters are not indented. // - If the range ends just after a line break, the following row is not indented - at // least one character on a row must be included for it to be indented // - Mimics behaviour of Visual Studio editor. // // See: line_unindent(), line_*() functions, ARichEditOS::indent_selection() // Author(s): Conan Reis uint32_t AString::line_indent( uint32_t space_count, // = AString_indent_spaces_def uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { // $Revisit - CReis Could use space_count=0 to indicate that spaces should be used to indent rather than spaces. AStringRef * str_ref_p = m_str_ref_p; uint32_t length = str_ref_p->m_length; if (length == 0u) { return 0u; } if (end_pos == ALength_remainder) { end_pos = length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "indent"); #endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Determine number of lines. uint32_t line_count = 1u; char * buffer_p = str_ref_p->m_cstr_p; char * cstr_start_p = buffer_p + start_pos; char * cstr_end_p = buffer_p + end_pos; char * cstr_p = cstr_start_p; // Use < rather than <= to intentionally stop before last character while (cstr_p < cstr_end_p) { if (*cstr_p == '\n') { line_count++; } cstr_p++; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Ensure enough memory for indenting size_t char_count; char * dest_p; char * source_p = buffer_p; uint32_t extra_chars = line_count * space_count; // $Revisit - CReis Could reuse existing buffer if it is large enough. // Test to see if new buffer needed or if old one can be reused //bool new_buffer_b = (str_ref_p->m_size < (length + extra_chars)) // || ((str_ref_p->m_ref_count + str_ref_p->m_read_only) != 1u); uint32_t new_size = AStringRef::request_char_count(length + extra_chars); char * new_buffer_p = AStringRef::alloc_buffer(new_size); dest_p = new_buffer_p; cstr_p = cstr_start_p; do { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Find first non-space while ((cstr_p <= cstr_end_p) && ((*cstr_p == ' ') || (*cstr_p == '\t'))) { cstr_p++; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Indent if some non-space chars before end of line if ((cstr_p <= cstr_end_p) && (*cstr_p != '\r') && (*cstr_p != '\n')) { // Copy characters so far char_count = size_t(cstr_p - source_p); memcpy(dest_p, source_p, char_count); source_p = cstr_p; dest_p += char_count; // Indent memset(dest_p, ' ', space_count); dest_p += space_count; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Skip past end of line (skip `\r` of `\r\n`) or to end of range while (cstr_p <= cstr_end_p) { if (*cstr_p == '\n') { // Skip past newline cstr_p++; break; } cstr_p++; } } while (cstr_p <= cstr_end_p); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Copy any remainder of the string char_count = size_t(cstr_p - source_p); memcpy(dest_p, source_p, char_count); dest_p += char_count; length = uint32_t(dest_p - new_buffer_p); new_buffer_p[length] = '\0'; m_str_ref_p = str_ref_p->reuse_or_new(new_buffer_p, length, new_size); return line_count; } //--------------------------------------------------------------------------------------- // Indents all rows/lines after the first row by specified `space_count` spaces from // `start_pos` to `end_pos`. Works on line breaks that are in Unix style `\n` or DOS // style `\r\n`. // // Returns: number of line breaks over the range specified // Params: // space_count: number of space characters to indent // start_pos: starting index to begin indentation // end_pos: ending index to stop indentation // // Notes: // - Spaces inserted just prior to first non-space (space or tab) character on each row. // - Rows with no non-space characters are not indented. // - If the range ends just after a line break, the following row is not indented - at // least one character on a row must be included for it to be indented // - Mimics behaviour of Visual Studio editor. // // See: line_unindent(), line_*() functions, ARichEditOS::indent_selection() // Author(s): Conan Reis uint32_t AString::line_indent_next( uint32_t space_count, // = AString_indent_spaces_def uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { if (find('\n', 1u, &start_pos, start_pos, end_pos)) { return line_indent(space_count, start_pos + 1u, end_pos); } return 0u; } //--------------------------------------------------------------------------------------- // Unindents rows/lines by specified `space_count` spaces from `start_pos` to `end_pos`. // Works on line breaks that are in Unix style `\n` or DOS style `\r\n`. // // Returns: number of line breaks over the range specified // Params: // space_count: number of space characters to unindent // tab_stops: tab stop count in spaces // start_pos: starting index to begin // end_pos: ending index to stop // // Notes: // - Spaces removed just prior to first non-space (space or tab) character on each row. // - Rows with no non-space characters are left as is // - If the range ends just after a line break, the following row is not unindented - at // least one character on a row must be included for it to be unindented // // See: line_indent(), line_*() functions, ARichEditOS::unindent_selection() // Author(s): Conan Reis uint32_t AString::line_unindent( uint32_t space_count, // = AString_indent_spaces_def uint32_t tab_stops, // = AString_tab_stop_def uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ struct Nested { static char * set_column( char * cstr_p, uint32_t column, uint32_t tab_stops) { uint32_t idx = 0u; uint32_t tab_spaces = 0u; while (idx < column) { if (*cstr_p == ' ') { cstr_p++; idx++; } else { // Must be a tab - determine its number of spaces tab_spaces = tab_stops - (idx % tab_stops); if ((idx + tab_spaces) >= column) { // Convert tab to spaces as needed and increment space difference tab_spaces = column - idx; memset(cstr_p, ' ', tab_spaces); return cstr_p + tab_spaces; } idx += tab_spaces; } } return cstr_p; } }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AStringRef * str_ref_p = m_str_ref_p; uint32_t length = str_ref_p->m_length; if (length == 0u) { return 0u; } if (end_pos == ALength_remainder) { end_pos = length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "indent"); #endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Determine number of lines. uint32_t line_count = 1u; char * buffer_p = str_ref_p->m_cstr_p; char * cstr_start_p = buffer_p + start_pos; char * cstr_end_p = buffer_p + end_pos; char * cstr_p = cstr_start_p; // Use < rather than <= to intentionally stop before last character while (cstr_p < cstr_end_p) { if (*cstr_p == '\n') { line_count++; } cstr_p++; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Ensure enough memory for unindenting // - Note that tabs are converted to spaces as they are reduced and they may add up to // more characters even after space_count characters have been removed. size_t char_count; char * line_p; char * dest_p; char * source_p = buffer_p; uint32_t extra_chars = 0u; uint32_t column = 0u; if (tab_stops > space_count) { extra_chars = line_count * (tab_stops - space_count - 1); } // $Revisit - CReis Could reuse existing buffer if it is large enough. // Test to see if new buffer needed or if old one can be reused //bool new_buffer_b = (str_ref_p->m_size < (length + extra_chars)) // || ((str_ref_p->m_ref_count + str_ref_p->m_read_only) != 1u); uint32_t new_size = AStringRef::request_char_count(length + extra_chars); char * new_buffer_p = AStringRef::alloc_buffer(new_size); dest_p = new_buffer_p; cstr_p = cstr_start_p; do { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Find first non-space column = 0u; line_p = dest_p + size_t(cstr_p - source_p); while ((cstr_p <= cstr_end_p) && ((*cstr_p == ' ') || (*cstr_p == '\t'))) { column += (*cstr_p == '\t') ? (tab_stops - (column % tab_stops)) : 1u; cstr_p++; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Unindent if some non-space chars before end of line if ((cstr_p <= cstr_end_p) && (*cstr_p != '\r') && (*cstr_p != '\n')) { // Copy characters so far char_count = size_t(cstr_p - source_p); memcpy(dest_p, source_p, char_count); source_p = cstr_p; // Unindent dest_p = Nested::set_column( line_p, (column > space_count) ? column - space_count : 0u, tab_stops); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Skip past end of line (skip `\r` of `\r\n`) or to end of range while (cstr_p <= cstr_end_p) { if (*cstr_p == '\n') { // Skip past newline cstr_p++; break; } cstr_p++; } } while (cstr_p <= cstr_end_p); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Copy any remainder of the string char_count = size_t(cstr_p - source_p); memcpy(dest_p, source_p, char_count); dest_p += char_count; length = uint32_t(dest_p - new_buffer_p); new_buffer_p[length] = '\0'; m_str_ref_p = str_ref_p->reuse_or_new(new_buffer_p, length, new_size); return line_count; } //--------------------------------------------------------------------------------------- // Substring character insertion. // Returns: a reference to itself // Author(s): Conan Reis void AString::insert( char ch, uint32_t pos // = 0u ) { #ifdef A_BOUNDS_CHECK bounds_check(pos, "insert"); #endif // $Revisit - CReis This could be optimized - the end may be copied twice ensure_size(m_str_ref_p->m_length + 1u); memmove(m_str_ref_p->m_cstr_p + pos + 1u, m_str_ref_p->m_cstr_p + pos, size_t(m_str_ref_p->m_length - pos + 1u)); m_str_ref_p->m_cstr_p[pos] = ch; // insert character m_str_ref_p->m_length++; } //--------------------------------------------------------------------------------------- // Sub-string string insertion. // Returns: a reference to itself // Author(s): Conan Reis void AString::insert( const AString & str, uint32_t pos // = 0u ) { #ifdef A_BOUNDS_CHECK bounds_check(pos, "insert"); #endif // $Revisit - CReis This could be optimized - the end may be copied twice ensure_size(m_str_ref_p->m_length + str.m_str_ref_p->m_length); memmove(m_str_ref_p->m_cstr_p + pos + str.m_str_ref_p->m_length, m_str_ref_p->m_cstr_p + pos, size_t(m_str_ref_p->m_length - pos + 1u)); memcpy(m_str_ref_p->m_cstr_p + pos, str.m_str_ref_p->m_cstr_p, size_t(str.m_str_ref_p->m_length)); m_str_ref_p->m_length += str.m_str_ref_p->m_length; } //--------------------------------------------------------------------------------------- // Converts line breaks from to Unix style (\n) to DOS style (\r\n). // This method will also work if the string is already in DOS style. // Returns: Returns the number of line breaks that were converted. // See: line_*() functions // Author(s): Conan Reis uint32_t AString::line_break_unix2dos( uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t pre_remove = m_str_ref_p->m_length; remove_all('\r', start_pos, end_pos); end_pos = (end_pos == ALength_remainder) ? m_str_ref_p->m_length - 1u : end_pos - (pre_remove - m_str_ref_p->m_length); return replace_all('\n', ms_dos_break, start_pos, end_pos); } //--------------------------------------------------------------------------------------- // Substring search and removal. Finds Nth instance string str starting from start_pos // and stores the index position if found in find_pos. Returns true if found false if not. // Author(s): Conan Reis bool AString::remove( const AString & str, uint32_t instance, // = 1u uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0u uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) { uint32_t pos; if (find(str, instance, &pos, start_pos, end_pos, case_check)) { // $Revisit - CReis This could be optimized - the end may be copied twice ensure_writable(); m_str_ref_p->m_length -= str.m_str_ref_p->m_length; // length of new string memmove(m_str_ref_p->m_cstr_p + pos, m_str_ref_p->m_cstr_p + pos + str.m_str_ref_p->m_length, size_t(m_str_ref_p->m_length - pos + 1u)); if (find_pos_p) { *find_pos_p = pos; } return true; } return false; } //--------------------------------------------------------------------------------------- // Quick substring search and removal using the Boyer Moore algorithm. // Good for multiple searches for the same substring. Finds Nth instance // of bm starting from start_pos and stores the index position if // found in find_pos. Returns true if found false if not. // Author(s): Conan Reis bool AString::remove( const AStringBM & bm, uint32_t instance, // = 1u uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t pos; if (find(bm, instance, &pos, start_pos, end_pos)) { // $Revisit - CReis This could be optimized - the end may be copied twice ensure_writable(); m_str_ref_p->m_length -= bm.get_length(); // length of new string memmove(m_str_ref_p->m_cstr_p + pos, m_str_ref_p->m_cstr_p + pos + bm.get_length(), size_t(m_str_ref_p->m_length - pos + 1u)); if (find_pos_p) { *find_pos_p = pos; } return true; } return false; } //--------------------------------------------------------------------------------------- // Substring deletion method // Returns: a reference to itself // Author(s): Conan Reis void AString::remove_all( uint32_t pos, uint32_t char_count // = ALength_remainder ) { if (char_count == ALength_remainder) { char_count = m_str_ref_p->m_length - pos; } if (char_count) { #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "remove_all"); #endif // $Revisit - CReis This could be optimized - the end may be copied twice ensure_writable(); m_str_ref_p->m_length -= char_count; // length of new string memmove(m_str_ref_p->m_cstr_p + pos, m_str_ref_p->m_cstr_p + pos + char_count, size_t(m_str_ref_p->m_length - pos + 1u)); } } //--------------------------------------------------------------------------------------- // Remove all characters of matching ch from start_pos to end_pos. // Returns: Returns the number of characters that were removed. // Arg ch - character to match // Arg start_pos - first position to start removing (Default 0) // Arg end_pos - last position to look for characters to remove. // If end_pos is ALength_remainder, end_pos is set to the last index position of // the string (length - 1). // (Default ALength_remainder) // Examples: AString str(" the quick brown fox "); // // str.remove_all('o'); // str is now " the quick brwn fx " // See: trim(), truncate(), remove_all(match_type), remove_all(str), // find(match_type) // Author(s): Conan Reis uint32_t AString::remove_all( char ch, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t remove_count = 0u; if (m_str_ref_p->m_length) { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "remove_all"); #endif // $Revisit - CReis This could be optimized - some characters may be needlessly copied ensure_writable(); uint8_t * cstr_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + start_pos); uint8_t * rewrite_p = cstr_p; uint8_t * cstr_end_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + end_pos); uint32_t length = m_str_ref_p->m_length; for (; cstr_p <= cstr_end_p; cstr_p++) { if (*cstr_p != ch) { // $Revisit - CReis assuming that a check to see if rewrite_p == cstr_p would just slow things down *rewrite_p = *cstr_p; rewrite_p++; } else { length--; } } *rewrite_p = '\0'; remove_count = m_str_ref_p->m_length - length; m_str_ref_p->m_length = length; } return remove_count; } //--------------------------------------------------------------------------------------- // Remove all characters of match_type from start_pos to end_pos. // Returns: Returns the number of characters that were removed. // Arg match_type - classification of characters to match // Arg start_pos - first position to start removing (Default 0) // Arg end_pos - last position to look for characters to remove. // If end_pos is ALength_remainder, end_pos is set to the last index position of // the string (length - 1). // (Default ALength_remainder) // Examples: AString str(" the quick brown fox "); // // str.remove_all(ACharMatch_white_space); // str is now "thequickbrownfox" // See: trim(), truncate(), remove_all(str), remove_all(ch), find(match_type), // not_char_type() // Author(s): Conan Reis uint32_t AString::remove_all( eACharMatch match_type, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t remove_count = 0u; if (m_str_ref_p->m_length) { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "remove_all"); #endif // $Revisit - CReis This could be optimized - some characters may be needlessly copied ensure_writable(); uint8_t * cstr_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + start_pos); uint8_t * rewrite_p = cstr_p; uint8_t * cstr_end_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + end_pos); bool * match_table_p = ms_char_match_table[not_char_type(match_type)]; uint32_t length = m_str_ref_p->m_length; for (; cstr_p <= cstr_end_p; cstr_p++) { if (match_table_p[*cstr_p]) { *rewrite_p = *cstr_p; rewrite_p++; } else { length--; } } *rewrite_p = '\0'; remove_count = m_str_ref_p->m_length - length; m_str_ref_p->m_length = length; } return remove_count; } //--------------------------------------------------------------------------------------- // Remove all substrings matching str starting from start_pos to end_pos. // Returns: Returns the number of characters that were removed. // Arg str - substring to match // Arg start_pos - first position to start removing. // Arg end_pos - last position to look for substring to remove. // If end_pos is ALength_remainder, end_pos is set to the last index position // of the string (length - 1). // Arg case_check - indicates whether case should be AStrCase_sensitive or // AStrCase_insensitive // Author(s): Conan Reis uint32_t AString::remove_all( const AString & str, uint32_t start_pos, // = 0u uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) { // $Revisit - CReis This could be optimized - some characters may be needlessly copied // [Efficiency] Instead of moving from (end of the remove position) - (end of string) // to (beginning of the delete position) for each remove, the move could be from (end // of the remove position) - (beginning of next remove or end of string, whichever is // nearer) to (end of last move or start of string, whichever is later). uint32_t removed = 0u; uint32_t str_length = str.m_str_ref_p->m_length; uint32_t & length = m_str_ref_p->m_length; // Faster, but length must be up-to-date in find() if (str_length && length) { ensure_writable(); char * cstr_p = m_str_ref_p->m_cstr_p; if (end_pos == ALength_remainder) { end_pos = length - 1u; } while (find(str, 1u, &start_pos, start_pos, end_pos, case_check)) { end_pos -= str_length; length -= str_length; // length of new string memmove(cstr_p + start_pos, cstr_p + start_pos + str_length, size_t(length - start_pos + 1u)); removed++; } } return removed; } //--------------------------------------------------------------------------------------- // Remove all substrings matching fast finding Boyer-Moore str starting from // start_pos to end_pos. // Returns: Returns the number of characters that were removed. // Arg str - Boyer-Moore substring to match // Arg start_pos - first position to start removing. // Arg end_pos - last position to look for substring to remove. // If end_pos is ALength_remainder, end_pos is set to the last index position // of the string (length - 1). // Arg case_check - indicates whether case should be AStrCase_sensitive or // AStrCase_insensitive // Author(s): Conan Reis uint32_t AString::remove_all( const AStringBM & bm, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { // $Revisit - CReis This could be optimized - some characters may be needlessly copied // [Efficiency] Instead of moving from (end of the remove position) - (end of string) // to (beginning of the delete position) for each remove, the move could be from (end // of the remove position) - (beginning of next remove or end of string, whichever is // nearer) to (end of last move or start of string, whichever is later). uint32_t removed = 0u; uint32_t str_length = bm.m_str_ref_p->m_length; uint32_t & length = m_str_ref_p->m_length; // Faster, but length must be up-to-date in find() if (str_length && length) { ensure_writable(); char * cstr_p = m_str_ref_p->m_cstr_p; if (end_pos == ALength_remainder) { end_pos = length - 1u; } while (find(bm, 1u, &start_pos, start_pos, end_pos)) { end_pos -= str_length; length -= str_length; // length of new string memmove(cstr_p + start_pos, cstr_p + start_pos + str_length, size_t(length - start_pos + 1u)); removed++; } } return removed; } //--------------------------------------------------------------------------------------- // Removes specified number of characters from the end of the string. // Arg char_count - number of characters to remove from the end of the string. // See: set_length(), crop(), get_length(), remove(), trim(), truncate() // Author(s): Conan Reis void AString::remove_end(uint32_t char_count) { #ifdef A_BOUNDS_CHECK A_VERIFY(char_count <= m_str_ref_p->m_length, a_cstr_format("- tried to remove %u characters out of %u", char_count, m_str_ref_p->m_length), AErrId_invalid_index_span, AString); #endif set_length(m_str_ref_p->m_length - char_count); } //--------------------------------------------------------------------------------------- // Replaces chars in string starting at pos with new_char_count chars from // new_str at new_pos. If the pos + new_char_count is greater than the // current length of the string, it will extend its length. // Returns: a reference to itself // Arg new_str - string to replace with // Arg pos - position in this string to begin replace // Arg char_count - number of chars to replace in this string. If it is set to // ALength_remainder, it is set to length of this string - pos. To do an // "overwrite" use new_str.get_length(). If this value is 0, it is the same // as an "insert". // Arg new_pos - position to start copying from new_str // Arg new_char_count - number of chars to copy from new_str into this string. // If it is set to ALength_remainder, it is set to length of new - new_pos. // Author(s): Conan Reis void AString::replace( const AString & new_str, uint32_t pos, // = 0 uint32_t char_count, // = ALength_remainder uint32_t new_pos, // = 0 uint32_t new_char_count // = ALength_remainder ) { if (new_char_count == ALength_remainder) { new_char_count = new_str.m_str_ref_p->m_length - new_pos; } #ifdef A_BOUNDS_CHECK new_str.span_check(new_pos, new_char_count, "replace"); #endif if (new_char_count) { uint32_t rem_length = m_str_ref_p->m_length - pos; char_count = (char_count == ALength_remainder) ? rem_length : a_min(char_count, rem_length); // Only remove the characters available #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "replace"); #endif uint32_t new_length = m_str_ref_p->m_length - char_count + new_char_count; AStringRef * str_ref_p = m_str_ref_p; // $Revisit - CReis This could be optimized - the end may be copied twice ensure_size(new_length); // Move remaining characters following old_str up or down if (pos + new_char_count <= new_length) { memmove(m_str_ref_p->m_cstr_p + pos + new_char_count, str_ref_p->m_cstr_p + pos + char_count, str_ref_p->m_length - pos - char_count + 1u); } // Copy new_str to its replacement position in the current string memcpy(m_str_ref_p->m_cstr_p + pos, new_str.m_str_ref_p->m_cstr_p + new_pos, new_char_count); m_str_ref_p->m_length = new_length; } } //--------------------------------------------------------------------------------------- // Substring search and replacement // Author(s): Conan Reis bool AString::replace( const AString & old_str, const AString & new_str, uint32_t instance, // = 1u uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0u uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) { uint32_t pos; if (find(old_str, instance, &pos, start_pos, end_pos, case_check)) { uint32_t old_length = old_str.m_str_ref_p->m_length; uint32_t new_length = new_str.m_str_ref_p->m_length; uint32_t length = m_str_ref_p->m_length - old_length + new_length; AStringRef * str_ref_p = m_str_ref_p; // $Revisit - CReis This could be optimized - the end may be copied twice ensure_size(length); // Move remaining characters following old_str up or down if (pos + new_length < length) { memmove(m_str_ref_p->m_cstr_p + pos + new_length, str_ref_p->m_cstr_p + pos + old_length, str_ref_p->m_length - pos - old_length + 1u); } // Copy new_str to its replacement position in the current string memcpy(m_str_ref_p->m_cstr_p + pos, new_str.m_str_ref_p->m_cstr_p, new_length); m_str_ref_p->m_length = m_str_ref_p->m_length - old_length + new_length; if (find_pos_p) { *find_pos_p = pos; } return true; } return false; } //--------------------------------------------------------------------------------------- // Substring search and replacement // Author(s): Conan Reis bool AString::replace( const AStringBM & bm, const AString & new_str, uint32_t instance, // = 1u uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t pos; if (find(bm, instance, &pos, start_pos, end_pos)) { uint32_t old_length = bm.m_str_ref_p->m_length; uint32_t new_length = new_str.m_str_ref_p->m_length; uint32_t length = m_str_ref_p->m_length - old_length + new_length; // $Revisit - CReis This could be optimized - the end may be copied twice ensure_size(length); // Move remaining characters following bm up or down memmove(m_str_ref_p->m_cstr_p + pos + new_length, m_str_ref_p->m_cstr_p + pos + old_length, m_str_ref_p->m_length - pos - old_length + 1u); // Copy new_str to its replacement position in the current string memcpy(m_str_ref_p->m_cstr_p + pos, new_str.m_str_ref_p->m_cstr_p, new_length); m_str_ref_p->m_length = length; if (find_pos_p) { *find_pos_p = pos; } return true; } return false; } //--------------------------------------------------------------------------------------- // Replace all old_ch with new_ch starting at start_pos and ending at end_pos. // Returns: Number of characters replaced. // Author(s): Conan Reis uint32_t AString::replace_all( char old_ch, char new_ch, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t count = 0u; uint32_t length = m_str_ref_p->m_length; if (length) // if not empty { if (end_pos == ALength_remainder) { end_pos = length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "replace_all"); #endif ensure_writable(); char * cstr_p = m_str_ref_p->m_cstr_p; char * cstr_end_p = cstr_p + length; while (cstr_p < cstr_end_p) { if (*cstr_p == old_ch) { *cstr_p = new_ch; count++; } cstr_p++; } } return count; } //--------------------------------------------------------------------------------------- // Replace all old_ch with new_str starting at start_pos and ending at end_pos. // Returns: Number of characters replaced. // Efficiency See remove_all() efficiency comment for replacements where new_str is // shorter than old_str. It may also be more efficient to apply the same // method for the reverse - just determine offset or tally the results. // Stability Assumes that new_str is > 1 character in length uint32_t AString::replace_all( char old_ch, const AString & new_str, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t pos; uint32_t found = 0u; if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "replace_all"); #endif found = count(old_ch, start_pos, end_pos); if (found) { uint32_t new_length = new_str.m_str_ref_p->m_length; uint32_t size_difference = new_length - 1u; ensure_size(m_str_ref_p->m_length + (found * size_difference)); // These must be after the ensure_size() since the AStringRef and internal buffer could change uint32_t & length = m_str_ref_p->m_length; // Faster, but length must be up-to-date in find() char * cstr_p = m_str_ref_p->m_cstr_p; char * new_cstr_p = new_str.m_str_ref_p->m_cstr_p; while ((start_pos <= end_pos) && find(old_ch, 1u, &pos, start_pos, end_pos)) { memmove(cstr_p + pos + new_length, cstr_p + pos + 1u, size_t(length - pos)); length += size_difference; end_pos += size_difference; memcpy(cstr_p + pos, new_cstr_p, size_t(new_length)); start_pos = pos + new_length; } } } return found; } //--------------------------------------------------------------------------------------- // Replace all bm with new_str starting at start_pos // Author(s): Conan Reis // Efficiency See remove_all() efficiency comment for replacements where new_str is // shorter than old_str. It may also be more efficient to apply the same // method for the reverse - just determine offset or tally the results. uint32_t AString::replace_all( const AStringBM & bm, const AString & new_str, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) { uint32_t pos; uint32_t found = 0u; if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "replace_all"); #endif found = count(bm, start_pos, end_pos); if (found) { uint32_t new_length = new_str.m_str_ref_p->m_length; uint32_t old_length = bm.get_length(); int size_difference = int(new_length) - int(old_length); ensure_size(m_str_ref_p->m_length + (found * size_difference)); // These must be after the ensure_size() since the internal buffer could change uint32_t & length = m_str_ref_p->m_length; // Faster, but length must be up-to-date in find() char * cstr_p = m_str_ref_p->m_cstr_p; char * new_cstr_p = new_str.m_str_ref_p->m_cstr_p; while ((start_pos <= end_pos) && find(bm, 1u, &pos, start_pos, end_pos)) { if (size_difference != 0) { memmove(cstr_p + pos + new_length, cstr_p + pos + old_length, size_t(length - old_length + 1u - pos)); length += uint32_t(size_difference); // Silly cast to stop compiler warning end_pos += uint32_t(size_difference); } memcpy(cstr_p + pos, new_cstr_p, size_t(new_length)); start_pos = pos + new_length; } } } return found; } //--------------------------------------------------------------------------------------- // Reverse order of char_count characters starting at pos. // Arg pos - character index to begin reversing characters. (Default 0u) // Arg char_count - number of characters to reverse. If char_count is ALength_remainder, // the number of characters is equal to the length of the string - pos. // (Default ALength_remainder) // Examples: AString str("12345"); // str.reverse(); // = "54321" // See: as_reverse(), find_reverse() // Author(s): Conan Reis void AString::reverse( uint32_t pos, // = 0u uint32_t char_count // = ALength_remainder ) { if (char_count == ALength_remainder) // default { char_count = m_str_ref_p->m_length - pos; } if (char_count > 1) // If less than 2 characters are reversed, there is no point { #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "reverse"); #endif // $Revisit - CReis This could be optimized - characters in specified range may be copied twice. ensure_writable(); char ch; char * cstr_p = m_str_ref_p->m_cstr_p + pos; char * cstr_end_p = cstr_p + char_count - 1; while (cstr_p < cstr_end_p) { ch = *cstr_p; *cstr_p = *cstr_end_p; *cstr_end_p = ch; cstr_p++; cstr_end_p--; } } } //--------------------------------------------------------------------------------------- // Sets the C-String character buffer. See the description of the // argument 'buffer_p' for the three possible uses of this constructor. // Returns: itself // Arg buffer_p - pointer to array of characters (does not need to be null // terminated unless 'length' is equal to ALength_calculate). If 'buffer_p' // is nullptr, 'length' and 'deallocate' are ignored. There are in general 3 // different types of values that 'buffer_p' will be given: // 1. A temporary buffer which is allocated on the stack or is recovered // by some other means. // 2. A pre-allocated character array that this AString object should take // over responsibility for. // 3. nullptr. This then creates an empty string with a space of 'size' // already allocated including the null terminating character. // Arg size - This is the size in bytes of the memory pointed to by 'buffer_p' // or if 'buffer_p' is nullptr, it is the initial memory size that should be // allocated by this string. Also note that this size includes the null // terminating character, so 'size' should never be less than 1. // Arg length - number of characters to use in 'buffer_p' and the index position // to place a terminating null character. The given length must not be more // than the size of 'buffer_p' and the C-String buffer pointed to by // 'buffer_p' should not have any null characters less then the given length. // 'length' may also be set to ALength_calculate in which case the character // length is calculated by finding the first terminating null character // already present in 'buffer_p'. (Default ALength_calculate) // Arg deallocate - Indicates whether this string (or more specifically the // AStringRef) should take control of the memory pointed to by buffer_p and // do deallocate it when it is no longer in use. // Examples: char buffer_p[100]; // str.set_buffer(buffer_p, 100u, 0u); // See: set_cstr(), operator=(cstr), append(), insert(), AString(cstr_p), // AString(cstr_p, length, persistent), AString(buffer_p, size, length, deallocate) // Notes: To make a copy of a C-String call AString(cstr_p, length, persistent = false). // To reference a C-String literal call AString(cstr_p) or // AString(cstr_p, length, persistent = true) // Author(s): Conan Reis void AString::set_buffer( const char * buffer_p, uint32_t size, uint32_t length, // = ALength_calculate bool deallocate // = false ) { if (buffer_p) { if (length == ALength_calculate) { length = uint32_t(::strlen(buffer_p)); } m_str_ref_p = m_str_ref_p->reuse_or_new(buffer_p, length, size, deallocate); m_str_ref_p->m_cstr_p[length] = '\0'; // Put in null-terminator } else // nullptr, so create empty string with specified buffer size { ensure_size_empty(size); } } //--------------------------------------------------------------------------------------- // Sets the C-String character buffer. Refers to a persistent null-terminated // C-String or makes its own copy of an existing character array. // Arg cstr_p - pointer to array of characters (does not need to be null // terminated unless length is set to ALength_calculate or 'persistent' is // true). 'cstr_p' should never be nullptr. 'cstr_p' will usually be a string // literal or if 'persistent' is false, 'cstr_p' may be any C-String that // this string should make a copy of. // Arg length - number of characters to use in 'cstr_p' and the index position to // place a terminating null character. The given length must not be more // than the size of 'cstr_p' and the C-String buffer pointed to by 'cstr_p' // should not have any null characters less then the given length. A null // terminator is placed only if 'persistent' is not true. // 'length' may also be set to ALength_calculate in which case the character // length is calculated by finding the first terminating null character // already present in 'cstr_p'. // Arg persistent - Indicates whether the data pointed to by cstr_p will be // available for the lifetime of this string. If 'persistent' is true, the // memory pointed to by 'cstr_p' will be used rather than having this object // allocate its own memory - also the memory pointed to by 'cstr_p' will not // be written to. If 'persistent' is false, then this AString object will // allocate its own memory and copy the contents of 'cstr_p' to it. // Examples: str.set_cstr("Hello"); // See: set_buffer(), operator=(cstr), append(), insert(), AString(cstr_p), // AString(cstr_p, length, persistent), AString(buffer_p, size, length, deallocate) // Author(s): Conan Reis void AString::set_cstr( const char * cstr_p, uint32_t length, // = ALength_calculate bool persistent // = true ) { A_ASSERT(cstr_p != nullptr, "Given nullptr instead of valid C-String", ErrId_null_cstr, AString); if (length == ALength_calculate) { length = uint32_t(::strlen(cstr_p)); } if (persistent) { m_str_ref_p->dereference(); m_str_ref_p = AStringRef::pool_new(cstr_p, length, length + 1u, 1u, false, true); } else // Not persistent - make a copy { ensure_size_buffer(length); memcpy(m_str_ref_p->m_cstr_p, cstr_p, length); m_str_ref_p->m_cstr_p[length] = '\0'; // Put in null-terminator m_str_ref_p->m_length = length; } } //--------------------------------------------------------------------------------------- // Removes all the characters of match_type from the beginning of the string // until it encounters a character that is not match_type. // Arg match_type - classification of characters to match. // (Default ACharMatch_white_space) // Examples: AString str(" the quick brown fox "); // // str.trim(); // str is now "the quick brown fox " // See: truncate(), crop(), remove_all(match_type), find(match_type), not_char_type() // Author(s): Conan Reis // Efficiency See efficiency comment for remove_all(). void AString::trim( eACharMatch match_type // = ACharMatch_white_space ) { uint32_t find_pos; if (find(not_char_type(match_type), 1u, &find_pos)) { // $Revisit - CReis this code could be transplanted here for extra speed. crop_quick(find_pos, m_str_ref_p->m_length - find_pos); } else { empty(); } } //--------------------------------------------------------------------------------------- // Removes all the characters of match_type from the end of the string // until it encounters a character that is not match_type. // Arg match_type - classification of characters to match. // (Default ACharMatch_white_space) // Examples: AString str(" the quick brown fox "); // // str.truncate(); // str is now " the quick brown fox" // See: trim(), crop(), remove_all(match_type), find(match_type), not_char_type() // Author(s): Conan Reis void AString::truncate( eACharMatch match_type // = ACharMatch_white_space ) { uint32_t find_pos; if (find_reverse(not_char_type(match_type), 1u, &find_pos)) { // $Revisit - CReis this code could be transplanted here for extra speed. crop_quick(0u, find_pos + 1u); } else { empty(); } } //--------------------------------------------------------------------------------------- // Add-assignment operator: string += cstring // Returns: a reference to itself // Arg cstr_p - Null-terminated C-sting to append. 'cstr_p' should never be // nullptr. // See: append(), insert(), set_cstr(), set_buffer(), add(), operator+=(), // operator+(), operator=() // Author(s): Conan Reis AString & AString::operator+=(const char * cstr_p) { A_ASSERT(cstr_p != nullptr, "Given nullptr instead of valid C-String", ErrId_null_cstr, AString); uint32_t length = uint32_t(::strlen(cstr_p)); if (length) { uint32_t total_length = m_str_ref_p->m_length + length; // Calculate total length of string ensure_size(total_length); // concatenate new string memcpy(m_str_ref_p->m_cstr_p + m_str_ref_p->m_length, cstr_p, size_t(length)); m_str_ref_p->m_length = total_length; m_str_ref_p->m_cstr_p[total_length] = '\0'; // Place a terminating character } return *this; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Non-Modifying Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Add - concatenate this string and another string to form a new string. // Returns: new string resulting from the concatenation of this string and 'str' // Arg str - string to append // Notes: Note that the name add() is used as a convention rather than as_append() // Author(s): Conan Reis AString AString::add(const AString & str) const { uint32_t length_this = m_str_ref_p->m_length; uint32_t length_str = str.m_str_ref_p->m_length; uint32_t length_new = length_this + length_str; uint32_t size = length_new + 1u; char * buffer_p = AStringRef::alloc_buffer(size); ::memcpy(buffer_p, m_str_ref_p->m_cstr_p, size_t(length_this)); ::memcpy(buffer_p + length_this, str.m_str_ref_p->m_cstr_p, size_t(length_str)); // Add null terminator by hand rather than copying it from str to ensure that it exists. buffer_p[length_new] = '\0'; return AStringRef::pool_new(buffer_p, length_new, size, 0u, true, false); } //--------------------------------------------------------------------------------------- // Add - concatenate this string and a C-string to form a new string. // Returns: new string resulting from the concatenation of this string and 'cstr_p' // Arg cstr_p - pointer to array of characters (does not need to be null // terminated unless length is equal to ALength_calculate). 'cstr_p' should // never be nullptr. // Arg length - number of characters to use in 'cstr_p' and used to determine a // position to place a terminating null character. The given length must not // be more than the size of 'cstr_p' and 'cstr_p' should not have any null // characters less then the given length. 'length' may also be set to // ALength_calculate in which case the character length is calculated by // finding the first terminating null character already present in 'cstr_p'. // Notes: Note that the name add() is used as a convention rather than as_append() // Author(s): Conan Reis AString AString::add( const char * cstr_p, uint32_t length // = ALength_calculate ) const { if (length == ALength_calculate) { length = uint32_t(::strlen(cstr_p)); } uint32_t length_this = m_str_ref_p->m_length; uint32_t length_new = length_this + length; uint32_t size = AStringRef::request_char_count(length_new); char * buffer_p = AStringRef::alloc_buffer(size); ::memcpy(buffer_p, m_str_ref_p->m_cstr_p, size_t(length_this)); ::memcpy(buffer_p + length_this, cstr_p, size_t(length)); buffer_p[length_new] = '\0'; // Put in null-terminator return AStringRef::pool_new(buffer_p, length_new, size, 0u, true, false); } //--------------------------------------------------------------------------------------- // Character concatenation: string + ch // Author(s): Conan Reis AString AString::add(char ch) const { if (ch != '\0') { uint32_t length_this = m_str_ref_p->m_length; uint32_t size = AStringRef::request_char_count(length_this + 1u); char * buffer_p = AStringRef::alloc_buffer(size); ::memcpy(buffer_p, m_str_ref_p->m_cstr_p, size_t(length_this)); buffer_p[length_this] = ch; buffer_p[length_this + 1u] = '\0'; // Put in null-terminator return AStringRef::pool_new(buffer_p, length_this + 1u, size, 0u, true, false); } return *this; } //--------------------------------------------------------------------------------------- // Copies itself to reversed_p with char_count characters starting at pos in // reversed order. // Arg reversed_p - address to store a copy of this string with all or a portion // of its characters reversed. // Arg pos - character index to begin reversing characters. (Default 0u) // Arg char_count - number of characters to reverse. If char_count is // ALength_remainder, the number of characters is equal to the length of the // string - pos. (Default ALength_remainder) // Examples: AString str("12345"); // str.as_reverse(&str_rev); // str_rev = "54321" // See: as_reverse(pos, char_count), reverse(), find_reverse() // Author(s): Conan Reis void AString::as_reverse( AString * reversed_p, uint32_t pos, // = 0u uint32_t char_count // = ALength_remainder ) const { if (char_count == ALength_remainder) // default { char_count = m_str_ref_p->m_length - pos; } #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "as_reverse"); #endif if (char_count > 1u) // If less than 2 characters are reversed, there is no point { reversed_p->ensure_size_empty(m_str_ref_p->m_length); char * rev_cstr_p = reversed_p->m_str_ref_p->m_cstr_p; // Local caching // Copy initial non-reversed portion - if any if (pos) { ::memcpy(rev_cstr_p, m_str_ref_p->m_cstr_p, size_t(pos)); } // Copy reversed portion char * cstr_p = m_str_ref_p->m_cstr_p + pos; char * cstr_end_p = cstr_p + char_count; char * reversed_end_p = rev_cstr_p + pos + char_count - 1; for (; cstr_p < cstr_end_p; cstr_p++, reversed_end_p--) { *reversed_end_p = *cstr_p; } // Copy remaining non-reversed portion - if any if ((pos + char_count) < m_str_ref_p->m_length) { // This copy includes the null terminator ::memcpy(rev_cstr_p + pos + char_count, m_str_ref_p->m_cstr_p, size_t(m_str_ref_p->m_length - pos - char_count + 1u)); } else { rev_cstr_p[m_str_ref_p->m_length] = '\0'; } reversed_p->m_str_ref_p->m_length = m_str_ref_p->m_length; } else // No reversing - just a standard copy { *reversed_p = *this; } } //--------------------------------------------------------------------------------------- // Determines the number of occurrences of the specified character. // // Returns: number of occurrences of specified character // Arg ch - character to count // Arg start_pos - starting position of count search range (Default 0) // Arg end_pos - ending position of count search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched. (Default ALength_remainder) // Arg last_counted_p - optional address to store index of last counted character. // If nothing is counted then it is set to start_pos. // Examples: uint32_t underscores = str.count('_'); // See: find(), get() // Author(s): Conan Reis uint32_t AString::count( char ch, uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder uint32_t * last_counted_p // = nullptr ) const { // $Revisit - CReis [Efficiency] This should be faster than repeatedly calling memchr() - profile. // It could be rewritten using inline assembly. // Ensure not empty if (m_str_ref_p->m_length == 0u) { return 0u; } if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "count"); #endif uint32_t num_count = 0u; char * cstr_start_p = m_str_ref_p->m_cstr_p; char * cstr_count_p = cstr_start_p + start_pos; char * cstr_p = cstr_count_p; char * cstr_end_p = cstr_start_p + end_pos; for (; cstr_p <= cstr_end_p; cstr_p++) { if (*cstr_p == ch) { cstr_count_p = cstr_p; num_count++; } } if (last_counted_p) { *last_counted_p = uint32_t(reinterpret_cast<uintptr_t>(cstr_count_p) - reinterpret_cast<uintptr_t>(cstr_start_p)); } return num_count; } //--------------------------------------------------------------------------------------- // Determines the number of occurrences of the specified character. // Returns: number of occurrences of specified character // Arg match_type - classification of characters to match. // Arg start_pos - starting position of count search range (Default 0) // Arg end_pos - ending position of count search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched. (Default ALength_remainder) // Examples: uint32_t digits = str.count(ACharMatch_digit); // See: find(match_type), get(match_type), not_char_type() // Author(s): Conan Reis uint32_t AString::count( eACharMatch match_type, uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { // $Revisit - CReis [Efficiency] This should be faster than repeatedly calling memchr() - profile. // It could be rewritten using inline assembly. uint32_t num_count= 0u; if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "count"); #endif uint8_t * cstr_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + start_pos); uint8_t * cstr_end_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + end_pos); bool * match_table_p = ms_char_match_table[match_type]; for (; cstr_p <= cstr_end_p; cstr_p++) { if (match_table_p[*cstr_p]) { num_count++; } } } return num_count; } //--------------------------------------------------------------------------------------- // Returns number of substrings found // Author(s): Conan Reis uint32_t AString::count( const AStringBM & bm, uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) const { uint32_t result = 0u; uint32_t length = bm.m_str_ref_p->m_length; while (find(bm, 1u, &start_pos, start_pos, end_pos) == true) { result++; start_pos += length; // non-overlapping } return result; } //--------------------------------------------------------------------------------------- // Finds instance of specified character starting from start_pos and ending // at end_pos and if found stores the index position found. // Returns: true if instance character found, false if not // Arg ch - character to find // Arg instance - occurrence of character to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance character if found. // It is not modified if the character is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting position of search range (Default 0) // Arg end_pos - ending position of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Examples: if (str.find('_', 2)) // if 2nd underscore is found // do_something(); // See: count(), get() // Notes: This character find method is faster than the find method searching for a // single character string. // Author(s): Conan Reis bool AString::find( char ch, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { // $Revisit - CReis [Efficiency] This should be faster than repeatedly calling memchr() - profile. // It could be rewritten using inline assembly. if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find"); #endif char * cstr_p = m_str_ref_p->m_cstr_p + start_pos; char * cstr_end_p = m_str_ref_p->m_cstr_p + end_pos; while (cstr_p <= cstr_end_p) { if (*cstr_p == ch) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_p - m_str_ref_p->m_cstr_p); } return true; } instance--; } cstr_p++; } } return false; } //--------------------------------------------------------------------------------------- // Finds instance of specified type of character starting from start_pos and // ending at end_pos and if found stores the index position found. // Returns: true if instance character type found, false if not // Arg match_type - classification of characters to match. // Arg instance - occurrence of character type to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance character type if found. // It is not modified if the character type is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting position of search range (Default 0) // Arg end_pos - ending position of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Examples: if (str.find(ACharMatch_lowercase, 2)) // if 2nd lowercase letter is found // do_something(); // See: count(), get(), not_char_type() // Author(s): Conan Reis bool AString::find( eACharMatch match_type, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { uint32_t length = m_str_ref_p->m_length; if (length && (start_pos < length)) // if not empty or skipped { if (end_pos == ALength_remainder) { end_pos = length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find"); #endif uint8_t * cstr_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + start_pos); uint8_t * cstr_end_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + end_pos); bool * match_table_p = ms_char_match_table[match_type]; while (cstr_p <= cstr_end_p) { if (match_table_p[*cstr_p]) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_p - reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p)); } return true; } instance--; } cstr_p++; } } return false; } //--------------------------------------------------------------------------------------- // Finds instance of substring str starting from start_pos and ending // at end_pos and if found stores the index position found. // Returns: true if instance of str found, false if not // Arg str - substring to find // Arg args_p - find info - see AFindStrArgs declaration. // (Default &AFindStrArgs::ms_sensitive) // Examples: AString sub_str("hello"); // if (str.find(sub_str, &AFindStrArgs(2))) // if 2nd "hello" substring is found // do_something(); // See: find(bm), count(), get() // Notes: [Efficiency] This method should be faster than calling strstr() - profile. // The case insensitive routine could probably be made more efficient - via // a lowercase table and/or only converting the characters once in temporary // C-String buffers. // Author(s): Conan Reis /* bool AString::find2( const AString & str, AFindStrArgs * args_p // = &AFindStrArgs::ms_sensitive ) const { if (m_str_ref_p->m_length && (m_str_ref_p->m_length >= str.m_str_ref_p->m_length)) // if not empty and str is no larger than this string { uint32_t end_pos = args_p->m_end_pos; uint32_t instance = args_p->m_instance; if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(args_p->m_start_pos, end_pos, instance, "find"); #endif char * match_p; char * find_p; char * cstr_p = m_str_ref_p->m_cstr_p + args_p->m_start_pos; char * cstr_end_p = m_str_ref_p->m_cstr_p + end_pos - str.m_str_ref_p->m_length - 1; // won't match if less than str left char * find_start_p = str.m_str_ref_p->m_cstr_p; char * find_end_p = find_start_p + str.m_str_ref_p->m_length; if (args_p->m_case_check == AStrCase_sensitive) // Case sensitive { while (cstr_p <= cstr_end_p) { match_p = cstr_p; find_p = find_start_p; while ((find_p < find_end_p) && (*match_p == *find_p)) { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { args_p->m_find_start = uint32_t(cstr_p - m_str_ref_p->m_cstr_p); args_p->m_find_end = args_p->m_find_start + str.m_str_ref_p->m_length; return true; } instance--; cstr_p = match_p; } else { cstr_p++; } } } else // Ignore case { while (cstr_p <= cstr_end_p) { match_p = cstr_p; find_p = find_start_p; while ((find_p < find_end_p) && !compare_insensitive(*match_p, *find_p)) { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { args_p->m_find_start = uint32_t(cstr_p - m_str_ref_p->m_cstr_p); args_p->m_find_end = args_p->m_find_start + str.m_str_ref_p->m_length; return true; } instance--; cstr_p = match_p; } else { cstr_p++; } } } } return false; } */ //--------------------------------------------------------------------------------------- // Finds instance of substring str starting from start_pos and ending // at end_pos and if found stores the index position found. // Returns: true if instance of str found, false if not // Arg str - substring to find // Arg instance - occurrence of substring to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting character index of search range (Default 0) // Arg end_pos - ending character index of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Arg case_check - if set to AStrCase_sensitive, case is important (q != Q), if set // to AStrCase_ignore, case is not important (q == Q). (Default AStrCase_sensitive) // Examples: AString sub_str("hello"); // if (str.find(sub_str, 2)) // if 2nd "hello" substring is found // do_something(); // See: find(bm), count(), get() // Notes: [Efficiency] This method should be faster than calling strstr() - profile. // The case insensitive routine could probably be made more efficient - via // a lowercase table and/or only converting the characters once in temporary // C-String buffers. // Author(s): Conan Reis bool AString::find( const AString & str, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) const { if (m_str_ref_p->m_length && (m_str_ref_p->m_length >= str.m_str_ref_p->m_length)) // if not empty and str is no larger than this string { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find"); #endif char * match_p; char * find_p; char * cstr_p = m_str_ref_p->m_cstr_p + start_pos; char * cstr_end_p = m_str_ref_p->m_cstr_p + end_pos - str.m_str_ref_p->m_length + 1u; // won't match if less than str left char * find_start_p = str.m_str_ref_p->m_cstr_p; char * find_end_p = find_start_p + str.m_str_ref_p->m_length; if (case_check == AStrCase_sensitive) // Case sensitive { while (cstr_p <= cstr_end_p) { match_p = cstr_p; find_p = find_start_p; while ((*match_p == *find_p) && (find_p < find_end_p)) // Note: Okay to check end condition (find_p < find_end_p) second because if >= it will point to null terminator i.e. still valid memory in first part of condition. { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_p - m_str_ref_p->m_cstr_p); } return true; } instance--; cstr_p = match_p; } else { cstr_p++; } } } else // Ignore case { while (cstr_p <= cstr_end_p) { match_p = cstr_p; find_p = find_start_p; while (!compare_insensitive(*match_p, *find_p) && (find_p < find_end_p)) // Note: Okay to check end condition (find_p < find_end_p) second because if >= it will point to null terminator i.e. still valid memory in first part of condition. { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_p - m_str_ref_p->m_cstr_p); } return true; } instance--; cstr_p = match_p; } else { cstr_p++; } } } } return false; } //--------------------------------------------------------------------------------------- // Quick substring search using the Boyer Moore algorithm. Good for // multiple searches for the same substring. Finds instance of substring // bm starting from start_pos and ending // at end_pos and if found stores the index position found. // Returns: true if instance of bm found, false if not // Arg bm - Boyer Moore substring to find // Arg instance - occurrence of substring to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting character index of search range (Default 0) // Arg end_pos - ending character index of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Arg case_check - if set to AStrCase_sensitive, case is important (q != Q), if set // to AStrCase_ignore, case is not important (q == Q). (Default AStrCase_sensitive) // Examples: AStringBM sub_str("hello"); // if (str.find(sub_str, 2)) // if 2nd "hello" substring is found // do_something(); // See: find(bm), count(), get() // Notes: [Efficiency] The case insensitive routine could probably be made more // efficient - via a lowercase table and/or only converting the characters // once in temporary C-String buffers. // Author(s): Conan Reis bool AString::find( const AStringBM & bm, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { // $Revisit - CReis Rewrite using pointers rather than indexes if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find"); #endif char insensitive_ch; uint32_t bm_pos; // bm_pos is an index into pattern uint32_t patlen = bm.get_length(); // store pattern length locally (high use) uint32_t target_pos = start_pos + patlen - 1u; // target_pos is the index into the target_p const char * cstr_p = m_str_ref_p->m_cstr_p; // store cstr locally (high use) const char * bm_cstr_p = bm.m_str_ref_p->m_cstr_p; // store bm cstr locally (high use) const uint8_t * delta_p = bm.m_delta_p; // store delta table locally (high use) if (bm.m_case == AStrCase_ignore) // same, but to_lowercase used { while (target_pos <= end_pos) { bm_pos = patlen - 1u; insensitive_ch = to_lowercase(cstr_p[target_pos]); while (bm_cstr_p[bm_pos] == insensitive_ch) // while corresponding chars match { if (bm_pos > 0u) // Still characters to check { // move left one character for next comparison --bm_pos; --target_pos; } else // pattern found! { if (instance == 1u) // correct number of occurrences found! { if (find_pos_p) { *find_pos_p = target_pos; } return true; } else // one less instance to find { instance--; } break; // Ugly, I know - could be [bm_pos = bm.get_length] } insensitive_ch = to_lowercase(cstr_p[target_pos]); } target_pos += a_max(static_cast<uint32_t>(delta_p[uint8_t(insensitive_ch)]), (patlen - bm_pos)); // move target_p index by delta value of mismatched character } } else // Case sensitive { while (target_pos <= end_pos) { bm_pos = patlen - 1u; while (bm_cstr_p[bm_pos] == cstr_p[target_pos]) // while corresponding chars match { if (bm_pos > 0u) // Still characters to check { // move left one character for next comparison --bm_pos; --target_pos; } else // pattern found! { if (instance == 1u) // correct number of occurrences found! { if (find_pos_p) { *find_pos_p = target_pos; } return true; } else // one less instance to find { instance--; } break; // Ugly, I know - could be [bm_pos = bm.get_length] } } target_pos += a_max(static_cast<uint32_t>(delta_p[uint8_t(cstr_p[target_pos])]), (patlen - bm_pos)); // move target_p index by delta value of mismatched character } } } return false; } //--------------------------------------------------------------------------------------- // Finds instance of substring str starting from start_pos and ending at end_pos using a // fuzzy search and if found stores the start and end position of the found text. // Returns: true if instance of str found, false if not // Arg str - substring to find // Arg instance - occurrence of substring to find. It may not be less than 1. // (Default 1) // Arg find_start_p - address to store index of instance of the beginning of the substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg find_end_p - address to store index of instance of the end of the substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting character index of search range (Default 0) // Arg end_pos - ending character index of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Arg case_check - if set to AStrCase_sensitive, case is important (q != Q), if set // to AStrCase_ignore, case is not important (q == Q). (Default AStrCase_sensitive) // Examples: AString source("abcde_abxxc"); // if (source.find_fuzzy("ac", 1)) // returns true, find_first_p returns 0, find_end_p return 2 // do_something(); // See: find(bm), count(), get() // Notes: Matches do not cross line terminators. // Author(s): John Stenersen bool AString::find_fuzzy( const AString & str, uint32_t instance, // = 1 uint32_t * find_start_p, // = nullptr uint32_t * find_end_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) const { if (!str.m_str_ref_p->m_length || (str.m_str_ref_p->m_length > m_str_ref_p->m_length)) { // The key string is empty or longer than the text being searched. return false; } if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find_fuzzy"); #endif const char * key_start_p = str.m_str_ref_p->m_cstr_p; const char * key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; const char * text_start_p = & m_str_ref_p->m_cstr_p[start_pos]; const char * text_end_p = & m_str_ref_p->m_cstr_p[end_pos - 1]; const char * first_p = nullptr; const char * next_p = nullptr; if (case_check == AStrCase_sensitive) // Case sensitive { do // Each instance { // Fnd the first character match. while (text_start_p <= text_end_p) { if (*text_start_p == *key_start_p) { first_p = text_start_p; break; } text_start_p ++; } if (!first_p) { // Did not find the first character match. return false; } // For the remainder of the key, find a matching character in the text. key_start_p ++; text_start_p ++; next_p = first_p; while (key_start_p <= key_end_p) { // Find the next character match. next_p = nullptr; while ((text_start_p <= text_end_p) && (*text_start_p != '\n') && (*text_start_p != '\r')) { if (*text_start_p == *key_start_p) { next_p = text_start_p; break; } text_start_p ++; } if ((*text_start_p == '\n') || (*text_start_p == '\r')) { // Start over on next line. next_p = text_start_p; first_p = nullptr; key_start_p = str.m_str_ref_p->m_cstr_p; instance ++; break; } if (!next_p) { return false; // Match not found. } key_start_p ++; text_start_p ++; } // Found a match. instance --; if (!instance) { // The instance of the match. if (find_start_p) { * find_start_p = (uint32_t) (first_p - m_str_ref_p->m_cstr_p); } if (find_end_p) { * find_end_p = (uint32_t) (next_p - m_str_ref_p->m_cstr_p + 1); } return true; } text_start_p = next_p + 1; first_p = nullptr; key_start_p = str.m_str_ref_p->m_cstr_p; } while (instance); } else // Ignore case { do // Each instance { // Fnd the first character match. while (text_start_p <= text_end_p) { if (!compare_insensitive(*text_start_p, *key_start_p)) { first_p = text_start_p; break; } text_start_p ++; } if (!first_p) { // Did not find the first character match. return false; } // For the remainder of the key, find a matching character in the text. key_start_p ++; text_start_p ++; next_p = first_p; while (key_start_p <= key_end_p) { // Find the next character match. next_p = nullptr; while ((text_start_p <= text_end_p) && (*text_start_p != '\n') && (*text_start_p != '\r')) { if (!compare_insensitive(*text_start_p, *key_start_p)) { next_p = text_start_p; break; } text_start_p ++; } if ((*text_start_p == '\n') || (*text_start_p == '\r')) { // Start over on next line. next_p = text_start_p; first_p = nullptr; key_start_p = str.m_str_ref_p->m_cstr_p; instance ++; break; } if (!next_p) { return false; // Match not found. } key_start_p ++; text_start_p ++; } // Found a match. instance --; if (!instance) { // The instance of the match. if (find_start_p) { * find_start_p = (uint32_t) (first_p - m_str_ref_p->m_cstr_p); } if (find_end_p) { * find_end_p = (uint32_t) (next_p - m_str_ref_p->m_cstr_p + 1); } return true; } text_start_p = next_p + 1; first_p = nullptr; key_start_p = str.m_str_ref_p->m_cstr_p; } while (instance); } return false; // Not found. } // AString::find_fuzzy() //--------------------------------------------------------------------------------------- // Finds in reverse direction the instance of substring str starting from start_pos and ending at end_pos using a // fuzzy search and if found stores the start and end position of the found text. // Returns: true if instance of str found, false if not // Arg str - substring to find // Arg instance - occurrence of substring to find. It may not be less than 1. // (Default 1) // Arg find_start_p - address to store index of instance of the beginning of the substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg find_end_p - address to store index of instance of the end of the substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - starting character index of search range (Default 0) // Arg end_pos - ending character index of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Arg case_check - if set to AStrCase_sensitive, case is important (q != Q), if set // to AStrCase_ignore, case is not important (q == Q). (Default AStrCase_sensitive) // Examples: AString source("abcde_abxxc"); // if (source.find_fuzzy_reverse("ac", 1)) // returns true, find_first_p returns 6, find_end_p return 10 // do_something(); // See: find(bm), count(), get() // Notes: Matches do not cross line terminators. // Author(s): John Stenersen bool AString::find_fuzzy_reverse( const AString & str, uint32_t instance, // = 1 uint32_t * find_start_p, // = nullptr uint32_t * find_end_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) const { if (!str.m_str_ref_p->m_length || (str.m_str_ref_p->m_length > m_str_ref_p->m_length)) { // The key string is empty or longer than the text being searched. return false; } if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find_fuzzy"); #endif const char * key_start_p = str.m_str_ref_p->m_cstr_p; const char * key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; const char * text_start_p = & m_str_ref_p->m_cstr_p[start_pos]; const char * text_end_p = & m_str_ref_p->m_cstr_p[end_pos - 1]; const char * last_p = nullptr; const char * prev_p = nullptr; if (case_check == AStrCase_sensitive) // Case sensitive { do // Each instance { // Fnd the last character match. while (text_start_p <= text_end_p) { if (*text_end_p == *key_end_p) { last_p = text_end_p; break; } text_end_p --; } if (!last_p) { // Did not find the last character match. return false; } // For the remainder of the key, find a matching character in the text. key_end_p --; text_end_p --; prev_p = last_p; while (key_start_p <= key_end_p) { // Find the prev character match. prev_p = nullptr; while ((text_start_p <= text_end_p) && (*text_end_p != '\n') && (*text_end_p != '\r')) { if (*text_end_p == *key_end_p) { prev_p = text_end_p; break; } text_end_p --; } if ((*text_end_p == '\n') || (*text_end_p == '\r')) { // Start over on next line. prev_p = text_end_p; last_p = nullptr; key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; instance ++; break; } if (!prev_p) { return false; // Match not found. } key_end_p --; text_end_p --; } // Found a match. instance --; if (!instance) { // The instance of the match. if (find_start_p) { * find_start_p = (uint32_t) (prev_p - m_str_ref_p->m_cstr_p); } if (find_end_p) { * find_end_p = (uint32_t) (last_p - m_str_ref_p->m_cstr_p + 1); } return true; } text_end_p = prev_p - 1; last_p = nullptr; key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; } while (instance); } else // Ignore case { do // Each instance { // Fnd the last character match. while (text_start_p <= text_end_p) { if (!compare_insensitive(*text_end_p, *key_end_p)) { last_p = text_end_p; break; } text_end_p --; } if (!last_p) { // Did not find the last character match. return false; } // For the remainder of the key, find a matching character in the text. key_end_p --; text_end_p --; prev_p = last_p; while (key_start_p <= key_end_p) { // Find the prev character match. prev_p = nullptr; while ((text_start_p <= text_end_p) && (*text_end_p != '\n') && (*text_end_p != '\r')) { if (!compare_insensitive(*text_end_p, *key_end_p)) { prev_p = text_end_p; break; } text_end_p --; } if ((*text_end_p == '\n') || (*text_end_p == '\r')) { // Start over on next line. prev_p = text_end_p; last_p = nullptr; key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; instance ++; break; } if (!prev_p) { return false; // Match not found. } key_end_p --; text_end_p --; } // Found a match. instance --; if (!instance) { // The instance of the match. if (find_start_p) { * find_start_p = (uint32_t) (prev_p - m_str_ref_p->m_cstr_p); } if (find_end_p) { * find_end_p = (uint32_t) (last_p - m_str_ref_p->m_cstr_p + 1); } return true; } text_end_p = prev_p - 1; last_p = nullptr; key_end_p = key_start_p + str.m_str_ref_p->m_length - 1; } while (instance); } return false; // Not found. } // AString::find_fuzzy_reverse() //--------------------------------------------------------------------------------------- // Determine column that starts indent - i.e. first character from `start_pos` that is // non-space (not ` ` or `\t`). Takes into account tab stops and adjusts column if any // tab `\t` characters encountered. // // Returns: 0-based row/line number // Params: // tab_stops: tab stop count in spaces // indent_idx_p: address to store 0-based index position. Ignored if nullptr. // start_pos: starting index to begin // end_pos: ending index to stop // // See: // index_to_row(), row_to_index(), line_indent(), line_unindent(), advance_to_indent() // // Author(s): Conan Reis uint32_t AString::find_indent_column( uint32_t tab_stops, // = AString_tab_stop_def uint32_t * indent_idx_p, // = nullptr uint32_t start_pos, // = 0u uint32_t end_pos // = ALength_remainder ) const { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Setup AStringRef * str_ref_p = m_str_ref_p; uint32_t length = str_ref_p->m_length; if (length == 0u) { if (indent_idx_p) { *indent_idx_p = 0u; } return 0u; } if (end_pos == ALength_remainder) { end_pos = length - 1u; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "indent"); #endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uint32_t column = 0u; char * buffer_p = str_ref_p->m_cstr_p; const char * indent_p = advance_to_indent(buffer_p + start_pos, buffer_p + end_pos, tab_stops, &column); if (indent_idx_p) { *indent_idx_p = uint(indent_p - buffer_p); } return column; } //--------------------------------------------------------------------------------------- // Finds instance of specified character in reverse starting from end_pos // and ending at start_pos and if found stores the index position found. // Returns: true if instance character found, false if not // Arg ch - character to find // Arg instance - occurrence of character to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance character if found. // It is not modified if the character is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - ending position of search range (Default 0) // Arg end_pos - starting position of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Examples: if (str.find_reverse('_', 2)) // if 2nd to last underscore is found // do_something(); // See: count(), get() // Notes: This character find method is faster than the find_reverse() method // searching for a single character string. // Author(s): Conan Reis bool AString::find_reverse( char ch, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { // $Revisit - CReis [Efficiency] This should be faster than repeatedly calling memchr() - profile. // It could be rewritten using inline assembly. if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find_reverse"); #endif char * cstr_p = m_str_ref_p->m_cstr_p + start_pos; char * cstr_end_p = m_str_ref_p->m_cstr_p + end_pos; while (cstr_p <= cstr_end_p) { if (*cstr_end_p == ch) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_end_p - m_str_ref_p->m_cstr_p); } return true; } instance--; } cstr_end_p--; } } return false; } //--------------------------------------------------------------------------------------- // Finds instance of specified type of character in reverse starting from // end_pos and ending at start_pos and if found stores the index position found. // Returns: true if instance character type found, false if not // Arg match_type - classification of characters to match. // Arg instance - occurrence of character type to find. It may not be less than 1. // (Default 1) // Arg find_pos_p - address to store index of instance character type if found. // It is not modified if the character type is not found or if it is set to nullptr. // (Default nullptr) // Arg start_pos - ending position of search range (Default 0) // Arg end_pos - starting position of search range. If end_pos is set to // ALength_remainder, the entire length of the string (from the starting position) // is searched (end_pos = length - start_pos). (Default ALength_remainder) // Examples: if (str.find_reverse(ACharMatch_lowercase, 2)) // if 2nd to last lowercase letter is found // do_something(); // See: count(), get() // Author(s): Conan Reis bool AString::find_reverse( eACharMatch match_type, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find_reverse"); #endif uint8_t * cstr_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + start_pos); uint8_t * cstr_end_p = reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p + end_pos); bool * match_table_p = ms_char_match_table[match_type]; while (cstr_p <= cstr_end_p) { if (match_table_p[*cstr_end_p ]) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_end_p - reinterpret_cast<uint8_t *>(m_str_ref_p->m_cstr_p)); } return true; } instance--; } cstr_end_p--; } } return false; } //--------------------------------------------------------------------------------------- // Substring reverse search. // // Returns: `true` if instance of str found, `false` if not // // Params: // str: substring to find // instance: occurrence of substring to find. It may not be less than 1. // find_pos_p: // Address to store index of instance substring if found. // It is not modified if the substring is not found or if it is set to nullptr. // start_pos: starting character index of search range. // end_pos: // Ending character index of search range. If `end_pos` is set to `ALength_remainder`, // the entire length of the string (from the starting position) is searched (`end_pos // = length - 1u`). // case_check: // If set to `AStrCase_sensitive`, case is important (q != Q), if set to // `AStrCase_ignore`, case is not important (q == Q). // // See: // find_reverse(ch), find_reverse(match_type), // find(str), find(bm), find(ch), find(match_type) bool AString::find_reverse( const AString & str, uint32_t instance, // = 1 uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) const { uint32_t length = m_str_ref_p->m_length; uint32_t str_length = str.m_str_ref_p->m_length; if ((length == 0u) || (str_length == 0u) || (length < str_length)) { return false; } if (end_pos == ALength_remainder) { end_pos = length; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, instance, "find_reverse"); #endif char * match_p; char * find_p; char * cstr_p = m_str_ref_p->m_cstr_p + start_pos; char * cstr_end_p = m_str_ref_p->m_cstr_p + end_pos - str_length + 1u; // won't match if less than str left char * find_start_p = str.m_str_ref_p->m_cstr_p; char * find_end_p = find_start_p + str_length; if (case_check == AStrCase_sensitive) // Case sensitive { do { cstr_end_p--; match_p = cstr_end_p; find_p = find_start_p; while ((find_p < find_end_p) && (*match_p == *find_p)) { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_end_p - m_str_ref_p->m_cstr_p); } return true; } instance--; } } while (cstr_p < cstr_end_p); } else // Ignore case { do { cstr_end_p--; match_p = cstr_end_p; find_p = find_start_p; while (!compare_insensitive(*match_p, *find_p) && (find_p < find_end_p)) // Note: Okay to check end condition (find_p < find_end_p) second because if >= it will point to null terminator i.e. still valid memory in first part of condition. { find_p++; match_p++; } if (find_p == find_end_p) // Found one { if (instance == 1u) // Found it! { if (find_pos_p) { *find_pos_p = uint32_t(cstr_end_p - m_str_ref_p->m_cstr_p); } return true; } instance--; } } while (cstr_p < cstr_end_p); } return false; } //--------------------------------------------------------------------------------------- // substring retrieval method // Author(s): Conan Reis void AString::get( AString * str_p, uint32_t pos, // = 0u uint32_t char_count // = ALength_remainder ) const { if (char_count == ALength_remainder) { char_count = m_str_ref_p->m_length - pos; } str_p->ensure_size_empty(char_count); if (char_count) { #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "get"); #endif memcpy(str_p->m_str_ref_p->m_cstr_p, m_str_ref_p->m_cstr_p + pos, size_t(char_count)); str_p->m_str_ref_p->m_cstr_p[char_count] = '\0'; str_p->m_str_ref_p->m_length = char_count; } } //--------------------------------------------------------------------------------------- // substring retrieval method // Author(s): Conan Reis AString AString::get( uint32_t pos, // = 0u uint32_t char_count // = ALength_remainder ) const { if (char_count == ALength_remainder) { char_count = m_str_ref_p->m_length - pos; } AString result(nullptr, uint32_t(char_count + 1u), uint32_t(0u)); if (char_count) { #ifdef A_BOUNDS_CHECK span_check(pos, char_count, "get"); #endif memcpy(result.m_str_ref_p->m_cstr_p, m_str_ref_p->m_cstr_p + pos, size_t(char_count)); result.m_str_ref_p->m_cstr_p[char_count] = '\0'; result.m_str_ref_p->m_length = char_count; } return result; } //--------------------------------------------------------------------------------------- // Dynamic substring retrieval // Author(s): Conan Reis AString * AString::get_new( uint32_t pos, // = 0u uint32_t char_count // = ALength_remainder ) const { AString * str_p; if (char_count == ALength_remainder) { char_count = m_str_ref_p->m_length - pos; } #ifdef A_BOUNDS_CHECK if (char_count) { span_check(pos, char_count, "get_new"); } #endif str_p = new AString(m_str_ref_p->m_cstr_p + pos, char_count); A_VERIFY_MEMORY(str_p != nullptr, AString); return str_p; } //--------------------------------------------------------------------------------------- // Substring at index position in between tokens in current string // looking from start_pos to end_pos. // Separators that are adjacent to one another count as an empty string. // Returns: Substring at index position in between tokens // Arg index - index position of substring to return (zero indexed) // Arg token - substring to separate on // Arg find_pos_p - pointer to store index position in current string // where returned substring is found. Not set if nullptr // Arg start_pos - index position in current string to begin looking // Arg end_pos - index position in current string to stop looking // (ALength_remainder = current length of string) // Arg case_check - whether or not the token should be case sensitive or not // Notes: If the index given is out of range or if the specified index is // between two separators, an empty string is returned. // If the index is out of range, the value find_pos_p points to is // not changed. // Examples: AString str("one, two, three, four"); // AString third(str.get_token(2, ", ")); // = "three" // Author(s): Conan Reis AString AString::get_token( uint32_t index, const AStringBM & token, uint32_t * find_pos_p, // = nullptr uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } // Get starting position if (index) { #ifdef A_BOUNDS_CHECK bool found = find(token, index, &start_pos, start_pos, end_pos); A_VERIFY(found, "::get_token() - index out of range", AErrId_invalid_index, AString); #endif start_pos += token.m_str_ref_p->m_length; } // Get ending position if (!find(token, 1u, &end_pos, start_pos, end_pos)) { end_pos++; } } else { #ifdef A_BOUNDS_CHECK A_VERIFY(index == 0u, "::get_token() - index out of range", AErrId_invalid_index, AString); #endif end_pos = 0u; } if (find_pos_p) { *find_pos_p = start_pos; } return AString(m_str_ref_p->m_cstr_p + start_pos, end_pos - start_pos); } //--------------------------------------------------------------------------------------- // Splits current string from start_pos to end_pos into new dynamic // substrings with separator as the substring to split on. // Arg collect_p - array to accumulate (i.e. append) the dynamically allocated // substrings to. Any previous AString objects will remain in collected_p, // they are just added to. // *** Remember to free the substrings after they are finished being used. // Arg separator - // Arg start_pos - character index position to begin tokenization (Default 0) // Arg end_pos - character index position to end tokenization. If end_pos is // ALength_remainder, then end_pos is set to the last character positon. // (Default ALength_remainder) // Arg case_check - Indicates whether the search for the separator substring // should be case sensitive (AStrCase_sensitive) or case insensitive (AStrCase_ignore). // (Default AStrCase_sensitive) // See: get_token(), AString(APArrayLogical<AString>, separator) // Notes: Seperators that are adjacent to one another count as an empty string. // Author(s): Conan Reis void AString::tokenize( APArrayLogical<AString> * collect_p, const AString & separator, // = AString(',') uint32_t start_pos, // = 0 uint32_t end_pos, // = ALength_remainder eAStrCase case_check // = AStrCase_sensitive ) const { uint32_t pos; if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "tokenize"); #endif uint32_t length = separator.m_str_ref_p->m_length; while ((start_pos <= end_pos) && (find(separator, 1u, &pos, start_pos, end_pos, case_check))) { collect_p->append(*get_new(start_pos, pos - start_pos)); start_pos = pos + length; } collect_p->append(*get_new(start_pos, end_pos - start_pos + 1)); } } //--------------------------------------------------------------------------------------- // Splits current string from start_pos to end_pos into new dynamic // substrings with separator as the substring to split on. // Arg collect_p - array to accumulate (i.e. append) the dynamically allocated // substrings to. Any previous AString objects will remain in collected_p, // they are just added to. // *** Remember to free the substrings after they are finished being used. // Arg separator - // Arg start_pos - character index position to begin tokenization (Default 0) // Arg end_pos - character index position to end tokenization. If end_pos is // ALength_remainder, then end_pos is set to the last character positon. // (Default ALength_remainder) // Arg case_check - Indicates whether the search for the separator substring // should be case sensitive (AStrCase_sensitive) or case insensitive (AStrCase_ignore). // (Default AStrCase_sensitive) // See: get_token(), AString(APArrayLogical<AString>, separator) // Notes: Separators that are adjacent to one another count as an empty string. // Author(s): Conan Reis void AString::tokenize( APArrayLogical<AString> * collect_p, const AStringBM & separator, uint32_t start_pos, // = 0 uint32_t end_pos // = ALength_remainder ) const { uint32_t pos; if (m_str_ref_p->m_length) // if not empty { if (end_pos == ALength_remainder) { end_pos = m_str_ref_p->m_length - 1; } #ifdef A_BOUNDS_CHECK bounds_check(start_pos, end_pos, "tokenize"); #endif uint32_t length = separator.get_length(); while ((start_pos <= end_pos) && (find(separator, 1u, &pos, start_pos, end_pos))) { collect_p->append(*get_new(start_pos, pos - start_pos)); start_pos = pos + length; } collect_p->append(*get_new(start_pos, end_pos - start_pos + 1)); } } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Internal Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Makes the string writable and have a unique reference. // Examples: called by ensure_writable() // Notes: Maintains data integrity. // Author(s): Conan Reis void AString::make_writable() { AStringRef * str_ref_p = m_str_ref_p; uint32_t length = str_ref_p->m_length; uint32_t size = AStringRef::request_char_count(str_ref_p->m_length); char * buffer_p = AStringRef::alloc_buffer(size); memcpy(buffer_p, str_ref_p->m_cstr_p, size_t(length)); // Add null terminator by hand rather than copying it to ensure that it exists. buffer_p[length] = '\0'; m_str_ref_p = str_ref_p->reuse_or_new(buffer_p, length, size, true); } //--------------------------------------------------------------------------------------- // Makes C-String buffer large enough, writable, and unique (not shared) // - copying the data already present in the string. // Arg needed_chars - amount of characters that need to be stored not including // the null terminating character // Examples: Called by ensure_size() // See: set_size_buffer(), ensure_size(), ensure_size_empty(), // ensure_size_buffer(), set_length() // Author(s): Conan Reis void AString::set_size(uint32_t needed_chars) { AStringRef * str_ref_p = m_str_ref_p; uint32_t size = AStringRef::request_char_count(needed_chars); uint32_t length = a_min(str_ref_p->m_length, size - 1u); char * buffer_p = AStringRef::alloc_buffer(size); // Copy previous contents memcpy(buffer_p, str_ref_p->m_cstr_p, size_t(length)); // Add null terminator by hand rather than copying it to ensure that it exists. buffer_p[length] = '\0'; m_str_ref_p = str_ref_p->reuse_or_new(buffer_p, length, size); } #ifdef A_BOUNDS_CHECK // $Revisit - CReis These methods should be changed to macros so that they are faster in debug mode and so that they use the __FUNCSIG__ macro //--------------------------------------------------------------------------------------- // Author(s): Conan Reis void AString::bounds_check( uint32_t pos, const char * func_name_p ) const { A_VERIFY( pos <= m_str_ref_p->m_length, a_cstr_format("AString::%s() - invalid index\nGiven %u but length only %u, AString:\n%s", func_name_p, pos, m_str_ref_p->m_length, m_str_ref_p->m_cstr_p), AErrId_invalid_index, AString); } //--------------------------------------------------------------------------------------- // Author(s): Conan Reis void AString::bounds_check( uint32_t start_pos, uint32_t end_pos, const char * func_name_p ) const { A_VERIFY( ((start_pos < m_str_ref_p->m_length) && (end_pos < m_str_ref_p->m_length) && (start_pos <= end_pos)), a_cstr_format("AString::%s(start_pos %u, end_pos %u) - invalid index(es)\nLength is %u, AString:\n%s", func_name_p, start_pos, end_pos, m_str_ref_p->m_length, m_str_ref_p->m_cstr_p), AErrId_invalid_index_range, AString); } //--------------------------------------------------------------------------------------- // Author(s): Conan Reis void AString::bounds_check( uint32_t start_pos, uint32_t end_pos, uint32_t instance, const char * func_name_p ) const { A_VERIFY( ((start_pos < m_str_ref_p->m_length) && (end_pos <= m_str_ref_p->m_length) && (start_pos <= end_pos) && (instance != 0u)), a_cstr_format("AString::%s(start_pos %u, end_pos %u, instance %u) - invalid index(es)\nLength is %u, AString:\n%s", func_name_p, start_pos, end_pos, instance, m_str_ref_p->m_length, m_str_ref_p->m_cstr_p), AErrId_invalid_index_range, AString); } //--------------------------------------------------------------------------------------- // Author(s): Conan Reis void AString::span_check( uint32_t pos, uint32_t char_count, const char * func_name_p ) const { A_VERIFY( (pos + char_count) <= m_str_ref_p->m_length, a_cstr_format("AString::%s(pos %u, char_count %u) - invalid index(es)\nLength is %u, AString:\n%s", func_name_p, pos, char_count, m_str_ref_p->m_length, m_str_ref_p->m_cstr_p), AErrId_invalid_index_span, AString); } #endif // A_BOUNDS_CHECK //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class Internal Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Initializes the character matching / classification table. // // Only uses ASCII so as not to be dependent on ANSI Code Pages, etc. // Probably should be replaced with more comprehensive Unicode UTF-8 mechanism - though // should work with ASCII subset of UTF-8 // // # Notes // Use the 2 dimensional table ms_char_match_table instead of the standard character // classification functions like isalpha(), isspace(), etc. // // ms_char_match_table[ACharMatch_white_space][ch] is the same as isspace(ch) // // Always convert characters to unsigned if they are greater than 127. For example, use // ms_char_match_table[ACharMatch_alphabetic][uint8_t(ch)] rather than // ms_char_match_table[ACharMatch_alphabetic][ch]. // // If the same character classification test is to be used repeatedly, a temporary // variable can be made to remove one level of indirection and use it as a one // dimensional array. For example: // ``` // bool * is_digit_p = ms_char_match_table[ACharMatch_digit]; // for (...) // { // ... // if (is_digit_p[ch]) // ... // } // ``` // // Examples: Called at system start-up. // See: not_char_type() // Author(s): Conan Reis void AString::init_match_table() { const size_t bool_bytes = sizeof(bool); // #################### Affirmative Classifications #################### // Most of the classification tests return false memset(ms_char_match_table, false, bool_bytes * ACharMatch__not_start * AString_ansi_charset_length); // Set alphabetic ACharMatch_alphabetic memset(&ms_char_match_table[ACharMatch_alphabetic]['A'], true, bool_bytes * ('Z' - 'A' + 1)); memset(&ms_char_match_table[ACharMatch_alphabetic]['a'], true, bool_bytes * ('z' - 'a' + 1)); // Set alphanumeric ACharMatch_alphanumeric memcpy(ms_char_match_table[ACharMatch_alphanumeric], ms_char_match_table[ACharMatch_alphabetic], bool_bytes * AString_ansi_charset_length); // Alphabetic memset(&ms_char_match_table[ACharMatch_alphanumeric]['0'], true, bool_bytes * ('9'- '0' + 1)); // Set alphanumeric ACharMatch_alphascore memcpy(ms_char_match_table[ACharMatch_alphascore], ms_char_match_table[ACharMatch_alphabetic], bool_bytes * AString_ansi_charset_length); // Alphabetic ms_char_match_table[ACharMatch_alphascore]['_'] = true; // Set digit ACharMatch_DIGIT memset(&ms_char_match_table[ACharMatch_digit]['0'], true, bool_bytes * ('9'- '0' + 1)); // Set alphanumeric ACharMatch_identifier memcpy(ms_char_match_table[ACharMatch_identifier], ms_char_match_table[ACharMatch_alphanumeric], bool_bytes * AString_ansi_charset_length); // Alphanumeric ms_char_match_table[ACharMatch_identifier]['_'] = true; // Set lowercase ACharMatch_lowercase memset(&ms_char_match_table[ACharMatch_lowercase]['a'], true, bool_bytes * ('z' - 'a' + 1)); // Set Punctuation ACharMatch_punctuation ms_char_match_table[ACharMatch_punctuation]['!'] = true; ms_char_match_table[ACharMatch_punctuation]['"'] = true; ms_char_match_table[ACharMatch_punctuation]['\''] = true; ms_char_match_table[ACharMatch_punctuation]['('] = true; ms_char_match_table[ACharMatch_punctuation][')'] = true; ms_char_match_table[ACharMatch_punctuation][','] = true; ms_char_match_table[ACharMatch_punctuation]['-'] = true; // Note this could be a hyphen as well as a minus sign ms_char_match_table[ACharMatch_punctuation]['.'] = true; ms_char_match_table[ACharMatch_punctuation][':'] = true; ms_char_match_table[ACharMatch_punctuation][';'] = true; ms_char_match_table[ACharMatch_punctuation]['?'] = true; ms_char_match_table[ACharMatch_punctuation]['['] = true; ms_char_match_table[ACharMatch_punctuation][']'] = true; ms_char_match_table[ACharMatch_punctuation]['{'] = true; ms_char_match_table[ACharMatch_punctuation]['}'] = true; // Set symbol ACharMatch_symbol memset(&ms_char_match_table[ACharMatch_symbol]['#'], true, bool_bytes * ('&' - '#' + 1)); ms_char_match_table[ACharMatch_symbol]['*'] = true; ms_char_match_table[ACharMatch_symbol]['+'] = true; ms_char_match_table[ACharMatch_symbol]['-'] = true; // Note this could be a hyphen as well as a minus sign ms_char_match_table[ACharMatch_symbol]['/'] = true; ms_char_match_table[ACharMatch_symbol]['<'] = true; ms_char_match_table[ACharMatch_symbol]['='] = true; ms_char_match_table[ACharMatch_symbol]['>'] = true; ms_char_match_table[ACharMatch_symbol]['@'] = true; ms_char_match_table[ACharMatch_symbol]['\\'] = true; ms_char_match_table[ACharMatch_symbol]['^'] = true; ms_char_match_table[ACharMatch_symbol]['`'] = true; ms_char_match_table[ACharMatch_symbol]['|'] = true; ms_char_match_table[ACharMatch_symbol]['~'] = true; // Set Punctuation and symbols ACharMatch_token memset(&ms_char_match_table[ACharMatch_token]['!'], true, bool_bytes * ('/' - '!' + 1)); memset(&ms_char_match_table[ACharMatch_token][':'], true, bool_bytes * ('@' - ':' + 1)); memset(&ms_char_match_table[ACharMatch_token]['['], true, bool_bytes * ('`' - '[' + 1)); memset(&ms_char_match_table[ACharMatch_token]['{'], true, bool_bytes * ('~' - '{' + 1)); // Set alphabetic ACharMatch_uppercase memset(&ms_char_match_table[ACharMatch_uppercase]['A'], true, bool_bytes * ('Z' - 'A' + 1)); // Set white space ACharMatch_white_space // Horizontal Tab, Line Feed, Vertical Tab, Form Feed, Carriage Return memset(&ms_char_match_table[ACharMatch_white_space][9], true, bool_bytes * 5); // Space ms_char_match_table[ACharMatch_white_space][' '] = true; // #################### Negative Classifications ####################### // Most of the negative classification tests return true memset(ms_char_match_table[ACharMatch__not_start], true, bool_bytes * ACharMatch__not_start * AString_ansi_charset_length); // Set alphabetic ACharMatch_not_alphabetic memset(&ms_char_match_table[ACharMatch_not_alphabetic]['A'], false, bool_bytes * ('Z' - 'A' + 1)); memset(&ms_char_match_table[ACharMatch_not_alphabetic]['a'], false, bool_bytes * ('z' - 'a' + 1)); // Set alphanumeric ACharMatch_not_alphanumeric memcpy(ms_char_match_table[ACharMatch_not_alphanumeric], ms_char_match_table[ACharMatch_not_alphabetic], bool_bytes * AString_ansi_charset_length); // Alphabetic memset(&ms_char_match_table[ACharMatch_not_alphanumeric]['0'], false, bool_bytes * ('9'- '0' + 1)); // Set alphanumeric ACharMatch_not_alphascore memcpy(ms_char_match_table[ACharMatch_not_alphascore], ms_char_match_table[ACharMatch_not_alphabetic], bool_bytes * AString_ansi_charset_length); // Alphabetic ms_char_match_table[ACharMatch_not_alphascore]['_'] = false; // Set digit ACharMatch_not_digit memset(&ms_char_match_table[ACharMatch_not_digit]['0'], false, bool_bytes * ('9'- '0' + 1)); // Set alphanumeric ACharMatch_not_identifier memcpy(ms_char_match_table[ACharMatch_not_identifier], ms_char_match_table[ACharMatch_not_alphanumeric], bool_bytes * AString_ansi_charset_length); // Alphanumeric ms_char_match_table[ACharMatch_not_identifier]['_'] = false; // Set lowercase ACharMatch_not_lowercase memset(&ms_char_match_table[ACharMatch_not_lowercase]['a'], false, bool_bytes * ('z' - 'a' + 1)); // Set Punctuation ACharMatch_not_punctuation ms_char_match_table[ACharMatch_not_punctuation]['!'] = false; ms_char_match_table[ACharMatch_not_punctuation]['"'] = false; ms_char_match_table[ACharMatch_not_punctuation]['\''] = false; ms_char_match_table[ACharMatch_not_punctuation]['('] = false; ms_char_match_table[ACharMatch_not_punctuation][')'] = false; ms_char_match_table[ACharMatch_not_punctuation][','] = false; ms_char_match_table[ACharMatch_not_punctuation]['-'] = false; // Note this could be a hyphen as well as a minus sign ms_char_match_table[ACharMatch_not_punctuation]['.'] = false; ms_char_match_table[ACharMatch_not_punctuation][':'] = false; ms_char_match_table[ACharMatch_not_punctuation][';'] = false; ms_char_match_table[ACharMatch_not_punctuation]['?'] = false; ms_char_match_table[ACharMatch_not_punctuation]['['] = false; ms_char_match_table[ACharMatch_not_punctuation][']'] = false; ms_char_match_table[ACharMatch_not_punctuation]['{'] = false; ms_char_match_table[ACharMatch_not_punctuation]['}'] = false; // Set symbol ACharMatch_not_symbol memset(&ms_char_match_table[ACharMatch_not_symbol]['#'], false, bool_bytes * ('&' - '#' + 1)); ms_char_match_table[ACharMatch_not_symbol]['*'] = false; ms_char_match_table[ACharMatch_not_symbol]['+'] = false; ms_char_match_table[ACharMatch_not_symbol]['-'] = false; // Note this could be a hyphen as well as a minus sign ms_char_match_table[ACharMatch_not_symbol]['/'] = false; ms_char_match_table[ACharMatch_not_symbol]['<'] = false; ms_char_match_table[ACharMatch_not_symbol]['='] = false; ms_char_match_table[ACharMatch_not_symbol]['>'] = false; ms_char_match_table[ACharMatch_not_symbol]['@'] = false; ms_char_match_table[ACharMatch_not_symbol]['\\'] = false; ms_char_match_table[ACharMatch_not_symbol]['^'] = false; ms_char_match_table[ACharMatch_not_symbol]['`'] = false; ms_char_match_table[ACharMatch_not_symbol]['|'] = false; ms_char_match_table[ACharMatch_not_symbol]['~'] = false; // Set Punctuation and symbols ACharMatch_not_token memset(&ms_char_match_table[ACharMatch_not_token]['!'], false, bool_bytes * ('/' - '!' + 1)); memset(&ms_char_match_table[ACharMatch_not_token][':'], false, bool_bytes * ('@' - ':' + 1)); memset(&ms_char_match_table[ACharMatch_not_token]['['], false, bool_bytes * ('`' - '[' + 1)); memset(&ms_char_match_table[ACharMatch_not_token]['{'], false, bool_bytes * ('~' - '{' + 1)); // Set alphabetic ACharMatch_not_uppercase memset(&ms_char_match_table[ACharMatch_not_uppercase]['A'], false, bool_bytes * ('Z' - 'A' + 1)); // Set white space ACharMatch_not_white_space // Horizontal Tab, Line Feed, Vertical Tab, Form Feed, Carriage Return memset(&ms_char_match_table[ACharMatch_not_white_space][9], false, bool_bytes * 5); // Space ms_char_match_table[ACharMatch_not_white_space][' '] = false; } //####################################################################################### // AStringBM Class //####################################################################################### //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Common Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Normal constructor from string. // Author(s): Conan Reis AStringBM::AStringBM( const AString & str, // = ms_empty eAStrCase case_check // = AStrCase_sensitive ) : AString(str), m_case(case_check) { uint32_t pos = 0u; uint32_t length = m_str_ref_p->m_length; // get length of pattern uint32_t offset = length - 1u; if (case_check == AStrCase_ignore) { lowercase(); } char * cstr_p = m_str_ref_p->m_cstr_p; // for quicker access uint8_t * delta_p = m_delta_p; // for quicker access memset(m_delta_p, int(length), static_cast<size_t>(AString_ansi_charset_length)); for (; pos < length; pos++) // set table values { delta_p[static_cast<uint32_t>(cstr_p[pos])] = uint8_t(offset - pos); } } //--------------------------------------------------------------------------------------- // Copy constructor. // Author(s): Conan Reis AStringBM::AStringBM(const AStringBM & bm) : AString(bm), m_case(bm.m_case) { memcpy(m_delta_p, bm.m_delta_p, static_cast<size_t>(AString_ansi_charset_length)); // copy contents of source } //--------------------------------------------------------------------------------------- // Assignment operator. // Author(s): Conan Reis const AStringBM & AStringBM::operator=(const AStringBM & bm) { AString::operator=(bm); m_case = bm.m_case; memcpy(m_delta_p, bm.m_delta_p, static_cast<size_t>(AString_ansi_charset_length)); // copy contents of source return *this; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Modifying Methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //--------------------------------------------------------------------------------------- // Converter from AString to existing AStringBM. // Author(s): Conan Reis void AStringBM::convert( const AString & str, eAStrCase case_check // = AStrCase_sensitive ) { uint32_t pos = 0u; uint32_t length = str.m_str_ref_p->m_length; // get length of pattern uint32_t offset = length - 1u; AString::operator=(str); m_case = case_check; if (case_check == AStrCase_ignore) { lowercase(); } char * cstr_p = str.m_str_ref_p->m_cstr_p; // for quicker access uint8_t * delta_p = m_delta_p; // for quicker access memset(m_delta_p, int(length), static_cast<size_t>(AString_ansi_charset_length)); for (; pos < length; pos++) // set table values { delta_p[static_cast<uint32_t>(cstr_p[pos])] = uint8_t(offset - pos); } }
[ "markus@agoglabs.com" ]
markus@agoglabs.com
6850cc89c0625937d3a6965b2319aca490bb04dc
428989cb9837b6fedeb95e4fcc0a89f705542b24
/erle/ros2_ws/build/example_interfaces/rosidl_typesupport_opensplice_cpp/example_interfaces/msg/dds_opensplice/LargeFixed_Dcps_impl.cpp
1e61828bfcbdba9e661603a7a21afa867011bd8f
[]
no_license
swift-nav/ros_rover
70406572cfcf413ce13cf6e6b47a43d5298d64fc
308f10114b35c70b933ee2a47be342e6c2f2887a
refs/heads/master
2020-04-14T22:51:38.911378
2016-07-08T21:44:22
2016-07-08T21:44:22
60,873,336
1
2
null
null
null
null
UTF-8
C++
false
false
28,619
cpp
#include "LargeFixed_Dcps_impl.h" #include "gapi.h" #include "gapi_loanRegistry.h" #include "LargeFixed_SplDcps.h" #include "ccpp_DataReader_impl.h" #include "ccpp_DataReaderView_impl.h" extern c_bool __example_interfaces_msg_dds__LargeFixed___copyIn( c_base base, struct example_interfaces::msg::dds_::LargeFixed_ *from, struct _example_interfaces_msg_dds__LargeFixed_ *to); extern void __example_interfaces_msg_dds__LargeFixed___copyOut( void *_from, void *_to); // DDS example_interfaces::msg::dds_::LargeFixed_ TypeSupportFactory Object Body ::DDS::DataWriter_ptr example_interfaces::msg::dds_::LargeFixed_TypeSupportFactory::create_datawriter (gapi_dataWriter handle) { return new example_interfaces::msg::dds_::LargeFixed_DataWriter_impl(handle); } ::DDS::DataReader_ptr example_interfaces::msg::dds_::LargeFixed_TypeSupportFactory::create_datareader (gapi_dataReader handle) { return new example_interfaces::msg::dds_::LargeFixed_DataReader_impl (handle); } ::DDS::DataReaderView_ptr example_interfaces::msg::dds_::LargeFixed_TypeSupportFactory::create_view (gapi_dataReaderView handle) { return new example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl (handle); } // DDS example_interfaces::msg::dds_::LargeFixed_ TypeSupport Object Body example_interfaces::msg::dds_::LargeFixed_TypeSupport::LargeFixed_TypeSupport(void) : TypeSupport_impl( __example_interfaces_msg_dds__LargeFixed___name(), __example_interfaces_msg_dds__LargeFixed___keys(), example_interfaces::msg::dds_::LargeFixed_TypeSupport::metaDescriptor, (gapi_copyIn) __example_interfaces_msg_dds__LargeFixed___copyIn, (gapi_copyOut) __example_interfaces_msg_dds__LargeFixed___copyOut, (gapi_readerCopy) ::DDS::ccpp_DataReaderCopy<example_interfaces::msg::dds_::LargeFixed_Seq, example_interfaces::msg::dds_::LargeFixed_>, new example_interfaces::msg::dds_::LargeFixed_TypeSupportFactory(), example_interfaces::msg::dds_::LargeFixed_TypeSupport::metaDescriptorArrLength) { // Parent constructor takes care of everything. } example_interfaces::msg::dds_::LargeFixed_TypeSupport::~LargeFixed_TypeSupport(void) { // Parent destructor takes care of everything. } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_TypeSupport::register_type( ::DDS::DomainParticipant_ptr domain, const char * type_name) THROW_ORB_EXCEPTIONS { return TypeSupport_impl::register_type(domain, type_name); } char * example_interfaces::msg::dds_::LargeFixed_TypeSupport::get_type_name() THROW_ORB_EXCEPTIONS { return TypeSupport_impl::get_type_name(); } // DDS example_interfaces::msg::dds_::LargeFixed_ DataWriter_impl Object Body example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::LargeFixed_DataWriter_impl ( gapi_dataWriter handle ) : ::DDS::DataWriter_impl(handle) { // Parent constructor takes care of everything. } example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::~LargeFixed_DataWriter_impl(void) { // Parent destructor takes care of everything. } ::DDS::InstanceHandle_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::register_instance( const example_interfaces::msg::dds_::LargeFixed_ & instance_data) THROW_ORB_EXCEPTIONS { return DataWriter_impl::register_instance(&instance_data); } ::DDS::InstanceHandle_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::register_instance_w_timestamp( const LargeFixed_ & instance_data, const ::DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS { return DataWriter_impl::register_instance_w_timestamp(&instance_data, source_timestamp); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::unregister_instance( const example_interfaces::msg::dds_::LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataWriter_impl::unregister_instance(&instance_data, handle); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::unregister_instance_w_timestamp( const LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle, const ::DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS { return DataWriter_impl::unregister_instance_w_timestamp(&instance_data, handle, source_timestamp); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::write( const example_interfaces::msg::dds_::LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataWriter_impl::write(&instance_data, handle); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::write_w_timestamp( const LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle, const ::DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS { return DataWriter_impl::write_w_timestamp(&instance_data, handle, source_timestamp); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::dispose( const example_interfaces::msg::dds_::LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataWriter_impl::dispose(&instance_data, handle); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::dispose_w_timestamp( const LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle, const ::DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS { return DataWriter_impl::dispose_w_timestamp(&instance_data, handle, source_timestamp); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::writedispose( const example_interfaces::msg::dds_::LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataWriter_impl::writedispose(&instance_data, handle); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::writedispose_w_timestamp( const LargeFixed_ & instance_data, ::DDS::InstanceHandle_t handle, const ::DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS { return DataWriter_impl::writedispose_w_timestamp(&instance_data, handle, source_timestamp); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::get_key_value( LargeFixed_ & key_holder, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataWriter_impl::get_key_value(&key_holder, handle); } ::DDS::InstanceHandle_t example_interfaces::msg::dds_::LargeFixed_DataWriter_impl::lookup_instance( const example_interfaces::msg::dds_::LargeFixed_ & instance_data) THROW_ORB_EXCEPTIONS { return DataWriter_impl::lookup_instance(&instance_data); } // DDS example_interfaces::msg::dds_::LargeFixed_ DataReader_impl Object Body example_interfaces::msg::dds_::LargeFixed_DataReader_impl::LargeFixed_DataReader_impl ( gapi_dataReader handle ) : ::DDS::DataReader_impl(handle, ::DDS::ccpp_DataReaderParallelDemarshallingMain<example_interfaces::msg::dds_::LargeFixed_Seq>) { // Parent constructor takes care of everything. } example_interfaces::msg::dds_::LargeFixed_DataReader_impl::~LargeFixed_DataReader_impl(void) { // Parent destructor takes care of everything. } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::read(&received_data, info_seq, max_samples, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::take(&received_data, info_seq, max_samples, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::read_w_condition(&received_data, info_seq, max_samples, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::take_w_condition(&received_data, info_seq, max_samples, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read_next_sample( example_interfaces::msg::dds_::LargeFixed_ & received_data, ::DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS { return DataReader_impl::read_next_sample(&received_data, sample_info); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take_next_sample( example_interfaces::msg::dds_::LargeFixed_ & received_data, ::DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS { return DataReader_impl::take_next_sample(&received_data, sample_info); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::read_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::take_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read_next_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::read_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take_next_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::take_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::read_next_instance_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::read_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::take_next_instance_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReader_impl::take_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::return_loan( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status = ::DDS::RETCODE_OK; if ( received_data.length() > 0 ) { if (received_data.length() == info_seq.length() && received_data.release() == info_seq.release() ) { if (!received_data.release()) { status = DataReader_impl::return_loan( received_data.get_buffer(), info_seq.get_buffer() ); if ( status == ::DDS::RETCODE_OK ) { if ( !received_data.release() ) { example_interfaces::msg::dds_::LargeFixed_Seq::freebuf( received_data.get_buffer(false) ); received_data.replace(0, 0, NULL, false); ::DDS::SampleInfoSeq::freebuf( info_seq.get_buffer(false) ); info_seq.replace(0, 0, NULL, false); } } else if ( status == ::DDS::RETCODE_NO_DATA ) { if ( received_data.release() ) { status = ::DDS::RETCODE_OK; } else { status = ::DDS::RETCODE_PRECONDITION_NOT_MET; } } } } else { status = ::DDS::RETCODE_PRECONDITION_NOT_MET; } } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::get_key_value( example_interfaces::msg::dds_::LargeFixed_ & key_holder, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataReader_impl::get_key_value(&key_holder, handle); } ::DDS::InstanceHandle_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::lookup_instance( const example_interfaces::msg::dds_::LargeFixed_ & instance) THROW_ORB_EXCEPTIONS { return DataReader_impl::lookup_instance(&instance); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples) { ::DDS::ReturnCode_t status = ::DDS::RETCODE_PRECONDITION_NOT_MET; if ( received_data.length() == info_seq.length() && received_data.maximum() == info_seq.maximum() && received_data.release() == info_seq.release() ) { if ( received_data.maximum() == 0 || received_data.release() ) { if (received_data.maximum() == 0 || max_samples <= static_cast<DDS::Long>(received_data.maximum()) || max_samples == ::DDS::LENGTH_UNLIMITED ) { status = ::DDS::RETCODE_OK; } } } return status; } // DDS example_interfaces::msg::dds_::LargeFixed_ DataReaderView_impl Object Body example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::LargeFixed_DataReaderView_impl ( gapi_dataReaderView handle ) : ::DDS::DataReaderView_impl(handle) { // Parent constructor takes care of everything. } example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::~LargeFixed_DataReaderView_impl(void) { // Parent destructor takes care of everything. } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::read(&received_data, info_seq, max_samples, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::take(&received_data, info_seq, max_samples, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::read_w_condition(&received_data, info_seq, max_samples, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::take_w_condition(&received_data, info_seq, max_samples, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read_next_sample( example_interfaces::msg::dds_::LargeFixed_ & received_data, ::DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS { return DataReaderView_impl::read_next_sample(&received_data, sample_info); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take_next_sample( example_interfaces::msg::dds_::LargeFixed_ & received_data, ::DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS { return DataReaderView_impl::take_next_sample(&received_data, sample_info); } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::read_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::take_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read_next_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::read_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take_next_instance( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::take_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::read_next_instance_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::read_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::take_next_instance_w_condition( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq, ::DDS::Long max_samples, ::DDS::InstanceHandle_t a_handle, ::DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status; status = example_interfaces::msg::dds_::LargeFixed_DataReader_impl::check_preconditions(received_data, info_seq, max_samples); if ( status == ::DDS::RETCODE_OK ) { status = DataReaderView_impl::take_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition); } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::return_loan( example_interfaces::msg::dds_::LargeFixed_Seq & received_data, ::DDS::SampleInfoSeq & info_seq) THROW_ORB_EXCEPTIONS { ::DDS::ReturnCode_t status = ::DDS::RETCODE_OK; if ( received_data.length() > 0 ) { if (received_data.length() == info_seq.length() && received_data.release() == info_seq.release() ) { if (!received_data.release()) { status = DataReaderView_impl::return_loan( received_data.get_buffer(), info_seq.get_buffer() ); if ( status == ::DDS::RETCODE_OK ) { if ( !received_data.release() ) { example_interfaces::msg::dds_::LargeFixed_Seq::freebuf( received_data.get_buffer(false) ); received_data.replace(0, 0, NULL, false); ::DDS::SampleInfoSeq::freebuf( info_seq.get_buffer(false) ); info_seq.replace(0, 0, NULL, false); } } else if ( status == ::DDS::RETCODE_NO_DATA ) { if ( received_data.release() ) { status = ::DDS::RETCODE_OK; } else { status = ::DDS::RETCODE_PRECONDITION_NOT_MET; } } } } else { status = ::DDS::RETCODE_PRECONDITION_NOT_MET; } } return status; } ::DDS::ReturnCode_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::get_key_value( example_interfaces::msg::dds_::LargeFixed_ & key_holder, ::DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS { return DataReaderView_impl::get_key_value(&key_holder, handle); } ::DDS::InstanceHandle_t example_interfaces::msg::dds_::LargeFixed_DataReaderView_impl::lookup_instance( const example_interfaces::msg::dds_::LargeFixed_ & instance) THROW_ORB_EXCEPTIONS { return DataReaderView_impl::lookup_instance(&instance); } const char * ::example_interfaces::msg::dds_::LargeFixed_TypeSupport::metaDescriptor[] = {"<MetaData version=\"1.0.0\"><Module name=\"example_interfaces\"><Module name=\"msg\"><Module name=\"dds_\">", "<TypeDef name=\"example_interfaces__LargeFixed__long_array_255\"><Array size=\"255\"><Long/></Array></TypeDef>", "<Struct name=\"LargeFixed_\"><Member name=\"data_\"><Type name=\"example_interfaces__LargeFixed__long_array_255\"/>", "</Member></Struct></Module></Module></Module></MetaData>"}; const ::DDS::ULong (::example_interfaces::msg::dds_::LargeFixed_TypeSupport::metaDescriptorArrLength) = 4;
[ "igdoty@swiftnav.com" ]
igdoty@swiftnav.com
d8d79bd28b1aefb4975f05080bca3708e3779b49
cee828460946c5eec221ec1813e7d21b29c6e32c
/Ky-031/Ky-031.ino
9f12b552332dbcaa8d9a6497b182a384aa013b9c
[]
no_license
keremerolce/arduino-37-sensor
7e026e71581b3c85b10efd9b76544926ab1f4af9
af858afd9e5cac8a995fe2574685665ca5de2b5c
refs/heads/master
2020-03-30T17:46:13.789395
2018-10-03T19:49:52
2018-10-03T19:49:52
151,469,099
0
0
null
null
null
null
UTF-8
C++
false
false
557
ino
int Led = 13 ; // define LED Interface int Shock = 3; // define the percussion Sensor Interface int val ; // define numeric variables val void setup () { pinMode (Led, OUTPUT) ; // define LED as output interface pinMode (Shock, INPUT) ; // define knock sensor output interface } void loop () { val = digitalRead (Shock) ; // read digital interface is assigned a value of 3 val if (val == HIGH) // When the percussion when the sensor detects a signal, LED flashes { digitalWrite (Led, LOW); } else { digitalWrite (Led, HIGH); } }
[ "keremerol.ce@outlook.com" ]
keremerol.ce@outlook.com
c83c6440cc280bd7ff238cf9f39ba0055e992bc4
23f64812a8be5606a78edf2cd630f1229ba25550
/SimulatedAnnealingExtraP/GeneralParameterEstimator.h
131eda856b3c69bc4c308526505e95c86802042c
[ "MIT" ]
permissive
tudasc/SimAnMo
dfa9aad1ffb95cb3b89bdd9799b431ee836a890c
e60bdd17513adb983abfc5754ff77c84b36fa906
refs/heads/master
2023-08-11T01:09:45.369779
2021-09-30T05:35:42
2021-09-30T05:35:42
290,442,787
2
0
null
2020-08-27T06:40:37
2020-08-26T08:40:26
C++
UTF-8
C++
false
false
526
h
#ifndef GENERALPARAMETERESTIMATOR_H #define GENERALPARAMETERESTIMATOR_H #include "MeasurementDB.h" #include "ParameterEstimatorInterface.h" class GeneralParameterEstimator : public ParameterEstimatorInterface { public: GeneralParameterEstimator(); GeneralParameterEstimator(MeasurementDB* inputDB); ~GeneralParameterEstimator(); int estimateParameters(AbstractSolution* sol, double newrelerr = 0.0); private: MeasurementDB* _inputDB; ParameterEstimatorInterface* _esti; }; #endif // ! GENERALPARAMETERESTIMATOR_H
[ "michael.burger@sc.tu-darmstadt.de" ]
michael.burger@sc.tu-darmstadt.de
553d843042c751af45e99c3d8d08537a7553a640
4cfe06e384e903cff94796abdeb40c66e48b56b6
/XMLParser/XMLString.h
fa8dcdf7944a5dbd48c6edfbc17314b0957a55e6
[]
no_license
fardragon/XMLParser
06e2e18c80e71b13a4adbd94f29c7f17a5036d61
0e279db9cbd77e1ddd1b85e380a2af4858e660af
refs/heads/master
2021-01-20T11:51:00.872670
2017-09-05T07:01:36
2017-09-05T07:01:36
101,691,527
0
0
null
null
null
null
UTF-8
C++
false
false
628
h
#ifndef XMLString_h__ #define XMLString_h__ #include <string> #include <algorithm> #include <regex> enum class XMLelementType; class XMLString { public: XMLString(const std::string &data); std::string extractNext(); std::string peekNext() const; bool isEmpty() const; static bool isProlog(const std::string &element); static std::pair<std::string, std::string> parseProlog(const std::string &element); static XMLelementType elementType(const std::string &element); private: private: std::string m_data; }; enum class XMLelementType { openTag, closeTag, singleTag, syntaxError }; #endif // XMLString_h__
[ "michaldrozd@protonmail.ch" ]
michaldrozd@protonmail.ch
c823fc9ec96c2e95bf5bb5ab92413a2d04a3d366
a602b22acea1c34ae0fcf68a1ffb9e1339852e93
/src/Chemistry/MoleculeRecipes.cpp
d7c16486d5a495fdf1ed3d4a07c4607b619a4c6e
[]
no_license
alexlitty/tree-simulator
2505878dea8a0cb84b7556285a83c3022c141e6f
ca2f4e7ac65b81bfae59e5abdcf7460555311dd4
refs/heads/master
2021-01-19T02:20:53.985363
2018-12-24T11:35:38
2018-12-24T11:35:38
34,832,492
0
0
null
null
null
null
UTF-8
C++
false
false
1,158
cpp
#include <tree/Chemistry/MoleculeRecipes.hpp> // Retrieves all the elements composing a molecule collection. tree::ElementCollection tree::getElements(tree::MoleculeCollection& molecules) { ElementCollection elements; for (auto pair : molecules) { for (unsigned int i = 0; i < pair.second; i++) { elements.add(MoleculeRecipes[pair.first]); } } return elements; } // Generates the most interesting molecules from an element collection. tree::MoleculeCollection tree::generateMolecules(tree::ElementCollection elements) { MoleculeCollection molecules; while (!elements.isEmpty()) { molecules.add(tree::generateMolecule(elements)); } return molecules; } std::map<tree::Molecule, tree::ElementCollection> tree::MoleculeRecipes = { { Molecule::Water, { tree::Element::Hydrogen, tree::Element::Hydrogen, tree::Element::Oxygen } }, { Molecule::Hydrogen, { tree::Element::Hydrogen } }, { Molecule::Oxygen, { tree::Element::Oxygen } } };
[ "github@alexlitty.com" ]
github@alexlitty.com
96c92d7d9ae0f1d16424b6609a37a61e5b5b03bb
0179b3259384adafcd8a259a08205eae6c422492
/logdevice/common/configuration/nodes/utils.cpp
fc2452305825f3f896b1f1f40211d23384b86e44
[ "BSD-3-Clause" ]
permissive
Kejba93/LogDevice
673318d434758c3e816fade1a4c71b1e587a6e59
355ff8f576591c23653b2e32af6261cfd2cf429b
refs/heads/master
2020-04-15T08:57:52.782328
2019-01-08T01:44:15
2019-01-08T01:47:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
809
cpp
/** * Copyright (c) 2017-present, Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include "utils.h" namespace facebook { namespace logdevice { namespace configuration { namespace nodes { bool shouldIncludeInNodesetSelection(const NodesConfiguration& nodes_config, ShardID shard) { // if `shard' is in membership then it must have an attribute // defined, thus direct deference is used return nodes_config.getStorageMembership()->canWriteToShard(shard) && !nodes_config.getNodeStorageAttribute(shard.node()) ->exclude_from_nodesets; } }}}} // namespace facebook::logdevice::configuration::nodes
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
3b345d24294bcb23a21f58f8949a509aba368fd3
e7d907a5e1a0f4a92a373da4a1847683f8a9c7b4
/src/bsb_engine/bsb_particel.cpp
69fdfee6feefb31c27b528e5c2f6e1dce6ad1851
[]
no_license
imclab/voxelart
0620c53a7facbf7894c21b9c17c354f32c35da75
166d55f5dea199b0b7a6cb866a2763bc785000eb
refs/heads/master
2020-04-01T14:20:42.645006
2012-04-22T17:37:16
2012-04-22T17:37:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,217
cpp
#include "../../inc/bsb_engine/bsb_particel.h" Bsb_Particel::Bsb_Particel(Bsb_Vector* p_vPosition,Bsb_Vector* p_vVelocity,float p_fBirthday,float p_fLifetime){ m_vPosition = p_vPosition; m_vVelocity = p_vVelocity; m_fBirthday = p_fBirthday; m_fLifetime = p_fLifetime; } void Bsb_Particel::update(float p_seconds){// Aufruf einmal pro Frame if(p_seconds - m_fBirthday > m_fLifetime){ m_bLife= false ; // Partikel wird beim nächsten // Schleifendruchlauf gelöscht return; // keine weiteren Updates mehr nötig } // neue Position anhand der Geschwindigkeit und der Zeit seit // dem letzen Update berechnen m_vPosition->x += (m_vVelocity->x*p_seconds); m_vPosition->y += (m_vVelocity->y*p_seconds); m_vPosition->z += (m_vVelocity->z*p_seconds); } void Bsb_Particel::render(){ // Aufruf einmal pro Frame m_Sprite->render(); } void Bsb_Particel::set(Bsb_Vector* p_vPosition,Bsb_Vector* p_vVelocity,float p_fBirthday,float p_fLifetime){ // … steht für Attribute des Objekts m_vPosition = p_vPosition; m_vVelocity = p_vVelocity; m_fBirthday = p_fBirthday; m_fLifetime = p_fLifetime; }
[ "l_schmid@cojobo.net" ]
l_schmid@cojobo.net
7838fa15a58b01de7a285a6c92153c79773cdfcb
84fc6209079c364aca7d8fb88833b991ddb8b914
/datainput/worldtest.cpp
c8bea17482b1a3c54a8e7a16fa32ed6b6db2ba1b
[]
no_license
ABRG-Models/VisualAttention
6429d4bb20eb76b90111ab1eec1f42109fb8d7ad
52fb2ec49dce471c2d8cbaf4934d5f3ef855e0c7
refs/heads/master
2023-06-08T08:31:52.851892
2023-06-05T15:15:31
2023-06-05T15:15:31
133,489,500
0
1
null
null
null
null
UTF-8
C++
false
false
6,395
cpp
/* * A tester for WorldFrame, EyeFrame etc. */ #include "luminance.h" #include "worldframe.h" #include "eyeframe.h" #include <vector> #include <iostream> #include <fstream> #include "common.h" #include "debug.h" #include <json/json.h> using namespace wdm; using namespace std; std::ofstream DBGSTREAM; void readLuminanceFile (WorldFrame& wf) { ifstream jsonfile ("luminances.json", ifstream::binary); Json::Value root; string errs; Json::CharReaderBuilder rbuilder; rbuilder["collectComments"] = false; bool parsingSuccessful = Json::parseFromStream (rbuilder, jsonfile, &root, &errs); if (!parsingSuccessful) { // report to the user the failure and their locations in the document. cerr << "Failed to parse JSON: " << errs; return; } const Json::Value plugins = root["luminances"]; for (int index = 0; index < plugins.size(); ++index) { // Iterates over the sequence elements. Json::Value v = plugins[index]; // args for Luminance are: (thX, thY, crosswidth, barthickness, brightness, timeOn, timeOff) if (v.get ("shape", "cross").asString() == "cross") { CrossLuminance cross_lum (v.get ("thetaX", 0.0).asInt(), v.get ("thetaY", 0.0).asInt(), v.get ("widthThetaX", 0.0).asInt(), v.get ("widthThetaY", 0.0).asInt(), v.get ("luminance", 0.0).asFloat(), v.get ("timeOn", 0.0).asFloat(), v.get ("timeOff", 0.0).asFloat()); wf.luminanceSeries.push_back (cross_lum); } else { Luminance rect_lum (v.get ("thetaX", 0.0).asInt(), v.get ("thetaY", 0.0).asInt(), v.get ("widthThetaX", 0.0).asInt(), v.get ("widthThetaY", 0.0).asInt(), v.get ("rotation", 0).asInt(), v.get ("luminance", 0.0).asFloat(), v.get ("timeOn", 0.0).asFloat(), v.get ("timeOff", 0.0).asFloat()); wf.luminanceSeries.push_back (rect_lum); } cout << "Added " << v.get ("shape", 0.0).asString() << "luminance with params: thetaX:" << v.get ("thetaX", 0.0).asInt() << " thetaY:" << v.get ("thetaY", 0.0).asInt() << " widthThetaX:" << v.get ("widthThetaX", 0.0).asInt() << " widthThetaY:" << v.get ("widthThetaY", 0.0).asInt() << " rotation:" << v.get ("rotation", 0.0).asInt() << " luminance:" << v.get ("luminance", 0.0).asFloat() << " timeOn:" << v.get ("timeOn", 0.0).asFloat() << " timeOff:" << v.get ("timeOff", 0.0).asFloat() << endl; } } int main() { DBGOPEN ("worldtest_debug.log"); { // Showing the use of readLuminanceFile: WorldFrame wf0; readLuminanceFile (wf0); } WorldFrame wf; // Straight ahead: thetax=0, thetay=0. // Luminance (thetax, thetay, widthThX, widthThY, rotn, luminosity, time_on, time_off) //CrossLuminance l1 (0, 0, 6, 2, 2, 0.0, 0.25); CornerLuminance l1 (0, 3, 5, 1, 0, 1.0, 0.0, 0.25); CornerLuminance l2 (0, 13, 5, 1, 90, 0.8, 0.0, 0.25); CornerLuminance l3 (0, 19, 5, 1, 180, 0.6, 0.0, 0.25); CornerLuminance l4 (0, 23, 5, 1, 270, 0.4, 0.0, 0.25); CornerLuminance m1 (0, -3, 5, 1, 0, 1.0, 0.0, 0.25); CornerLuminance m2 (0, -13, 5, 1, 90, 0.8, 0.0, 0.25); CornerLuminance m3 (0, -19, 5, 1, 180, 0.6, 0.0, 0.25); CornerLuminance m4 (0, -23, 5, 1, 270, 0.4, 0.0, 0.25); CornerLuminance n1 (-3, 0, 5, 1, 0, 1.0, 0.0, 0.25); CornerLuminance n2 (-13, 0, 5, 1, 90, 0.8, 0.0, 0.25); CornerLuminance n3 (-19, 0, 5, 1, 180, 0.6, 0.0, 0.25); CornerLuminance n4 (-23, 0, 5, 1, 270, 0.4, 0.0, 0.25); CornerLuminance o1 (3, 0, 5, 1, 0, 1.0, 0.0, 0.25); CornerLuminance o2 (13, 0, 5, 1, 90, 0.8, 0.0, 0.25); CornerLuminance o3 (19, 0, 5, 1, 180, 0.6, 0.0, 0.25); CornerLuminance o4 (23, 0, 5, 1, 270, 0.4, 0.0, 0.25); //CornerLuminance l5 (0, 23, 5, 1, 270, 0.4, 0.0, 0.25); //const int& thX, const int& thY, //const int& wThX, const int& wThY, //const int& rotn, //const double& bright, const double& tOn, const double& tOff Luminance r1 (0, 0, 10, 2, 0, 0.4, 0.0, 0.25); Luminance r2 (20, 0, 10, 2, 90, 0.4, 0.0, 0.25); Luminance r3 (20, 20, 10, 2, 270, 0.4, 0.0, 0.25); wf.luminanceSeries.push_back (l1); wf.luminanceSeries.push_back (l2); wf.luminanceSeries.push_back (l3); wf.luminanceSeries.push_back (l4); wf.luminanceSeries.push_back (m1); wf.luminanceSeries.push_back (m2); wf.luminanceSeries.push_back (m3); wf.luminanceSeries.push_back (m4); wf.luminanceSeries.push_back (n1); wf.luminanceSeries.push_back (n2); wf.luminanceSeries.push_back (n3); wf.luminanceSeries.push_back (n4); wf.luminanceSeries.push_back (o1); wf.luminanceSeries.push_back (o2); wf.luminanceSeries.push_back (o3); wf.luminanceSeries.push_back (o4); wf.setLuminanceThetaMap (0.01); // Set up the map for time=0.01s. // Save maps/coords wf.saveLuminanceThetaMap(); wf.saveLuminanceCoords(); EyeFrame ef; ef.setDistanceToScreen (wf.distanceToScreen); ef.setOffset (0, 0, 0); ef.setEyeField (wf.luminanceCoords); // Save things which are visualised with show_data.m ef.saveLuminanceMap(); ef.saveLuminanceCartesianCoords(); ef.saveNeuronPixels(); ef.saveNeuronPrecise(); ef.saveCorticalSheet(); wf.setLuminanceThetaMap (0.07); // Set up the map for time=0.07s. wf.saveLuminanceThetaMap("worldframe_lum_map_off.dat"); //wf.saveLuminanceCoords(""); ef.setEyeField (wf.luminanceCoords); // Save things which are visualised with show_data.m ef.saveLuminanceMap("eyeframe_lum_map_off.dat"); ef.saveLuminanceCartesianCoords("eyeframe_lum_cart_off.dat"); ef.saveNeuronPixels("neuron_pixels_w_lum_off.dat"); ef.saveNeuronPrecise("neuron_precise_w_lum_off.dat"); ef.saveCorticalSheet("cortical_sheet_off.dat"); DBGCLOSE(); return 0; }
[ "seb.james@sheffield.ac.uk" ]
seb.james@sheffield.ac.uk
664c32f36a11f135a5ad1171c932d2fee73ce1dd
32f97b6d14352d6c740033307784be24088b626e
/src/tests/myImportandFunction/alignTranscript.cpp
32b44a55179e27923b76913fd523bc89a8f947be
[ "MIT" ]
permissive
illarionovaanastasia/GEAN
bcc48ebf740fb8c5f0623dcfc84415ddf0b36fea
b81bbf45dd869ffde2833fd1eb78463d09de45cb
refs/heads/master
2022-12-03T13:54:23.898262
2020-08-17T09:17:30
2020-08-17T09:17:30
288,134,843
0
0
MIT
2020-08-17T09:14:17
2020-08-17T09:14:17
null
UTF-8
C++
false
false
14,969
cpp
// // Created by song on 8/26/18. // #include "../../../googletest/googletest/include/gtest/gtest.h" #include "../../impl/impl.h" #include <string> #include "../../myImportandFunction/myImportantFunction.h" #include <iostream> #include <ctime> #include <ratio> #include <chrono> TEST(alignTranscript, c1){ std::string parameterFile = "configure"; std::map<std::string, std::string> parameters = initialize_paramters(parameterFile, "./"); NucleotideCodeSubstitutionMatrix nucleotideCodeSubstitutionMatrix(parameters); int minIntron = 5; std::string referenceGenomeFilePath = "/biodata/dep_tsiantis/grp_gan/song/rdINDELallHere/inputData/fullSdiFile/col_0.fa"; std::map<std::string, Fasta> referenceGenome; readFastaFile(referenceGenomeFilePath, referenceGenome); std::cout << "reference genome sequence reading done" << std::endl; std::string referenceGffFilePath = "/biodata/dep_tsiantis/grp_gan/song/gennepredication/TAIR10annotationclassification/unmodifyed/TAIR10_GFF3_genes.gff"; std::map<std::string, std::vector<Transcript> > referenceTranscriptHashSet; std::string regex = get_parameters("cdsParentRegex", parameters); readGffFile (referenceGffFilePath, referenceTranscriptHashSet, regex); CheckAndUpdateTranscriptsEnds( referenceTranscriptHashSet, referenceGenome, nucleotideCodeSubstitutionMatrix, minIntron); std::cout << "gff file reading done" << std::endl; std::map<std::string, std::vector<Variant> > variantsMaps; std::string sdiFile = "/biodata/dep_tsiantis/grp_gan/song/rdINDELallHere/inputData/fullSdiFile/PA9830.sdi"; readSdiFile (sdiFile, variantsMaps, "", referenceGenome); std::cout << "variant tables reading done" << std::endl; std::map<std::string, Fasta> targetGenome; getPseudoGenomeSequence(referenceGenome, variantsMaps, targetGenome, parameters); std::cout << "get pseudoGenome sequence done" << std::endl; std::map<std::string, Transcript> targetTranscriptsHashMap;// transcriptName Transcript annotationLiftOver(referenceTranscriptHashSet, targetTranscriptsHashMap, variantsMaps, targetGenome, referenceGenome, parameters, minIntron); std::cout << "annotationLiftOver done" << std::endl; std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); for(std::map<std::string, std::vector<Transcript> >::iterator it=referenceTranscriptHashSet.begin(); it!=referenceTranscriptHashSet.end(); ++it) { if( referenceGenome.find(it->first) != referenceGenome.end() ) { for (std::vector<Transcript>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { Transcript referenceTranscript = (*it2); Transcript targetTranscript = targetTranscriptsHashMap[it2->getName()]; TranscriptUpdateCdsInformation(referenceTranscript, referenceGenome); std::string refGenomeSequence = referenceTranscript.getGeneomeSequence(); int startCodonPosition = 1; int stopCodonPosition = refGenomeSequence.length() - 2; std::vector<SpliceSitePosition> spliceSitePositions; targetTranscript.setSource("REALIGNMENT"); //prepare for the new GenomeBasicFeature After re-alignment begin std::vector<int> targetCdsStarts; std::vector<int> targetCdsEnds; STRAND thisStrand = referenceTranscript.getStrand(); int startTarget = targetTranscript.getPStart() - refGenomeSequence.length(); int endTarget = targetTranscript.getPEnd() + refGenomeSequence.length(); std::string dna_b = getSubsequence(targetGenome, it->first, startTarget, endTarget, thisStrand); if (referenceTranscript.getStrand() == POSITIVE && referenceTranscript.getCdsVector().size() > 1) { if (referenceTranscript.getCdsVector().size() > 1) { for (size_t i = 1; i < referenceTranscript.getCdsVector().size(); ++i) { SpliceSitePosition spliceSitePosition( referenceTranscript.getCdsVector()[i - 1].getEnd() - referenceTranscript.getPStart() + 2, referenceTranscript.getCdsVector()[i].getStart() - referenceTranscript.getPStart()); spliceSitePositions.push_back(spliceSitePosition); } } if (dna_b.length() < 10000) { AlignTranscript nw(refGenomeSequence, dna_b, startCodonPosition, stopCodonPosition, spliceSitePositions, parameters, nucleotideCodeSubstitutionMatrix); // std::cout << "standard " << referenceTranscript.getName() << " begin" << std::endl; NeedlemanWunschForTranscript nw2(refGenomeSequence, dna_b, startCodonPosition, stopCodonPosition, spliceSitePositions, parameters, nucleotideCodeSubstitutionMatrix); std::string rq = nw.getAlignment_q(); rq.erase(std::remove(rq.begin(), rq.end(), '-'), rq.end()); std::string rd = nw.getAlignment_d(); rd.erase(std::remove(rd.begin(), rd.end(), '-'), rd.end()); if (nw.getAlignment_d().compare(nw2.getAlignment_d()) != 0) { std::cerr << "error d" << it2->getName() << std::endl; //nw.print_results(); nw2.print_results(); } else if (nw.getAlignment_q().compare(nw2.getAlignment_q()) != 0) { std::cerr << "error q" << it2->getName() << std::endl; //nw.print_results(); nw2.print_results(); } else if (rq.compare(dna_b) != 0) { std::cerr << "error rq" << it2->getName() << std::endl; //nw.print_results(); nw2.print_results(); } else if (rd.compare(refGenomeSequence) != 0) { std::cerr << "error rd" << it2->getName() << std::endl; //nw.print_results(); nw2.print_results(); } } } } } } ASSERT_EQ(0, 0); } TEST(alignTranscript, c2){ std::string parameterFile = "configure"; std::map<std::string, std::string> parameters = initialize_paramters(parameterFile, "./"); NucleotideCodeSubstitutionMatrix nucleotideCodeSubstitutionMatrix(parameters); int minIntron = 5; std::string referenceGenomeFilePath = "/biodata/dep_tsiantis/grp_gan/song/rdINDELallHere/inputData/fullSdiFile/col_0.fa"; std::map<std::string, Fasta> referenceGenome; readFastaFile(referenceGenomeFilePath, referenceGenome); std::cout << "reference genome sequence reading done" << std::endl; std::string referenceGffFilePath = "/biodata/dep_tsiantis/grp_gan/song/gennepredication/TAIR10annotationclassification/unmodifyed/TAIR10_GFF3_genes.gff"; std::map<std::string, std::vector<Transcript> > referenceTranscriptHashSet; std::string regex = get_parameters("cdsParentRegex", parameters); readGffFile (referenceGffFilePath, referenceTranscriptHashSet, regex); CheckAndUpdateTranscriptsEnds( referenceTranscriptHashSet, referenceGenome, nucleotideCodeSubstitutionMatrix, minIntron); std::cout << "gff file reading done" << std::endl; std::map<std::string, std::vector<Variant> > variantsMaps; std::string sdiFile = "/biodata/dep_tsiantis/grp_gan/song/rdINDELallHere/inputData/fullSdiFile/PA9830.sdi"; readSdiFile (sdiFile, variantsMaps, "", referenceGenome); std::cout << "variant tables reading done" << std::endl; std::map<std::string, Fasta> targetGenome; getPseudoGenomeSequence(referenceGenome, variantsMaps, targetGenome, parameters); std::cout << "get pseudoGenome sequence done" << std::endl; std::map<std::string, Transcript> targetTranscriptsHashMap;// transcriptName Transcript annotationLiftOver(referenceTranscriptHashSet, targetTranscriptsHashMap, variantsMaps, targetGenome, referenceGenome, parameters, minIntron); std::cout << "annotationLiftOver done" << std::endl; std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); for(std::map<std::string, std::vector<Transcript> >::iterator it=referenceTranscriptHashSet.begin(); it!=referenceTranscriptHashSet.end(); ++it) { if( referenceGenome.find(it->first) != referenceGenome.end() ) { for (std::vector<Transcript>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { Transcript referenceTranscript = (*it2); Transcript targetTranscript = targetTranscriptsHashMap[it2->getName()]; TranscriptUpdateCdsInformation(referenceTranscript, referenceGenome); std::string refGenomeSequence = referenceTranscript.getGeneomeSequence(); int startCodonPosition = 1; int stopCodonPosition = refGenomeSequence.length() - 2; std::vector<SpliceSitePosition> spliceSitePositions; targetTranscript.setSource("REALIGNMENT"); int targetPosition = 0; int referencePosition = 0; //prepare for the new GenomeBasicFeature After re-alignment begin std::vector<int> targetCdsStarts; std::vector<int> targetCdsEnds; STRAND thisStrand = referenceTranscript.getStrand(); int startTarget = targetTranscript.getPStart() - refGenomeSequence.length(); int endTarget = targetTranscript.getPEnd() + refGenomeSequence.length(); std::string dna_b = getSubsequence(targetGenome, it->first, startTarget, endTarget, thisStrand); if (referenceTranscript.getStrand() == POSITIVE && referenceTranscript.getCdsVector().size() > 1) { if (referenceTranscript.getCdsVector().size() > 1) { for (size_t i = 1; i < referenceTranscript.getCdsVector().size(); ++i) { SpliceSitePosition spliceSitePosition( referenceTranscript.getCdsVector()[i - 1].getEnd() - referenceTranscript.getPStart() + 2, referenceTranscript.getCdsVector()[i].getStart() - referenceTranscript.getPStart()); spliceSitePositions.push_back(spliceSitePosition); } } if (dna_b.length() < 5000) { AlignTranscript nw(refGenomeSequence, dna_b, startCodonPosition, stopCodonPosition, spliceSitePositions, parameters, nucleotideCodeSubstitutionMatrix); } } } } } std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); for(std::map<std::string, std::vector<Transcript> >::iterator it=referenceTranscriptHashSet.begin(); it!=referenceTranscriptHashSet.end(); ++it) { if( referenceGenome.find(it->first) != referenceGenome.end() ) { for (std::vector<Transcript>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { Transcript referenceTranscript = (*it2); Transcript targetTranscript = targetTranscriptsHashMap[it2->getName()]; TranscriptUpdateCdsInformation(referenceTranscript, referenceGenome); std::string refGenomeSequence = referenceTranscript.getGeneomeSequence(); int startCodonPosition = 1; int stopCodonPosition = refGenomeSequence.length() - 2; std::vector<SpliceSitePosition> spliceSitePositions; targetTranscript.setSource("REALIGNMENT"); int targetPosition = 0; int referencePosition = 0; //prepare for the new GenomeBasicFeature After re-alignment begin std::vector<int> targetCdsStarts; std::vector<int> targetCdsEnds; STRAND thisStrand = referenceTranscript.getStrand(); int startTarget = targetTranscript.getPStart() - refGenomeSequence.length(); int endTarget = targetTranscript.getPEnd() + refGenomeSequence.length(); std::string dna_b = getSubsequence(targetGenome, it->first, startTarget, endTarget, thisStrand); if (referenceTranscript.getStrand() == POSITIVE && referenceTranscript.getCdsVector().size() > 1) { if (referenceTranscript.getCdsVector().size() > 1) { for (size_t i = 1; i < referenceTranscript.getCdsVector().size(); ++i) { SpliceSitePosition spliceSitePosition( referenceTranscript.getCdsVector()[i - 1].getEnd() - referenceTranscript.getPStart() + 2, referenceTranscript.getCdsVector()[i].getStart() - referenceTranscript.getPStart()); spliceSitePositions.push_back(spliceSitePosition); } } if (dna_b.length() < 5000) { NeedlemanWunschForTranscript nw(refGenomeSequence, dna_b, startCodonPosition, stopCodonPosition, spliceSitePositions, parameters, nucleotideCodeSubstitutionMatrix); } } } } } std::chrono::high_resolution_clock::time_point t3 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double, std::milli> time_span1 = t2 - t1; std::chrono::duration<double, std::milli> time_span2 = t3 - t2; std::cout << "time costing " << time_span1.count() << std::endl; std::cout << "time costing " << time_span2.count()<< std::endl; ASSERT_EQ(0, 0); }
[ "bs674@cornell.edu" ]
bs674@cornell.edu
0f2cc11e2ee0634ae1ee8f0c114709e5301ddc1e
c776476e9d06b3779d744641e758ac3a2c15cddc
/examples/litmus/c/run-scripts/tmp_1/MP+dmb.sy+pos-[fr-rf]-pos-ctrl-addr.c.cbmc_out.cpp
6390927c09ce5efa90e71f08b455997f4c26fe1a
[]
no_license
ashutosh0gupta/llvm_bmc
aaac7961c723ba6f7ffd77a39559e0e52432eade
0287c4fb180244e6b3c599a9902507f05c8a7234
refs/heads/master
2023-08-02T17:14:06.178723
2023-07-31T10:46:53
2023-07-31T10:46:53
143,100,825
3
4
null
2023-05-25T05:50:55
2018-08-01T03:47:00
C++
UTF-8
C++
false
false
61,608
cpp
// 0:vars:3 // 5:atom_1_X3_2:1 // 3:atom_1_X0_1:1 // 4:atom_1_X2_1:1 // 6:atom_1_X4_2:1 // 7:atom_1_X8_0:1 // 8:thr0:1 // 9:thr1:1 // 10:thr2:1 #define ADDRSIZE 11 #define NPROC 4 #define NCONTEXT 1 #define ASSUME(stmt) __CPROVER_assume(stmt) #define ASSERT(stmt) __CPROVER_assert(stmt, "error") #define max(a,b) (a>b?a:b) char __get_rng(); char get_rng( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } char get_rng_th( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } int main(int argc, char **argv) { // declare arrays for intial value version in contexts int meminit_[ADDRSIZE*NCONTEXT]; #define meminit(x,k) meminit_[(x)*NCONTEXT+k] int coinit_[ADDRSIZE*NCONTEXT]; #define coinit(x,k) coinit_[(x)*NCONTEXT+k] int deltainit_[ADDRSIZE*NCONTEXT]; #define deltainit(x,k) deltainit_[(x)*NCONTEXT+k] // declare arrays for running value version in contexts int mem_[ADDRSIZE*NCONTEXT]; #define mem(x,k) mem_[(x)*NCONTEXT+k] int co_[ADDRSIZE*NCONTEXT]; #define co(x,k) co_[(x)*NCONTEXT+k] int delta_[ADDRSIZE*NCONTEXT]; #define delta(x,k) delta_[(x)*NCONTEXT+k] // declare arrays for local buffer and observed writes int buff_[NPROC*ADDRSIZE]; #define buff(x,k) buff_[(x)*ADDRSIZE+k] int pw_[NPROC*ADDRSIZE]; #define pw(x,k) pw_[(x)*ADDRSIZE+k] // declare arrays for context stamps char cr_[NPROC*ADDRSIZE]; #define cr(x,k) cr_[(x)*ADDRSIZE+k] char iw_[NPROC*ADDRSIZE]; #define iw(x,k) iw_[(x)*ADDRSIZE+k] char cw_[NPROC*ADDRSIZE]; #define cw(x,k) cw_[(x)*ADDRSIZE+k] char cx_[NPROC*ADDRSIZE]; #define cx(x,k) cx_[(x)*ADDRSIZE+k] char is_[NPROC*ADDRSIZE]; #define is(x,k) is_[(x)*ADDRSIZE+k] char cs_[NPROC*ADDRSIZE]; #define cs(x,k) cs_[(x)*ADDRSIZE+k] char crmax_[NPROC*ADDRSIZE]; #define crmax(x,k) crmax_[(x)*ADDRSIZE+k] char sforbid_[ADDRSIZE*NCONTEXT]; #define sforbid(x,k) sforbid_[(x)*NCONTEXT+k] // declare arrays for synchronizations int cl[NPROC]; int cdy[NPROC]; int cds[NPROC]; int cdl[NPROC]; int cisb[NPROC]; int caddr[NPROC]; int cctrl[NPROC]; int cstart[NPROC]; int creturn[NPROC]; // declare arrays for contexts activity int active[NCONTEXT]; int ctx_used[NCONTEXT]; int r0= 0; char creg_r0; int r1= 0; char creg_r1; int r2= 0; char creg_r2; int r3= 0; char creg_r3; int r4= 0; char creg_r4; int r5= 0; char creg_r5; int r6= 0; char creg_r6; int r7= 0; char creg_r7; int r8= 0; char creg_r8; int r9= 0; char creg_r9; int r10= 0; char creg_r10; int r11= 0; char creg_r11; int r12= 0; char creg_r12; int r13= 0; char creg_r13; int r14= 0; char creg_r14; int r15= 0; char creg_r15; int r16= 0; char creg_r16; int r17= 0; char creg_r17; int r18= 0; char creg_r18; int r19= 0; char creg_r19; int r20= 0; char creg_r20; int r21= 0; char creg_r21; int r22= 0; char creg_r22; int r23= 0; char creg_r23; int r24= 0; char creg_r24; int r25= 0; char creg_r25; int r26= 0; char creg_r26; char old_cctrl= 0; char old_cr= 0; char old_cdy= 0; char old_cw= 0; char new_creg= 0; buff(0,0) = 0; pw(0,0) = 0; cr(0,0) = 0; iw(0,0) = 0; cw(0,0) = 0; cx(0,0) = 0; is(0,0) = 0; cs(0,0) = 0; crmax(0,0) = 0; buff(0,1) = 0; pw(0,1) = 0; cr(0,1) = 0; iw(0,1) = 0; cw(0,1) = 0; cx(0,1) = 0; is(0,1) = 0; cs(0,1) = 0; crmax(0,1) = 0; buff(0,2) = 0; pw(0,2) = 0; cr(0,2) = 0; iw(0,2) = 0; cw(0,2) = 0; cx(0,2) = 0; is(0,2) = 0; cs(0,2) = 0; crmax(0,2) = 0; buff(0,3) = 0; pw(0,3) = 0; cr(0,3) = 0; iw(0,3) = 0; cw(0,3) = 0; cx(0,3) = 0; is(0,3) = 0; cs(0,3) = 0; crmax(0,3) = 0; buff(0,4) = 0; pw(0,4) = 0; cr(0,4) = 0; iw(0,4) = 0; cw(0,4) = 0; cx(0,4) = 0; is(0,4) = 0; cs(0,4) = 0; crmax(0,4) = 0; buff(0,5) = 0; pw(0,5) = 0; cr(0,5) = 0; iw(0,5) = 0; cw(0,5) = 0; cx(0,5) = 0; is(0,5) = 0; cs(0,5) = 0; crmax(0,5) = 0; buff(0,6) = 0; pw(0,6) = 0; cr(0,6) = 0; iw(0,6) = 0; cw(0,6) = 0; cx(0,6) = 0; is(0,6) = 0; cs(0,6) = 0; crmax(0,6) = 0; buff(0,7) = 0; pw(0,7) = 0; cr(0,7) = 0; iw(0,7) = 0; cw(0,7) = 0; cx(0,7) = 0; is(0,7) = 0; cs(0,7) = 0; crmax(0,7) = 0; buff(0,8) = 0; pw(0,8) = 0; cr(0,8) = 0; iw(0,8) = 0; cw(0,8) = 0; cx(0,8) = 0; is(0,8) = 0; cs(0,8) = 0; crmax(0,8) = 0; buff(0,9) = 0; pw(0,9) = 0; cr(0,9) = 0; iw(0,9) = 0; cw(0,9) = 0; cx(0,9) = 0; is(0,9) = 0; cs(0,9) = 0; crmax(0,9) = 0; buff(0,10) = 0; pw(0,10) = 0; cr(0,10) = 0; iw(0,10) = 0; cw(0,10) = 0; cx(0,10) = 0; is(0,10) = 0; cs(0,10) = 0; crmax(0,10) = 0; cl[0] = 0; cdy[0] = 0; cds[0] = 0; cdl[0] = 0; cisb[0] = 0; caddr[0] = 0; cctrl[0] = 0; cstart[0] = get_rng(0,NCONTEXT-1); creturn[0] = get_rng(0,NCONTEXT-1); buff(1,0) = 0; pw(1,0) = 0; cr(1,0) = 0; iw(1,0) = 0; cw(1,0) = 0; cx(1,0) = 0; is(1,0) = 0; cs(1,0) = 0; crmax(1,0) = 0; buff(1,1) = 0; pw(1,1) = 0; cr(1,1) = 0; iw(1,1) = 0; cw(1,1) = 0; cx(1,1) = 0; is(1,1) = 0; cs(1,1) = 0; crmax(1,1) = 0; buff(1,2) = 0; pw(1,2) = 0; cr(1,2) = 0; iw(1,2) = 0; cw(1,2) = 0; cx(1,2) = 0; is(1,2) = 0; cs(1,2) = 0; crmax(1,2) = 0; buff(1,3) = 0; pw(1,3) = 0; cr(1,3) = 0; iw(1,3) = 0; cw(1,3) = 0; cx(1,3) = 0; is(1,3) = 0; cs(1,3) = 0; crmax(1,3) = 0; buff(1,4) = 0; pw(1,4) = 0; cr(1,4) = 0; iw(1,4) = 0; cw(1,4) = 0; cx(1,4) = 0; is(1,4) = 0; cs(1,4) = 0; crmax(1,4) = 0; buff(1,5) = 0; pw(1,5) = 0; cr(1,5) = 0; iw(1,5) = 0; cw(1,5) = 0; cx(1,5) = 0; is(1,5) = 0; cs(1,5) = 0; crmax(1,5) = 0; buff(1,6) = 0; pw(1,6) = 0; cr(1,6) = 0; iw(1,6) = 0; cw(1,6) = 0; cx(1,6) = 0; is(1,6) = 0; cs(1,6) = 0; crmax(1,6) = 0; buff(1,7) = 0; pw(1,7) = 0; cr(1,7) = 0; iw(1,7) = 0; cw(1,7) = 0; cx(1,7) = 0; is(1,7) = 0; cs(1,7) = 0; crmax(1,7) = 0; buff(1,8) = 0; pw(1,8) = 0; cr(1,8) = 0; iw(1,8) = 0; cw(1,8) = 0; cx(1,8) = 0; is(1,8) = 0; cs(1,8) = 0; crmax(1,8) = 0; buff(1,9) = 0; pw(1,9) = 0; cr(1,9) = 0; iw(1,9) = 0; cw(1,9) = 0; cx(1,9) = 0; is(1,9) = 0; cs(1,9) = 0; crmax(1,9) = 0; buff(1,10) = 0; pw(1,10) = 0; cr(1,10) = 0; iw(1,10) = 0; cw(1,10) = 0; cx(1,10) = 0; is(1,10) = 0; cs(1,10) = 0; crmax(1,10) = 0; cl[1] = 0; cdy[1] = 0; cds[1] = 0; cdl[1] = 0; cisb[1] = 0; caddr[1] = 0; cctrl[1] = 0; cstart[1] = get_rng(0,NCONTEXT-1); creturn[1] = get_rng(0,NCONTEXT-1); buff(2,0) = 0; pw(2,0) = 0; cr(2,0) = 0; iw(2,0) = 0; cw(2,0) = 0; cx(2,0) = 0; is(2,0) = 0; cs(2,0) = 0; crmax(2,0) = 0; buff(2,1) = 0; pw(2,1) = 0; cr(2,1) = 0; iw(2,1) = 0; cw(2,1) = 0; cx(2,1) = 0; is(2,1) = 0; cs(2,1) = 0; crmax(2,1) = 0; buff(2,2) = 0; pw(2,2) = 0; cr(2,2) = 0; iw(2,2) = 0; cw(2,2) = 0; cx(2,2) = 0; is(2,2) = 0; cs(2,2) = 0; crmax(2,2) = 0; buff(2,3) = 0; pw(2,3) = 0; cr(2,3) = 0; iw(2,3) = 0; cw(2,3) = 0; cx(2,3) = 0; is(2,3) = 0; cs(2,3) = 0; crmax(2,3) = 0; buff(2,4) = 0; pw(2,4) = 0; cr(2,4) = 0; iw(2,4) = 0; cw(2,4) = 0; cx(2,4) = 0; is(2,4) = 0; cs(2,4) = 0; crmax(2,4) = 0; buff(2,5) = 0; pw(2,5) = 0; cr(2,5) = 0; iw(2,5) = 0; cw(2,5) = 0; cx(2,5) = 0; is(2,5) = 0; cs(2,5) = 0; crmax(2,5) = 0; buff(2,6) = 0; pw(2,6) = 0; cr(2,6) = 0; iw(2,6) = 0; cw(2,6) = 0; cx(2,6) = 0; is(2,6) = 0; cs(2,6) = 0; crmax(2,6) = 0; buff(2,7) = 0; pw(2,7) = 0; cr(2,7) = 0; iw(2,7) = 0; cw(2,7) = 0; cx(2,7) = 0; is(2,7) = 0; cs(2,7) = 0; crmax(2,7) = 0; buff(2,8) = 0; pw(2,8) = 0; cr(2,8) = 0; iw(2,8) = 0; cw(2,8) = 0; cx(2,8) = 0; is(2,8) = 0; cs(2,8) = 0; crmax(2,8) = 0; buff(2,9) = 0; pw(2,9) = 0; cr(2,9) = 0; iw(2,9) = 0; cw(2,9) = 0; cx(2,9) = 0; is(2,9) = 0; cs(2,9) = 0; crmax(2,9) = 0; buff(2,10) = 0; pw(2,10) = 0; cr(2,10) = 0; iw(2,10) = 0; cw(2,10) = 0; cx(2,10) = 0; is(2,10) = 0; cs(2,10) = 0; crmax(2,10) = 0; cl[2] = 0; cdy[2] = 0; cds[2] = 0; cdl[2] = 0; cisb[2] = 0; caddr[2] = 0; cctrl[2] = 0; cstart[2] = get_rng(0,NCONTEXT-1); creturn[2] = get_rng(0,NCONTEXT-1); buff(3,0) = 0; pw(3,0) = 0; cr(3,0) = 0; iw(3,0) = 0; cw(3,0) = 0; cx(3,0) = 0; is(3,0) = 0; cs(3,0) = 0; crmax(3,0) = 0; buff(3,1) = 0; pw(3,1) = 0; cr(3,1) = 0; iw(3,1) = 0; cw(3,1) = 0; cx(3,1) = 0; is(3,1) = 0; cs(3,1) = 0; crmax(3,1) = 0; buff(3,2) = 0; pw(3,2) = 0; cr(3,2) = 0; iw(3,2) = 0; cw(3,2) = 0; cx(3,2) = 0; is(3,2) = 0; cs(3,2) = 0; crmax(3,2) = 0; buff(3,3) = 0; pw(3,3) = 0; cr(3,3) = 0; iw(3,3) = 0; cw(3,3) = 0; cx(3,3) = 0; is(3,3) = 0; cs(3,3) = 0; crmax(3,3) = 0; buff(3,4) = 0; pw(3,4) = 0; cr(3,4) = 0; iw(3,4) = 0; cw(3,4) = 0; cx(3,4) = 0; is(3,4) = 0; cs(3,4) = 0; crmax(3,4) = 0; buff(3,5) = 0; pw(3,5) = 0; cr(3,5) = 0; iw(3,5) = 0; cw(3,5) = 0; cx(3,5) = 0; is(3,5) = 0; cs(3,5) = 0; crmax(3,5) = 0; buff(3,6) = 0; pw(3,6) = 0; cr(3,6) = 0; iw(3,6) = 0; cw(3,6) = 0; cx(3,6) = 0; is(3,6) = 0; cs(3,6) = 0; crmax(3,6) = 0; buff(3,7) = 0; pw(3,7) = 0; cr(3,7) = 0; iw(3,7) = 0; cw(3,7) = 0; cx(3,7) = 0; is(3,7) = 0; cs(3,7) = 0; crmax(3,7) = 0; buff(3,8) = 0; pw(3,8) = 0; cr(3,8) = 0; iw(3,8) = 0; cw(3,8) = 0; cx(3,8) = 0; is(3,8) = 0; cs(3,8) = 0; crmax(3,8) = 0; buff(3,9) = 0; pw(3,9) = 0; cr(3,9) = 0; iw(3,9) = 0; cw(3,9) = 0; cx(3,9) = 0; is(3,9) = 0; cs(3,9) = 0; crmax(3,9) = 0; buff(3,10) = 0; pw(3,10) = 0; cr(3,10) = 0; iw(3,10) = 0; cw(3,10) = 0; cx(3,10) = 0; is(3,10) = 0; cs(3,10) = 0; crmax(3,10) = 0; cl[3] = 0; cdy[3] = 0; cds[3] = 0; cdl[3] = 0; cisb[3] = 0; caddr[3] = 0; cctrl[3] = 0; cstart[3] = get_rng(0,NCONTEXT-1); creturn[3] = get_rng(0,NCONTEXT-1); // Dumping initializations mem(0+0,0) = 0; mem(0+1,0) = 0; mem(0+2,0) = 0; mem(5+0,0) = 0; mem(3+0,0) = 0; mem(4+0,0) = 0; mem(6+0,0) = 0; mem(7+0,0) = 0; mem(8+0,0) = 0; mem(9+0,0) = 0; mem(10+0,0) = 0; // Dumping context matching equalities co(0,0) = 0; delta(0,0) = -1; co(1,0) = 0; delta(1,0) = -1; co(2,0) = 0; delta(2,0) = -1; co(3,0) = 0; delta(3,0) = -1; co(4,0) = 0; delta(4,0) = -1; co(5,0) = 0; delta(5,0) = -1; co(6,0) = 0; delta(6,0) = -1; co(7,0) = 0; delta(7,0) = -1; co(8,0) = 0; delta(8,0) = -1; co(9,0) = 0; delta(9,0) = -1; co(10,0) = 0; delta(10,0) = -1; // Dumping thread 1 int ret_thread_1 = 0; cdy[1] = get_rng(0,NCONTEXT-1); ASSUME(cdy[1] >= cstart[1]); T1BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !41, metadata !DIExpression()), !dbg !50 // br label %label_1, !dbg !51 goto T1BLOCK1; T1BLOCK1: // call void @llvm.dbg.label(metadata !49), !dbg !52 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !42, metadata !DIExpression()), !dbg !53 // call void @llvm.dbg.value(metadata i64 1, metadata !45, metadata !DIExpression()), !dbg !53 // store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !54 // ST: Guess iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW old_cw = cw(1,0); cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM // Check ASSUME(active[iw(1,0)] == 1); ASSUME(active[cw(1,0)] == 1); ASSUME(sforbid(0,cw(1,0))== 0); ASSUME(iw(1,0) >= 0); ASSUME(iw(1,0) >= 0); ASSUME(cw(1,0) >= iw(1,0)); ASSUME(cw(1,0) >= old_cw); ASSUME(cw(1,0) >= cr(1,0)); ASSUME(cw(1,0) >= cl[1]); ASSUME(cw(1,0) >= cisb[1]); ASSUME(cw(1,0) >= cdy[1]); ASSUME(cw(1,0) >= cdl[1]); ASSUME(cw(1,0) >= cds[1]); ASSUME(cw(1,0) >= cctrl[1]); ASSUME(cw(1,0) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0) = 1; mem(0,cw(1,0)) = 1; co(0,cw(1,0))+=1; delta(0,cw(1,0)) = -1; ASSUME(creturn[1] >= cw(1,0)); // call void (...) @dmbsy(), !dbg !55 // dumbsy: Guess old_cdy = cdy[1]; cdy[1] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[1] >= old_cdy); ASSUME(cdy[1] >= cisb[1]); ASSUME(cdy[1] >= cdl[1]); ASSUME(cdy[1] >= cds[1]); ASSUME(cdy[1] >= cctrl[1]); ASSUME(cdy[1] >= cw(1,0+0)); ASSUME(cdy[1] >= cw(1,0+1)); ASSUME(cdy[1] >= cw(1,0+2)); ASSUME(cdy[1] >= cw(1,5+0)); ASSUME(cdy[1] >= cw(1,3+0)); ASSUME(cdy[1] >= cw(1,4+0)); ASSUME(cdy[1] >= cw(1,6+0)); ASSUME(cdy[1] >= cw(1,7+0)); ASSUME(cdy[1] >= cw(1,8+0)); ASSUME(cdy[1] >= cw(1,9+0)); ASSUME(cdy[1] >= cw(1,10+0)); ASSUME(cdy[1] >= cr(1,0+0)); ASSUME(cdy[1] >= cr(1,0+1)); ASSUME(cdy[1] >= cr(1,0+2)); ASSUME(cdy[1] >= cr(1,5+0)); ASSUME(cdy[1] >= cr(1,3+0)); ASSUME(cdy[1] >= cr(1,4+0)); ASSUME(cdy[1] >= cr(1,6+0)); ASSUME(cdy[1] >= cr(1,7+0)); ASSUME(cdy[1] >= cr(1,8+0)); ASSUME(cdy[1] >= cr(1,9+0)); ASSUME(cdy[1] >= cr(1,10+0)); ASSUME(creturn[1] >= cdy[1]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !46, metadata !DIExpression()), !dbg !56 // call void @llvm.dbg.value(metadata i64 1, metadata !48, metadata !DIExpression()), !dbg !56 // store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !57 // ST: Guess iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW old_cw = cw(1,0+1*1); cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM // Check ASSUME(active[iw(1,0+1*1)] == 1); ASSUME(active[cw(1,0+1*1)] == 1); ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(cw(1,0+1*1) >= iw(1,0+1*1)); ASSUME(cw(1,0+1*1) >= old_cw); ASSUME(cw(1,0+1*1) >= cr(1,0+1*1)); ASSUME(cw(1,0+1*1) >= cl[1]); ASSUME(cw(1,0+1*1) >= cisb[1]); ASSUME(cw(1,0+1*1) >= cdy[1]); ASSUME(cw(1,0+1*1) >= cdl[1]); ASSUME(cw(1,0+1*1) >= cds[1]); ASSUME(cw(1,0+1*1) >= cctrl[1]); ASSUME(cw(1,0+1*1) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0+1*1) = 1; mem(0+1*1,cw(1,0+1*1)) = 1; co(0+1*1,cw(1,0+1*1))+=1; delta(0+1*1,cw(1,0+1*1)) = -1; ASSUME(creturn[1] >= cw(1,0+1*1)); // ret i8* null, !dbg !58 ret_thread_1 = (- 1); // Dumping thread 2 int ret_thread_2 = 0; cdy[2] = get_rng(0,NCONTEXT-1); ASSUME(cdy[2] >= cstart[2]); T2BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !61, metadata !DIExpression()), !dbg !110 // br label %label_2, !dbg !92 goto T2BLOCK1; T2BLOCK1: // call void @llvm.dbg.label(metadata !108), !dbg !112 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !64, metadata !DIExpression()), !dbg !113 // %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !95 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r0 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r0 = buff(2,0+1*1); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r0 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %0, metadata !66, metadata !DIExpression()), !dbg !113 // %conv = trunc i64 %0 to i32, !dbg !96 // call void @llvm.dbg.value(metadata i32 %conv, metadata !62, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !68, metadata !DIExpression()), !dbg !116 // %1 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !98 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r1 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r1 = buff(2,0+1*1); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r1 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %1, metadata !70, metadata !DIExpression()), !dbg !116 // %conv4 = trunc i64 %1 to i32, !dbg !99 // call void @llvm.dbg.value(metadata i32 %conv4, metadata !67, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !72, metadata !DIExpression()), !dbg !119 // %2 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !101 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r2 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r2 = buff(2,0+1*1); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r2 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %2, metadata !74, metadata !DIExpression()), !dbg !119 // %conv8 = trunc i64 %2 to i32, !dbg !102 // call void @llvm.dbg.value(metadata i32 %conv8, metadata !71, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !76, metadata !DIExpression()), !dbg !122 // %3 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !104 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r3 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r3 = buff(2,0+1*1); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r3 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %3, metadata !78, metadata !DIExpression()), !dbg !122 // %conv12 = trunc i64 %3 to i32, !dbg !105 // call void @llvm.dbg.value(metadata i32 %conv12, metadata !75, metadata !DIExpression()), !dbg !110 // %tobool = icmp ne i32 %conv12, 0, !dbg !106 // br i1 %tobool, label %if.then, label %if.else, !dbg !108 old_cctrl = cctrl[2]; cctrl[2] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[2] >= old_cctrl); ASSUME(cctrl[2] >= creg_r3); ASSUME(cctrl[2] >= 0); if((r3!=0)) { goto T2BLOCK2; } else { goto T2BLOCK3; } T2BLOCK2: // br label %lbl_LC00, !dbg !109 goto T2BLOCK4; T2BLOCK3: // br label %lbl_LC00, !dbg !110 goto T2BLOCK4; T2BLOCK4: // call void @llvm.dbg.label(metadata !109), !dbg !130 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !80, metadata !DIExpression()), !dbg !131 // %4 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !113 // LD: Guess old_cr = cr(2,0+2*1); cr(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+2*1)] == 2); ASSUME(cr(2,0+2*1) >= iw(2,0+2*1)); ASSUME(cr(2,0+2*1) >= 0); ASSUME(cr(2,0+2*1) >= cdy[2]); ASSUME(cr(2,0+2*1) >= cisb[2]); ASSUME(cr(2,0+2*1) >= cdl[2]); ASSUME(cr(2,0+2*1) >= cl[2]); // Update creg_r4 = cr(2,0+2*1); crmax(2,0+2*1) = max(crmax(2,0+2*1),cr(2,0+2*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+2*1) < cw(2,0+2*1)) { r4 = buff(2,0+2*1); } else { if(pw(2,0+2*1) != co(0+2*1,cr(2,0+2*1))) { ASSUME(cr(2,0+2*1) >= old_cr); } pw(2,0+2*1) = co(0+2*1,cr(2,0+2*1)); r4 = mem(0+2*1,cr(2,0+2*1)); } ASSUME(creturn[2] >= cr(2,0+2*1)); // call void @llvm.dbg.value(metadata i64 %4, metadata !82, metadata !DIExpression()), !dbg !131 // %conv16 = trunc i64 %4 to i32, !dbg !114 // call void @llvm.dbg.value(metadata i32 %conv16, metadata !79, metadata !DIExpression()), !dbg !110 // %xor = xor i32 %conv16, %conv16, !dbg !115 creg_r5 = max(creg_r4,creg_r4); ASSUME(active[creg_r5] == 2); r5 = r4 ^ r4; // call void @llvm.dbg.value(metadata i32 %xor, metadata !83, metadata !DIExpression()), !dbg !110 // %add = add nsw i32 0, %xor, !dbg !116 creg_r6 = max(0,creg_r5); ASSUME(active[creg_r6] == 2); r6 = 0 + r5; // %idxprom = sext i32 %add to i64, !dbg !116 // %arrayidx = getelementptr inbounds [3 x i64], [3 x i64]* @vars, i64 0, i64 %idxprom, !dbg !116 r7 = 0+r6*1; ASSUME(creg_r7 >= 0); ASSUME(creg_r7 >= creg_r6); ASSUME(active[creg_r7] == 2); // call void @llvm.dbg.value(metadata i64* %arrayidx, metadata !85, metadata !DIExpression()), !dbg !136 // %5 = load atomic i64, i64* %arrayidx monotonic, align 8, !dbg !116 // LD: Guess old_cr = cr(2,r7); cr(2,r7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,r7)] == 2); ASSUME(cr(2,r7) >= iw(2,r7)); ASSUME(cr(2,r7) >= creg_r7); ASSUME(cr(2,r7) >= cdy[2]); ASSUME(cr(2,r7) >= cisb[2]); ASSUME(cr(2,r7) >= cdl[2]); ASSUME(cr(2,r7) >= cl[2]); // Update creg_r8 = cr(2,r7); crmax(2,r7) = max(crmax(2,r7),cr(2,r7)); caddr[2] = max(caddr[2],creg_r7); if(cr(2,r7) < cw(2,r7)) { r8 = buff(2,r7); } else { if(pw(2,r7) != co(r7,cr(2,r7))) { ASSUME(cr(2,r7) >= old_cr); } pw(2,r7) = co(r7,cr(2,r7)); r8 = mem(r7,cr(2,r7)); } ASSUME(creturn[2] >= cr(2,r7)); // call void @llvm.dbg.value(metadata i64 %5, metadata !87, metadata !DIExpression()), !dbg !136 // %conv20 = trunc i64 %5 to i32, !dbg !118 // call void @llvm.dbg.value(metadata i32 %conv20, metadata !84, metadata !DIExpression()), !dbg !110 // %cmp = icmp eq i32 %conv, 1, !dbg !119 // %conv21 = zext i1 %cmp to i32, !dbg !119 // call void @llvm.dbg.value(metadata i32 %conv21, metadata !88, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !89, metadata !DIExpression()), !dbg !139 // %6 = zext i32 %conv21 to i64 // call void @llvm.dbg.value(metadata i64 %6, metadata !91, metadata !DIExpression()), !dbg !139 // store atomic i64 %6, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !121 // ST: Guess iw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,3); cw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,3)] == 2); ASSUME(active[cw(2,3)] == 2); ASSUME(sforbid(3,cw(2,3))== 0); ASSUME(iw(2,3) >= max(creg_r0,0)); ASSUME(iw(2,3) >= 0); ASSUME(cw(2,3) >= iw(2,3)); ASSUME(cw(2,3) >= old_cw); ASSUME(cw(2,3) >= cr(2,3)); ASSUME(cw(2,3) >= cl[2]); ASSUME(cw(2,3) >= cisb[2]); ASSUME(cw(2,3) >= cdy[2]); ASSUME(cw(2,3) >= cdl[2]); ASSUME(cw(2,3) >= cds[2]); ASSUME(cw(2,3) >= cctrl[2]); ASSUME(cw(2,3) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,3) = (r0==1); mem(3,cw(2,3)) = (r0==1); co(3,cw(2,3))+=1; delta(3,cw(2,3)) = -1; ASSUME(creturn[2] >= cw(2,3)); // %cmp23 = icmp eq i32 %conv4, 1, !dbg !122 // %conv24 = zext i1 %cmp23 to i32, !dbg !122 // call void @llvm.dbg.value(metadata i32 %conv24, metadata !92, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* @atom_1_X2_1, metadata !93, metadata !DIExpression()), !dbg !142 // %7 = zext i32 %conv24 to i64 // call void @llvm.dbg.value(metadata i64 %7, metadata !95, metadata !DIExpression()), !dbg !142 // store atomic i64 %7, i64* @atom_1_X2_1 seq_cst, align 8, !dbg !124 // ST: Guess iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,4); cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,4)] == 2); ASSUME(active[cw(2,4)] == 2); ASSUME(sforbid(4,cw(2,4))== 0); ASSUME(iw(2,4) >= max(creg_r1,0)); ASSUME(iw(2,4) >= 0); ASSUME(cw(2,4) >= iw(2,4)); ASSUME(cw(2,4) >= old_cw); ASSUME(cw(2,4) >= cr(2,4)); ASSUME(cw(2,4) >= cl[2]); ASSUME(cw(2,4) >= cisb[2]); ASSUME(cw(2,4) >= cdy[2]); ASSUME(cw(2,4) >= cdl[2]); ASSUME(cw(2,4) >= cds[2]); ASSUME(cw(2,4) >= cctrl[2]); ASSUME(cw(2,4) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,4) = (r1==1); mem(4,cw(2,4)) = (r1==1); co(4,cw(2,4))+=1; delta(4,cw(2,4)) = -1; ASSUME(creturn[2] >= cw(2,4)); // %cmp28 = icmp eq i32 %conv8, 2, !dbg !125 // %conv29 = zext i1 %cmp28 to i32, !dbg !125 // call void @llvm.dbg.value(metadata i32 %conv29, metadata !96, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* @atom_1_X3_2, metadata !97, metadata !DIExpression()), !dbg !145 // %8 = zext i32 %conv29 to i64 // call void @llvm.dbg.value(metadata i64 %8, metadata !99, metadata !DIExpression()), !dbg !145 // store atomic i64 %8, i64* @atom_1_X3_2 seq_cst, align 8, !dbg !127 // ST: Guess iw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,5); cw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,5)] == 2); ASSUME(active[cw(2,5)] == 2); ASSUME(sforbid(5,cw(2,5))== 0); ASSUME(iw(2,5) >= max(creg_r2,0)); ASSUME(iw(2,5) >= 0); ASSUME(cw(2,5) >= iw(2,5)); ASSUME(cw(2,5) >= old_cw); ASSUME(cw(2,5) >= cr(2,5)); ASSUME(cw(2,5) >= cl[2]); ASSUME(cw(2,5) >= cisb[2]); ASSUME(cw(2,5) >= cdy[2]); ASSUME(cw(2,5) >= cdl[2]); ASSUME(cw(2,5) >= cds[2]); ASSUME(cw(2,5) >= cctrl[2]); ASSUME(cw(2,5) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,5) = (r2==2); mem(5,cw(2,5)) = (r2==2); co(5,cw(2,5))+=1; delta(5,cw(2,5)) = -1; ASSUME(creturn[2] >= cw(2,5)); // %cmp33 = icmp eq i32 %conv12, 2, !dbg !128 // %conv34 = zext i1 %cmp33 to i32, !dbg !128 // call void @llvm.dbg.value(metadata i32 %conv34, metadata !100, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* @atom_1_X4_2, metadata !101, metadata !DIExpression()), !dbg !148 // %9 = zext i32 %conv34 to i64 // call void @llvm.dbg.value(metadata i64 %9, metadata !103, metadata !DIExpression()), !dbg !148 // store atomic i64 %9, i64* @atom_1_X4_2 seq_cst, align 8, !dbg !130 // ST: Guess iw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,6); cw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,6)] == 2); ASSUME(active[cw(2,6)] == 2); ASSUME(sforbid(6,cw(2,6))== 0); ASSUME(iw(2,6) >= max(creg_r3,0)); ASSUME(iw(2,6) >= 0); ASSUME(cw(2,6) >= iw(2,6)); ASSUME(cw(2,6) >= old_cw); ASSUME(cw(2,6) >= cr(2,6)); ASSUME(cw(2,6) >= cl[2]); ASSUME(cw(2,6) >= cisb[2]); ASSUME(cw(2,6) >= cdy[2]); ASSUME(cw(2,6) >= cdl[2]); ASSUME(cw(2,6) >= cds[2]); ASSUME(cw(2,6) >= cctrl[2]); ASSUME(cw(2,6) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,6) = (r3==2); mem(6,cw(2,6)) = (r3==2); co(6,cw(2,6))+=1; delta(6,cw(2,6)) = -1; ASSUME(creturn[2] >= cw(2,6)); // %cmp38 = icmp eq i32 %conv20, 0, !dbg !131 // %conv39 = zext i1 %cmp38 to i32, !dbg !131 // call void @llvm.dbg.value(metadata i32 %conv39, metadata !104, metadata !DIExpression()), !dbg !110 // call void @llvm.dbg.value(metadata i64* @atom_1_X8_0, metadata !105, metadata !DIExpression()), !dbg !151 // %10 = zext i32 %conv39 to i64 // call void @llvm.dbg.value(metadata i64 %10, metadata !107, metadata !DIExpression()), !dbg !151 // store atomic i64 %10, i64* @atom_1_X8_0 seq_cst, align 8, !dbg !133 // ST: Guess iw(2,7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,7); cw(2,7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,7)] == 2); ASSUME(active[cw(2,7)] == 2); ASSUME(sforbid(7,cw(2,7))== 0); ASSUME(iw(2,7) >= max(creg_r8,0)); ASSUME(iw(2,7) >= 0); ASSUME(cw(2,7) >= iw(2,7)); ASSUME(cw(2,7) >= old_cw); ASSUME(cw(2,7) >= cr(2,7)); ASSUME(cw(2,7) >= cl[2]); ASSUME(cw(2,7) >= cisb[2]); ASSUME(cw(2,7) >= cdy[2]); ASSUME(cw(2,7) >= cdl[2]); ASSUME(cw(2,7) >= cds[2]); ASSUME(cw(2,7) >= cctrl[2]); ASSUME(cw(2,7) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,7) = (r8==0); mem(7,cw(2,7)) = (r8==0); co(7,cw(2,7))+=1; delta(7,cw(2,7)) = -1; ASSUME(creturn[2] >= cw(2,7)); // ret i8* null, !dbg !134 ret_thread_2 = (- 1); // Dumping thread 3 int ret_thread_3 = 0; cdy[3] = get_rng(0,NCONTEXT-1); ASSUME(cdy[3] >= cstart[3]); T3BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !156, metadata !DIExpression()), !dbg !161 // br label %label_3, !dbg !48 goto T3BLOCK1; T3BLOCK1: // call void @llvm.dbg.label(metadata !160), !dbg !163 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !157, metadata !DIExpression()), !dbg !164 // call void @llvm.dbg.value(metadata i64 2, metadata !159, metadata !DIExpression()), !dbg !164 // store atomic i64 2, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !51 // ST: Guess iw(3,0+1*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW old_cw = cw(3,0+1*1); cw(3,0+1*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM // Check ASSUME(active[iw(3,0+1*1)] == 3); ASSUME(active[cw(3,0+1*1)] == 3); ASSUME(sforbid(0+1*1,cw(3,0+1*1))== 0); ASSUME(iw(3,0+1*1) >= 0); ASSUME(iw(3,0+1*1) >= 0); ASSUME(cw(3,0+1*1) >= iw(3,0+1*1)); ASSUME(cw(3,0+1*1) >= old_cw); ASSUME(cw(3,0+1*1) >= cr(3,0+1*1)); ASSUME(cw(3,0+1*1) >= cl[3]); ASSUME(cw(3,0+1*1) >= cisb[3]); ASSUME(cw(3,0+1*1) >= cdy[3]); ASSUME(cw(3,0+1*1) >= cdl[3]); ASSUME(cw(3,0+1*1) >= cds[3]); ASSUME(cw(3,0+1*1) >= cctrl[3]); ASSUME(cw(3,0+1*1) >= caddr[3]); // Update caddr[3] = max(caddr[3],0); buff(3,0+1*1) = 2; mem(0+1*1,cw(3,0+1*1)) = 2; co(0+1*1,cw(3,0+1*1))+=1; delta(0+1*1,cw(3,0+1*1)) = -1; ASSUME(creturn[3] >= cw(3,0+1*1)); // ret i8* null, !dbg !52 ret_thread_3 = (- 1); // Dumping thread 0 int ret_thread_0 = 0; cdy[0] = get_rng(0,NCONTEXT-1); ASSUME(cdy[0] >= cstart[0]); T0BLOCK0: // %thr0 = alloca i64, align 8 // %thr1 = alloca i64, align 8 // %thr2 = alloca i64, align 8 // call void @llvm.dbg.value(metadata i32 %argc, metadata !174, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i8** %argv, metadata !175, metadata !DIExpression()), !dbg !242 // %0 = bitcast i64* %thr0 to i8*, !dbg !115 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !115 // call void @llvm.dbg.declare(metadata i64* %thr0, metadata !176, metadata !DIExpression()), !dbg !244 // %1 = bitcast i64* %thr1 to i8*, !dbg !117 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !117 // call void @llvm.dbg.declare(metadata i64* %thr1, metadata !180, metadata !DIExpression()), !dbg !246 // %2 = bitcast i64* %thr2 to i8*, !dbg !119 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !119 // call void @llvm.dbg.declare(metadata i64* %thr2, metadata !181, metadata !DIExpression()), !dbg !248 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !182, metadata !DIExpression()), !dbg !249 // call void @llvm.dbg.value(metadata i64 0, metadata !184, metadata !DIExpression()), !dbg !249 // store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !122 // ST: Guess iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+2*1); cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+2*1)] == 0); ASSUME(active[cw(0,0+2*1)] == 0); ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(cw(0,0+2*1) >= iw(0,0+2*1)); ASSUME(cw(0,0+2*1) >= old_cw); ASSUME(cw(0,0+2*1) >= cr(0,0+2*1)); ASSUME(cw(0,0+2*1) >= cl[0]); ASSUME(cw(0,0+2*1) >= cisb[0]); ASSUME(cw(0,0+2*1) >= cdy[0]); ASSUME(cw(0,0+2*1) >= cdl[0]); ASSUME(cw(0,0+2*1) >= cds[0]); ASSUME(cw(0,0+2*1) >= cctrl[0]); ASSUME(cw(0,0+2*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+2*1) = 0; mem(0+2*1,cw(0,0+2*1)) = 0; co(0+2*1,cw(0,0+2*1))+=1; delta(0+2*1,cw(0,0+2*1)) = -1; ASSUME(creturn[0] >= cw(0,0+2*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !185, metadata !DIExpression()), !dbg !251 // call void @llvm.dbg.value(metadata i64 0, metadata !187, metadata !DIExpression()), !dbg !251 // store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !124 // ST: Guess iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+1*1); cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+1*1)] == 0); ASSUME(active[cw(0,0+1*1)] == 0); ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(cw(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cw(0,0+1*1) >= old_cw); ASSUME(cw(0,0+1*1) >= cr(0,0+1*1)); ASSUME(cw(0,0+1*1) >= cl[0]); ASSUME(cw(0,0+1*1) >= cisb[0]); ASSUME(cw(0,0+1*1) >= cdy[0]); ASSUME(cw(0,0+1*1) >= cdl[0]); ASSUME(cw(0,0+1*1) >= cds[0]); ASSUME(cw(0,0+1*1) >= cctrl[0]); ASSUME(cw(0,0+1*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+1*1) = 0; mem(0+1*1,cw(0,0+1*1)) = 0; co(0+1*1,cw(0,0+1*1))+=1; delta(0+1*1,cw(0,0+1*1)) = -1; ASSUME(creturn[0] >= cw(0,0+1*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !188, metadata !DIExpression()), !dbg !253 // call void @llvm.dbg.value(metadata i64 0, metadata !190, metadata !DIExpression()), !dbg !253 // store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !126 // ST: Guess iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0); cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0)] == 0); ASSUME(active[cw(0,0)] == 0); ASSUME(sforbid(0,cw(0,0))== 0); ASSUME(iw(0,0) >= 0); ASSUME(iw(0,0) >= 0); ASSUME(cw(0,0) >= iw(0,0)); ASSUME(cw(0,0) >= old_cw); ASSUME(cw(0,0) >= cr(0,0)); ASSUME(cw(0,0) >= cl[0]); ASSUME(cw(0,0) >= cisb[0]); ASSUME(cw(0,0) >= cdy[0]); ASSUME(cw(0,0) >= cdl[0]); ASSUME(cw(0,0) >= cds[0]); ASSUME(cw(0,0) >= cctrl[0]); ASSUME(cw(0,0) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0) = 0; mem(0,cw(0,0)) = 0; co(0,cw(0,0))+=1; delta(0,cw(0,0)) = -1; ASSUME(creturn[0] >= cw(0,0)); // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !191, metadata !DIExpression()), !dbg !255 // call void @llvm.dbg.value(metadata i64 0, metadata !193, metadata !DIExpression()), !dbg !255 // store atomic i64 0, i64* @atom_1_X0_1 monotonic, align 8, !dbg !128 // ST: Guess iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,3); cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,3)] == 0); ASSUME(active[cw(0,3)] == 0); ASSUME(sforbid(3,cw(0,3))== 0); ASSUME(iw(0,3) >= 0); ASSUME(iw(0,3) >= 0); ASSUME(cw(0,3) >= iw(0,3)); ASSUME(cw(0,3) >= old_cw); ASSUME(cw(0,3) >= cr(0,3)); ASSUME(cw(0,3) >= cl[0]); ASSUME(cw(0,3) >= cisb[0]); ASSUME(cw(0,3) >= cdy[0]); ASSUME(cw(0,3) >= cdl[0]); ASSUME(cw(0,3) >= cds[0]); ASSUME(cw(0,3) >= cctrl[0]); ASSUME(cw(0,3) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,3) = 0; mem(3,cw(0,3)) = 0; co(3,cw(0,3))+=1; delta(3,cw(0,3)) = -1; ASSUME(creturn[0] >= cw(0,3)); // call void @llvm.dbg.value(metadata i64* @atom_1_X2_1, metadata !194, metadata !DIExpression()), !dbg !257 // call void @llvm.dbg.value(metadata i64 0, metadata !196, metadata !DIExpression()), !dbg !257 // store atomic i64 0, i64* @atom_1_X2_1 monotonic, align 8, !dbg !130 // ST: Guess iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,4); cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,4)] == 0); ASSUME(active[cw(0,4)] == 0); ASSUME(sforbid(4,cw(0,4))== 0); ASSUME(iw(0,4) >= 0); ASSUME(iw(0,4) >= 0); ASSUME(cw(0,4) >= iw(0,4)); ASSUME(cw(0,4) >= old_cw); ASSUME(cw(0,4) >= cr(0,4)); ASSUME(cw(0,4) >= cl[0]); ASSUME(cw(0,4) >= cisb[0]); ASSUME(cw(0,4) >= cdy[0]); ASSUME(cw(0,4) >= cdl[0]); ASSUME(cw(0,4) >= cds[0]); ASSUME(cw(0,4) >= cctrl[0]); ASSUME(cw(0,4) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,4) = 0; mem(4,cw(0,4)) = 0; co(4,cw(0,4))+=1; delta(4,cw(0,4)) = -1; ASSUME(creturn[0] >= cw(0,4)); // call void @llvm.dbg.value(metadata i64* @atom_1_X3_2, metadata !197, metadata !DIExpression()), !dbg !259 // call void @llvm.dbg.value(metadata i64 0, metadata !199, metadata !DIExpression()), !dbg !259 // store atomic i64 0, i64* @atom_1_X3_2 monotonic, align 8, !dbg !132 // ST: Guess iw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,5); cw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,5)] == 0); ASSUME(active[cw(0,5)] == 0); ASSUME(sforbid(5,cw(0,5))== 0); ASSUME(iw(0,5) >= 0); ASSUME(iw(0,5) >= 0); ASSUME(cw(0,5) >= iw(0,5)); ASSUME(cw(0,5) >= old_cw); ASSUME(cw(0,5) >= cr(0,5)); ASSUME(cw(0,5) >= cl[0]); ASSUME(cw(0,5) >= cisb[0]); ASSUME(cw(0,5) >= cdy[0]); ASSUME(cw(0,5) >= cdl[0]); ASSUME(cw(0,5) >= cds[0]); ASSUME(cw(0,5) >= cctrl[0]); ASSUME(cw(0,5) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,5) = 0; mem(5,cw(0,5)) = 0; co(5,cw(0,5))+=1; delta(5,cw(0,5)) = -1; ASSUME(creturn[0] >= cw(0,5)); // call void @llvm.dbg.value(metadata i64* @atom_1_X4_2, metadata !200, metadata !DIExpression()), !dbg !261 // call void @llvm.dbg.value(metadata i64 0, metadata !202, metadata !DIExpression()), !dbg !261 // store atomic i64 0, i64* @atom_1_X4_2 monotonic, align 8, !dbg !134 // ST: Guess iw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,6); cw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,6)] == 0); ASSUME(active[cw(0,6)] == 0); ASSUME(sforbid(6,cw(0,6))== 0); ASSUME(iw(0,6) >= 0); ASSUME(iw(0,6) >= 0); ASSUME(cw(0,6) >= iw(0,6)); ASSUME(cw(0,6) >= old_cw); ASSUME(cw(0,6) >= cr(0,6)); ASSUME(cw(0,6) >= cl[0]); ASSUME(cw(0,6) >= cisb[0]); ASSUME(cw(0,6) >= cdy[0]); ASSUME(cw(0,6) >= cdl[0]); ASSUME(cw(0,6) >= cds[0]); ASSUME(cw(0,6) >= cctrl[0]); ASSUME(cw(0,6) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,6) = 0; mem(6,cw(0,6)) = 0; co(6,cw(0,6))+=1; delta(6,cw(0,6)) = -1; ASSUME(creturn[0] >= cw(0,6)); // call void @llvm.dbg.value(metadata i64* @atom_1_X8_0, metadata !203, metadata !DIExpression()), !dbg !263 // call void @llvm.dbg.value(metadata i64 0, metadata !205, metadata !DIExpression()), !dbg !263 // store atomic i64 0, i64* @atom_1_X8_0 monotonic, align 8, !dbg !136 // ST: Guess iw(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,7); cw(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,7)] == 0); ASSUME(active[cw(0,7)] == 0); ASSUME(sforbid(7,cw(0,7))== 0); ASSUME(iw(0,7) >= 0); ASSUME(iw(0,7) >= 0); ASSUME(cw(0,7) >= iw(0,7)); ASSUME(cw(0,7) >= old_cw); ASSUME(cw(0,7) >= cr(0,7)); ASSUME(cw(0,7) >= cl[0]); ASSUME(cw(0,7) >= cisb[0]); ASSUME(cw(0,7) >= cdy[0]); ASSUME(cw(0,7) >= cdl[0]); ASSUME(cw(0,7) >= cds[0]); ASSUME(cw(0,7) >= cctrl[0]); ASSUME(cw(0,7) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,7) = 0; mem(7,cw(0,7)) = 0; co(7,cw(0,7))+=1; delta(7,cw(0,7)) = -1; ASSUME(creturn[0] >= cw(0,7)); // %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !137 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[1] >= cdy[0]); // %call15 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !138 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[2] >= cdy[0]); // %call16 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !139 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[3] >= cdy[0]); // %3 = load i64, i64* %thr0, align 8, !dbg !140, !tbaa !141 // LD: Guess old_cr = cr(0,8); cr(0,8) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,8)] == 0); ASSUME(cr(0,8) >= iw(0,8)); ASSUME(cr(0,8) >= 0); ASSUME(cr(0,8) >= cdy[0]); ASSUME(cr(0,8) >= cisb[0]); ASSUME(cr(0,8) >= cdl[0]); ASSUME(cr(0,8) >= cl[0]); // Update creg_r10 = cr(0,8); crmax(0,8) = max(crmax(0,8),cr(0,8)); caddr[0] = max(caddr[0],0); if(cr(0,8) < cw(0,8)) { r10 = buff(0,8); } else { if(pw(0,8) != co(8,cr(0,8))) { ASSUME(cr(0,8) >= old_cr); } pw(0,8) = co(8,cr(0,8)); r10 = mem(8,cr(0,8)); } ASSUME(creturn[0] >= cr(0,8)); // %call17 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !145 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[1]); // %4 = load i64, i64* %thr1, align 8, !dbg !146, !tbaa !141 // LD: Guess old_cr = cr(0,9); cr(0,9) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,9)] == 0); ASSUME(cr(0,9) >= iw(0,9)); ASSUME(cr(0,9) >= 0); ASSUME(cr(0,9) >= cdy[0]); ASSUME(cr(0,9) >= cisb[0]); ASSUME(cr(0,9) >= cdl[0]); ASSUME(cr(0,9) >= cl[0]); // Update creg_r11 = cr(0,9); crmax(0,9) = max(crmax(0,9),cr(0,9)); caddr[0] = max(caddr[0],0); if(cr(0,9) < cw(0,9)) { r11 = buff(0,9); } else { if(pw(0,9) != co(9,cr(0,9))) { ASSUME(cr(0,9) >= old_cr); } pw(0,9) = co(9,cr(0,9)); r11 = mem(9,cr(0,9)); } ASSUME(creturn[0] >= cr(0,9)); // %call18 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !147 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[2]); // %5 = load i64, i64* %thr2, align 8, !dbg !148, !tbaa !141 // LD: Guess old_cr = cr(0,10); cr(0,10) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,10)] == 0); ASSUME(cr(0,10) >= iw(0,10)); ASSUME(cr(0,10) >= 0); ASSUME(cr(0,10) >= cdy[0]); ASSUME(cr(0,10) >= cisb[0]); ASSUME(cr(0,10) >= cdl[0]); ASSUME(cr(0,10) >= cl[0]); // Update creg_r12 = cr(0,10); crmax(0,10) = max(crmax(0,10),cr(0,10)); caddr[0] = max(caddr[0],0); if(cr(0,10) < cw(0,10)) { r12 = buff(0,10); } else { if(pw(0,10) != co(10,cr(0,10))) { ASSUME(cr(0,10) >= old_cr); } pw(0,10) = co(10,cr(0,10)); r12 = mem(10,cr(0,10)); } ASSUME(creturn[0] >= cr(0,10)); // %call19 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !149 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cw(0,10+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(cdy[0] >= cr(0,10+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[3]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !207, metadata !DIExpression()), !dbg !278 // %6 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) seq_cst, align 8, !dbg !151 // LD: Guess old_cr = cr(0,0); cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0)] == 0); ASSUME(cr(0,0) >= iw(0,0)); ASSUME(cr(0,0) >= 0); ASSUME(cr(0,0) >= cdy[0]); ASSUME(cr(0,0) >= cisb[0]); ASSUME(cr(0,0) >= cdl[0]); ASSUME(cr(0,0) >= cl[0]); // Update creg_r13 = cr(0,0); crmax(0,0) = max(crmax(0,0),cr(0,0)); caddr[0] = max(caddr[0],0); if(cr(0,0) < cw(0,0)) { r13 = buff(0,0); } else { if(pw(0,0) != co(0,cr(0,0))) { ASSUME(cr(0,0) >= old_cr); } pw(0,0) = co(0,cr(0,0)); r13 = mem(0,cr(0,0)); } ASSUME(creturn[0] >= cr(0,0)); // call void @llvm.dbg.value(metadata i64 %6, metadata !209, metadata !DIExpression()), !dbg !278 // %conv = trunc i64 %6 to i32, !dbg !152 // call void @llvm.dbg.value(metadata i32 %conv, metadata !206, metadata !DIExpression()), !dbg !242 // %cmp = icmp eq i32 %conv, 1, !dbg !153 // %conv20 = zext i1 %cmp to i32, !dbg !153 // call void @llvm.dbg.value(metadata i32 %conv20, metadata !210, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !212, metadata !DIExpression()), !dbg !282 // %7 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) seq_cst, align 8, !dbg !155 // LD: Guess old_cr = cr(0,0+1*1); cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0+1*1)] == 0); ASSUME(cr(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cr(0,0+1*1) >= 0); ASSUME(cr(0,0+1*1) >= cdy[0]); ASSUME(cr(0,0+1*1) >= cisb[0]); ASSUME(cr(0,0+1*1) >= cdl[0]); ASSUME(cr(0,0+1*1) >= cl[0]); // Update creg_r14 = cr(0,0+1*1); crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1)); caddr[0] = max(caddr[0],0); if(cr(0,0+1*1) < cw(0,0+1*1)) { r14 = buff(0,0+1*1); } else { if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) { ASSUME(cr(0,0+1*1) >= old_cr); } pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1)); r14 = mem(0+1*1,cr(0,0+1*1)); } ASSUME(creturn[0] >= cr(0,0+1*1)); // call void @llvm.dbg.value(metadata i64 %7, metadata !214, metadata !DIExpression()), !dbg !282 // %conv24 = trunc i64 %7 to i32, !dbg !156 // call void @llvm.dbg.value(metadata i32 %conv24, metadata !211, metadata !DIExpression()), !dbg !242 // %cmp25 = icmp eq i32 %conv24, 2, !dbg !157 // %conv26 = zext i1 %cmp25 to i32, !dbg !157 // call void @llvm.dbg.value(metadata i32 %conv26, metadata !215, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !217, metadata !DIExpression()), !dbg !286 // %8 = load atomic i64, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !159 // LD: Guess old_cr = cr(0,3); cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,3)] == 0); ASSUME(cr(0,3) >= iw(0,3)); ASSUME(cr(0,3) >= 0); ASSUME(cr(0,3) >= cdy[0]); ASSUME(cr(0,3) >= cisb[0]); ASSUME(cr(0,3) >= cdl[0]); ASSUME(cr(0,3) >= cl[0]); // Update creg_r15 = cr(0,3); crmax(0,3) = max(crmax(0,3),cr(0,3)); caddr[0] = max(caddr[0],0); if(cr(0,3) < cw(0,3)) { r15 = buff(0,3); } else { if(pw(0,3) != co(3,cr(0,3))) { ASSUME(cr(0,3) >= old_cr); } pw(0,3) = co(3,cr(0,3)); r15 = mem(3,cr(0,3)); } ASSUME(creturn[0] >= cr(0,3)); // call void @llvm.dbg.value(metadata i64 %8, metadata !219, metadata !DIExpression()), !dbg !286 // %conv30 = trunc i64 %8 to i32, !dbg !160 // call void @llvm.dbg.value(metadata i32 %conv30, metadata !216, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* @atom_1_X2_1, metadata !221, metadata !DIExpression()), !dbg !289 // %9 = load atomic i64, i64* @atom_1_X2_1 seq_cst, align 8, !dbg !162 // LD: Guess old_cr = cr(0,4); cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,4)] == 0); ASSUME(cr(0,4) >= iw(0,4)); ASSUME(cr(0,4) >= 0); ASSUME(cr(0,4) >= cdy[0]); ASSUME(cr(0,4) >= cisb[0]); ASSUME(cr(0,4) >= cdl[0]); ASSUME(cr(0,4) >= cl[0]); // Update creg_r16 = cr(0,4); crmax(0,4) = max(crmax(0,4),cr(0,4)); caddr[0] = max(caddr[0],0); if(cr(0,4) < cw(0,4)) { r16 = buff(0,4); } else { if(pw(0,4) != co(4,cr(0,4))) { ASSUME(cr(0,4) >= old_cr); } pw(0,4) = co(4,cr(0,4)); r16 = mem(4,cr(0,4)); } ASSUME(creturn[0] >= cr(0,4)); // call void @llvm.dbg.value(metadata i64 %9, metadata !223, metadata !DIExpression()), !dbg !289 // %conv34 = trunc i64 %9 to i32, !dbg !163 // call void @llvm.dbg.value(metadata i32 %conv34, metadata !220, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* @atom_1_X3_2, metadata !225, metadata !DIExpression()), !dbg !292 // %10 = load atomic i64, i64* @atom_1_X3_2 seq_cst, align 8, !dbg !165 // LD: Guess old_cr = cr(0,5); cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,5)] == 0); ASSUME(cr(0,5) >= iw(0,5)); ASSUME(cr(0,5) >= 0); ASSUME(cr(0,5) >= cdy[0]); ASSUME(cr(0,5) >= cisb[0]); ASSUME(cr(0,5) >= cdl[0]); ASSUME(cr(0,5) >= cl[0]); // Update creg_r17 = cr(0,5); crmax(0,5) = max(crmax(0,5),cr(0,5)); caddr[0] = max(caddr[0],0); if(cr(0,5) < cw(0,5)) { r17 = buff(0,5); } else { if(pw(0,5) != co(5,cr(0,5))) { ASSUME(cr(0,5) >= old_cr); } pw(0,5) = co(5,cr(0,5)); r17 = mem(5,cr(0,5)); } ASSUME(creturn[0] >= cr(0,5)); // call void @llvm.dbg.value(metadata i64 %10, metadata !227, metadata !DIExpression()), !dbg !292 // %conv38 = trunc i64 %10 to i32, !dbg !166 // call void @llvm.dbg.value(metadata i32 %conv38, metadata !224, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* @atom_1_X4_2, metadata !229, metadata !DIExpression()), !dbg !295 // %11 = load atomic i64, i64* @atom_1_X4_2 seq_cst, align 8, !dbg !168 // LD: Guess old_cr = cr(0,6); cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,6)] == 0); ASSUME(cr(0,6) >= iw(0,6)); ASSUME(cr(0,6) >= 0); ASSUME(cr(0,6) >= cdy[0]); ASSUME(cr(0,6) >= cisb[0]); ASSUME(cr(0,6) >= cdl[0]); ASSUME(cr(0,6) >= cl[0]); // Update creg_r18 = cr(0,6); crmax(0,6) = max(crmax(0,6),cr(0,6)); caddr[0] = max(caddr[0],0); if(cr(0,6) < cw(0,6)) { r18 = buff(0,6); } else { if(pw(0,6) != co(6,cr(0,6))) { ASSUME(cr(0,6) >= old_cr); } pw(0,6) = co(6,cr(0,6)); r18 = mem(6,cr(0,6)); } ASSUME(creturn[0] >= cr(0,6)); // call void @llvm.dbg.value(metadata i64 %11, metadata !231, metadata !DIExpression()), !dbg !295 // %conv42 = trunc i64 %11 to i32, !dbg !169 // call void @llvm.dbg.value(metadata i32 %conv42, metadata !228, metadata !DIExpression()), !dbg !242 // call void @llvm.dbg.value(metadata i64* @atom_1_X8_0, metadata !233, metadata !DIExpression()), !dbg !298 // %12 = load atomic i64, i64* @atom_1_X8_0 seq_cst, align 8, !dbg !171 // LD: Guess old_cr = cr(0,7); cr(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,7)] == 0); ASSUME(cr(0,7) >= iw(0,7)); ASSUME(cr(0,7) >= 0); ASSUME(cr(0,7) >= cdy[0]); ASSUME(cr(0,7) >= cisb[0]); ASSUME(cr(0,7) >= cdl[0]); ASSUME(cr(0,7) >= cl[0]); // Update creg_r19 = cr(0,7); crmax(0,7) = max(crmax(0,7),cr(0,7)); caddr[0] = max(caddr[0],0); if(cr(0,7) < cw(0,7)) { r19 = buff(0,7); } else { if(pw(0,7) != co(7,cr(0,7))) { ASSUME(cr(0,7) >= old_cr); } pw(0,7) = co(7,cr(0,7)); r19 = mem(7,cr(0,7)); } ASSUME(creturn[0] >= cr(0,7)); // call void @llvm.dbg.value(metadata i64 %12, metadata !235, metadata !DIExpression()), !dbg !298 // %conv46 = trunc i64 %12 to i32, !dbg !172 // call void @llvm.dbg.value(metadata i32 %conv46, metadata !232, metadata !DIExpression()), !dbg !242 // %and = and i32 %conv42, %conv46, !dbg !173 creg_r20 = max(creg_r18,creg_r19); ASSUME(active[creg_r20] == 0); r20 = r18 & r19; // call void @llvm.dbg.value(metadata i32 %and, metadata !236, metadata !DIExpression()), !dbg !242 // %and47 = and i32 %conv38, %and, !dbg !174 creg_r21 = max(creg_r17,creg_r20); ASSUME(active[creg_r21] == 0); r21 = r17 & r20; // call void @llvm.dbg.value(metadata i32 %and47, metadata !237, metadata !DIExpression()), !dbg !242 // %and48 = and i32 %conv34, %and47, !dbg !175 creg_r22 = max(creg_r16,creg_r21); ASSUME(active[creg_r22] == 0); r22 = r16 & r21; // call void @llvm.dbg.value(metadata i32 %and48, metadata !238, metadata !DIExpression()), !dbg !242 // %and49 = and i32 %conv30, %and48, !dbg !176 creg_r23 = max(creg_r15,creg_r22); ASSUME(active[creg_r23] == 0); r23 = r15 & r22; // call void @llvm.dbg.value(metadata i32 %and49, metadata !239, metadata !DIExpression()), !dbg !242 // %and50 = and i32 %conv26, %and49, !dbg !177 creg_r24 = max(max(creg_r14,0),creg_r23); ASSUME(active[creg_r24] == 0); r24 = (r14==2) & r23; // call void @llvm.dbg.value(metadata i32 %and50, metadata !240, metadata !DIExpression()), !dbg !242 // %and51 = and i32 %conv20, %and50, !dbg !178 creg_r25 = max(max(creg_r13,0),creg_r24); ASSUME(active[creg_r25] == 0); r25 = (r13==1) & r24; // call void @llvm.dbg.value(metadata i32 %and51, metadata !241, metadata !DIExpression()), !dbg !242 // %cmp52 = icmp eq i32 %and51, 1, !dbg !179 // br i1 %cmp52, label %if.then, label %if.end, !dbg !181 old_cctrl = cctrl[0]; cctrl[0] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[0] >= old_cctrl); ASSUME(cctrl[0] >= creg_r25); ASSUME(cctrl[0] >= 0); if((r25==1)) { goto T0BLOCK1; } else { goto T0BLOCK2; } T0BLOCK1: // call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([120 x i8], [120 x i8]* @.str.1, i64 0, i64 0), i32 noundef 96, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !182 // unreachable, !dbg !182 r26 = 1; T0BLOCK2: // %13 = bitcast i64* %thr2 to i8*, !dbg !185 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %13) #7, !dbg !185 // %14 = bitcast i64* %thr1 to i8*, !dbg !185 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %14) #7, !dbg !185 // %15 = bitcast i64* %thr0 to i8*, !dbg !185 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %15) #7, !dbg !185 // ret i32 0, !dbg !186 ret_thread_0 = 0; ASSERT(r26== 0); }
[ "tuan-phong.ngo@it.uu.se" ]
tuan-phong.ngo@it.uu.se
874dbdee1cbb64c4b4f299c059272112cda5153c
3ff1fe3888e34cd3576d91319bf0f08ca955940f
/cls/src/v20201016/model/Ckafka.cpp
81393d08ba8de3835ed933cf40ed6ad11a641f10
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-cpp
9f5df8220eaaf72f7eaee07b2ede94f89313651f
42a76b812b81d1b52ec6a217fafc8faa135e06ca
refs/heads/master
2023-08-30T03:22:45.269556
2023-08-30T00:45:39
2023-08-30T00:45:39
188,991,963
55
37
Apache-2.0
2023-08-17T03:13:20
2019-05-28T08:56:08
C++
UTF-8
C++
false
false
6,709
cpp
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <tencentcloud/cls/v20201016/model/Ckafka.h> using TencentCloud::CoreInternalOutcome; using namespace TencentCloud::Cls::V20201016::Model; using namespace std; Ckafka::Ckafka() : m_vipHasBeenSet(false), m_vportHasBeenSet(false), m_instanceIdHasBeenSet(false), m_instanceNameHasBeenSet(false), m_topicIdHasBeenSet(false), m_topicNameHasBeenSet(false) { } CoreInternalOutcome Ckafka::Deserialize(const rapidjson::Value &value) { string requestId = ""; if (value.HasMember("Vip") && !value["Vip"].IsNull()) { if (!value["Vip"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.Vip` IsString=false incorrectly").SetRequestId(requestId)); } m_vip = string(value["Vip"].GetString()); m_vipHasBeenSet = true; } if (value.HasMember("Vport") && !value["Vport"].IsNull()) { if (!value["Vport"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.Vport` IsString=false incorrectly").SetRequestId(requestId)); } m_vport = string(value["Vport"].GetString()); m_vportHasBeenSet = true; } if (value.HasMember("InstanceId") && !value["InstanceId"].IsNull()) { if (!value["InstanceId"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.InstanceId` IsString=false incorrectly").SetRequestId(requestId)); } m_instanceId = string(value["InstanceId"].GetString()); m_instanceIdHasBeenSet = true; } if (value.HasMember("InstanceName") && !value["InstanceName"].IsNull()) { if (!value["InstanceName"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.InstanceName` IsString=false incorrectly").SetRequestId(requestId)); } m_instanceName = string(value["InstanceName"].GetString()); m_instanceNameHasBeenSet = true; } if (value.HasMember("TopicId") && !value["TopicId"].IsNull()) { if (!value["TopicId"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.TopicId` IsString=false incorrectly").SetRequestId(requestId)); } m_topicId = string(value["TopicId"].GetString()); m_topicIdHasBeenSet = true; } if (value.HasMember("TopicName") && !value["TopicName"].IsNull()) { if (!value["TopicName"].IsString()) { return CoreInternalOutcome(Core::Error("response `Ckafka.TopicName` IsString=false incorrectly").SetRequestId(requestId)); } m_topicName = string(value["TopicName"].GetString()); m_topicNameHasBeenSet = true; } return CoreInternalOutcome(true); } void Ckafka::ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const { if (m_vipHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "Vip"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_vip.c_str(), allocator).Move(), allocator); } if (m_vportHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "Vport"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_vport.c_str(), allocator).Move(), allocator); } if (m_instanceIdHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "InstanceId"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_instanceId.c_str(), allocator).Move(), allocator); } if (m_instanceNameHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "InstanceName"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_instanceName.c_str(), allocator).Move(), allocator); } if (m_topicIdHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "TopicId"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_topicId.c_str(), allocator).Move(), allocator); } if (m_topicNameHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "TopicName"; iKey.SetString(key.c_str(), allocator); value.AddMember(iKey, rapidjson::Value(m_topicName.c_str(), allocator).Move(), allocator); } } string Ckafka::GetVip() const { return m_vip; } void Ckafka::SetVip(const string& _vip) { m_vip = _vip; m_vipHasBeenSet = true; } bool Ckafka::VipHasBeenSet() const { return m_vipHasBeenSet; } string Ckafka::GetVport() const { return m_vport; } void Ckafka::SetVport(const string& _vport) { m_vport = _vport; m_vportHasBeenSet = true; } bool Ckafka::VportHasBeenSet() const { return m_vportHasBeenSet; } string Ckafka::GetInstanceId() const { return m_instanceId; } void Ckafka::SetInstanceId(const string& _instanceId) { m_instanceId = _instanceId; m_instanceIdHasBeenSet = true; } bool Ckafka::InstanceIdHasBeenSet() const { return m_instanceIdHasBeenSet; } string Ckafka::GetInstanceName() const { return m_instanceName; } void Ckafka::SetInstanceName(const string& _instanceName) { m_instanceName = _instanceName; m_instanceNameHasBeenSet = true; } bool Ckafka::InstanceNameHasBeenSet() const { return m_instanceNameHasBeenSet; } string Ckafka::GetTopicId() const { return m_topicId; } void Ckafka::SetTopicId(const string& _topicId) { m_topicId = _topicId; m_topicIdHasBeenSet = true; } bool Ckafka::TopicIdHasBeenSet() const { return m_topicIdHasBeenSet; } string Ckafka::GetTopicName() const { return m_topicName; } void Ckafka::SetTopicName(const string& _topicName) { m_topicName = _topicName; m_topicNameHasBeenSet = true; } bool Ckafka::TopicNameHasBeenSet() const { return m_topicNameHasBeenSet; }
[ "tencentcloudapi@tencent.com" ]
tencentcloudapi@tencent.com
f5fc3dc494b97db1a05fe3d4ad99be09f6873498
19eb97436a3be9642517ea9c4095fe337fd58a00
/private/inet/urlmon/download/isctrl.cxx
5f3f5dfa764e86b60af69684df09343fb2de5417
[]
no_license
oturan-boga/Windows2000
7d258fd0f42a225c2be72f2b762d799bd488de58
8b449d6659840b6ba19465100d21ca07a0e07236
refs/heads/main
2023-04-09T23:13:21.992398
2021-04-22T11:46:21
2021-04-22T11:46:21
360,495,781
2
0
null
null
null
null
UTF-8
C++
false
false
68,845
cxx
#include <cdlpch.h> #pragma hdrstop #include "verp.h" #include <mstask.h> #include <pkgguid.h> extern LCID g_lcidBrowser; // default to english extern char g_szBrowserPrimaryLang[]; // global that encapsulates delay-loaded version.dll CVersion g_versiondll; extern BOOL g_bRunOnWin95; HRESULT NeedForceLanguageCheck(HKEY hkeyCLSID, CLocalComponentInfo *plci); BOOL SniffStringFileInfo( LPSTR szFileName, LPCTSTR lpszSubblock, DWORD *pdw = NULL ); HRESULT IsDistUnitLocallyInstalledZI(LPCWSTR , LPCWSTR, DWORD , DWORD , CLocalComponentInfo * ); HRESULT IsDistUnitLocallyInstalledSxS(LPCWSTR wszDistUnit, LPCWSTR wszClsid, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo * plci); void ExtractVersion(char *pszDistUnit, DWORD *pdwVerMS, DWORD *pdwVerLS); void GetLatestZIVersion(const WCHAR *pwzDistUnit, DWORD *pdwVerMS, DWORD *pdwVerLS); // --------------------------------------------------------------------------- // %%Function: CLocalComponentInfo::CLocalComponentInfo // --------------------------------------------------------------------------- CLocalComponentInfo::CLocalComponentInfo() { szExistingFileName[0] = '\0'; pBaseExistingFileName = NULL; lpDestDir = NULL; dwLocFVMS = 0; dwLocFVLS = 0; ftLastModified.dwLowDateTime = 0; ftLastModified.dwHighDateTime = 0; lcid = g_lcidBrowser; bForceLangGetLatest = FALSE; pbEtag = NULL; dwAvailMS = 0; dwAvailLS = 0; } // CLocalComponentInfo // --------------------------------------------------------------------------- // %%Function: CLocalComponentInfo::~CLocalComponentInfo // --------------------------------------------------------------------------- CLocalComponentInfo::~CLocalComponentInfo() { SAFEDELETE(lpDestDir); SAFEDELETE(pbEtag); } // ~CLocalComponentInfo // --------------------------------------------------------------------------- // %%Function: CLocalComponentInfo::MakeDestDir // --------------------------------------------------------------------------- HRESULT CLocalComponentInfo::MakeDestDir() { HRESULT hr = S_OK; Assert(pBaseExistingFileName); if (szExistingFileName[0]) { DWORD cbLen = (DWORD) (pBaseExistingFileName - szExistingFileName); lpDestDir = new char[cbLen + 1]; if (lpDestDir) { StrNCpy(lpDestDir, szExistingFileName, cbLen); } else { hr = E_OUTOFMEMORY; } } return hr; } // ~MakeDestDir // --------------------------------------------------------------------------- // %%Function: CModuleUsage::CModuleUsage // CModuleUsage is the basic download obj. // --------------------------------------------------------------------------- CModuleUsage::CModuleUsage(LPCSTR szFileName, DWORD muflags, HRESULT *phr) { m_szFileName = NULL; if (szFileName) { CHAR szCanonical[MAX_PATH]; if ( CDLGetLongPathNameA( szCanonical, szFileName, MAX_PATH ) != 0 ) m_szFileName = new char [lstrlen(szCanonical)+1]; if (m_szFileName) { lstrcpy(m_szFileName, szCanonical); } else { // CDLGetLongPathName failed, so we are on a platform that // doesn't support it, and we can't guess what the right long // pathname is. Just use the short one m_szFileName = new char [lstrlen(szFileName)+1]; if (m_szFileName) { lstrcpy(m_szFileName, szFileName); } else { *phr = E_OUTOFMEMORY; } } } m_dwFlags = muflags; } // CModuleUsage // --------------------------------------------------------------------------- // %%Function: CModuleUsage::~CModuleUsage // --------------------------------------------------------------------------- CModuleUsage::~CModuleUsage() { if (m_szFileName) SAFEDELETE(m_szFileName); } // ~CModuleUsage // --------------------------------------------------------------------------- // %%Function: CModuleUsage::Update(LPCSTR lpClientName) // --------------------------------------------------------------------------- HRESULT CModuleUsage::Update(LPCSTR lpClientName) { return ::UpdateModuleUsage(m_szFileName, lpClientName, NULL, m_dwFlags); } // ~CModuleUsage HRESULT GetVersionHint(HKEY hkeyVersion, DWORD *pdwVersionMS, DWORD *pdwVersionLS) { DWORD Size = MAX_PATH; char szVersionBuf[MAX_PATH]; DWORD dwType; HRESULT hr = S_OK; *pdwVersionMS = 0; *pdwVersionLS = 0; DWORD lResult = ::RegQueryValueEx(hkeyVersion, NULL, NULL, &dwType, (unsigned char *)szVersionBuf, &Size); if (lResult != ERROR_SUCCESS) { // value not found, consider this is always with bad/low version // of InstalledVersion hr = S_FALSE; goto Exit; } if ( FAILED(GetVersionFromString(szVersionBuf, pdwVersionMS, pdwVersionLS))){ hr = S_FALSE; } Exit: return hr; } /******************************************************************* NAME: CheckInstalledVersionHint SYNOPSIS: Checks for key InstalledVersion under {...} If no key then we fail once key is present we check version numbers S_OK: local version is good enough S_FALSE: need update: ERROR: not applicable, caller proceeds with InProcServer32 check. [HKCR:clsid] [{...}] [InstalledVersion] Deafult "1,0,0,1" Path "c:\foo\foo.ocx" The Path is optional, if find we will req update id file pointed to by path is missing on client. This is a way to robustify if user deletes the file on disk but not the regsitry (unclean uninstall) In this case update is needed ********************************************************************/ HRESULT CheckInstalledVersionHint( HKEY hKeyEmbedding, CLocalComponentInfo *plci, DWORD dwFileVersionMS, DWORD dwFileVersionLS) { HRESULT hr = S_OK; DWORD Size = MAX_PATH; DWORD dwType =0; LONG lResult = ERROR_SUCCESS; const static char * szInstalledVersion = "InstalledVersion"; const static char * szAvailableVersion = "AvailableVersion"; const static char * szPATH = "Path"; const static char * szLASTMODIFIED = "LastModified"; const static char * szETAG = "Etag"; char szVersionBuf[MAX_PATH]; char szFileName[MAX_PATH]; HKEY hKeyVersion = 0; HKEY hkeyAvailableVersion = 0; DWORD dwLocFVMS = 0; DWORD dwLocFVLS = 0; char szLastMod[INTERNET_RFC1123_BUFSIZE+1]; if (RegOpenKeyEx(hKeyEmbedding, szAvailableVersion, 0, KEY_READ, &hkeyAvailableVersion) == ERROR_SUCCESS) { DWORD dwAvailMS = 0; DWORD dwAvailLS = 0; if ( GetVersionHint(hkeyAvailableVersion, &dwAvailMS, &dwAvailLS) == S_OK){ plci->dwAvailMS = dwAvailMS; plci->dwAvailLS = dwAvailLS; } } lResult = ::RegOpenKeyEx(hKeyEmbedding, szInstalledVersion, 0, KEY_READ, &hKeyVersion); if (lResult != ERROR_SUCCESS) { // key not found, consider this is regular ActiveX with no hint // of InstalledVersion hr = HRESULT_FROM_WIN32(lResult); goto Exit; } if ( GetVersionHint(hKeyVersion, &dwLocFVMS, &dwLocFVLS) == S_FALSE){ hr = S_FALSE; goto Exit; } plci->dwLocFVMS = dwLocFVMS; plci->dwLocFVLS = dwLocFVLS; Size = INTERNET_RFC1123_BUFSIZE + 1; lResult = ::RegQueryValueEx(hKeyVersion, szLASTMODIFIED, NULL, &dwType, (unsigned char *)szLastMod, &Size); if (lResult == ERROR_SUCCESS) { SYSTEMTIME st; FILETIME ft; // convert intenet time to file time if (InternetTimeToSystemTime(szLastMod, &st, 0) && SystemTimeToFileTime(&st, &ft) ) { memcpy(&(plci->ftLastModified), &ft, sizeof(FILETIME)); } } Size = 0; lResult = ::RegQueryValueEx(hKeyVersion, szETAG, NULL, &dwType, (unsigned char *)NULL, &Size); if (lResult == ERROR_SUCCESS) { char *pbEtag = new char [Size]; if (pbEtag) { lResult = ::RegQueryValueEx(hKeyVersion, szETAG, NULL, &dwType, (unsigned char *)pbEtag, &Size); if (lResult == ERROR_SUCCESS) plci->pbEtag = pbEtag; else delete pbEtag; } } // check file versions if ((dwFileVersionMS > dwLocFVMS) || ((dwFileVersionMS == dwLocFVMS) && (dwFileVersionLS > dwLocFVLS))) hr = S_FALSE; if (hr == S_OK) { // if we seem to have the right version // check if the file physically exists on disk // the software can specify this by having a PATH="c:\foo\foo.class" // if present we will check for physical file existance dwType = 0; Size = MAX_PATH; lResult = ::SHQueryValueEx(hKeyVersion, szPATH, NULL, &dwType, (unsigned char *)szFileName, &Size); if (lResult != ERROR_SUCCESS) goto Exit; // value present, check if file is present if (GetFileAttributes(szFileName) == -1) { // if file is not physically present then clear out our // local file version. this comes in the way of doing // get latest. (ie get latest will assume that if a local file // is present then do If-Modified-Since plci->dwLocFVMS = 0; plci->dwLocFVLS = 0; hr = S_FALSE; } } Exit: if (hKeyVersion) ::RegCloseKey(hKeyVersion); if (hkeyAvailableVersion) ::RegCloseKey(hkeyAvailableVersion); return hr; } HRESULT CreateJavaPackageManager(IJavaPackageManager **ppPackageManager) { HRESULT hr = S_OK; Assert(ppPackageManager); if (!(*ppPackageManager)) { ICreateJavaPackageMgr *picjpm; hr=CoCreateInstance(CLSID_JavaPackageManager,NULL,(CLSCTX_INPROC_SERVER), IID_ICreateJavaPackageMgr,(LPVOID *) &picjpm); if (SUCCEEDED(hr)) { hr = picjpm->GetPackageManager(ppPackageManager); picjpm->Release(); } } return hr; } HRESULT IsPackageLocallyInstalled(IJavaPackageManager **ppPackageManager, LPCWSTR szPackageName, LPCWSTR szNameSpace, DWORD dwVersionMS, DWORD dwVersionLS) { HRESULT hr = S_OK; // assume Ok! IJavaPackage *pJavaPkg = NULL; DWORD dwLocMS = 0; DWORD dwLocLS = 0; Assert(ppPackageManager); if (!(*ppPackageManager)) { hr = CreateJavaPackageManager(ppPackageManager); if (FAILED(hr)) goto Exit; } if (SUCCEEDED((*ppPackageManager)->GetPackage(szPackageName, szNameSpace, &pJavaPkg))) { Assert(pJavaPkg); pJavaPkg->GetVersion(&dwLocMS, &dwLocLS); if ((dwVersionMS > dwLocMS) || ((dwVersionMS == dwLocMS) && (dwVersionLS > dwLocLS))) hr = S_FALSE; BSTR bstrFileName = NULL; if (SUCCEEDED(pJavaPkg->GetFilePath(&bstrFileName))) { // check if file really exists LPSTR szFileName = NULL; if (SUCCEEDED(Unicode2Ansi(bstrFileName, &szFileName))) { if (GetFileAttributes(szFileName) == -1) hr = S_FALSE; } else { hr = S_FALSE; } } else { hr = S_FALSE; } SAFESYSFREESTRING(bstrFileName); SAFERELEASE(pJavaPkg); } else { hr = S_FALSE; } Exit: return hr; } HRESULT AreNameSpacePackagesIntact(HKEY hkeyJava, LPCWSTR lpwszNameSpace, IJavaPackageManager **ppPackageManager) { int iValue = 0; DWORD dwType = REG_SZ; DWORD dwValueSize = MAX_PATH; char szPkgName[MAX_PATH]; HRESULT hr = S_OK; while ( RegEnumValue(hkeyJava, iValue++, szPkgName, &dwValueSize, 0, &dwType, NULL, NULL) == ERROR_SUCCESS) { LPWSTR lpwszPkgName = NULL; dwValueSize = MAX_PATH; // reset if ( (Ansi2Unicode(szPkgName,&lpwszPkgName) == S_OK) && ((IsPackageLocallyInstalled (ppPackageManager, lpwszPkgName, lpwszNameSpace, 0,0) != S_OK)) ) { hr = S_FALSE; SAFEDELETE(lpwszPkgName); break; } SAFEDELETE(lpwszPkgName); } return hr; } HRESULT ArePackagesIntact(HKEY hkeyContains) { HRESULT hr = S_OK; HKEY hkeyJava = 0; const static char * szJava = "Java"; IJavaPackageManager *pPackageManager = NULL; DWORD iSubKey = 0; DWORD dwSize = MAX_PATH; DWORD lResult; char szNameSpace[MAX_PATH]; // first validate pkgs in the global namespace if (RegOpenKeyEx( hkeyContains, szJava, 0, KEY_READ, &hkeyJava) == ERROR_SUCCESS) { hr = AreNameSpacePackagesIntact(hkeyJava, NULL, &pPackageManager); if (hr != S_OK) goto Exit; } else { goto Exit; } // validate pkgs in each of other namespaces, if any while ( (lResult = RegEnumKeyEx(hkeyJava, iSubKey++, szNameSpace, &dwSize, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { dwSize = MAX_PATH; HKEY hkeyNameSpace = 0; if (RegOpenKeyEx( hkeyJava, szNameSpace, 0, KEY_READ, &hkeyNameSpace) == ERROR_SUCCESS) { LPWSTR lpwszNameSpace = NULL; if (Ansi2Unicode(szNameSpace,&lpwszNameSpace) == S_OK) hr = AreNameSpacePackagesIntact(hkeyNameSpace, lpwszNameSpace, &pPackageManager); SAFEDELETE(lpwszNameSpace); RegCloseKey(hkeyNameSpace); if (hr != S_OK) goto Exit; } } if (lResult != ERROR_NO_MORE_ITEMS) { hr = HRESULT_FROM_WIN32(lResult); //FALLTHRU goto Exit; } Exit: SAFERELEASE(pPackageManager); if (hkeyJava) RegCloseKey(hkeyJava); return hr; } /******************************************************************* NAME: IsDistUnitLocallyInstalled SYNOPSIS: S_OK - distribution is installed correctly S_FALSE - distribution unit entry exists, but not installed or installed incorrectly E_FAIL - distribution unit doesn't exit (no entry for it) ********************************************************************/ HRESULT IsDistUnitLocallyInstalled( LPCWSTR szDistUnit, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo *plci, LPSTR szDestDirHint, LPBOOL pbParanoidCheck, DWORD flags) { LPSTR pszDist = NULL; HRESULT hr = S_FALSE; HKEY hkeyDist, hkeyThisDist = 0; HKEY hkeyContains = 0; HKEY hkeyFiles = 0; HKEY hkeyDepends = 0; const static char * szContains = "Contains"; const static char * szFiles = "Files"; const static char * szDistUnitStr = "Distribution Units"; LONG lResult = ERROR_SUCCESS; char szFileName[MAX_PATH]; ULONG cbSize = MAX_PATH; DWORD dwType = REG_SZ; if (pbParanoidCheck) { *pbParanoidCheck = FALSE; } lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_DIST_UNITS, 0, KEY_READ, &hkeyDist); if (lResult != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(REGDB_E_KEYMISSING); goto Exit; } if (FAILED((hr=::Unicode2Ansi(szDistUnit, &pszDist)))) { goto Exit; } hr = S_FALSE; // reset to NOT found // Open the key for this embedding: lResult = ::RegOpenKeyEx(hkeyDist, pszDist, 0, KEY_READ, &hkeyThisDist); if (lResult == ERROR_SUCCESS) { hr = CheckInstalledVersionHint( hkeyThisDist, plci, dwFileVersionMS, dwFileVersionLS); } else { hr = HRESULT_FROM_WIN32(REGDB_E_KEYMISSING); goto Exit; } if (hr == S_OK || (SUCCEEDED(hr) && dwFileVersionMS == -1 && dwFileVersionLS == -1)) { if (RegOpenKeyEx( hkeyThisDist, szContains, 0, KEY_READ, &hkeyContains) == ERROR_SUCCESS) { if (pbParanoidCheck) { *pbParanoidCheck = TRUE; } // BUGBUG: only do if paranoid flag on? // assert dependency state installed correctly on machine // this is where we would have to walk the dependecy tree // as well as make sure the contained packages and files // are indeed availabel on the client machine // BUGBUG: maybe we should only do this in paranoid mode // instead of all the time. if (RegOpenKeyEx( hkeyContains, szDistUnitStr, 0, KEY_READ, &hkeyDepends) == ERROR_SUCCESS ) { int iSubKey = 0; while (RegEnumValue(hkeyDepends, iSubKey++, szFileName, &cbSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { CLocalComponentInfo lci; LPWSTR wszFileName = 0; CLSID clsidTemp; if (FAILED(Ansi2Unicode(szFileName, &wszFileName))) break; clsidTemp = CLSID_NULL; if (wszFileName) CLSIDFromString(wszFileName, &clsidTemp); // if above call fails DistUnit is not clsid if (IsControlLocallyInstalled(NULL, &clsidTemp, wszFileName, 0,0, &lci, NULL) != S_OK) { SAFEDELETE(wszFileName); plci->dwLocFVMS = 0; plci->dwLocFVLS = 0; hr = S_FALSE; goto Exit; } SAFEDELETE(wszFileName); cbSize = MAX_PATH; } } if (RegOpenKeyEx( hkeyContains, szFiles, 0, KEY_READ, &hkeyFiles) == ERROR_SUCCESS) { int iValue = 0; DWORD dwType = REG_SZ; DWORD dwValueSize = MAX_PATH; while (RegEnumValue(hkeyFiles, iValue++, szFileName, &dwValueSize, 0, &dwType, NULL, NULL) == ERROR_SUCCESS) { dwValueSize = MAX_PATH; // reset if (GetFileAttributes(szFileName) == -1) { // if file is not physically present then clear out our // local file version. this comes in the way of doing // get latest. (get latest will assume that if a local // file is present then do If-Modified-Since plci->dwLocFVMS = 0; plci->dwLocFVLS = 0; hr = S_FALSE; goto Exit; } } } if (ArePackagesIntact(hkeyContains) == S_FALSE) { plci->dwLocFVMS = 0; plci->dwLocFVLS = 0; hr = S_FALSE; goto Exit; } } } else { hr = S_FALSE; // mark not present, don't error out } Exit: if (pszDist) delete pszDist; if (hkeyDepends) ::RegCloseKey(hkeyDepends); if (hkeyFiles) ::RegCloseKey(hkeyFiles); if (hkeyContains) ::RegCloseKey(hkeyContains); if (hkeyThisDist) ::RegCloseKey(hkeyThisDist); if (hkeyDist) ::RegCloseKey(hkeyDist); return hr; } IsFileLocallyInstalled( LPSTR lpCurCode, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo *plci, LPSTR szDestDirHint, BOOL bExactVersion ) { HRESULT hr = S_FALSE; // no clsid, but we have a file name // first check for a file of the same name in DestDirHint. // This is the directory that the main OCX file existed on // and so should be checked first. // In case this is a new install this will point to the // suggested destination dir for the DLL. if (szDestDirHint) { if (SearchPath( szDestDirHint, lpCurCode, NULL, MAX_PATH, plci->szExistingFileName, &(plci->pBaseExistingFileName))) { // check fileversion to see if update reqd. hr = LocalVersionOK(0,plci,dwFileVersionMS, dwFileVersionLS, bExactVersion); goto Exit; } } // file not found in suggested destination. Look in system searchpath // SearchPath for this filename if (!(SearchPath( NULL, lpCurCode, NULL, MAX_PATH, plci->szExistingFileName, &(plci->pBaseExistingFileName)))) { hr = S_FALSE; goto Exit; } // check fileversion to see if update reqd. hr = LocalVersionOK(0,plci,dwFileVersionMS, dwFileVersionLS, bExactVersion); Exit: return hr; } BOOL GetEXEName(LPSTR szCmdLine) { Assert(szCmdLine); LPSTR pchStartBaseName = szCmdLine; BOOL bFullyQualified = FALSE; BOOL bHasSpaces = FALSE; char *pch; if (*szCmdLine == '"') { szCmdLine++; char *pszEnd = StrStrA(szCmdLine, "\""); ASSERT(pszEnd); *pszEnd = '\0'; if (GetFileAttributes(szCmdLine) != -1) { //found the EXE name, but got to get rid of the first quote szCmdLine--; // step back to the " while (*szCmdLine) { *szCmdLine = *(szCmdLine + 1); szCmdLine++; } return TRUE; } szCmdLine--; // step back to the " while (*szCmdLine) { *szCmdLine = *(szCmdLine + 1); szCmdLine++; } return FALSE; } // skip past the directory if fully qualified. for (pch = szCmdLine; *pch; pch++) { if (*pch == '\\') pchStartBaseName = pch; if ( (*pch == ' ') || (*pch == '\t') ) bHasSpaces = TRUE; } if (!bHasSpaces) { if (GetFileAttributes(szCmdLine) != -1) { //found the EXE name, it is already in szCmdLine return TRUE; } return FALSE; } // pchStartBaseName now points at the last '\\' if any if (*pchStartBaseName == '\\') { pchStartBaseName++; bFullyQualified = TRUE; } // pchStartBaseName no points at the base name of the EXE. // Now look for spaces. When we find a space we will // replace with a '\0' and check if the cmd line is valid. // if valid, this must be the EXE name, return // if not valid, march on to do the same. when we finish // examining all of the cmd line, or no more spaces, likely the // EXE is missing. for (pch = pchStartBaseName; *pch != '\0'; pch++) { if ( (*pch == ' ') || (*pch == '\t') ) { char chTemp = *pch; // sacve the white spc char *pch = '\0'; // stomp the spc with nul. now we have in szCmdLine // what could be the full EXE name if (bFullyQualified) { if (GetFileAttributes(szCmdLine) != -1) { //found the EXE name, it is already in szCmdLine return TRUE; } } else { char szBuf[MAX_PATH]; LPSTR pBaseFileName; if (SearchPath( NULL, szCmdLine, NULL, MAX_PATH, szBuf, &pBaseFileName)) { //found the EXE name, it is already in szCmdLine return TRUE; } } *pch = chTemp; // restore the while spc and move past. } } return FALSE; } BOOL AdviseForceDownload(const LPCLSID lpclsid, DWORD dwClsContext) { HRESULT hr = S_OK; BOOL bNullClsid = lpclsid?IsEqualGUID(*lpclsid , CLSID_NULL):TRUE; HKEY hKeyClsid = 0; HKEY hKeyEmbedding = 0; HKEY hkeyDist = 0; BOOL bForceDownload = TRUE; LPOLESTR pwcsClsid = NULL; DWORD dwType; LONG lResult = ERROR_SUCCESS; static char * szAppID = "AppID"; LPSTR pszClsid = NULL; CLocalComponentInfo lci; static char * szInprocServer32 = "InProcServer32"; static char * szLocalServer32 = "LocalServer32"; if (bNullClsid) goto Exit; // return if we can't get a valid string representation of the CLSID if (FAILED((hr=StringFromCLSID(*lpclsid, &pwcsClsid)))) goto Exit; Assert(pwcsClsid != NULL); if (FAILED((hr=::Unicode2Ansi(pwcsClsid, &pszClsid)))) { goto Exit; } // Open root HKEY_CLASSES_ROOT\CLSID key lResult = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &hKeyClsid); if (lResult == ERROR_SUCCESS) { // Open the key for this embedding: lResult = ::RegOpenKeyEx(hKeyClsid, pszClsid, 0, KEY_READ, &hKeyEmbedding); if (lResult == ERROR_SUCCESS) { // check for hint of FileVersion before actually getting FileVersion // This way non-PE files, like Java, random data etc. can be // accomodated with CODEBASE= with proper version checking. // If they are not really COM object then they can't be // instantiated by COM or us (if object needed). But if they // use AsyncGetClassBits(no object instantiated) or from the // browser give height=0 width=0, the browser will not // report placeholders with errors, so they can work gracefully // overloading the object tag to do version checking and // random stuff hr = CheckInstalledVersionHint( hKeyEmbedding, &lci, 0, 0); // if the key is found and // if the latest version is not available then // return now with false, if right version is already // present return. If the key is missing then we // proceed with checks for InprocServer32/LocalServer32 if (SUCCEEDED(hr)) { // if using installed version hint and the verdict is // local good enough if (hr == S_OK) bForceDownload = FALSE; goto Exit; } hr = S_OK; // reset // ckeck if DCOM HKEY hKeyAppID; lResult = ::RegOpenKeyEx(hKeyEmbedding, szAppID, 0, KEY_READ, &hKeyAppID); if (lResult == ERROR_SUCCESS) { // DCOM // just assume that this is the latest version already // we never attempt code download for dcom bForceDownload = FALSE; // no force download for DCOM RegCloseKey(hKeyAppID); goto Exit; } HKEY hKeyInProc; lResult = ::RegOpenKeyEx(hKeyEmbedding, szInprocServer32, 0, KEY_READ, &hKeyInProc); if (lResult != ERROR_SUCCESS) { if (RegOpenKeyEx(hKeyEmbedding, szLocalServer32, 0, KEY_READ, &hKeyInProc) == ERROR_SUCCESS) { // specific look for vb doc obj hack where they just use // the OBJECT tag to do code download, but not hosting // no inproc but we have localserver // we could have failed because we pass the wrong clsctx RegCloseKey(hKeyInProc); if (!(dwClsContext & CLSCTX_LOCAL_SERVER)) bForceDownload = FALSE; } } else { RegCloseKey(hKeyInProc); } } } lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_DIST_UNITS, 0, KEY_READ, &hkeyDist); if (lResult == ERROR_SUCCESS) { // Open the key for this embedding: HKEY hkeyThisDist = 0; if (RegOpenKeyEx(hkeyDist, pszClsid, 0, KEY_READ, &hkeyThisDist) == ERROR_SUCCESS) { HKEY hkeyJava = 0; if (RegOpenKeyEx(hkeyThisDist, "Contains\\Java", 0, KEY_READ, &hkeyJava) == ERROR_SUCCESS) { bForceDownload = FALSE; RegCloseKey(hkeyJava); } RegCloseKey(hkeyThisDist); } RegCloseKey(hkeyDist); } Exit: if (pwcsClsid) delete pwcsClsid; if (pszClsid) delete pszClsid; if (hKeyClsid) ::RegCloseKey(hKeyClsid); if (hKeyEmbedding) ::RegCloseKey(hKeyEmbedding); return bForceDownload; } /******************************************************************* NAME: IsControlLocallyInstalled SYNOPSIS: Indicates whether the provided CLSID represents an OLE control. If no clsid provided then checks to see if lpCurCode exists in system and checks file version to verify if update is needed ********************************************************************/ HRESULT IsControlLocallyInstalled(LPSTR lpCurCode, const LPCLSID lpclsid, LPCWSTR szDistUnit, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo *plci, LPSTR szDestDirHint, BOOL bExactVersion) { HRESULT hr1, hr2, hrResult, hr = S_FALSE; BOOL bNullClsid = lpclsid?IsEqualGUID(*lpclsid , CLSID_NULL):TRUE; BOOL bParanoidCheck = FALSE; #ifdef _ZEROIMPACT LPOLESTR wszClsid = NULL; StringFromCLSID(*lpclsid, &wszClsid); #endif if ( bNullClsid && (lpCurCode == NULL) && (szDistUnit == NULL) ) { hr = E_INVALIDARG; goto Exit; } // hr1: HRESULT for whether the dist unit is installed // hr2: HRESULT for whether the particular clsid is installed // hrResult: HRESULT for whether the particular clsid is present (but not necessarily installed correctly) #ifdef _ZEROIMPACT // check for an exact match in the ZeroImpact installations first if (szDistUnit) { hr = IsDistUnitLocallyInstalledZI(szDistUnit, wszClsid, dwFileVersionMS, dwFileVersionLS, plci); } if (hr == S_OK) { goto Exit; } plci->m_bIsZI = FALSE; #endif if (szDistUnit) { hr1 = IsDistUnitLocallyInstalled( szDistUnit, dwFileVersionMS, dwFileVersionLS, plci, szDestDirHint, &bParanoidCheck, 0); } else { if (bNullClsid) { hr1 = IsFileLocallyInstalled( lpCurCode, dwFileVersionMS, dwFileVersionLS, plci, szDestDirHint, bExactVersion); // if no dist unit name or clsid and this is // clearly just checking for dependent file then // no need to fall thru and check the com br as well hr = hr1; goto Exit; } else { hr1 = E_FAIL; } } hr2 = IsCLSIDLocallyInstalled( lpCurCode, lpclsid, szDistUnit, dwFileVersionMS, dwFileVersionLS, plci, szDestDirHint, &hrResult , bExactVersion); if (hr2 != S_OK) { // if HKLM\CLSID\{CLSID} existed, but control wasn't there, we fail with that error // otherwise we fail with hr1. if (SUCCEEDED(hrResult)) { hr = hr2; } else { // if DU check returned S_FALSE or S_OK we return that, otherwise return from CLSID check. if (SUCCEEDED(hr1)) { hr = hr1; } else { hr = hr2; } } } else { if (hr1 == S_FALSE) { // COM branch says we are OK, but Distribution unit says we are lacking. // if we did paranoid checking and then failed the DU then // really fail. But if we just looked at the InstalledVersion // in the registry and concluded that our DU is no good then we // should go by the COM br and succeed the call as the user // could have obtained a newer version thru a mechanism other than // code download and so we have no business trying to update this // BUGBUG: do we at this point try to correct our registry // record of the version? need to ship tomorrow! if (bParanoidCheck) hr = hr1; else hr = hr2; } else { hr = hr2; } } Exit: #ifdef _ZEROIMPACT if(wszClsid) delete wszClsid; #endif return hr; } /******************************************************************* NAME: IsCLSIDLocallyInstalled SYNOPSIS: Indicates whether the provided CLSID represents an OLE control. If no clsid provided then checks to see if lpCurCode exists in system and checks file version to verify if update is needed ********************************************************************/ HRESULT IsCLSIDLocallyInstalled(LPSTR lpCurCode, const LPCLSID lpclsid, LPCWSTR szDistUnit, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo *plci, LPSTR szDestDirHint, HRESULT *pHrExtra, BOOL bExactVersion ) { LPSTR pszClsid = NULL; LPOLESTR pwcsClsid = NULL; HRESULT hr = S_FALSE; DWORD dwType; LONG lResult = ERROR_SUCCESS; static char * szInprocServer32 = "InProcServer32"; static char * szLocalServer32 = "LocalServer32"; static char * szAppID = "AppID"; HKEY hKeyClsid = 0; DWORD Size = MAX_PATH; if (pHrExtra) *pHrExtra = E_FAIL; // return if we can't get a valid string representation of the CLSID if (FAILED((hr=StringFromCLSID(*lpclsid, &pwcsClsid)))) goto Exit; Assert(pwcsClsid != NULL); // Open root HKEY_CLASSES_ROOT\CLSID key lResult = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &hKeyClsid); if (lResult == ERROR_SUCCESS) { if (FAILED((hr=::Unicode2Ansi(pwcsClsid, &pszClsid)))) { goto Exit; } // Open the key for this embedding: HKEY hKeyEmbedding; HKEY hKeyInProc; lResult = ::RegOpenKeyEx(hKeyClsid, pszClsid, 0, KEY_READ, &hKeyEmbedding); if (lResult == ERROR_SUCCESS) { // check for hint of FileVersion before actually getting FileVersion // This way non-PE files, like Java, random data etc. can be // accomodated with CODEBASE= with proper version checking. // If they are not really COM object then they can't be // instantiated by COM or us (if object needed). But if they // use AsyncGetClassBits(no object instantiated) or from the // browser give height=0 width=0, the browser will not // report placeholders with errors, so they can work gracefully // overloading the object tag to do version checking and // random stuff if (pHrExtra) { // indicate that CLSID reg key exists, so any failures after this // imply the control is not registered correctly *pHrExtra = S_OK; } hr = CheckInstalledVersionHint( hKeyEmbedding, plci, dwFileVersionMS, dwFileVersionLS); // if the key is found and // if the latest version is not available then // return now with false, if right version is already // present return. If the key is missing then we // proceed with checks for InprocServer32/LocalServer32 if (SUCCEEDED(hr)) goto finish_all; hr = S_OK; // reset // ckeck if DCOM HKEY hKeyAppID; lResult = ::RegOpenKeyEx(hKeyEmbedding, szAppID, 0, KEY_READ, &hKeyAppID); if (lResult == ERROR_SUCCESS) { // DCOM // just assume that this is the latest version already // we never attempt code download for dcom ::RegCloseKey(hKeyAppID); goto finish_all; } lResult = ::RegOpenKeyEx(hKeyEmbedding, szInprocServer32, 0, KEY_READ, &hKeyInProc); if (lResult == ERROR_SUCCESS) { Size = MAX_PATH; lResult = ::SHQueryValueEx(hKeyInProc, NULL, NULL, &dwType, (unsigned char *)plci->szExistingFileName, &Size); if (lResult == ERROR_SUCCESS) { if (!(SearchPath( NULL, plci->szExistingFileName, NULL, MAX_PATH, plci->szExistingFileName, &(plci->pBaseExistingFileName)))) { hr = S_FALSE; goto finish_verchecks; } // check fileversion to see if update reqd. hr = LocalVersionOK(hKeyEmbedding, plci, dwFileVersionMS, dwFileVersionLS, bExactVersion); if (plci->bForceLangGetLatest) { hr = NeedForceLanguageCheck(hKeyEmbedding, plci); } goto finish_verchecks; } else { hr = S_FALSE; // problem: can't locate file goto finish_verchecks; } } else { lResult = ::RegOpenKeyEx(hKeyEmbedding, szLocalServer32, 0, KEY_READ, &hKeyInProc); if (lResult != ERROR_SUCCESS) { hr = S_FALSE; // problem :have a clsid but, can't locate it goto finish_all; } Size = MAX_PATH; lResult = ::SHQueryValueEx(hKeyInProc, NULL, NULL, &dwType, (unsigned char *)plci->szExistingFileName, &Size); if (lResult == ERROR_SUCCESS) { // strip out args if any for this localserver32 // and extract only the EXE name GetEXEName(plci->szExistingFileName); if (!(SearchPath( NULL, plci->szExistingFileName, NULL, MAX_PATH, plci->szExistingFileName, &(plci->pBaseExistingFileName)))) { hr = S_FALSE; goto finish_verchecks; } // check fileversion to see if update reqd. hr = LocalVersionOK(hKeyEmbedding, plci, dwFileVersionMS, dwFileVersionLS, bExactVersion); if (plci->bForceLangGetLatest) hr = NeedForceLanguageCheck(hKeyEmbedding, plci); goto finish_verchecks; } else { hr = S_FALSE; // problem: can't locate file goto finish_verchecks; } } finish_verchecks: ::RegCloseKey(hKeyInProc); finish_all: ::RegCloseKey(hKeyEmbedding); } else { // here if we could not find the embedding in HKCR\CLSID hr = S_FALSE; } } else hr = S_FALSE; Exit: // release the string allocated by StringFromCLSID if (pwcsClsid) delete pwcsClsid; if (pszClsid) delete pszClsid; if (hKeyClsid) ::RegCloseKey(hKeyClsid); return hr; } BOOL SupportsSelfRegister(LPSTR szFileName) { return SniffStringFileInfo( szFileName, TEXT("OLESelfRegister") ); } BOOL WantsAutoExpire(LPSTR szFileName, DWORD *pnExpireDays) { return SniffStringFileInfo( szFileName, TEXT("Expire"), pnExpireDays ); } HRESULT GetFileVersion(CLocalComponentInfo *plci, LPDWORD pdwFileVersionMS, LPDWORD pdwFileVersionLS) { DWORD handle; UINT uiInfoSize; UINT uiVerSize ; UINT uiSize ; BYTE* pbData = NULL ; VS_FIXEDFILEINFO *lpVSInfo;; HRESULT hr = S_OK; LPVOID lpVerBuffer = NULL; #ifdef UNIX // We don't have version.dll DebugBreak(); return E_INVALIDARG; #endif if (!pdwFileVersionMS || !pdwFileVersionLS) { hr = E_INVALIDARG; goto Exit; } *pdwFileVersionMS = 0; *pdwFileVersionLS = 0; // Get the size of the version information. uiInfoSize = g_versiondll.GetFileVersionInfoSize( (char *)plci->szExistingFileName, &handle); if (uiInfoSize == 0) { hr = S_FALSE; goto Exit; } // Allocate a buffer for the version information. pbData = new BYTE[uiInfoSize] ; if (!pbData) return E_OUTOFMEMORY; // Fill the buffer with the version information. if (!g_versiondll.GetFileVersionInfo((char *)plci->szExistingFileName, handle, uiInfoSize, pbData)) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Exit ; } // Get the translation information. if (!g_versiondll.VerQueryValue( pbData, "\\", (void**)&lpVSInfo, &uiVerSize)) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Exit ; } if (!uiVerSize) { hr = E_FAIL; goto Exit ; } *pdwFileVersionMS = lpVSInfo->dwFileVersionMS; *pdwFileVersionLS = lpVSInfo->dwFileVersionLS; // Get the translation information. if (!g_versiondll.VerQueryValue( pbData, "\\VarFileInfo\\Translation", &lpVerBuffer, &uiVerSize)) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Exit ; } if (!uiVerSize) { hr = E_FAIL; goto Exit ; } plci->lcid = LOWORD(*((DWORD *) lpVerBuffer)); // Language ID Exit: if (pbData) delete [] pbData ; return hr; } DWORD GetLanguageCheckInterval(HKEY hkeyCheckPeriod) { DWORD dwMagicDays = 30; DWORD dwType = REG_DWORD; DWORD dwSize = sizeof(DWORD); char szLangString[MAX_PATH]; LCID lcidPriOverride = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())); LCID lcidPriBrowser = PRIMARYLANGID(LANGIDFROMLCID(g_lcidBrowser)); if (SUCCEEDED(GetLangString(lcidPriOverride, szLangString))) { if (RegQueryValueEx(hkeyCheckPeriod, szLangString, NULL, &dwType, (unsigned char *)&dwMagicDays, &dwSize) == ERROR_SUCCESS) { return dwMagicDays; } } if ( (lcidPriOverride != lcidPriBrowser) && SUCCEEDED(GetLangString(lcidPriBrowser, szLangString))) { if (RegQueryValueEx(hkeyCheckPeriod, szLangString, NULL, &dwType, (unsigned char *)&dwMagicDays, &dwSize) == ERROR_SUCCESS) { return dwMagicDays; } } return dwMagicDays; } // returns: // S_OK: local version OK or local version lang check not reqd now // S_FALSE: localversion not of right lang force lang check now // ERROR: fail HRESULT NeedForceLanguageCheck(HKEY hkeyCLSID, CLocalComponentInfo *plci) { HRESULT hr = S_OK; DWORD lResult; const char *szCHECKPERIOD = "LanguageCheckPeriod"; const char *szLASTCHECKEDHI = "LastCheckedHi"; DWORD dwMagicPerDay = 201; DWORD dwMagicDays; DWORD dwType; DWORD dwSize; FILETIME ftlast, ftnow; SYSTEMTIME st; HKEY hkeyCheckPeriod = 0; char szLangEnable[MAX_PATH]; if (!plci->bForceLangGetLatest) return hr; // lang is mismatched for this browser // check when was the last time we checked for the right lang if ((lResult = RegOpenKeyEx( hkeyCLSID, szCHECKPERIOD, 0, KEY_READ, &hkeyCheckPeriod)) != ERROR_SUCCESS) { plci->bForceLangGetLatest = FALSE; goto Exit; } szLangEnable[0] = '\0'; dwType = REG_SZ; dwSize = MAX_PATH; if ( (RegQueryValueEx(hkeyCheckPeriod, NULL, NULL, &dwType, (unsigned char *)szLangEnable, &dwSize) != ERROR_SUCCESS) || lstrcmpi(szLangEnable, "Enabled") != 0 ) { plci->bForceLangGetLatest = FALSE; goto Exit; } // see if lang check interval is specified for this lang dwMagicDays = GetLanguageCheckInterval(hkeyCheckPeriod); GetSystemTime(&st); SystemTimeToFileTime(&st, &ftnow); ftnow.dwLowDateTime = 0; memset(&ftlast, 0, sizeof(FILETIME)); dwType = REG_DWORD; dwSize = sizeof(DWORD); if (RegQueryValueEx(hkeyCheckPeriod, szLASTCHECKEDHI, NULL, &dwType, (unsigned char *)&ftlast.dwHighDateTime, &dwSize) == ERROR_SUCCESS) { ftlast.dwHighDateTime += (dwMagicPerDay * dwMagicDays); } if (CompareFileTime(&ftlast, &ftnow) > 0) { plci->bForceLangGetLatest = FALSE; } Exit: SAFEREGCLOSEKEY(hkeyCheckPeriod); if (FAILED(hr)) plci->bForceLangGetLatest = FALSE; return plci->bForceLangGetLatest?S_FALSE:S_OK; } HRESULT IsRightLanguageLocallyInstalled(CLocalComponentInfo *plci) { HRESULT hr = S_OK; LCID lcidLocalVersion; LCID lcidNeeded; if (!plci->lcid) // lang neutral? goto Exit; // make sure that the browser locale and lang strings are // initialized at this point hr = InitBrowserLangStrings(); if (FAILED(hr)) goto Exit; // BUGBUG: we are using threadlocale here instead of the // bindopts from the bindctx passed in if (plci->lcid == GetThreadLocale()) // full match with override? goto Exit; if (plci->lcid == g_lcidBrowser) // full match with browser? goto Exit; // get primary lang of local version lcidLocalVersion = PRIMARYLANGID(LANGIDFROMLCID(plci->lcid)); // check with primary language of override lcidNeeded = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())); if (lcidLocalVersion == lcidNeeded) // same primary lang? goto Exit; // check with primary language of browser lcidNeeded = PRIMARYLANGID(LANGIDFROMLCID(g_lcidBrowser)); if (lcidLocalVersion == lcidNeeded) // same primary lang? goto Exit; // BUGBUG: how to detect language neutral or multiligual OCX // we have a mismatch // check when was the last time we check and if past the // interval to check for new language availability // force a download now. hr = S_FALSE; plci->bForceLangGetLatest = TRUE; Exit: return hr; } // HRESULT LocalVersionOK(HKEY hkeyCLSID, CLocalComponentInfo *plci, DWORD dwFileVersionMS, DWORD dwFileVersionLS, BOOL bExactVersion) { DWORD handle; HRESULT hr = S_OK; // assume local version OK. DWORD dwLocFVMS = 0; DWORD dwLocFVLS = 0; HKEY hkeyCheckPeriod = 0; const char *szCHECKPERIOD = "LanguageCheckPeriod"; if (FAILED(hr = plci->MakeDestDir()) ) { goto Exit; } #ifdef UNIX return S_OK; #endif if ((dwFileVersionMS == 0) && (dwFileVersionLS == 0)) { // for dlls that don't require lang support and have no version req // don't check version numbers // this is to boost perf on system/IE dlls // One can also avoid such checks // by adding a [InstalledVersion] key under the clsid if (!hkeyCLSID || RegOpenKeyEx( hkeyCLSID, szCHECKPERIOD, 0, KEY_READ, &hkeyCheckPeriod) != ERROR_SUCCESS) { goto Exit; } } hr = GetFileVersion( plci, &dwLocFVMS, &dwLocFVLS); if (hr == S_OK) { plci->dwLocFVMS = dwLocFVMS; plci->dwLocFVLS = dwLocFVLS; if (bExactVersion) { if (dwFileVersionMS != dwLocFVMS || dwFileVersionLS != dwLocFVLS) { hr = S_FALSE; } else { // check language // sets the plci->bForcelangGetLatest if reqd IsRightLanguageLocallyInstalled(plci); } } else { if ((dwFileVersionMS > dwLocFVMS) || ((dwFileVersionMS == dwLocFVMS) && (dwFileVersionLS > dwLocFVLS))) { hr = S_FALSE; } else { // check language // sets the plci->bForcelangGetLatest if reqd IsRightLanguageLocallyInstalled(plci); } } } if ((dwFileVersionMS == 0) && (dwFileVersionLS == 0)) { hr = S_OK; } if ((dwFileVersionMS == -1) && (dwFileVersionLS == -1)) { hr = S_FALSE; } Exit: if (hkeyCheckPeriod) RegCloseKey(hkeyCheckPeriod); return hr; } /* * * UpdateSharedDlls * * the SharedDlls section looks like this * * [SharedDlls] * C:\Windows\System\foo.ocx = <ref count> * * Parameters: * * szFileName full file name of module we want to use * * Returns: * * S_OK incremented tge shared dlls ref count. * * Error the error encountered */ HRESULT UpdateSharedDlls( LPCSTR szFileName) { HKEY hKeySD = NULL; HRESULT hr = S_OK; DWORD dwType; DWORD dwRef = 1; DWORD dwSize = sizeof(DWORD); LONG lResult; // get the main SHAREDDLLS key ready; this is never freed! if ((lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REGSTR_PATH_SHAREDDLLS, 0, KEY_ALL_ACCESS, &hKeySD)) != ERROR_SUCCESS) { if ((lResult = RegCreateKey( HKEY_LOCAL_MACHINE, REGSTR_PATH_SHAREDDLLS, &hKeySD)) != ERROR_SUCCESS) { hKeySD = NULL; hr = HRESULT_FROM_WIN32(lResult); goto Exit; } } // now look for szFileName lResult = SHQueryValueEx(hKeySD, szFileName, NULL, &dwType, (unsigned char *)&dwRef, &dwSize); if (lResult == ERROR_SUCCESS) dwRef++; // does not exist. Create one and initialize to 1 if ((lResult = RegSetValueEx (hKeySD, szFileName, 0, REG_DWORD, (unsigned char *)&dwRef, sizeof(DWORD))) != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(lResult); goto Exit; } Exit: if (hKeySD) RegCloseKey(hKeySD); return hr; } /* * * UpdateModuleUsage * * the module usage section in the regitry looks like this * * [ModuleUsage] * [c:/windows/occache/foo.ocx] * Owner = Internet Code Downloader * FileVersion = <optional text version of 64-bit fileversion of ocx * [clients] * Internet Code Downloader = <this client's ref count> * To allow for full path names without using the backslash we convert * backslahes to forward slashes. * * * Parameters: * * szFileName full file name of module we want to use * * szClientName name of or stringfromclsid of client. * * szClientPath optional (if present we can detect if client is gone) * * muFlags: * MU_CLIENT mark ourselves client * MU_OWNER mark ourselves owner * * Returns: * S_OK we updated the module usage section, * and if that was previously absent then we also upped the * shared dlls count. * * Error the error encountered */ HRESULT UpdateModuleUsage( LPCSTR szFileName, LPCSTR szClientName, LPCSTR szClientPath, LONG muFlags) { HRESULT hr = S_OK; LONG lResult = 0; BOOL fUpdateSharedDlls = TRUE; DWORD dwType; HKEY hKeyMod = NULL; DWORD dwSize = MAX_PATH; char szBuf[MAX_PATH]; const char *pchSrc; char *pchDest; static const LPCSTR szCLIENTPATHDEFAULT = ""; LPCSTR lpClientPath = (szClientPath)?szClientPath:szCLIENTPATHDEFAULT; HKEY hKeyMU = NULL; static const char szOWNER[] = ".Owner"; static const char szUNKNOWN[] = "Unknown Owner"; Assert(szClientName); DWORD cbClientName = lstrlen(szClientName); DWORD cbUnknown = sizeof(szUNKNOWN); char szShortFileName[MAX_PATH]; #ifdef SHORTEN if (!GetShortPathName(szFileName, szShortFileName, MAX_PATH)) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Exit; } #else lstrcpy(szShortFileName, szFileName); #endif if (g_bRunOnWin95) { char szCharFileName[MAX_PATH]; OemToChar(szShortFileName, szCharFileName); lstrcpy(szShortFileName, szCharFileName); } // get the main MODULEUSAGE key ready; this is never freed! if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, REGSTR_PATH_MODULE_USAGE, 0, KEY_ALL_ACCESS, &hKeyMU) != ERROR_SUCCESS) if ((lResult = RegCreateKey( HKEY_LOCAL_MACHINE, REGSTR_PATH_MODULE_USAGE, &hKeyMU)) != ERROR_SUCCESS) { hKeyMU = NULL; hr = HRESULT_FROM_WIN32(lResult); goto Exit; } // check if Usage section is present for this dll // open the file's section we are concerned with // if absent create it // BUGBUG: win95 registry bug does not allow keys to be > 255 // MAX_PATH for filename is 260 pchDest = szBuf; for (pchSrc = szShortFileName; *pchSrc != '\0'; pchSrc++, pchDest++) { if ((*pchDest = *pchSrc) == '\\') *pchDest = '/'; } *pchDest = '\0'; // null terminate szBuf[256] = '\0'; // truncate if longer than 255 ude to win95 registry bug if (RegOpenKeyEx( hKeyMU, szBuf, 0, KEY_ALL_ACCESS, &hKeyMod) != ERROR_SUCCESS) { if ((lResult = RegCreateKey( hKeyMU, szBuf, &hKeyMod)) != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(lResult); goto Exit; } } // now look for '.Owner=' dwSize = MAX_PATH; szBuf[0] = '\0'; if (RegQueryValueEx(hKeyMod, szOWNER, NULL, &dwType, (unsigned char *)szBuf, &dwSize) == ERROR_SUCCESS) { if ((lstrcmpi(szBuf, szClientName) != 0) && (muFlags & MU_OWNER)) { // if we are the not the owner we can't make ourselves the owner hr = E_INVALIDARG; goto Exit; } } else { // '.Owner =' does not exist. Create one and initialize to us // if muFlags & MU_OWNER if (((lResult = RegSetValueEx (hKeyMod, szOWNER, 0, REG_SZ, (UCHAR *)((muFlags & MU_OWNER)?szClientName:szUNKNOWN), ((muFlags & MU_OWNER)?cbClientName:cbUnknown)))) != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(lResult); goto Exit; } } // look for szClientName already marked as a client dwSize = MAX_PATH; if (SHQueryValueEx(hKeyMod, szClientName, NULL, &dwType, (unsigned char *)szBuf, &dwSize) == ERROR_SUCCESS) { // signal that we have already registered as a // client and so don't up ref count in shareddlls fUpdateSharedDlls = FALSE; } else { // add ourselves as a client if ((lResult =RegSetValueEx(hKeyMod, szClientName, 0, REG_SZ, (unsigned char *)lpClientPath, lstrlen(lpClientPath)+1 )) != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(lResult); goto Exit; } } Exit: if (hKeyMod) RegCloseKey(hKeyMod); if (hKeyMU) RegCloseKey(hKeyMU); // Update ref count in SharedDlls only if usage section was not // already updated. This will ensure that the code downloader has // just one ref count represented in SharedDlls if ( fUpdateSharedDlls) hr = UpdateSharedDlls(szShortFileName); return hr; } // Name: SniffStringFileInfo // Parameters: // szFileName - full path to file whose StringFileInfo we want to sniff // lpszSubblock - sub block of the StringFileInfo to look for // pdw - place to put the string, interpreted as a number // Returns: // TRUE - if the subblock is present. // FALSE - if the subblock is absent. // Notes: // This function implements stuff common to SupportsSelfRegister and WantsAutoExpire BOOL SniffStringFileInfo( LPSTR szFileName, LPCTSTR lpszSubblock, DWORD *pdw ) { BOOL bResult = FALSE; DWORD handle; UINT uiInfoSize; UINT uiVerSize ; UINT uiSize ; BYTE* pbData = NULL ; DWORD* lpBuffer; TCHAR szName[512] ; LPTSTR szExpire; if ( pdw ) *pdw = 0; #ifdef UNIX // Don't have version.dll DebugBreak(); return FALSE; #endif // Get the size of the version information. uiInfoSize = g_versiondll.GetFileVersionInfoSize( szFileName, &handle); if (uiInfoSize == 0) return FALSE ; // Allocate a buffer for the version information. pbData = new BYTE[uiInfoSize] ; if (!pbData) return TRUE; // nothing nasty, just quirky // Fill the buffer with the version information. bResult = g_versiondll.GetFileVersionInfo( szFileName, handle, uiInfoSize, pbData); if (!bResult) goto Exit ; // Get the translation information. bResult = g_versiondll.VerQueryValue( pbData, "\\VarFileInfo\\Translation", (void**)&lpBuffer, &uiVerSize); if (!bResult) goto Exit ; if (!uiVerSize) goto Exit ; // Build the path to the OLESelfRegister key // using the translation information. wsprintf( szName, "\\StringFileInfo\\%04hX%04hX\\%s", LOWORD(*lpBuffer), HIWORD(*lpBuffer), lpszSubblock) ; // Search for the key. bResult = g_versiondll.VerQueryValue( pbData, szName, (void**)&szExpire, &uiSize); // If there's a string there, we need to convert it to a count of days. if ( bResult && pdw && uiSize ) { DWORD dwExpire = 0; for ( ; *szExpire; szExpire++ ) { if ( (*szExpire >= TEXT('0') && *szExpire <= TEXT('9')) ) dwExpire = dwExpire * 10 + *szExpire - TEXT('0'); else break; } if (dwExpire > MAX_EXPIRE_DAYS) dwExpire = MAX_EXPIRE_DAYS; *pdw = dwExpire; } Exit: delete [] pbData ; return bResult ; } // returns S_OK on dist unit(at version number) installed zeroimpactly, S_FALSE on not installed // zeroimpactly, or error codes HRESULT IsDistUnitLocallyInstalledZI(LPCWSTR wszDistUnit, LPCWSTR wszClsid, DWORD dwFileVersionMS, DWORD dwFileVersionLS, CLocalComponentInfo * plci) { HRESULT hrNormalCheck = S_OK; HRESULT hrZICheck = S_OK; HRESULT hrDll = S_OK; int cBufLen = MAX_PATH; int iLenDU = 0; int iLenVer = 0; TCHAR szDir[MAX_PATH]; TCHAR szFile[MAX_PATH]; TCHAR szDllName[MAX_PATH]; WCHAR wszDistDotVersion[MAX_PATH]; TCHAR szVersion[MAX_PATH]; WCHAR wszVersion[MAX_PATH]; BOOL bParanoid = TRUE; ASSERT(wszDistUnit); if (!dwFileVersionMS && !dwFileVersionLS) { GetLatestZIVersion(wszDistUnit, &dwFileVersionMS, &dwFileVersionLS); } if(GetStringFromVersion(szVersion, dwFileVersionMS, dwFileVersionLS, '_')) { if(MultiByteToWideChar(CP_ACP, 0, szVersion, -1, wszVersion, MAX_PATH) != 0) { // buffer overflow guard iLenDU = lstrlenW(wszDistUnit); iLenVer = lstrlenW(wszVersion); if(iLenDU + iLenVer /*dot and null*/ + 2 > MAX_PATH) return E_UNEXPECTED; StrCpyW(wszDistDotVersion, wszDistUnit); wszDistDotVersion[iLenDU++] = L'!'; StrCpyW(wszDistDotVersion + iLenDU, wszVersion); } } // Use the ZI api first; this has the final say on whether the control is installed ZI; // It also fills in szDir hrZICheck = ZIGetInstallationDir(wszDistUnit, &dwFileVersionMS, &dwFileVersionLS, szDir, &cBufLen); // Call the normal IsDistUnitLocallyInstalled function; this will fill in plci hrNormalCheck = IsDistUnitLocallyInstalled(wszDistDotVersion, dwFileVersionMS, dwFileVersionLS, plci, NULL, &bParanoid, 0); if(FAILED(hrZICheck)) { if(hrZICheck == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) return E_UNEXPECTED; else return hrZICheck; } // hrZICheck == S_OK: directory was found; hrZICheck == S_FALSE: directory was not found if(hrZICheck == S_OK) { cBufLen = MAX_PATH; // Found the dir, now look for a dll name to report up hrDll = ZIGetDllName(szDir, wszDistUnit, wszClsid, dwFileVersionMS, dwFileVersionLS, szFile, &cBufLen); if(hrDll == S_OK) { wsprintf(szDllName, TEXT("%s\\%s"), szDir, szFile); if(MultiByteToWideChar(CP_ACP, 0, szDllName, -1, plci->wszDllName, MAX_PATH) == 0) plci->wszDllName[0] = L'\0'; } else { plci->wszDllName[0] = L'\0'; } // if IsDistUnit...lled already filled this in, don't overwrite if(hrNormalCheck != S_OK) { plci->dwLocFVMS = dwFileVersionMS; plci->dwLocFVLS = dwFileVersionLS; } plci->m_bIsZI = TRUE; } else { plci->dwLocFVMS = 0; plci->dwLocFVLS = 0; plci->m_bIsZI = FALSE; } return hrZICheck; } void GetLatestZIVersion(const WCHAR *pwzDistUnit, DWORD *pdwVerMS, DWORD *pdwVerLS) { HKEY hkeyZI = 0; HANDLE hFile = INVALID_HANDLE_VALUE; DWORD dwDistVerMS = 0; DWORD dwDistVerLS = 0; DWORD lResult; DWORD iSubKey; DWORD dwSize = MAX_REGSTR_LEN; char szDistUnitCur[MAX_REGSTR_LEN]; char *szPtr = NULL; char *pszDistUnit = NULL; int iLen = 0; if (Unicode2Ansi(pwzDistUnit, &pszDistUnit)) { goto Exit; } if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY_ZEROIMPACT_DIRS, 0, KEY_READ, &hkeyZI) == ERROR_SUCCESS) { iSubKey = 0; while ((lResult = RegEnumKeyEx(hkeyZI, iSubKey++, szDistUnitCur, &dwSize, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { szPtr = StrStrI(szDistUnitCur, pszDistUnit); if (szPtr) { ExtractVersion(szDistUnitCur, &dwDistVerMS, &dwDistVerLS); if (dwDistVerMS > *pdwVerMS || ((dwDistVerMS == *pdwVerMS) && dwDistVerLS > *pdwVerLS)) { *pdwVerMS = dwDistVerMS; *pdwVerLS = dwDistVerLS; } } dwSize = MAX_REGSTR_LEN; } } if (!*pdwVerMS && !*pdwVerLS) { LPTSTR szDir = (LPTSTR)GetZeroImpactRootDir(); TCHAR szQualifiedPath[MAX_PATH]; WIN32_FIND_DATA wfd; // Still haven't found a version. Look in the file system if (szDir) { StrCpyN(szQualifiedPath, szDir, MAX_PATH); Assert(lstrlen(szQualifiedPath) + 4 < MAX_PATH); StrCat(szQualifiedPath, TEXT("\\*.*")); hFile = FindFirstFile(szQualifiedPath, &wfd); iLen = lstrlen(pszDistUnit); if (hFile != INVALID_HANDLE_VALUE) { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!StrCmpNI(wfd.cFileName, pszDistUnit, iLen)) { ExtractVersion(wfd.cFileName, &dwDistVerMS, &dwDistVerLS); if (dwDistVerMS > *pdwVerMS || ((dwDistVerMS == *pdwVerMS) && dwDistVerLS > *pdwVerLS)) { *pdwVerMS = dwDistVerMS; *pdwVerLS = dwDistVerLS; } } } while (FindNextFile(hFile, &wfd)) { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!StrCmpNI(wfd.cFileName, pszDistUnit, iLen)) { ExtractVersion(wfd.cFileName, &dwDistVerMS, &dwDistVerLS); if (dwDistVerMS > *pdwVerMS || ((dwDistVerMS == *pdwVerMS) && dwDistVerLS > *pdwVerLS)) { *pdwVerMS = dwDistVerMS; *pdwVerLS = dwDistVerLS; } } } } } } } Exit: if (hkeyZI) { RegCloseKey(hkeyZI); } if (hFile != INVALID_HANDLE_VALUE) { FindClose(hFile); } SAFEDELETE(pszDistUnit); } void ExtractVersion(char *pszDistUnit, DWORD *pdwVerMS, DWORD *pdwVerLS) { char *pszCopy = NULL; char *pszPtr = NULL; int iLen = 0; if (!pszDistUnit) { return; } iLen = lstrlen(pszDistUnit) + 1; pszCopy = new char[iLen]; if (!pszCopy) { return; } StrNCpy(pszCopy, pszDistUnit, iLen); pszPtr = pszCopy; // Convert _ to , for GetVersionFromString() while (*pszPtr) { if (*pszPtr == '_') { *pszPtr = ','; } pszPtr++; } pszPtr = StrStrA(pszCopy, "!"); if (pszPtr) { pszPtr++; GetVersionFromString(pszPtr, pdwVerMS, pdwVerLS); } SAFEDELETE(pszCopy); }
[ "mehmetyilmaz3371@gmail.com" ]
mehmetyilmaz3371@gmail.com
7df6fa8e90cff9e7487784550141dc906e1571ff
695bd42dc11828d04fae194c51b5cb289b7c099b
/main.cpp
6881a6afb02d6d38c909fa57e769d0c700f6ca57
[]
no_license
phplego/PixelLamp
2599fc281505b6ecd876fd6b2c1031bd984a26ef
2d4d5e8ecd3f7eddf981709b7de138cee4da0d80
refs/heads/master
2022-12-02T16:55:49.115874
2020-07-24T23:55:35
2020-07-24T23:55:35
277,692,640
0
0
null
null
null
null
UTF-8
C++
false
false
13,594
cpp
#include <ArduinoOTA.h> #include <ArduinoJson.h> #include <FastLED.h> #include <ESP8266WiFi.h> #include <Adafruit_MQTT.h> #include <Adafruit_MQTT_Client.h> #include <EEPROM.h> #include "WebService.h" #include "Queue.h" #include "utils.h" ADC_MODE(ADC_VCC); // for make ESP.getVCC() work #define APP_VERSION "0.5" #define DEVICE_ID "PixelLamp" #define LED_PIN 0 #define MOSFET_PIN 3 //RX #define VCC2BAT_CORRECTION 0.7f #define TURN_OFF_VOLTAGE 3.7f #define MQTT_HOST "192.168.1.157" // MQTT host (e.g. m21.cloudmqtt.com) #define MQTT_PORT 11883 // MQTT port (e.g. 18076) #define MQTT_PUBLISH_INTERVAL 60000 // 1 min #define VCC_MEASURE_INTERVAL 1000 // 1 sec CRGB leds[256] = {0}; #include "ledeffects.h" const char * gConfigFile = "/config.json"; byte gBrightness = 40; unsigned long gRestart = 0; Queue<20> vccQueue; WiFiClient client; // WiFi Client WiFiManager wifiManager; // WiFi Manager WebService webService; // Web Server Adafruit_MQTT_Client mqtt(&client, MQTT_HOST, MQTT_PORT); // MQTT client Adafruit_MQTT_Subscribe mqttSubscription = Adafruit_MQTT_Subscribe (&mqtt, "wifi2mqtt/pixellamp/set"); Adafruit_MQTT_Publish mqttPublish = Adafruit_MQTT_Publish (&mqtt, "wifi2mqtt/pixellamp"); unsigned long lastPublishTime = 0; unsigned long lastVccMeasureTime = 0; float getVcc(){ return (float)ESP.getVcc() / 1024.0f; } void saveTheConfig() { int addr = 0; for (int i = 0; i < MODE_COUNT; i++) { EEPROM.put(addr++, gModeConfigs[i].speed); EEPROM.put(addr++, gModeConfigs[i].scale); } EEPROM.put(addr++, gCurrentMode); EEPROM.commit(); DynamicJsonDocument json(1024); json["temp"] = 123; json["mode"] = 123; saveConfig(gConfigFile, json); } void loadTheConfig() { int addr = 0; for (int i = 0; i < MODE_COUNT; i++) { EEPROM.get(addr++, gModeConfigs[i].speed); EEPROM.get(addr++, gModeConfigs[i].scale); } EEPROM.get(addr++, gCurrentMode); } void publishState() { String jsonStr; StaticJsonDocument<512> doc; float vccRouned = round(vccQueue.average() * 100.0) / 100.0; doc["mode"] = gCurrentMode; doc["mode-name"] = gModeStructs[gCurrentMode].name; doc["speed"] = gModeConfigs[gCurrentMode].speed; doc["scale"] = gModeConfigs[gCurrentMode].scale; doc["brightness"] = gBrightness; doc["vcc"] = vccRouned; doc["vbat"] = vccRouned + VCC2BAT_CORRECTION; doc["version"] = APP_VERSION; serializeJson(doc, jsonStr); // Ensure the connection to the MQTT server is alive (this will make the first // connection and automatically reconnect when disconnected). See the MQTT_connect() MQTT_connect(&mqtt); // Publish state to output topic mqttPublish.publish(jsonStr.c_str()); } void setup() { Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY); EEPROM.begin(512); //pinMode(1 /*TX*/, OUTPUT); //pinMode(3 /*RX*/, OUTPUT); pinMode(MOSFET_PIN, OUTPUT); digitalWrite(MOSFET_PIN, HIGH); // config loading loadTheConfig(); // measure vcc first time vccQueue.add(getVcc()); // ЛЕНТА FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, 256);//.setCorrection( TypicalLEDStrip ); FastLED.setBrightness(gBrightness); FastLED.setMaxPowerInVoltsAndMilliamps(5, 5000); FastLED.clear(); leds[0] = CRGB::Blue; leds[1] = CRGB::Magenta; leds[2] = CRGB::Red; leds[3] = CRGB::Green; leds[4] = CRGB::Blue; FastLED.show(); delay(50); FastLED.show(); // ===================== Setup WiFi ================== String apName = String("esp-") + DEVICE_ID + "-" + ESP.getChipId(); apName.replace('.', '_'); WiFi.hostname(apName); wifi_set_sleep_type(NONE_SLEEP_T); //prevent wifi sleep (stronger connection) wifiManager.setAPStaticIPConfig(IPAddress(10, 0, 1, 1), IPAddress(10, 0, 1, 1), IPAddress(255, 255, 255, 0)); wifiManager.setConfigPortalTimeout(60); wifiManager.autoConnect(apName.c_str(), "12341234"); // IMPORTANT! Blocks execution. Waits until connected //WiFi.begin("OpenWrt_2GHz", "111"); // Restart if not connected if (WiFi.status() != WL_CONNECTED) { ESP.restart(); } Serial.print("\nConnected to "); Serial.println(WiFi.SSID()); Serial.print("IP address: "); Serial.println(WiFi.localIP()); // ===================== End Setup ================== // socketService.init(); webService.init(); String menu; menu += "<div>"; menu += "<a href='/'>index</a> "; menu += "<a href='/logout'>logout</a> "; menu += "<a href='/restart'>restart</a> "; menu += "<a href='/turn-off'>turn off</a> "; menu += "<a href='/index2.html'>index2.html</a> "; menu += "</div><hr>"; webService.server->on("/", [menu](){ String str = ""; str += menu; str += "<pre>"; str += String() + " Uptime: " + (millis() / 1000) + " \n"; str += String() + " FullVersion: " + ESP.getFullVersion() + " \n"; str += String() + " ESP Chip ID: " + ESP.getChipId() + " \n"; str += String() + " Hostname: " + WiFi.hostname() + " \n"; str += String() + " CpuFreqMHz: " + ESP.getCpuFreqMHz() + " \n"; str += String() + " VCC: " + vccQueue.average() + " \n"; str += String() + " ~Battery(aprox): " + (vccQueue.average() + VCC2BAT_CORRECTION) + " \n"; str += String() + " WiFi status: " + client.status() + " \n"; str += String() + " FreeHeap: " + ESP.getFreeHeap() + " \n"; str += String() + " SketchSize: " + ESP.getSketchSize() + " \n"; str += String() + " FreeSketchSpace: " + ESP.getFreeSketchSpace() + " \n"; str += String() + " FlashChipSize: " + ESP.getFlashChipSize() + " \n"; str += String() + "FlashChipRealSize: " + ESP.getFlashChipRealSize() + " \n"; str += "</pre>"; for(int i = 0; i < MODE_COUNT; i++){ str += "<button style='font-size:25px' onclick='document.location=\"/set-mode?mode="+String(i)+"\"'> "; str += String() + (gCurrentMode == i ? "* " : "") + gModeStructs[i].name; str += "</button> "; } str += "<br>"; str += "<br>"; str += "speed: " + String(gSpeed) + "<br>"; for(int i = 5; i < 61; i+=5){ str += " <button style='font-size:25px; width:70px' onclick='document.location=\"/set-speed?speed="+String(i)+"\"'> "; str += String() + (gSpeed == i ? "* " : "") + i; str += "</button>\n"; } str += "<br><br>"; str += "scale: " + String(gScale) + "<br>"; str += " <button style='font-size:25px; width:70px' onclick='document.location=\"/set-scale?scale="+String(gScale-1)+"\"'>-1</button> "; str += " <button style='font-size:25px; width:70px' onclick='document.location=\"/set-scale?scale="+String(gScale+1)+"\"'>+1</button> "; str += "&nbsp;&nbsp;"; for(int i = 0; i < 61; i+=5){ str += " <button style='font-size:25px; width:70px' onclick='document.location=\"/set-scale?scale="+String(i)+"\"'> "; str += String() + (gScale == i ? "* " : "") + i; str += "</button>\n"; } str += "<br><br>"; str += "brightness: " + String(gBrightness) + "<br>"; for(int i = 0; i < 255; i+=20){ str += " <button style='font-size:25px' onclick='document.location=\"/set-brightness?brightness="+String(i)+"\"'> "; str += String() + (gBrightness == i ? "* " : "") + i; str += "</button>\n"; } webService.server->send(200, "text/html; charset=utf-8", str); }); webService.server->on("/set-mode", [](){ gCurrentMode = atoi(webService.server->arg(0).c_str()) % MODE_COUNT; saveTheConfig(); publishState(); webService.server->sendHeader("Location", "/",true); //Redirect to index webService.server->send(302, "text/plane",""); }); webService.server->on("/set-speed", [](){ gModeConfigs[gCurrentMode].speed = atoi(webService.server->arg(0).c_str()); saveTheConfig(); publishState(); webService.server->sendHeader("Location", "/",true); //Redirect to index webService.server->send(302, "text/plane",""); }); webService.server->on("/set-scale", [](){ gModeConfigs[gCurrentMode].scale = atoi(webService.server->arg(0).c_str()); saveTheConfig(); publishState(); webService.server->sendHeader("Location", "/",true); //Redirect to index webService.server->send(302, "text/plane",""); }); webService.server->on("/set-brightness", [](){ gBrightness = atoi(webService.server->arg(0).c_str()); FastLED.setBrightness(gBrightness); saveTheConfig(); publishState(); webService.server->sendHeader("Location", "/",true); //Redirect to index webService.server->send(302, "text/plane",""); }); webService.server->on("/restart", [menu](){ if(webService.server->method() == HTTP_POST){ webService.server->sendHeader("Location", "/",true); //Redirect to index webService.server->send(200, "text/html", "<script> setTimeout(()=> document.location = '/', 5000) </script> restarting ESP ..."); gRestart = millis(); } else{ String output = ""; output += menu; output += "<form method='post'><button>Restart ESP</button></form>"; webService.server->send(200, "text/html", output); } }); webService.server->on("/turn-off", [menu](){ if(webService.server->method() == HTTP_POST){ webService.server->send(200, "text/html", "OK"); digitalWrite(MOSFET_PIN, LOW); ESP.deepSleep(0); } else{ String output = ""; output += menu; output += "<form method='post'><button>Turn off the MOSFET and go to deep sleep mode</button></form>"; webService.server->send(200, "text/html", output); } }); // Logout (reset wifi settings) webService.server->on("/logout", [menu](){ if(webService.server->method() == HTTP_POST){ webService.server->send(200, "text/html", "OK"); wifiManager.resetSettings(); ESP.reset(); } else{ String output = ""; output += menu; output += String() + "<pre>"; output += String() + "Wifi network: " + WiFi.SSID() + " \n"; output += String() + " RSSI: " + WiFi.RSSI() + " \n"; output += String() + " hostname: " + WiFi.hostname() + " \n"; output += String() + "</pre>"; output += "<form method='post'><button>Forget</button></form>"; webService.server->send(200, "text/html", output); } }); // Setup MQTT subscription for the 'set' topic. mqtt.subscribe(&mqttSubscription); mqttSubscription.setCallback([](char *str, uint16_t len){ char buf [len + 1]; buf[len] = 0; strncpy(buf, str, len); Serial.println(String("Got mqtt message: ") + buf); const int JSON_SIZE = 1024; DynamicJsonDocument root(JSON_SIZE); DeserializationError error = deserializeJson(root, buf); if(error) return; if(root.containsKey("mode")){ int mode = root["mode"]; while(mode < 0) mode += MODE_COUNT; gCurrentMode = (mode % MODE_COUNT); // 0..17 } if(root.containsKey("speed")) gModeConfigs[gCurrentMode].speed = root["speed"]; if(root.containsKey("scale")) gModeConfigs[gCurrentMode].scale = root["scale"]; if(root.containsKey("brightness")){ gBrightness = root["brightness"]; FastLED.setBrightness(gBrightness); } saveTheConfig(); publishState(); }); ArduinoOTA.begin(); //myBroker.init(); Serial.println("*** end setup ***"); publishState(); } void loop() { effectsLoop(); webService.loop(); ArduinoOTA.handle(); // Ensure the connection to the MQTT server is alive (this will make the first // connection and automatically reconnect when disconnected). See the MQTT_connect() MQTT_connect(&mqtt); if(millis() > lastVccMeasureTime + VCC_MEASURE_INTERVAL) { vccQueue.add(getVcc()); lastVccMeasureTime = millis(); // turn off if battery is low if(vccQueue.isFull() && vccQueue.average() + VCC2BAT_CORRECTION <= TURN_OFF_VOLTAGE){ digitalWrite(MOSFET_PIN, LOW); ESP.deepSleep(0); } } if(millis() > lastPublishTime + MQTT_PUBLISH_INTERVAL) { publishState(); lastPublishTime = millis(); } // wait X milliseconds for subscription messages mqtt.processPackets(10); if(gRestart && millis() - gRestart > 1000){ ESP.restart(); } }
[ "phplego@gmail.com" ]
phplego@gmail.com
7d6b45e37c467e12913c9851b378dd3bad8702b5
21d3d43d0b627233596d0102ad22ffcbca9e17f2
/알고리즘공부/알고리즘특강/백준 -16987 계란으로 바위치기.cpp
fdb1c4f3a73db5de956a2821e051268af6419af5
[]
no_license
kyhoon001/TIL
581963c949d5da321a26a00df67a727cdc68d84f
2515e89eb1b335118d813017f4127c23836d4e7c
refs/heads/master
2020-09-28T17:25:04.475133
2020-09-10T00:37:21
2020-09-10T00:37:21
226,824,007
1
1
null
null
null
null
UTF-8
C++
false
false
978
cpp
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<string.h> #include<vector> using namespace std; int n; int arr[10][2]; int check[10]; // 0은 내구도 // 1은 무게 int answer = -1; void solve(int a) { if (a == n) { int cnt = 0; for (int i = 0; i < n; i++) { if (arr[i][0] <= 0) cnt++; } answer = max(answer, cnt); return; } if (arr[a][0] <= 0) { solve(a + 1); // 깨져있을 때. return; } bool strike = false; for (int i = 0; i < n; i++) { if (i == a || arr[i][0] <= 0) continue; arr[a][0] -= arr[i][1]; arr[i][0] -= arr[a][1]; strike = true; solve(a + 1); arr[a][0] += arr[i][1]; arr[i][0] += arr[a][1]; } if (strike == false) { solve(n); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; memset(check, 0, sizeof(check)); for (int i = 0; i < n; i++) { cin >> arr[i][0] >> arr[i][1]; } solve(0); cout << answer << endl; return 0; }
[ "kyhoon001@naver.com" ]
kyhoon001@naver.com
6270af5bcb21fe1706c227f982bfebd3570dec70
4f4d3ec9bca4e2acb085a0c77e5cd3ed1b43b98d
/DFS/1743.cpp
353a516efb2d5e0c8bc160a339bdc5d11d963f69
[]
no_license
Jeonghwan-Yoo/BOJ
5293c181e17ea3bcd7f15e3a9e1df08d3a885447
5f2018106a188ce36b15b9ae09cf68da4566ec99
refs/heads/master
2021-03-05T02:36:45.338480
2021-01-20T12:43:40
2021-01-20T12:43:40
246,088,916
0
0
null
null
null
null
UTF-8
C++
false
false
1,354
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int constexpr dy[4] = { -1, 0, 1, 0 }; int constexpr dx[4] = { 0, 1, 0, -1 }; int N, M, K; int Dfs(int y, int x, vector<vector<int>> &board, vector<vector<int>> &visited) { int ret = 1; for (int dir = 0; dir < 4; ++dir) { int ny = y + dy[dir]; int nx = x + dx[dir]; if (ny <= 0 || ny > N || nx <= 0 || nx > M) continue; if (visited[ny][nx]) continue; visited[ny][nx] = 1; if (board[ny][nx]) ret += Dfs(ny, nx, board, visited); } return ret; } int main() { freopen("in.txt", "r", stdin); ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> M >> K; vector<vector<int>> board(N + 1, vector<int>(M + 1)); for (int i = 0; i < K; ++i) { int r, c; cin >> r >> c; board[r][c] = 1; } vector<vector<int>> visited(N + 1, vector<int>(M + 1)); int maxSize = 0; for (int i = 1; i <= N; ++i) { for (int j = 1; j <= M; ++j) { if (visited[i][j]) continue; visited[i][j] = 1; if (board[i][j]) maxSize = max(maxSize, Dfs(i, j, board, visited)); } } cout << maxSize; return 0; }
[ "dwgbjdhks2@gmail.com" ]
dwgbjdhks2@gmail.com
7a478afa5f3570d2744317ef7e0a544a58e06dd5
8bd2314d1e4d1d474a9378b9f57125df4f89291e
/1001.cpp
5f5a31a1776189640719c828828360c842260d72
[]
no_license
18237257328/my_c_code
84e46b5a44e62c5d06a005d23e0174f601695ef8
b082e52c272341135a50b3092cfe86f204dc612c
refs/heads/master
2020-06-26T20:44:17.288224
2019-09-22T09:05:52
2019-09-22T09:05:52
199,752,761
0
0
null
null
null
null
GB18030
C++
false
false
1,182
cpp
/* Pta题目1001 害死人不偿命的(3n+1)猜想 (15 分) 卡拉兹(Callatz)猜想: 对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证 (3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄意延缓美国数学界教学与科研的进展…… 我们今天的题目不是证明卡拉兹猜想,而是对给定的任一不超过 1000 的正整数 n,简单地数一下,需要多少步(砍几下)才能得到 n=1? 输入格式: 每个测试输入包含 1 个测试用例,即给出正整数 n 的值。 输出格式: 输出从 n 计算到 1 需要的步数。 输入样例: 3 输出样例: 5 */ #include<stdio.h> int main(void) { int n,t=0; scanf ("%d",&n); while(1) { if (n==1) break; if (n%2==0) n=n/2; else n=((3*n)+1)/2; t++; } printf ("%d",t); return 0; }
[ "2972866128@qq.com" ]
2972866128@qq.com
a1cda40cdb5e9ab853ef67fdc940532bf1c0707e
f3c8d78b4f8af9a5a0d047fbae32a5c2fca0edab
/Qt/mega_git_tests/sensors/Test_MPU-6050/src/test_glwidget/src/test_glwidget.hpp
a440ff3cdc0ea3f0d9849769f18205355074f0dd
[]
no_license
RinatB2017/mega_GIT
7ddaa3ff258afee1a89503e42b6719fb57a3cc32
f322e460a1a5029385843646ead7d6874479861e
refs/heads/master
2023-09-02T03:44:33.869767
2023-08-21T08:20:14
2023-08-21T08:20:14
97,226,298
5
2
null
2022-12-09T10:31:43
2017-07-14T11:17:39
C++
UTF-8
C++
false
false
3,510
hpp
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef TEST_GLWIDGET_HPP #define TEST_GLWIDGET_HPP //-------------------------------------------------------------------------------- #include <QGLWidget> //-------------------------------------------------------------------------------- #include "logo.h" //-------------------------------------------------------------------------------- #define NO_MOUSE //-------------------------------------------------------------------------------- class Test_GLWidget : public QGLWidget { Q_OBJECT public: explicit Test_GLWidget(QWidget *parent = nullptr); virtual ~Test_GLWidget(); public slots: void setXRotation(int angle); void setYRotation(int angle); void setZRotation(int angle); signals: void xRotationChanged(int angle); void yRotationChanged(int angle); void zRotationChanged(int angle); protected: void initializeGL(void) override; void resizeGL(int width, int height) override; void paintGL(void) override; }; //-------------------------------------------------------------------------------- #endif
[ "tux4096@gmail.com" ]
tux4096@gmail.com
7ad7534442e263c2e69d5e44d711b92fbc3e25d9
e16dac5f76a7c57616c474aa1e252e9a37aee47a
/facebookEgo.cpp
46269d2df7b829f8894af86fa9ce27154c71d9ac
[]
no_license
srinivasbalaji-1/openmpProject
c18d0a39600e7849b588662eb00a23ed58fb120d
3ec6911088e6c60ae32814fa2a002f56e8f49c47
refs/heads/master
2021-01-15T21:44:27.960948
2014-04-11T19:37:34
2014-04-11T19:37:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,411
cpp
#include<climits> #include<fstream> #include<cmath> #include<algorithm> #include<iostream> #include<omp.h> #define d 0.85 #define epsilon 0.0000001 using namespace std; int main() { ifstream input("facebook_combined.txt"); ofstream out("task_1.txt"); int a, b, i, j; int count1 =0; int tid, nthreads; int max = INT_MIN; int nValue = 0; int chunk = 500; double sumOfErrorSquared = 0.0; bool flag = false; while (input >> a >> b) { max = a > max ? a : max; max = b > max ? b : max; } printf("%d", max); input.clear(); input.seekg(0, input.beg); max++; const int size = max; double **adjacencyMatrix; adjacencyMatrix = new double*[size]; for(i=0;i<size;i++) { adjacencyMatrix[i] = new double[size]; } double oldPageRank[size],newPageRank[size]; int count[size]; //------------------------Initialize the adjacency matrix to zero--------------------------- for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { adjacencyMatrix[i][j] = 0; } oldPageRank[i] = 1.0; newPageRank[i] = 0.0; count[i] = 0; } //---------------------Read the input file and set adjacency matrix-------------------------- while (input >> a >> b) { adjacencyMatrix[a][b] = 1; adjacencyMatrix[b][a] = 1; nValue++; } nValue *= 2; input.close(); //------------------------------Normalize the adjacency matrix------------------------------- for(j=0;j<size;j++) { for(i=0;i<size;i++) { count[j] = adjacencyMatrix[i][j]==1 ? count[j]+1:count[j]; } } for(j=0;j<size;j++) { for(i=0;i<size;i++) { if(count[j]!=0) adjacencyMatrix[i][j] = adjacencyMatrix[i][j]/count[j]; } } #pragma omp parallel shared(max,adjacencyMatrix,nthreads,chunk,oldPageRank,newPageRank,count1) private(tid,i,j) { tid = omp_get_thread_num(); if (tid == 0) { nthreads = omp_get_num_threads(); } #pragma omp for schedule (static,chunk) for (j = 0; j < size; j++) { oldPageRank[j] = 1.0/(max); } while (!flag) { count1++; sumOfErrorSquared = 0.0; #pragma omp for schedule (static,chunk) for (i = 0; i < size; i++) { newPageRank[i] = 0; for (j = 0; j < size; j++) { newPageRank[i] = newPageRank[i] + (adjacencyMatrix[i][j] * oldPageRank[j]); } newPageRank[i] = ((1-d)/(max))+ (d*newPageRank[i]); } #pragma omp for schedule (static,chunk) for (i = 0; i < max; i++) { sumOfErrorSquared += pow(newPageRank[i] - oldPageRank[i], 2); } #pragma omp for schedule (static,chunk) for(i=0;i<max;i++){ oldPageRank[i] = newPageRank[i]; } flag = sumOfErrorSquared > (max) * pow(epsilon, 2) ? false : true; printf("%d\n",count1); } } //sort(newPageRank,newPageRank+size); int min = count[0]; int minj = 0; for (i = 0; i < size; i++) { out << i << "\t" << newPageRank[i]<<endl; min = count[i]<min ? count[i]:min; minj = count[i]==min ? i:minj; } return 0; }
[ "198srinivas@gmail.com" ]
198srinivas@gmail.com
0f47db337cc779e3cd318f762488874fafab8653
2d4bdc08f00d7077f3b0cc37bfc99c0a2ef231ca
/GH Injector Library/LdrLoadDll WOW64.cpp
e1d7876efe769c91703885acb3e29c54c67072ba
[]
no_license
pokevas/GH-Injector-Library
49abd1743780553b8149582bf9109cd4eb9c35c7
bfd2cda727e9e031cbbb89d6f5fa1a6d6c1a7bea
refs/heads/master
2022-05-17T18:56:23.145061
2020-04-06T21:12:27
2020-04-06T21:12:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,939
cpp
#include "pch.h" #ifdef _WIN64 #include "LdrLoadDll.h" #pragma comment (lib, "Psapi.lib") BYTE LdrLoadDll_Shell_WOW64[] = { 0x55, 0x8B, 0xEC, 0x56, 0x8B, 0x75, 0x08, 0x85, 0xF6, 0x75, 0x0A, 0xB8, 0x01, 0x00, 0x20, 0x00, 0x5E, 0x5D, 0xC2, 0x04, 0x00, 0x8B, 0x4E, 0x04, 0x85, 0xC9, 0x75, 0x0A, 0xB8, 0x02, 0x00, 0x20, 0x00, 0x5E, 0x5D, 0xC2, 0x04, 0x00, 0x8D, 0x46, 0x14, 0x56, 0x89, 0x46, 0x10, 0x8D, 0x46, 0x0C, 0x50, 0x6A, 0x00, 0x6A, 0x00, 0xFF, 0xD1, 0x33, 0xC9, 0x89, 0x46, 0x08, 0x85, 0xC0, 0xBA, 0x03, 0x00, 0x20, 0x00, 0x5E, 0x0F, 0x48, 0xCA, 0x8B, 0xC1, 0x5D, 0xC2, 0x04, 0x00 }; DWORD _LdrLoadDll_WOW64(const wchar_t * szDllFile, HANDLE hTargetProc, LAUNCH_METHOD Method, DWORD Flags, HINSTANCE & hOut, ERROR_DATA & error_data) { LDR_LOAD_DLL_DATA_WOW64 data{ 0 }; data.pModuleFileName.MaxLength = sizeof(data.Data); size_t size_out = 0; HRESULT hr = StringCbLengthW(szDllFile, data.pModuleFileName.MaxLength, &size_out); if (FAILED(hr)) { INIT_ERROR_DATA(error_data, (DWORD)hr); return INJ_ERR_STRINGC_XXX_FAIL; } hr = StringCbCopyW(ReCa<wchar_t *>(data.Data), data.pModuleFileName.MaxLength, szDllFile); if (FAILED(hr)) { INIT_ERROR_DATA(error_data, (DWORD)hr); return INJ_ERR_STRINGC_XXX_FAIL; } data.pModuleFileName.Length = (WORD)size_out; if (!REMOTE::LdrLoadDll_WOW64) { void * pLdrLoadDll = nullptr; if (!GetProcAddressEx_WOW64(hTargetProc, TEXT("ntdll.dll"), "LdrLoadDll", pLdrLoadDll)) { INIT_ERROR_DATA(error_data, INJ_ERR_ADVANCED_NOT_DEFINED); return INJ_ERR_LDRLOADDLL_MISSING; } REMOTE::LdrLoadDll_WOW64 = MDWD(pLdrLoadDll); } data.pLdrLoadDll = REMOTE::LdrLoadDll_WOW64; ULONG_PTR ShellSize = sizeof(LdrLoadDll_Shell_WOW64); BYTE * pAllocBase = ReCa<BYTE*>(VirtualAllocEx(hTargetProc, nullptr, sizeof(LDR_LOAD_DLL_DATA_WOW64) + ShellSize + 0x10, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE)); BYTE * pArg = pAllocBase; BYTE * pShell = ReCa<BYTE*>(ALIGN_UP(ReCa<ULONG_PTR>(pArg + sizeof(LDR_LOAD_DLL_DATA_WOW64)), 0x10)); if (!pArg) { INIT_ERROR_DATA(error_data, GetLastError()); return INJ_ERR_OUT_OF_MEMORY_EXT; } if (!WriteProcessMemory(hTargetProc, pArg, &data, sizeof(LDR_LOAD_DLL_DATA_WOW64), nullptr)) { INIT_ERROR_DATA(error_data, GetLastError()); VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); return INJ_ERR_WPM_FAIL; } if (!WriteProcessMemory(hTargetProc, pShell, LdrLoadDll_Shell_WOW64, ShellSize, nullptr)) { INIT_ERROR_DATA(error_data, GetLastError()); VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); return INJ_ERR_WPM_FAIL; } DWORD remote_ret = 0; DWORD dwRet = StartRoutine_WOW64(hTargetProc, MDWD(pShell), MDWD(pArg), Method, (Flags & INJ_THREAD_CREATE_CLOAKED) != 0, remote_ret, error_data); if (dwRet != SR_ERR_SUCCESS) { if (Method != LAUNCH_METHOD::LM_QueueUserAPC && !(Method == LAUNCH_METHOD::LM_HijackThread && dwRet == SR_HT_ERR_REMOTE_TIMEOUT)) { VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); } return dwRet; } else if (remote_ret != INJ_ERR_SUCCESS) { if (Method != LAUNCH_METHOD::LM_QueueUserAPC) { VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); } return remote_ret; } if (!ReadProcessMemory(hTargetProc, pAllocBase, &data, sizeof(LDR_LOAD_DLL_DATA_WOW64), nullptr)) { INIT_ERROR_DATA(error_data, GetLastError()); if (Method != LAUNCH_METHOD::LM_QueueUserAPC) { VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); } return INJ_ERR_VERIFY_RESULT_FAIL; } if (Method != LAUNCH_METHOD::LM_QueueUserAPC) { VirtualFreeEx(hTargetProc, pAllocBase, 0, MEM_RELEASE); } if (remote_ret != INJ_ERR_SUCCESS) { INIT_ERROR_DATA(error_data, (DWORD)data.ntRet); return remote_ret; } if (!data.hRet) { INIT_ERROR_DATA(error_data, INJ_ERR_ADVANCED_NOT_DEFINED); return INJ_ERR_FAILED_TO_LOAD_DLL; } hOut = ReCa<HINSTANCE>(MPTR(data.hRet)); return INJ_ERR_SUCCESS; } #endif
[ "konradherrmann@t-online.de" ]
konradherrmann@t-online.de
fa90131aa6caa6de19d4a4900713551383a9ba10
49151ac1b9d9e99b360cc9eecc6a89572a1f26fe
/Marbles/Marbles.cpp
66fbeabb8cd14fc28d4114b266224faae3f487f0
[ "MIT" ]
permissive
toadgee/marbles
018393ad5f6812680c95a3a6f93983834b5082d1
d24c3f3425459fdb2429cfc1bff83613e8dfde45
refs/heads/master
2023-04-21T15:06:38.197722
2023-03-26T00:45:13
2023-03-26T00:45:13
147,553,978
0
0
null
null
null
null
UTF-8
C++
false
false
4,637
cpp
#include "precomp.h" #include "Descriptions.h" #include "Game.h" #include "ComputerPlayer.h" #include "ConsoleUtilities.h" #include "ConsolePlayer.h" #include "RandomPlayerColor.h" void AddPlayersToGame(TGMGame* game, Strategy team1, Strategy team2, bool outputHowTheComputerWouldDo); void DoGame(TGMGame* game, Strategy team1, Strategy team2); void AddPlayersToGame(TGMGame* game, Strategy team1, Strategy team2, bool outputHowTheComputerWouldDo) { // generate random colors for the 6 players PlayerColor color1; PlayerColor color2; PlayerColor color3; PlayerColor color4; PlayerColor color5; PlayerColor color6; GenerateRandomColors(GameGetRandomNumberGenerator(game), &color1, &color2, &color3, &color4, &color5, &color6); // team 1 GameAddPlayer(game, CreateComputerPlayer("Aubrey", team1, color1)); GameAddPlayer(game, CreateComputerPlayer("Katie", team1, color3)); GameAddPlayer(game, CreateComputerPlayer("Shauna", team1, color5)); // team 2 GameAddPlayer(game, CreateComputerPlayer("Jason", team2, color2)); GameAddPlayer(game, CreateComputerPlayer("Ryan", team2, color4)); GameAddPlayer(game, CreateConsolePlayer(color6, game, outputHowTheComputerWouldDo)); } void DoGame(TGMGame* game, Strategy team1, Strategy team2) { for (PlayerColor pc = PlayerColor::Min; pc <= PlayerColor::Max; IteratePlayerColor(pc)) { TGMPlayer* player = GamePlayerForColor(game, pc); std::ostringstream str; str << PlayerGetName(player); str << " - "; str << StrategyToString(PlayerGetStrategy(player)); std::string coloredString = ColoredString(PlayerGetColor(player), str.str().c_str()); printf("%s\n", coloredString.c_str()); } // do one simulation here so that we can see if we'd win or lose SimulateGame(game, nullptr, true); // run game GameStartNew(game); } void RunConsoleGame() { while (true) { // TODO : improve reading names, strategies, colors Strategy team1 = Strategy::DefensiveAggressive; Strategy team2 = Strategy::DefensiveAggressive; bool onlyTryLosingGames = false; if (/* DISABLES CODE */ (false)) { for (int i = static_cast<int>(Strategy::Min); i <= static_cast<int>(Strategy::Max); i++) { const Strategy ms = static_cast<Strategy>(i); if (ms == Strategy::Human) continue; printf("%d) %s\n", i, StrategyToString(ms).c_str()); } int strat = static_cast<int>(Strategy::Max) + 1; while (strat == static_cast<int>(Strategy::Max) + 1) { strat = ConsoleGetInputNumber("Enter strategy of opposing team", static_cast<int>(Strategy::Max) + 1, static_cast<int>(Strategy::Min), static_cast<int>(Strategy::Max)); if (static_cast<Strategy>(strat) == Strategy::Human) { strat = static_cast<int>(Strategy::Max) + 1; } } team1 = static_cast<Strategy>(strat); strat = static_cast<int>(Strategy::Max) + 1; while (strat == static_cast<int>(Strategy::Max) + 1) { strat = ConsoleGetInputNumber("Enter strategy of your team", static_cast<int>(Strategy::Max) + 1, static_cast<int>(Strategy::Min), static_cast<int>(Strategy::Max)); if (static_cast<Strategy>(strat) == Strategy::Human) { strat = static_cast<int>(Strategy::Max) + 1; } } team2 = static_cast<Strategy>(strat); printf("Opposing team is %s\n", StrategyToString(team1).c_str()); printf("Your team is %s\n", StrategyToString(team2).c_str()); } //if (false) { while (true) { std::string input { ConsoleGetInput("Would you like to only play games that the computer could not have win if it played for you? (y/N)") }; #if WIN32 if (_stricmp(input.c_str(), "y") == 0) #else if (strcasecmp(input.c_str(), "y") == 0) #endif { onlyTryLosingGames = true; break; } #if WIN32 else if ((_stricmp(input.c_str(), "n") == 0) || (input.size() == 0)) #else else if ((strcasecmp(input.c_str(), "n") == 0) || (input.size() == 0)) #endif { onlyTryLosingGames = false; break; } printf("Unknown input\n"); } } #ifdef DEBUG TGRandom* rng = CreateRandomWithSeed(101); #else TGRandom* rng = CreateRandomAndSeed(); #endif TGMGame* game = CreateGame(nullptr, rng); AddPlayersToGame(game, team1, team2, onlyTryLosingGames); bool playerTeamWon = true; while (onlyTryLosingGames && playerTeamWon) { SimulateGame(game, &playerTeamWon, false); if (playerTeamWon) { game = CreateGame(nullptr, rng); AddPlayersToGame(game, team1, team2, onlyTryLosingGames); } } printf("Game ID : %u\n\n", RandomSeed(GameGetRandomNumberGenerator(game))); DoGame(game, team1, team2); // TODO : Play again? break; } }
[ "toadgee@gmail.com" ]
toadgee@gmail.com
051fee16ec3bcb68d036ef5beddb3fc056c351c4
1f63dde39fcc5f8be29f2acb947c41f1b6f1683e
/Boss2D/addon/_old/webrtc-qt5.11.2_for_boss/modules/rtp_rtcp/source/rtp_format_video_generic.cc
c9423b853f9599e32e9f8f8809ef44c3023e6926
[ "LicenseRef-scancode-google-patent-license-webrtc", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "GPL-1.0-or-later", "LicenseRef-scancode-takuya-ooura", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown", "MS-LPL", "MIT", "LicenseRef-scancode-google-patent-licen...
permissive
koobonil/Boss2D
09ca948823e0df5a5a53b64a10033c4f3665483a
e5eb355b57228a701495f2660f137bd05628c202
refs/heads/master
2022-10-20T09:02:51.341143
2019-07-18T02:13:44
2019-07-18T02:13:44
105,999,368
7
2
MIT
2022-10-04T23:31:12
2017-10-06T11:57:07
C++
UTF-8
C++
false
false
5,372
cc
/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include <string> #include BOSS_WEBRTC_U_modules__include__module_common_types_h //original-code:"modules/include/module_common_types.h" #include "modules/rtp_rtcp/source/rtp_format_video_generic.h" #include "modules/rtp_rtcp/source/rtp_packet_to_send.h" #include BOSS_WEBRTC_U_rtc_base__logging_h //original-code:"rtc_base/logging.h" namespace webrtc { static const size_t kGenericHeaderLength = 1; RtpPacketizerGeneric::RtpPacketizerGeneric(FrameType frame_type, size_t max_payload_len, size_t last_packet_reduction_len) : payload_data_(NULL), payload_size_(0), max_payload_len_(max_payload_len - kGenericHeaderLength), last_packet_reduction_len_(last_packet_reduction_len), frame_type_(frame_type), num_packets_left_(0), num_larger_packets_(0) {} RtpPacketizerGeneric::~RtpPacketizerGeneric() { } size_t RtpPacketizerGeneric::SetPayloadData( const uint8_t* payload_data, size_t payload_size, const RTPFragmentationHeader* fragmentation) { payload_data_ = payload_data; payload_size_ = payload_size; // Fragment packets such that they are almost the same size, even accounting // for larger header in the last packet. // Since we are given how much extra space is occupied by the longer header // in the last packet, we can pretend that RTP headers are the same, but // there's last_packet_reduction_len_ virtual payload, to be put at the end of // the last packet. // size_t total_bytes = payload_size_ + last_packet_reduction_len_; // Minimum needed number of packets to fit payload and virtual payload in the // last packet. num_packets_left_ = (total_bytes + max_payload_len_ - 1) / max_payload_len_; // Given number of packets, calculate average size rounded down. payload_len_per_packet_ = total_bytes / num_packets_left_; // If we can't divide everything perfectly evenly, we put 1 extra byte in some // last packets: 14 bytes in 4 packets would be split as 3+3+4+4. num_larger_packets_ = total_bytes % num_packets_left_; RTC_DCHECK_LE(payload_len_per_packet_, max_payload_len_); generic_header_ = RtpFormatVideoGeneric::kFirstPacketBit; if (frame_type_ == kVideoFrameKey) { generic_header_ |= RtpFormatVideoGeneric::kKeyFrameBit; } return num_packets_left_; } bool RtpPacketizerGeneric::NextPacket(RtpPacketToSend* packet) { RTC_DCHECK(packet); if (num_packets_left_ == 0) return false; // Last larger_packets_ packets are 1 byte larger than previous packets. // Increase per packet payload once needed. if (num_packets_left_ == num_larger_packets_) ++payload_len_per_packet_; size_t next_packet_payload_len = payload_len_per_packet_; if (payload_size_ <= next_packet_payload_len) { // Whole payload fits into this packet. next_packet_payload_len = payload_size_; if (num_packets_left_ == 2) { // This is the penultimate packet. Leave at least 1 payload byte for the // last packet. --next_packet_payload_len; RTC_DCHECK_GT(next_packet_payload_len, 0); } } RTC_DCHECK_LE(next_packet_payload_len, max_payload_len_); uint8_t* out_ptr = packet->AllocatePayload(kGenericHeaderLength + next_packet_payload_len); // Put generic header in packet. out_ptr[0] = generic_header_; // Remove first-packet bit, following packets are intermediate. generic_header_ &= ~RtpFormatVideoGeneric::kFirstPacketBit; // Put payload in packet. memcpy(out_ptr + kGenericHeaderLength, payload_data_, next_packet_payload_len); payload_data_ += next_packet_payload_len; payload_size_ -= next_packet_payload_len; --num_packets_left_; // Packets left to produce and data left to split should end at the same time. RTC_DCHECK_EQ(num_packets_left_ == 0, payload_size_ == 0); packet->SetMarker(payload_size_ == 0); return true; } std::string RtpPacketizerGeneric::ToString() { return "RtpPacketizerGeneric"; } bool RtpDepacketizerGeneric::Parse(ParsedPayload* parsed_payload, const uint8_t* payload_data, size_t payload_data_length) { assert(parsed_payload != NULL); if (payload_data_length == 0) { RTC_LOG(LS_ERROR) << "Empty payload."; return false; } uint8_t generic_header = *payload_data++; --payload_data_length; parsed_payload->frame_type = ((generic_header & RtpFormatVideoGeneric::kKeyFrameBit) != 0) ? kVideoFrameKey : kVideoFrameDelta; parsed_payload->type.Video.is_first_packet_in_frame = (generic_header & RtpFormatVideoGeneric::kFirstPacketBit) != 0; parsed_payload->type.Video.codec = kRtpVideoGeneric; parsed_payload->type.Video.width = 0; parsed_payload->type.Video.height = 0; parsed_payload->payload = payload_data; parsed_payload->payload_length = payload_data_length; return true; } } // namespace webrtc
[ "slacealic@nate.com" ]
slacealic@nate.com
a2dd0a29f54b6f914e0321e18caab1b7407a4d30
8769f635568f14dacf14e37faf6253f6318804c5
/ABC/abc194/c.cpp
7ca09bceab12fc473f19d832a813662278e7ebf8
[]
no_license
hjmkt/AtCoder
8f823de8cd12a8fa34c872788a3b8a89601c6b60
f9dfa2968b53255a356803235d77e169c04ed0e6
refs/heads/master
2023-06-01T10:04:54.893062
2023-05-24T08:35:12
2023-05-24T08:35:12
181,178,130
0
0
null
null
null
null
UTF-8
C++
false
false
791
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>; #define REP(i, n, m) for(ll i=n; i<(ll)m; ++i) #define IREP(i, n, m) for(ll i=n-1; i>=m; --i) #define rep(i, n) REP(i, 0, n) #define irep(i, n) IREP(i, n, 0) #define all(v) v.begin(), v.end() #define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl; #define vvprint(vv) for(auto v:vv){vprint(v)}; int main(){ cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(20); ll N; cin >> N; vll A(N); rep(i, N) cin >> A[i]; vll B(401, 0); rep(i, N) ++B[A[i]+200]; ll s = 0; rep(i, 401){ REP(j, i+1, 401){ s += B[i]*B[j]*(i-j)*(i-j); } } cout << s << endl; }
[ "hjmkt3126@gmail.com" ]
hjmkt3126@gmail.com
dcbc121c432af8f55053d5bb801d2d440f6227c9
f6be60be84271d747ed35a371f993cb9b74190eb
/OpenGLTemple/src/minesweeper/Minesweeper.h
c92328aa1d341811135b37cf7d61ea5ea017c05e
[]
no_license
jaccen/DeallyEngine
e2e8ccf58c9d1dea34608d79b660f7571643f1c0
27ec95d90ec450bfd0b56c50c391c4c12ff8f3ca
refs/heads/master
2023-04-14T16:23:42.761382
2023-04-07T07:37:51
2023-04-07T07:37:51
92,156,474
0
2
null
2022-12-13T04:20:15
2017-05-23T09:46:54
C++
UTF-8
C++
false
false
1,604
h
#ifndef MINESWEEPER_H_ #define MINESWEEPER_H_ #include "MineMap.h" #include "MineMapRenderer.h" #include "DigitRenderer.h" #include "MinesweeperDefs.h" #include "PreferencesManager.h" #include "Timer.hpp" namespace minesweeper { class Minesweeper { private: MineMap m_mineMap; int16_t m_mineMapMouseX; int16_t m_mineMapMouseY; int16_t m_remainingMineCount; ImVec2 m_viewportCenter; float m_recordTime; uint8_t m_recordRank; DifficultySelection m_difficulty; Timer m_timer; MineMapRenderer m_mineMapRenderer; DigitRenderer m_timerIntRenderer; DigitRenderer m_timerDecRenderer; DigitRenderer m_mineCountRenderer; enum { GAME_IDLE, GAME_PLAYING, GAME_WIN, GAME_WIN_NEW_RECORD, GAME_LOSE, GAME_QUIT, UI_EDIT_CUSTOM, UI_EDIT_PLAYER_ID, UI_SHOW_RECORDS_WINDOW, UI_EDIT_PREFERENCES, } m_state, m_prevState; Preferences m_prevPref; void initGame(); void showTimer(); void showRemainingMineCount(); void showCustomEditor(); void showPlayerIDEditor(); void showPreferencesEditor(); void showMenuBar(); void showStatistics(int col); void showRecords(); void showRecordsWindow(); void showFinishWindow(); void showFinishWindowWithRecords(); void showMineMap(); Operation getOperation(); public: Minesweeper(); void init(); void update(); void renderGui(); bool shouldQuit() const { return m_state == GAME_QUIT; } void terminate(); }; } // namespace minesweeper #endif
[ "jaccen2007@163.com" ]
jaccen2007@163.com
e6bef3b562615b3e4b05c4a23175f937498b253a
641fa8341d8c436ad24945bcbf8e7d7d1dd7dbb2
/ash/common/system/tray/default_system_tray_delegate.h
81a98211091ba25cffbaa2327d373bcbf22cd592
[ "BSD-3-Clause" ]
permissive
massnetwork/mass-browser
7de0dfc541cbac00ffa7308541394bac1e945b76
67526da9358734698c067b7775be491423884339
refs/heads/master
2022-12-07T09:01:31.027715
2017-01-19T14:29:18
2017-01-19T14:29:18
73,799,690
4
4
BSD-3-Clause
2022-11-26T11:53:23
2016-11-15T09:49:29
null
UTF-8
C++
false
false
1,340
h
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_COMMON_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_ #define ASH_COMMON_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_ #include "ash/ash_export.h" #include "ash/common/system/tray/system_tray_delegate.h" #include "base/macros.h" namespace ash { class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate { public: DefaultSystemTrayDelegate(); ~DefaultSystemTrayDelegate() override; // SystemTrayDelegate: LoginStatus GetUserLoginStatus() const override; std::string GetSupervisedUserManager() const override; bool IsUserSupervised() const override; void GetSystemUpdateInfo(UpdateInfo* info) const override; bool ShouldShowSettings() const override; bool ShouldShowNotificationTray() const override; void ToggleBluetooth() override; bool IsBluetoothDiscovering() const override; bool GetBluetoothAvailable() override; bool GetBluetoothEnabled() override; bool GetBluetoothDiscovering() override; int GetSystemTrayMenuWidth() override; private: bool bluetooth_enabled_; DISALLOW_COPY_AND_ASSIGN(DefaultSystemTrayDelegate); }; } // namespace ash #endif // ASH_COMMON_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_
[ "xElvis89x@gmail.com" ]
xElvis89x@gmail.com
34494cc60ef686b0c1fc9bf2c3be097fb82e2af9
15c99b1509b58c63104510918b4802ec4b988730
/CUADRADOcpp/main.cpp
82912080844a701d9e141389445f9ea1f3579115
[]
no_license
YolotzinDS/TRAZOSdeFigurasPorElALGORITMOdda_Ybresenhans_YOLOTZIN_DOMINGUEZ_SANTOS_3061.CPP
261266652f52417e05cbc1bceef4ebfca85a960a
296982eca16e77f6ff55fe528ed6ba008a1f8bde
refs/heads/master
2023-05-09T16:55:57.706288
2021-05-29T19:45:37
2021-05-29T19:45:37
null
0
0
null
null
null
null
ISO-8859-10
C++
false
false
8,355
cpp
#include <graphics.h> #include <conio.h> #include <windows.h> #include <C:\Program Files (x86)\Dev-Cpp\include\GL\glut.h> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <iostream> #include <iomanip> //#include "CuadradoDDA.cpp" using namespace std; //definimos la svariables parra usar elm algoritmo dda int x_1 = 1 ; int y_1 =1; int x_2 =18; int y_2 =18 ; int Pasos, c, p; int dy, dx; int steps = 0; float xinc, yinc; float Pendiente; //brem, funcion que crea la imagen //descricpion geometrica de la imagen se va us void algoritmoBre(){//Contiene mas infor //PONER LOS PIXELES EN LA PEN. Pendiente = (dy * 1.0) + (dx * 1.0); int x = x_1; int y= y_1; dx= (x_2 - x_1); dy= (y_2 - y_1); Pasos = max(dy, dx); glClear(GL_COLOR_BUFFER_BIT); //Con esta funcion el color de la ventana glColor3f(1,1,1);//Establecer color de objeto glLoadIdentity(); //Plano Cartesiano glLineWidth(5.0); glColor3f(0.0471, 0.7176, 0.949); //sky blue glBegin(GL_LINES); glVertex2d(-20, 0); glVertex2d(20, 0); glVertex2d(0, 20); glVertex2d(0, -20); glEnd(); //lc glLineWidth (2.0); glColor3f(0, 2, 1); glBegin(GL_LINES); for(int j = 21; j > -20; j--){ //Lin h glVertex2f(-20, j + 0.5); glVertex2f(20, j + 0.5); } for(int j = 21; j > -20; j--){//Lin v glVertex2f( j + 0.5 , -20); glVertex2f( j + 0.5, 20); } glEnd(); glPointSize(18); //Se define el tamaņo del pixel dependiendo glBegin(GL_POINTS); glColor3f(1.0, 1.0, 0.0); glColor3f(4, 0.788, 0.41); //INICIO A Pendiente=(dy/dx); if (Pendiente==1){ //INIT A p= (2*dy-dx); for(int k = 0; k < p + 1 ; k++){ glVertex2d(round(x_1),round(y_1)); y_1++; cout <<"(" << x_1 <<","<< y_1 <<")" ","; } cout <<"\n";//funcion de la funcion for(int k = 0 ;k < p + 1 ; k++){ glVertex2d(round(x_1),round(y_1-1)); x_1= x_1 + 1; cout <<"(" << x_1 <<","<< y_1 <<")" ","; }cout <<"\n"; //ini de la funcion x2 for(int k = 0 ; k < p + 1 ; k++){ glVertex2d(round(x_2),round(y_1-1)); y_1--; cout <<"(" << x_2 <<","<< y_1 <<")" ","; } cout <<"\n"; for(int k = 0 ; k < p + 1 ; k++){ glVertex2d(round(x_2),round(y_1)); x_2--; cout <<"(" << x_2 <<","<< y_1 <<")" ","; } }else{ glutHideWindow(); } glEnd(); glFlush(); } void algoritmoDDA()//contiene { //delta dy = y_2 - y_1; dx = x_2 - x_1; //Pendiente = (dy * 1.0) / (dx * 1.0); Pendiente=(dy/dx); // Numero de pasos Pasos = max(dy, dx); glClear(GL_COLOR_BUFFER_BIT); //Con esta funcion el color de la ventana glColor3f(1,1,1);//Establecer color de objeto glLoadIdentity(); //Plano Cartesiano glLineWidth(5.0); glColor3f(0.0471, 0.7176, 0.949); // blue glBegin(GL_LINES); glVertex2d(-20, 0); glVertex2d(20, 0); glVertex2d(0, 20); glVertex2d(0, -20); glEnd(); //cruce glLineWidth (2.0); glColor3f(4, 2, 0); glBegin(GL_LINES); for(int j = 21; j > -20; j--){ //Lineas horizontales glVertex2f(-20, j + 0.5); glVertex2f(20, j + 0.5); } for(int j = 21; j > -20; j--)//Lineas verticales { glVertex2f( j + 0.5 , -20); glVertex2f( j + 0.5, 20); } glEnd(); glPointSize(18); //Se define el tamaņo del pixel dependera de que taņaņo lo quiera glBegin(GL_POINTS); //prin grefica glColor3f(1.0, 1.0, 0.0); glColor3f(1, 0, 1); if(dx>dy){ steps=dx; } else{ steps=dy; } yinc = dy/ steps; xinc = dx/ steps; if(Pendiente==1){ //COMIENZO DE UNA U OTRA for(int i=0;i<steps+1;i++){ glVertex2d(round(x_1),round(y_1)); y_1= y_1 + yinc; cout <<"(" << x_1 <<","<< y_1 <<")" ","; } cout << "\n"; //SEGUNDA PART for(int i=0;i<steps+1;i++){ glVertex2d(round(x_1),round(y_1-1)); x_1= x_1 + xinc; cout <<"(" << x_1 <<","<< y_1 <<")" ","; } cout << "\n"; /* PARTE 3*/for(int i=0 ; i < steps + 1 ; i++){ glVertex2d(round(x_2),round(y_1-1)); y_1= y_1 - yinc; cout <<"(" << x_2 <<","<< y_1 <<")" ","; } cout << "\n"; /* PAR ifn*/ for(int i = 0 ; i < steps + 1 ; i++){ glVertex2d(round(x_2),round(y_1)); x_2= x_2 - xinc; cout <<"(" << x_2 <<","<< y_1 <<")" ","; } }else{ glutHideWindow(); } //printf( " %f\n", x1 6 // // printf("x1 = %f", x1); glEnd(); glLineWidth(0.000001); glVertex2d(x_1 * 1.0, y_1 * 1.0); glVertex2d(x_2 * 1.0, y_2 * 1.0); glEnd();//Elemento paa que no se cierre la ventana glFlush(); // } void Init(){ glClearColor(1, 1,1, 0); //Color de pantalla de la 2da vengtana } void reshape(int width, int height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION);//Tipo de proyeccion glLoadIdentity(); //Asigna nr la matriz identidad como de proyecto glOrtho (-20, 20, -20, 20, -1, 1);//SSe debe de usar una proyeccion glMatrixMode(GL_MODELVIEW); } int eleccion; /* void menuRE(){ do{ system("cls"); cout << "CUADRADO, FAVOR DE SELECCIONAR EL METODO QUE " << endl ; cout << "[1].Salir " << endl ; cout << "[2].Volver " << endl ; cin >> e; switch (e){ system("cls"); case 1: exit (0); break; default: break; } }while( eleccion != 0); system("pause>null"); }*/ int main(int argc, char * argv[]){ system ("color 0b "); //COLOR PANT do{ system("cls"); cout << "CUADRADO, FAVOR DE SELECCIONAR EL METODO QUE " << endl ; cout << "[1].Metodo de ADD " << endl ; cout << "[2].Metodo de Bresen " << endl ; cout << "[3].Limpiar ventana " << endl ; cout << "[4]. Salir " << endl ; cin >> eleccion; switch (eleccion){ system("cls"); case 1: system ("color 0d "); cout << "HOLA la figura asi quedaria:) " << endl ; printf( "COORDENADA DE ORIGEN PARA X1: %d\n", x_1 ); printf( "COORDENADA DE ORIGEN PARA Y1: %d\n", y_1 ); printf( "COORDENADA DE ORIGEN PARA X2: %d\n", x_2 ); printf( "COORDENADA DE ORIGEN PARA Y2: %d\n", y_2 ); // cout << "Coordenada de origen pora Y= " ; cin >> y_1; // cout << "Ingrese cuanto pixeles sera el cuadrado " ; cin >> c; glutInit(&argc, argv); //Realizar inclinacion glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);//numero glutInitWindowSize(800, 800);//va ser cundo se va a establecer la altura y la anchura del pixel glutCreateWindow("Algoritmo DDA"); //se gegnerara una 2da ventana de visualizacion Init();//p.init glutDisplayFunc(algoritmoDDA);//signa img. glutReshapeFunc(reshape);//Cambio de tamaņo de la ventana actual glutMainLoop();//Con esta funcion las ventanas que hayan creado ; //cout << "Ingrese Y2: " ; cin >> y_2; break; case 2: system ("color 0a "); cout << "HOLA la figura asi quedaria:) " << endl ; printf( "COORDENADA DE ORIGEN PARA X1: %d\n", x_1 ); printf( "COORDENADA DE ORIGEN PARA Y1: %d\n", y_1 ); printf( "COORDENADA DE ORIGEN PARA X2: %d\n", x_2 ); printf( "COORDENADA DE ORIGEN PARA Y2: %d\n", y_2 ); // cout << "Coordenada de origen pora Y= " ; cin >> y_1; // cout << "Ingrese cuanto pixeles sera el cuadrado " ; cin >> c; glutInit(&argc, argv); //Realizar inclinacion glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);//numero glutInitWindowSize(800, 800);//va ser cundo se va a establecer la altura y la anchura del pixel glutCreateWindow("Algoritmo Bresem"); //se gegnerara una 2da ventana de visualizacion Init();//p.init glutDisplayFunc(algoritmoBre);//signa img. glutReshapeFunc(reshape);//Cambio de tamaņo de la ventana actual glutMainLoop();//Con esta funcion las ventanas que hayan creado ; //cout << "Ingrese Y2: " ; cin >> y_2; break; case 3: cleardevice(); break; case 4: system ("color 0C "); cout << "SALIENDO >_<" << endl ; cout << " >_<" << endl ; cout << " >_<" << endl ; exit (0); break; } }while( eleccion != 0); system("pause>null"); }
[ "yois.2018ds@gmail.com" ]
yois.2018ds@gmail.com
5787d4be3a06ae3d36596213c20a1751e95a05ed
bd8f4b06c13779dd9fcadd0160514cc6948498bd
/Project16/GameObjectManager.h
e71474ae8414967e0f29fde55db9de44b57ff773
[]
no_license
GP-R/Project16
35c0101d1fa74804b2dcb36dc7304c874ad7bb95
8dffd61679865454d21b412984577a7d83464502
refs/heads/master
2023-05-04T12:33:20.011960
2021-05-14T04:10:19
2021-05-14T04:10:19
363,035,796
0
0
null
null
null
null
UTF-8
C++
false
false
675
h
#pragma once #include"GameObject.h" class GameObjectManager { int capacity; GameObject** gos; public: GameObjectManager(int capacity) :capacity(capacity), gos((GameObject**)malloc(sizeof(GameObject*)*capacity)) { for (int i = 0; i < capacity; i++) { gos[i] = (GameObject*)nullptr; } } ~GameObjectManager() { for (int i = 0; i < capacity; i++) { if (gos[i] == nullptr) continue; delete gos[i]; gos[i] = (GameObject*)nullptr; } free(gos); gos = (GameObject**)nullptr; capacity = 0; } void add(GameObject* obj); void remove(GameObject* obj); GameObject** getGameObjects() { return gos; } int getCapacity() { return capacity; } };
[ "48301097+GP-R@users.noreply.github.com" ]
48301097+GP-R@users.noreply.github.com
ecbd09dc13d20695405db1b4e8395c47e82359a2
01b38268272a0af657a14a20b173b388f7da43bf
/Template/STL/PairSample.cpp
328a9b00809eed6dda8eaa06a70cf9ab44c61dc5
[]
no_license
hydai/UnlimitedDebugWorld
02410d267153c68c952476fd930b28eb1986e899
222e8445e3639b4fdc4107ccdf77a14078a0af9f
refs/heads/master
2020-04-10T01:38:36.647424
2013-05-20T06:03:14
2013-05-20T06:03:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
604
cpp
#include <cstdio> #include <utility> // pair, make_pair #include <algorithm> // swap int main(int argc, char *argv[]) { std::pair <int, int> pt1(10, 6); std::pair <int, int> pt2; pt2 = std::make_pair(-8, -4); std::printf("Initial\n"); std::printf("pt1(x, y) = (%d, %d)\n", pt1.first, pt1.second); std::printf("pt2(x, y) = (%d, %d)\n", pt2.first, pt2.second); std::printf("\nCall swap function\n"); std::swap(pt1, pt2); std::printf("pt1(x, y) = (%d, %d)\n", pt1.first, pt1.second); std::printf("pt2(x, y) = (%d, %d)\n", pt2.first, pt2.second); return 0; }
[ "z54981220@gmail.com" ]
z54981220@gmail.com
d860cfe7625289fb616578b1c547c3d31bb0a7b7
5e02f9ca4b257c6bb034e89152d09ad8b9ae850a
/src/control_node.cpp
d016d3f2c4f2a4ea06abfe53be56cfd99f9d0b79
[]
no_license
Dragonbt/fpv_onboard_computer
36756dc07ec1181124fcab79f0ec48e6b7e964de
8c25117aa0da565f88bc96a6038eac2c04deffec
refs/heads/master
2020-09-08T12:05:29.595975
2019-11-11T17:15:38
2019-11-11T17:15:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,547
cpp
#include "control_node.hpp" void controlLoop( FileNode control_config, FileNode altitude_pid, FileNode vision_pid, FileNode flow_pid ) { int enable; string url; control_config["ENABLE"] >> enable; control_config["URL"] >> url; if( enable == 0 ) { cout << "[WARNING]: control node disabled" << endl; return; } /*Connect to pixhawk*/ Mavsdk dc; ConnectionResult connection_result; connection_result = dc.add_any_connection(url); if (connection_result != ConnectionResult::SUCCESS) { cout << string("[ERROR]: ") + connection_result_str(connection_result) << endl; cout << "[WARNING]: control node shut down" << endl; return; } while (!dc.is_connected()) { cout << "[LOGGING]: Wait for system to connect via heartbeat" << endl; this_thread::sleep_for(seconds(1)); } System& system = dc.system(); auto action = std::make_shared<Action>(system); auto offboard = std::make_shared<Offboard>(system); auto telemetry = std::make_shared<Telemetry>(system); /*Health Check*/ //healthCheck( telemetry ); setTelemetry( telemetry ); #if (TEST_LEVEL == LEVEL_FINAL0) || (TEST_LEVEL == LEVEL_FINAL1) || (TEST_LEVEL == LEVEL_FINAL2) || (TEST_LEVEL == LEVEL_FINAL3) missionLoop( telemetry, offboard, altitude_pid, vision_pid, flow_pid); #else testLoop( telemetry, offboard, altitude_pid, vision_pid, flow_pid); #endif cout << "[WARNING]: control node shut down" << endl; return; }
[ "821869740@qq.com" ]
821869740@qq.com
0e4079fba1eb62ef07cf13ac62dda4760473d7ab
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5769900270288896_1/C++/Dyian/main.cpp
dcc632429f4c3527db3cf31f619adcdbc7e21b03
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
12,256
cpp
#include <string.h> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; int h[] = {26, 142 }; int main() { freopen("B-large (1).in", "r", stdin); freopen("B-large (1).out", "w", stdout); int R,C,N; int T,c = 0; scanf("%d", &T); while (T--) { scanf("%d%d%d", &R,&C, &N); if (R > C) swap(R, C); printf("Case #%d: ", ++c); int a = (R*C + 1)>>1; if (N <= a) printf("0\n"); else { if (R == 1) { if (C&1) printf("%d\n", (N - a) <<1); else printf("%d\n", ((N - a) <<1) - 1); } else { int t = R*C; int m = (((R + C) << 1) - 4)>>1; if (t&1) { N -= a; int tmp1 = 0; if (N <= m) tmp1 = 3*N; else tmp1 = 3*m + (N - m)*4; int tmp2 = 0; ++N; if (N <= 4) tmp2 = N*2; else { if (N <= m) tmp2 = (N - 4)*3 + 8; else { tmp2 = 8 + (m - 4)*3; tmp2 += (N - m) * 4; } } printf("%d\n", min(tmp1, tmp2)); } else { N -= a; if (N <= 2) printf("%d\n", N << 1); else { if (N <= m) printf("%d\n", 4 + (N - 2)*3); else { printf("%d\n", 4 + (m - 2)*3 + (N - m)*4); } } } } } } return 0; long long d = 26; long long e = 10; for (int i = 3; i <=14; ++i) { d = d + 26 + e*9; e=e*10; printf("%I64d\n", d); } return 0; scanf("%d", &T); while (T--) { long long n; scanf("%I64d", &n); printf("Case #%d: ", ++c); if (n <= 11) { printf("%d\n", n - 1); continue; } int cnt = 0; long long t = n; while (t) { ++cnt; t >>= 1; } t = n >> (cnt - 1); int ans = 8 + (cnt - 2) * 26 + (t - 1) * 3 + 1; long long b = 1; while (b*10 < n) b = b * 10; if (t == 1) ans += n - b; else { b = b * t + 1; if (n < b) { //ans += } } //if } return 0; //freopen("B-small-attempt1.in", "r", stdin); //freopen("B-small-attempt1.out", "w", stdout); /* int T, B, N, c = 0, ma; scanf("%d", &T); while (T--) { scanf("%d%d", &B, &N); ma = 0; for (int i = 0; i < B; ++i) { scanf("%d", &m[i]); if (m[i] > ma) ma = m[i]; } long long l = 0, r = N*(long long)ma; long long mid, sum; while (l <= r) { mid = (l + r) >> 1, sum = 0; for (int i = 0; i < B; ++i) sum += mid/m[i]; if (sum > N - 1)r = mid - 1; else if (sum < N - 1) l = mid + 1; else { int j = 0, mi = 99999999, idx; while (j < B) { if (mid % m[j] < mi) mi = mid % m[j], idx = j; ++j; } printf("Case #%d: %d\n", ++c, idx + 1); break; } } if (sum < N - 1) { int tmp = N - sum, i = 0, idx,mi = 99999999; while (tmp) { while (mid % m[i] + 1 != m[i]) ++i; if (mid % m[i] <= mi) mi = mid % m[i], idx = i; --tmp, ++i; } printf("Case #%d: %d\n", ++c, idx+1); } else if (sum > N - 1){ sum = 0; for (int i = 0; i < B; ++i) sum += r/m[i]; int t = N - (int)sum, i = 0, idx; int mi = 99999999; for (int j = 0; j < t; ++j) { while (r % m[i] + 1 != m[i]) ++i; if (r % m[i] <= mi) mi = r % m[i], idx = i; ++i; } printf("Case #%d: %d\n", ++c, idx+1); } } return 0; */ } /* int a[1005]; int main() { freopen("A-large.in", "r", stdin); freopen("A-large.out", "w", stdout); int T, N,c = 0; scanf("%d", &T); while (T--) { scanf("%d", &N); for (int i = 0; i < N; ++i) scanf("%d", &a[i]); --N; int sum1 = 0, i = 0; do { ++i; if (a[i] < a[i - 1]) sum1 += a[i - 1] - a[i]; } while(i < N); int sum2 = 0; i = 0; int Max = 0; do { ++i; if (a[i] < a[i - 1]) if(a[i-1]- a[i]>Max) Max = a[i-1]- a[i]; } while(i < N); i= 0; do { sum2 += min(a[i], Max); } while(++i < N); printf("Case #%d: %d %d\n", ++c,sum1, sum2); } return 0; } */ /* int main() { freopen("D-small-attempt2.in", "r", stdin); freopen("D-small-attempt2.out", "w", stdout); int T, X, R, C, c = 0; scanf("%d", &T); while (T--) { scanf("%d%d%d", &X, &R, &C); if (X == 1) { printf("Case #%d: GABRIEL\n", ++c); continue; } if (X == 2) { if ((R*C)&1) { printf("Case #%d: RICHARD\n", ++c); } else printf("Case #%d: GABRIEL\n", ++c); continue; } if (X == 3) { if (R > C) swap(R, C); if ((R == 2 && C == 3) || (R == 3 && C == 4) || ( R == 3 && C == 3)) printf("Case #%d: GABRIEL\n", ++c); else printf("Case #%d: RICHARD\n", ++c); continue; } if (R > C) swap(R, C); if ((R == 3 || R == 4) && C == 4) printf("Case #%d: GABRIEL\n", ++c); else printf("Case #%d: RICHARD\n", ++c); } return 0; } */ /* int cnt[1005]; int T, c = 0, w, m, n; int piece[1005]; int main(){ freopen("B-large-practice.in", "r", stdin); freopen("B-large-practice.out", "w", stdout); scanf("%d", &T); int a, b; while (T--) { scanf("%d", &n); memset(cnt, 0, sizeof(cnt)); m = 0; for (int i = 0; i < n; ++i) { scanf("%d", &w); ++cnt[w]; if (w > m) m = w; } memset(piece, 0, sizeof(int) * (m + 1)); for (int i = m; i > 1; --i) { if (cnt[i] == 0) continue; double i_d = i * 1.0; for (int j = i - 1; j > 1; --j) { piece[j] += cnt[i] * (ceil(i_d/j) - 1); } } for (int i = 2; i < m; ++i) if (piece[i] + i < m) m = piece[i] + i; printf("Case #%d: %d\n", ++c, m); } return 0; } */ /*#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> using namespace std; typedef long long LL; const int MaxN = 5010; const double EInf = 1e50; struct tNode { double x, y; tNode(){} }; bool Use[MaxN]; int N, W, R, Vs, Vt; double F[MaxN]; tNode A[MaxN]; double sqr(double x) {return (x * x); } double Dis_vs(int i) {return sqr(min(A[i].x - 1, W - A[i].y)); } double Dis_vt(int i) {return sqr(min(A[i].y - 1, R - A[i].x)); } double Dis(int u, int v) {return (sqr(A[u].x - A[v].x) + sqr(A[u].y - A[v].y)) / 4.0; } int main() { freopen("a.txt", "r", stdin); // freopen("dis.out", "w", stdout); while(~scanf("%d%d%d",&N,&R,&W)){ Vs=N+1;Vt=N+2; for(int i=1;i<=N;i++)scanf("%lf%lf",&A[i].x,&A[i].y); for(int i=1;i<=Vt;i++){F[i]=EInf;Use[i]=false;}F[Vs]=0; for(int i=1;i<=Vt;i++){ int u=0; double Min=EInf; for (int j=1;j<=Vt;j++){ if ((!Use[j])&&(Min>F[j])){ Min = F[j]; u = j; } } if (u==0)break; Use[u]=true; if(u==Vt)break; if(u==Vs){ for(int j=1;j<=N;j++)if(Dis_vs(j)<=F[j])F[j]=Dis_vs(j); }else{ for(int j=1;j<=N;j++){ F[j] = min(F[j], max(F[u], Dis(u, j))); } F[Vt] = min(F[Vt], max(F[u], Dis_vt(u))); } } printf("%.2f\n", sqrt(F[Vt]));} return 0; }*/ /*double dp[5005][5005]; int main() { int n, k; dp[1][1] = 1; for (int i = 2; i <= 5000; ++i) { dp[i][1] = dp[i - 1][1] + 1.0/i; } for (int i = 2; i <= 4999; ++i) { dp[i][i] = dp[i - 1][i - 1] * 1.0/i; for (int j = i + 1; j <= 5000; ++j) { dp[j][i] = dp[j - 1][i - 1]/j + dp[j - 1][i]; } } while (scanf("%d%d", &n, &k) != EOF) { if(k == 1) { printf("%.4f\n", 1.0/n); } else { double ans = 0; while (k) { ans += (dp[n][k] - dp[n - 1][k]); --k; } printf("%.4f\n", ans); } } return 0; }*/ /*#include <stdio.h> #include <string.h> char mt[52][52]; int dx[] = {1, 0, 0, -1}; int dy[] = {0, 1, -1, 0}; int flag[52][52], cnt; int dir[125]; void go(const int x, const int y) { flag[x][y] = 1, ++cnt; int xx, yy; for (int i = 0; i < 4; ++i) { if (dir[mt[x][y]] & (1 << i)) { xx = x + dx[i]; yy = y + dy[i]; if (mt[xx][yy] != '#' && flag[xx][yy] == -1) go(xx, yy); } } } void go2(const int x, const int y) { flag[x][y] = 2, --cnt; int xx, yy; for (int i = 0; i < 4; ++i) { xx = x + dx[i]; yy = y + dy[i]; if (flag[xx][yy] == 1 && (dir[mt[xx][yy]] & (1 << (3 - i)))) go2(xx, yy); } } int main(){ dir['.'] = 1, dir['+'] = 15, dir['-'] = 6, dir['|'] = 9; //freopen("a.txt", "r", stdin); int r, c, rr, cc; int sx, sy, tx, ty; scanf("%d%d", &r, &c); for (int i = 1; i <= r; ++i) { scanf("%s", mt[i] + 1); for (int j = 1; j <= c; ++j) if (mt[i][j] == 'S') sx = i, sy = j; else if (mt[i][j] == 'T') tx = i, ty = j; } rr = r + 1, cc = c + 1; for (int i = 0; i <= cc; ++i) mt[0][i] = mt[rr][i] = '#'; for (int i = 1; i <= r; ++i) mt[i][0] = mt[i][cc] = '#'; memset(flag, -1, sizeof(flag)); mt[sx][sy] = '+', mt[tx][ty] = '+'; cnt = 0; go(sx, sy); if (flag[tx][ty] == -1) { puts("I'm stuck!"); } else { go2(tx, ty); printf("%d\n", cnt); } return 0; }*/ /*#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #include <deque> #include <list> using namespace std; long long f[2000][3][2]; /// f[seq_k to place][0: to place 0 , 1: ethier 0 or 1, 2 : must be 1][3 is placed ?1 : 0] int dp(int n, int p1, int p3) { long long &now = f[n][p1][p3]; if (now != -1) return now; if (n == 0) { if (p1 == 2 && p3 == 1) { now = 1; }else { now = 0; } return now; } now = 0; if (p1 == 0) { now += dp(n-1, 1, p3); /// go 0 }else if (p1 == 1) { now += dp(n-1, 1, p3); /// go 0now += dp(n-1, 2, p3); // go 1 }else /// p1 == 2 { now += dp(n-1, 2, p3); /// go 1 } if (p3 == 0) { now += dp(n-1, p1, p3); /// go 2; now += dp(n-1, p1, 1); /// go 3; }else { now += dp(n-1, p1, 1); /// go 3; } now %= 1000000007; } int main() { int n; cin >> n; memset(f, -1, sizeof(f)); int ans = dp(n - 1, 0, 0); /// seq[n] is 2 cout << ans << endl; return 0; }*/
[ "eewestman@gmail.com" ]
eewestman@gmail.com
bf11d143a68d4afb47c88d352fdf6e94c3da4f16
86ecc12c6ac9eb88f13cda2a82e9a8c37cccd2b8
/processor/controller.cpp
6661e33c24fbbc63544bc1e9ee6a053e49cf7957
[]
no_license
moiri-usi/USI-systemC
b88b40aceff7f866d65b35f3623e0e7db4868378
4bdd07bb9d96a0d4a31edcec3e6bfe9ab86729f7
refs/heads/master
2021-01-10T19:19:36.549357
2013-11-29T17:08:11
2013-11-29T17:08:11
14,721,006
0
0
null
null
null
null
UTF-8
C++
false
false
997
cpp
#include <controller.h> void Controller::control() { if (!reset_n.read()) { sel_const.write(0); sel_in_1.write(0); sel_in_2.write(0); sel_op.write(0); we_n.write("1111"); s_sel_op_mem.write(0); s_we_mem1_n.write("1111"); s_we_mem2_n.write("1111"); } else { sel_in_1.write(static_cast< sc_bv<3> > (addr_in_1.read())); sel_in_2.write(static_cast< sc_bv<3> > (addr_in_2.read())); sc_bv<4> tmp_we_n; if (opcode.read() == 0) { tmp_we_n = "1111"; } else if (addr_out.read() == 0) { tmp_we_n = "1110"; } else if (addr_out.read() == 1) { tmp_we_n = "1101"; } else if (addr_out.read() == 2) { tmp_we_n = "1011"; } else { tmp_we_n = "0111"; } s_we_mem1_n.write(tmp_we_n); s_we_mem2_n.write(s_we_mem1_n.read()); we_n.write(s_we_mem2_n.read()); s_sel_op_mem.write(static_cast< sc_bv<3> > (opcode.read())); sel_op.write(s_sel_op_mem.read()); sel_const.write((opcode.read() == 1) | (opcode.read() == 5)); } }
[ "moirelein@gmail.com" ]
moirelein@gmail.com