blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
162cd723b65360c2d59ef5a79f5c441ade402f8c | 182322f4f2800f851754bb1bcb85fd4f9fc324ea | /pcca/2015_1/1003/pa.cpp | f199c94bf1236c8e3390f31cdb2835aad0dc0304 | [] | no_license | Tocknicsu/oj | 66100fe94d76b6fe8d1bd3019f5ada9d686c1753 | e84d6c87f3e8c0443a27e8efc749ea4b569a6c91 | refs/heads/master | 2021-01-17T08:12:32.510731 | 2016-04-18T02:09:04 | 2016-04-18T02:09:16 | 32,704,322 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 638 | cpp | pa.cpp | #include <bits/stdc++.h>
using namespace std;
int ans[32768];
unordered_set<int> s;
int main(){
int t = 1;
for(int i = 1 ; i < 1001 ; i++){
if(s.count(i)){
for( ; t <= i && s.count(i*t) ; t++);
for(int j = t ; j <= i ; j++)
s.insert(j*i);
} else {
for(int j = 1 ; j <= i ; j++)
s.insert(i*j);
}
ans[i] = s.size();
}
for(int i = 1 ; i < 101 ; i++)
printf("%d\n", ans[i]);
return 0;
int n;
scanf("%d", &n);
while(n--){
int x;
scanf("%d", &x);
printf("%d\n", ans[x]);
}
}
|
d9e30b6086ef976aceafba9cb95c67c2929aa8b8 | f93d816161738cc58539108fff064a2de77147f5 | /OpenGLHelloWorld/src/main.cpp | e63d657cdfd499f3094ffd1d2931e3eac4dd8f5f | [] | no_license | icouldbreathe/sideproj-learn-opengl | 414da97319872b5bdfbd8cf012f1336a3b1dc086 | 5565aaf7a3d085f9363fccc6188cae0b0aa7bf7c | refs/heads/master | 2020-05-17T15:36:38.630625 | 2019-04-27T17:00:17 | 2019-04-27T17:00:17 | 183,794,742 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 396 | cpp | main.cpp | #include "Engine/Engine.h"
#include "Engine/Window.h"
#include <stdio.h>
#include <string>
#include <iostream>
uint32_t WINDOW_WIDTH = 800;
uint32_t WINDOW_HEIGHT = 800;
int _main (int argc, char *argv[]) {
Window *myWindow = nullptr;
Engine *myEngine = nullptr;
myEngine = new Engine(WINDOW_WIDTH, WINDOW_HEIGHT);
myEngine->Run();
delete myEngine;
return 0;
}
|
c69cf47ab4ca361759323573ba7bc5d26e117823 | 63e0684a30f177074b8f206c45c3fc2d381bde75 | /MyServer/MyProtocol/MyConnectionContext.h | 16134201e6b5df3dd35cf27910cefdd1fb51ac96 | [] | no_license | fion45/MyServer | 81b487a07757ab16b0bcb27fa6b02c7130d7c9a3 | 0d002a47f929706510b7b214985575718699ac31 | refs/heads/master | 2021-01-23T07:21:12.884135 | 2015-01-11T15:19:18 | 2015-01-11T15:19:18 | 27,760,243 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 558 | h | MyConnectionContext.h | #pragma once
#include "Symbols.h"
#include "Protocol.h"
class MYPROTOCOL_API MyConnectionContext : public PushFramework::ConnectionContext
{
public:
enum
{
Initialized = 0,
HandshakeStage,
HeartbeatStage,
ConnectedStage,
LoginedStage
};
enum
{
UnknowedProtocol = 0,
WebSocketProtocol = 1,
FCIIProtocol = 2
};
MyConnectionContext();
~MyConnectionContext();
int GetStage();
void SetStage(int stage);
int GetProtocol();
void SetProtocol(int protocol);
bool IsWebSocket();
bool IsFCII();
private:
int stage;
int protocol;
};
|
ef6195f8d59f40b7c24f294ee4a60b890db5ea54 | 62d31a4cf095806e6e57057b4556b26681857282 | /objtoan8/Animation.h | 152e7c53ab92f975aa27996854a38ee36e3fe9d7 | [
"Unlicense"
] | permissive | FForgione/N64-Tools | 9071feccc8669de2d0c7c7ad325309ddb35b5a5c | d29260ad65124dc822d528441ecee9501e0c38d0 | refs/heads/master | 2022-01-17T22:57:40.685697 | 2019-05-25T19:51:22 | 2019-05-25T19:51:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 218 | h | Animation.h | #pragma once
#include <vector>
#include "Keyframe.h"
class CAnimation
{
public:
CAnimation(void);
~CAnimation(void);
CString name;
std::vector<CKeyframe*> keyframes;
bool isCamera;
bool treatAsBlendShape;
};
|
944cbe93197e3682477ed17864ac230613bebfe9 | 729622d702c42d81c99cf88220db1f206382e916 | /source/app/public/Forms/FormMain.hxx | 410cf437fb33690aad49aa5a16c485b4b0dd6478 | [
"MIT"
] | permissive | xu7103224/pdb-type-viewer | 4f0494a89ecc7c59ee47a5092aff4e549addfcb2 | d348aaeb04a8f15c2f09dbda95f5010f1d6709e1 | refs/heads/master | 2023-03-16T16:10:28.000378 | 2019-06-27T12:33:21 | 2019-06-27T12:33:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,477 | hxx | FormMain.hxx | #pragma once
#include <QMainWindow>
#include <LibPtv.hxx>
class QAction;
class QListWidget;
class QMenu;
class QStringListModel;
class QTreeView;
class QDockWidget;
class QListView;
class QSortFilterProxyModel;
class QTableView;
class QLineEdit;
class QPushButton;
namespace ptvapp::models
{
class TypeDescriptorModel;
class TypeListModel;
class ValidationModel;
}
namespace ptvapp::forms
{
class MainWindow
: public QMainWindow
{
Q_OBJECT;
public:
MainWindow() noexcept;
public:
void LoadFromPath(QStringView path) noexcept;
private slots:
void ShowAbout() noexcept;
void LoadPdb() noexcept;
void DoAnalyze() noexcept;
private:
void CreateActions() noexcept;
void CreateStatusBar() noexcept;
void CreateControls() noexcept;
private:
std::unique_ptr<LibPdb::Session> m_PdbFile;
private:
ptvapp::models::TypeListModel* m_TypeListModel;
QSortFilterProxyModel* m_TypeListModelProxy;
QTreeView* m_TypeListView;
QLineEdit* m_TypeListViewFilter;
QDockWidget* m_DockTypeList;
QPushButton* m_TypeListAnalyzeButton;
private:
ptvapp::models::TypeDescriptorModel* m_TypeModel;
QTreeView* m_TypeView;
private:
QDockWidget* m_DockValidationIssues;
QTreeView* m_ValidationIssuesView;
ptvapp::models::ValidationModel* m_ValidationIssuesModel;
};
}
|
0e1102321904d0c33a60c6856a513485e8e442cd | d62c1081b555706daf9b86cdb80fdbace9aaa40a | /cpp_src/client/synccoroqueryresults.cc | 3d24ab72ca3df059a09e73c288189653950b6e0f | [
"Apache-2.0"
] | permissive | Restream/reindexer | 2906aae14e16c27e50b36e806949ef0fe4aca61c | 6d4504fcdb9dc2e98169ea739fd14c243766da2d | refs/heads/master | 2023-08-28T09:36:57.626697 | 2023-07-29T12:41:16 | 2023-07-29T12:41:16 | 96,545,309 | 775 | 79 | Apache-2.0 | 2022-12-27T11:39:04 | 2017-07-07T14:14:38 | C++ | UTF-8 | C++ | false | false | 904 | cc | synccoroqueryresults.cc | #include "synccoroqueryresults.h"
#include "client/namespace.h"
#include "synccororeindexer.h"
#include "synccororeindexerimpl.h"
namespace reindexer {
namespace client {
using namespace reindexer::net;
SyncCoroQueryResults::SyncCoroQueryResults(SyncCoroReindexer *rx, int fetchFlags) : results_(fetchFlags), rx_(rx) {}
void SyncCoroQueryResults::Bind(std::string_view rawResult, RPCQrId id) { results_.Bind(rawResult, id); }
void SyncCoroQueryResults::fetchNextResults() {
int flags = results_.fetchFlags_ ? (results_.fetchFlags_ & ~kResultsWithPayloadTypes) : kResultsCJson;
rx_->impl_->fetchResults(flags, *this);
}
h_vector<std::string_view, 1> SyncCoroQueryResults::GetNamespaces() const { return results_.GetNamespaces(); }
TagsMatcher SyncCoroQueryResults::getTagsMatcher(int nsid) const { return results_.nsArray_[nsid]->tagsMatcher_; }
} // namespace client
} // namespace reindexer
|
4b7efda01bd724dca137d92f938db07f30edaa5e | 620f7ae17cfea68d6dc4240ab8a5da114206741b | /unique_ptr.hpp | 017e7b29b6331d7f0ed1f1e20686d46c248219c4 | [] | no_license | Kalord/smart-pointer | 0be433573a36d91c5d1ae1cd69b79c1134d113d1 | c7419d03441caf22e4a92bc73f44e6e42d3a6dbf | refs/heads/master | 2022-03-31T01:29:20.475736 | 2020-01-24T22:38:17 | 2020-01-24T22:38:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 440 | hpp | unique_ptr.hpp | /**
* Smart pointer
* The allocated memory can belong to only one object.
*/
template<typename T>
class unique_ptr
{
private:
T* pointer;
//Non copy
unique_ptr<T>(unique_ptr<T> const&) = delete;
unique_ptr<T>& operator=(unique_ptr<T> const&) = delete;
public:
unique_ptr(T* pointer) :
pointer(pointer)
{}
~unique_ptr()
{
if(this->pointer != nullptr) delete this->pointer;
}
T* operator->()
{
return this->pointer;
}
}; |
a112c0165855e12a52d0e1e71ae0da72f2c8481a | 65f29dc80c0cbe5cc56075d0fe1124dcb41665df | /exercises/day_11/Exercise_2.cpp | a201d6633eaffa2767aa92a391415771361bfe5d | [] | no_license | br-labud/cpp | 3f44e95eb9dd969bed08612079b4c5e5c6e1bfa5 | 842b55a6b6fb5d29d76d6fc564334cedc6f7a90e | refs/heads/main | 2023-07-10T09:49:57.640728 | 2021-08-23T16:25:03 | 2021-08-23T16:25:03 | 398,587,781 | 0 | 0 | null | 2021-08-21T15:28:23 | 2021-08-21T15:08:13 | C++ | UTF-8 | C++ | false | false | 658 | cpp | Exercise_2.cpp | // Speed Control
#include <iostream>
#include <vector>
using namespace std;
int gps(int s, vector<double> &x) {
vector<double> arr;
if(x.size() < 1) return 0;
for(auto i = 0; i < x.size() - 1; i++) {
double diff = x[i+1] - x[i];
arr.push_back(3600.0 * (diff / (double)s));
}
int max = 0;
for(auto i = 0; i < arr.size(); i++) {
if(max < arr[i]) max = (int)arr[i];
}
return max;
}
int main() {
vector<double> speed = {0.0, 0.11, 0.22, 0.33, 0.44, 0.65, 1.08, 1.26, 1.68, 1.89, 2.1, 2.31, 2.52, 3.25};
int time = 12;
cout << gps(time, speed);
return 0;
} |
84d5bc3488d51d1d6544ebe1dff05df6c6525536 | 4349efc92fdcbbec693b0e95e3a6f7abed22bb23 | /include/bmp/greenblockleftbmp.h | ed9fe6150bad5557b3e4be774b1d45acffd08489 | [
"MIT"
] | permissive | ant512/ReallyBadEggs | 81d57d690cd0e37a22cdc1c42d4213fb9bae28c1 | 5537e9f4c22c5de7686623ac63d4b84992467ad4 | refs/heads/master | 2020-04-06T05:46:43.974711 | 2015-02-08T06:08:57 | 2015-02-08T06:08:57 | 15,411,446 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 190 | h | greenblockleftbmp.h | #ifndef _GREENBLOCKLEFTBMP_H_
#define _GREENBLOCKLEFTBMP_H_
#include <bitmapwrapper.h>
class GreenBlockLeftBmp : public WoopsiGfx::BitmapWrapper {
public:
GreenBlockLeftBmp();
};
#endif
|
dfacde0d6e02a51f234baee87937fcbc7e326a5f | 07306d96ba61d744cb54293d75ed2e9a09228916 | /External/Scaleform/Src/Platform/Platform_RenderHALThread.h | 1460756746ec315fa386463d626d7271ce7cd4dd | [] | no_license | D34Dspy/warz-client | e57783a7c8adab1654f347f389c1dace35b81158 | 5262ea65e0baaf3f37ffaede5f41c9b7eafee7c1 | refs/heads/master | 2023-03-17T00:56:46.602407 | 2015-12-20T16:43:00 | 2015-12-20T16:43:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,614 | h | Platform_RenderHALThread.h | /**************************************************************************
Filename : Platform_RenderHALThread.h
Content : Default RenderThread implementation used by applications
that render directly to HAL.
Created : Jan 2011
Authors : Michael Antonov
Copyright : Copyright 2011 Autodesk, Inc. All Rights reserved.
Use of this software is subject to the terms of the Autodesk license
agreement provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
**************************************************************************/
#ifndef INC_SF_Platform_RenderHALThread_H
#define INC_SF_Platform_RenderHALThread_H
#include "Render/Renderer2D.h"
#include "Render/Render_ThreadCommandQueue.h"
#include "Platform_RTCommandQueue.h"
#include "Platform.h"
#ifdef SF_OS_ANDROID
#error Use Platform_SystemRenderThread.h instead
#endif
namespace Scaleform { namespace Platform {
class Device;
//
#ifdef RENDERER_SINGLE_THREADED
#define SF_PLATFORM_THREADING_TYPE Scaleform::RTCommandQueue::SingleThreaded
#else
#define SF_PLATFORM_THREADING_TYPE Scaleform::RTCommandQueue::MultiThreaded
#endif
//------------------------------------------------------------------------
// ***** RenderHALThread
// RenderThreadBase includes render thread setup logic associated with Renderer HAL,
// without rendering the tree (the later functionality is provided by RenderThread
// derived class).
class RenderHALThread : public Thread, public Scaleform::RTCommandQueue,
public Render::ThreadCommandQueue
{
public:
struct DisplayWindow : public NewOverrideBase<Stat_Default_Mem>
{
Device::Window* pWindow;
ViewConfig VConfig;
Size<unsigned> ViewSize;
DisplayWindow(Device::Window* pwin)
: pWindow(pwin)
{
pWindow->GetViewConfig(&VConfig);
ViewSize = VConfig.ViewSize;
}
virtual ~DisplayWindow() {}
};
RenderHALThread(ThreadingType threadingType = SF_PLATFORM_THREADING_TYPE);
bool IsSingleThreaded() const { return GetThreadingType() != MultiThreaded; }
// Device must be applied before RenderThread is started.
void SetDevice(Platform::Device* device)
{ pDevice = device; }
// Starts thread, but only if it's in multi-threaded mode.
void StartThread()
{
if (!IsSingleThreaded())
{
if ( Start() )
{
SetThreadName("Scaleform Renderer");
SetRenderThreadId(GetThreadId());
}
}
else
SetRenderThreadId(GetCurrentThreadId());
}
void GetRenderStats(Render::HAL::Stats* pstats)
{
Lock::Locker lock(&RenderStatsLock);
*pstats = RenderStats;
}
void GetMeshCacheStats(Render::MeshCache::Stats* pstats)
{
Lock::Locker lock(&RenderStatsLock);
*pstats = MeshCacheStats;
}
// Adjusts view to match allowed HW resolutions and/or HW size.
// Applies default size if not specified.
bool AdjustViewConfig(ViewConfig* config);
bool InitGraphics(const ViewConfig& config, Device::Window* window,
ThreadId renderThreadId = 0);
bool ReconfigureGraphics(const ViewConfig& config);
void DestroyGraphics();
// Queues up UpdateDeviceStatus call. For D3D9, this is executed
// on the Blocked thread. For Lost devices users should
// issue this call occasionally to see if operation can be resumed.
void UpdateDeviceStatus();
void UpdateConfiguration();
// Returns most recent device status. This is updated by RenderThread
// after mode configurations, DrawFrame and UpdateStatus calls.
DeviceStatus GetDeviceStatus() const { return Status; }
void SetBackgroundColor(Render::Color bgColor)
{
PushCall(&RenderHALThread::setBackgroundColor, bgColor);
}
void UpdateCursor(const Point<int>& mousePos, SystemCursorState state)
{
PushCall(&RenderHALThread::updateCursor, mousePos, state);
}
void ExitThread()
{
PushCallAndWait(&RenderHALThread::exitThread);
}
void SetStereoParams(const Render::StereoParams& sparams)
{
PushCall(&RenderHALThread::setStereoParams, sparams);
}
void DrawFrame();
void WaitForOutstandingDrawFrame();
void ToggleWireframe()
{
Wireframe = !Wireframe;
}
void SetWireframe(bool wireframe)
{
Wireframe = wireframe;
}
unsigned GetFrames()
{
return Frames.Exchange_NoSync(0);
}
// TextureManager can be accessed after InitGraphics is called and
// before DestroyGraphics. Texture creation should be thread-safe.
Render::TextureManager* GetTextureManager() const
{
return pTextureManager;
}
// Get/Set mesh cache parameters.
Render::MeshCacheParams GetMeshCacheParams()
{
Render::MeshCacheParams params;
PushCallAndWait(&RenderHALThread::getMeshCacheParams, ¶ms);
return params;
}
void SetMeshCacheParams(const Render::MeshCacheParams& params)
{
PushCall(&RenderHALThread::setMeshCacheParams, params);
}
virtual bool TakeScreenShot(const String& filename)
{
bool returnValue;
PushCallAndWaitResult(&RenderHALThread::takeScreenShot, &returnValue, filename );
return returnValue;
}
virtual int Run();
// Render::ThreadCommandQueue implementation.
virtual void PushThreadCommand(Render::ThreadCommand* command);
protected:
bool adjustViewConfig(ViewConfig* config);
void updateDeviceStatus()
{ Status = pDevice->GetStatus(); }
virtual void updateConfiguration()
{
pWindow->GetViewConfig(&VConfig);
if (!VConfig.HasFlag(View_Stereo))
getHAL()->SetStereoDisplay(Render::StereoCenter, 1);
}
virtual bool initGraphics(const ViewConfig& config, Device::Window* window,
ThreadId renderThreadId);
virtual bool reconfigureGraphics(const ViewConfig& config);
virtual void destroyGraphics();
void blockForGraphicsInit();
void exitThread();
void setBackgroundColor(Render::Color bgColor) { BGColor = bgColor; }
void setStereoParams(Render::StereoParams sparams);
Render::Color getBackgroundColor() const { return BGColor; }
Render::HAL* getHAL() const { return pDevice->GetHAL(); }
virtual void drawFrame() = 0;
virtual void createCursorPrimitives(Render::HAL*) {};
virtual void updateCursor(const Point<int> mousePos, SystemCursorState state);
virtual void getMeshCacheParams(Render::MeshCacheParams* params);
virtual void setMeshCacheParams(const Render::MeshCacheParams& params);
virtual bool takeScreenShot(const String& filename);
// Overload to hide Thread::Start method.
virtual bool Start(ThreadState initialState = Running)
{
if ( !Thread::Start(initialState))
return false;
SetThreadName("Scaleform Renderer");
return true;
}
void executeThreadCommand(const Ptr<Render::ThreadCommand>& command);
// Helper class used to block RenderThread for duration of its scope.
class RTBlockScope
{
RenderHALThread* pThread;
public:
RTBlockScope(RenderHALThread* thread);
~RTBlockScope();
};
friend class RTBlockScope;
//--------------------------------------------------------------------
// ***** Members
Platform::Device* pDevice;
Platform::Device::Window* pWindow;
// TextureManger intended to be accessed from Advance thread,
// between the initGraphics/destroyGraphics calls.
Ptr<Render::TextureManager> pTextureManager;
volatile DeviceStatus Status;
bool Wireframe;
// Real-time render stats, not synchronized.
Lock RenderStatsLock;
Render::HAL::Stats RenderStats;
Render::MeshCache::Stats MeshCacheStats;
AtomicInt<unsigned> Frames;
Size<unsigned> ViewSize;
Render::Color BGColor;
ViewConfig VConfig;
Event DrawFrameDone;
bool DrawFrameEnqueued;
// These events are used for blocking/resuming render thread
// during maind-thread graphics configuration.
Event RTBlocked, RTResume;
bool RTBlockedFlag;
SystemCursorState CursorState; // Holds current cursor state (copied from main thread's manager).
Ptr<Render::Primitive> CursorPrims[Cursor_Type_Count]; // Primitives for rendering software cursors.
Render::HMatrix CursorMats[Cursor_Type_Count]; // Matrices for cursors
volatile unsigned WatchDogTrigger; // Indicates whether the watchdog is satisfied (false == unsatisfied)
static const int WatchDogInterval = 5000; // Time between watchdog checks (ms)
static const int WatchDogMaxFailureCount = 3; // Maximum number of watchdog failures before killing.
Thread WatchDogThread; // Thread object performing watchdog checks.
static int watchDogThreadFn(Thread* thread, void* trigger);
};
}} // Scaleform::Platform
#endif //INC_SF_Platform_RenderHALThread_H
|
c17e71517a44090b36211f1da46946eeb4a73f98 | bd500f4386225716a43aa002c4827c9b1067513e | /include/UImessenger.hh | bb10ca7b9df46042f19dd25be0282c509fb02ea8 | [] | no_license | WPIRadiationPhysics/Faraday-Cup | d6b3e66d36238e75d72e86daf80c3137c6e57082 | b337417903df5d7b0ae34b73ca07e73b6fa29967 | refs/heads/master | 2021-01-17T11:33:41.607218 | 2015-12-02T04:26:10 | 2015-12-02T04:26:10 | 25,929,759 | 0 | 0 | null | 2015-12-02T04:26:10 | 2014-10-29T16:18:03 | C | UTF-8 | C++ | false | false | 668 | hh | UImessenger.hh | #ifndef UImessenger_h
#define UImessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class UImessenger: public G4UImessenger {
public:
UImessenger(DetectorConstruction* );
virtual ~UImessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
// Obtain Detector Construction instance
DetectorConstruction* fDetectorConstruction;
// Create cmd and cmdDir objects
G4UIdirectory* fPFCDirectory;
G4UIcmdWithAnInteger* fModelCmd;
G4UIcmdWithADouble* fKaptonCmd;
};
#endif
|
3550e06b197e2c4c4def8f15e0c6b8a43bb65fcc | 268e0035da3170ddfe579d2337510925249b3ed4 | /fun/base/math/vectorize_dx.h | f68ee1689b57a85544445e70f33a621571ea7e57 | [] | no_license | maxidea1024/fun | 89e2b4ae1c23c60201e7b9a2ef85bb33a8a25202 | bc10f8a5fef70b4c02cf443c27c29c6a71cb31b5 | refs/heads/master | 2021-08-07T05:16:10.630398 | 2020-05-06T10:46:08 | 2020-05-06T10:46:08 | 169,390,099 | 2 | 0 | null | 2019-03-28T13:58:16 | 2019-02-06T10:39:41 | C++ | UTF-8 | C++ | false | false | 31,810 | h | vectorize_dx.h | #pragma once
#if __cplusplus_cli
// there are compile issues with this file in managed mode, so use the FPU version
#include "fun/base/math/math_vectorize_fpu.h"
#else
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
namespace fun {
//
// Helpers
//
/**
* float4 vector register type, where the first float (x)
* is stored in the lowest 32 bits, and so on.
*/
typedef DirectX::XMVECTOR VectorRegister;
// for an DirectX::XMVECTOR, we need a single set of braces (for clang)
#define DECLARE_VECTOR_REGISTER(x, y, z, w) { x, y, z, w }
/**
* Returns a bitwise equivalent vector based on 4 DWORDs.
*
* \param x - 1st uint32 component
* \param y - 2nd uint32 component
* \param z - 3rd uint32 component
* \param w - 4th uint32 component
*
* \return Bitwise equivalent vector with 4 floats
*/
FUN_ALWAYS_INLINE VectorRegister MakeVectorRegister(uint32 x, uint32 y, uint32 z, uint32 w) {
using namespace DirectX;
return DirectX::XMVectorSetInt(x, y, z, w);
}
/**
* Returns a vector based on 4 FLOATs.
*
* \param x - 1st float component
* \param y - 2nd float component
* \param z - 3rd float component
* \param w - 4th float component
*
* \return vector of the 4 FLOATs
*/
FUN_ALWAYS_INLINE VectorRegister MakeVectorRegister(float x, float y, float z, float w) {
return DirectX::XMVectorSet(x, y, z, w);
}
//
// Constants:
//
#include "fun/base/math/vectorize_constants.h"
//
// Intrinsics:
//
/**
* Returns a vector with all zeros.
*
* \return VectorRegister(0.f, 0.f, 0.f, 0.f)
*/
#define VectorZero() DirectX::XMVectorZero()
/**
* Returns a vector with all ones.
*
* \return VectorRegister(1.f, 1.f, 1.f, 1.f)
*/
#define VectorOne() DirectX::g_XMOne.v
/**
* Loads 4 FLOATs from unaligned memory.
*
* \param ptr - Unaligned memory pointer to the 4 FLOATs
*
* \return VectorRegister(ptr[0], ptr[1], ptr[2], ptr[3])
*/
#define VectorLoad(ptr) DirectX::XMLoadFloat4((const DirectX::XMFLOAT4*)(ptr))
/**
* Loads 3 FLOATs from unaligned memory and leaves w undefined.
*
* \param ptr - Unaligned memory pointer to the 3 FLOATs
*
* \return VectorRegister(ptr[0], ptr[1], ptr[2], undefined)
*/
#define VectorLoadFloat3(ptr) MakeVectorRegister(((const float*)(ptr))[0], ((const float*)(ptr))[1], ((const float*)(ptr))[2], 0.f)
/**
* Loads 3 FLOATs from unaligned memory and sets w=0.
*
* \param ptr - Unaligned memory pointer to the 3 FLOATs
*
* \return VectorRegister(ptr[0], ptr[1], ptr[2], 0.f)
*/
#define VectorLoadFloat3_W0(ptr) MakeVectorRegister(((const float*)(ptr))[0], ((const float*)(ptr))[1], ((const float*)(ptr))[2], 0.f)
/**
* Loads 3 FLOATs from unaligned memory and sets w=1.
*
* \param ptr - Unaligned memory pointer to the 3 FLOATs
*
* \return VectorRegister(ptr[0], ptr[1], ptr[2], 1.f)
*/
#define VectorLoadFloat3_W1(ptr) MakeVectorRegister(((const float*)(ptr))[0], ((const float*)(ptr))[1], ((const float*)(ptr))[2], 1.f)
/**
* Loads 4 FLOATs from aligned memory.
*
* \param ptr - Aligned memory pointer to the 4 FLOATs
*
* \return VectorRegister(ptr[0], ptr[1], ptr[2], ptr[3])
*/
#define VectorLoadAligned(ptr) DirectX::XMLoadFloat4A((const DirectX::XMFLOAT4A*)(ptr))
/**
* Loads 1 float from unaligned memory and replicates it to all 4 elements.
*
* \param ptr - Unaligned memory pointer to the float
*
* \return VectorRegister(ptr[0], ptr[0], ptr[0], ptr[0])
*/
#define VectorLoadFloat1(ptr) DirectX::XMVectorReplicatePtr((const float*)(ptr))
/**
* Creates a vector out of three FLOATs and leaves w undefined.
*
* \param x - 1st float component
* \param y - 2nd float component
* \param z - 3rd float component
*
* \return VectorRegister(x, y, z, undefined)
*/
#define VectorSetFloat3(x, y, z) MakeVectorRegister(x, y, z, 0.f)
/**
* Creates a vector out of four FLOATs.
*
* \param x - 1st float component
* \param y - 2nd float component
* \param z - 3rd float component
* \param w - 4th float component
*
* \return VectorRegister(x, y, z, w)
*/
#define VectorSet(x, y, z, w) MakeVectorRegister(x, y, z, w)
/**
* Stores a vector to aligned memory.
*
* \param vec - vector to store
* \param ptr - Aligned memory pointer
*/
#define VectorStoreAligned(vec, ptr) DirectX::XMStoreFloat4A((DirectX::XMFLOAT4A*)(ptr), vec)
/**
* Performs non-temporal store of a vector to aligned memory without polluting the caches
*
* \param vec - vector to store
* \param ptr - Aligned memory pointer
*/
#define VectorStoreAlignedStreamed(vec, ptr) XM_STREAM_PS((float*)(ptr), vec)
/**
* Stores a vector to memory (aligned or unaligned).
*
* \param vec - vector to store
* \param ptr - Memory pointer
*/
#define VectorStore(vec, ptr) DirectX::XMStoreFloat4((DirectX::XMFLOAT4*)(ptr), vec)
/**
* Stores the XYZ components of a vector to unaligned memory.
*
* \param vec - vector to store XYZ
* \param ptr - Unaligned memory pointer
*/
#define VectorStoreFloat3(vec, ptr) DirectX::XMStoreFloat3((DirectX::XMFLOAT3*)(ptr), vec)
/**
* Stores the x component of a vector to unaligned memory.
*
* \param vec - vector to store x
* \param ptr - Unaligned memory pointer
*/
#define VectorStoreFloat1(vec, ptr) DirectX::XMStoreFloat((float*)(ptr), vec)
/**
* Returns an component from a vector.
*
* \param vec - vector register
* \param component_index - Which component to get, x=0, y=1, z=2, w=3
*
* \return The component as a float
*/
FUN_ALWAYS_INLINE float VectorGetComponent(VectorRegister vec, uint32 component_index) {
switch (component_index) {
case 0:
return DirectX::XMVectorGetX(vec);
case 1:
return DirectX::XMVectorGetY(vec);
case 2:
return DirectX::XMVectorGetZ(vec);
case 3:
return DirectX::XMVectorGetW(vec);
}
return 0.f;
}
/**
* Replicates one element into all four elements and returns the new vector.
*
* \param vec - Source vector
* \param element_index - Index (0-3) of the element to replicate
*
* \return VectorRegister(vec[element_index], vec[element_index], vec[element_index], vec[element_index])
*/
#define VectorReplicate(vec, element_index) DirectX::XMVectorSwizzle<element_index, element_index, element_index, element_index>(vec)
/**
* Returns the absolute value (component-wise).
*
* \param vec - Source vector
*
* \return VectorRegister(abs(vec.x), abs(vec.y), abs(vec.z), abs(vec.w))
*/
#define VectorAbs(vec) DirectX::XMVectorAbs(vec)
/**
* Returns the negated value (component-wise).
*
* \param vec - Source vector
*
* \return VectorRegister(-vec.x, -vec.y, -vec.z, -vec.w)
*/
#define VectorNegate(vec) DirectX::XMVectorNegate(vec)
/**
* adds two vectors (component-wise) and returns the result.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x+vec2.x, vec1.y+vec2.y, vec1.z+vec2.z, vec1.w+vec2.w)
*/
#define VectorAdd(vec1, vec2) DirectX::XMVectorAdd(vec1, vec2)
/**
* subtracts a vector from another (component-wise) and returns the result.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x-vec2.x, vec1.y-vec2.y, vec1.z-vec2.z, vec1.w-vec2.w)
*/
#define VectorSubtract(vec1, vec2) DirectX::XMVectorSubtract(vec1, vec2)
/**
* Multiplies two vectors (component-wise) and returns the result.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x*vec2.x, vec1.y*vec2.y, vec1.z*vec2.z, vec1.w*vec2.w)
*/
#define VectorMultiply(vec1, vec2) DirectX::XMVectorMultiply(vec1, vec2)
/**
* Divides two vectors (component-wise) and returns the result.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x/vec2.x, vec1.y/vec2.y, vec1.z/vec2.z, vec1.w/vec2.w)
*/
#define VectorDivide(vec1, vec2) DirectX::XMVectorDivide(vec1, vec2)
/**
* Multiplies two vectors (component-wise), adds in the third vector and returns the result.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
* \param vec3 - 3rd vector
*
* \return VectorRegister(vec1.x*vec2.x + vec3.x, vec1.y*vec2.y + vec3.y, vec1.z*vec2.z + vec3.z, vec1.w*vec2.w + vec3.w)
*/
#define VectorMultiplyAdd(vec1, vec2, vec3) DirectX::XMVectorMultiplyAdd(vec1, vec2, vec3)
/**
* Calculates the dot3 product of two vectors and returns a vector with the result in all 4 components.
* Only really efficient on Xbox 360.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return d = dot3(vec1.xyz, vec2.xyz), VectorRegister(d, d, d, d)
*/
#define VectorDot3(vec1, vec2) DirectX::XMVector3Dot(vec1, vec2)
/**
* Calculates the dot4 product of two vectors and returns a vector with the result in all 4 components.
* Only really efficient on Xbox 360.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return d = dot4(vec1.xyzw, vec2.xyzw), VectorRegister(d, d, d, d)
*/
#define VectorDot4(vec1, vec2) DirectX::XMVector4Dot(vec1, vec2)
/**
* Creates a four-part mask based on component-wise == compares of the input vectors
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x == vec2.x ? 0xFFFFFFFF : 0, same for yzw)
*/
#define VectorCompareEQ(vec1, vec2) DirectX::XMVectorEqual(vec1, vec2)
/**
* Creates a four-part mask based on component-wise != compares of the input vectors
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x != vec2.x ? 0xFFFFFFFF : 0, same for yzw)
*/
#define VectorCompareNE(vec1, vec2) DirectX::XMVectorNotEqual(vec1, vec2)
/**
* Creates a four-part mask based on component-wise > compares of the input vectors
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x > vec2.x ? 0xFFFFFFFF : 0, same for yzw)
*/
#define VectorCompareGT(vec1, vec2) DirectX::XMVectorGreater(vec1, vec2)
/**
* Creates a four-part mask based on component-wise >= compares of the input vectors
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(vec1.x >= vec2.x ? 0xFFFFFFFF : 0, same for yzw)
*/
#define VectorCompareGE(vec1, vec2) DirectX::XMVectorGreaterOrEqual(vec1, vec2)
/**
* Does a bitwise vector selection based on a mask (e.g., created from VectorCompareXX)
*
* \param Mask - Mask (when 1: use the corresponding bit from vec1 otherwise from vec2)
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(for each bit i: Mask[i] ? vec1[i] : vec2[i])
*/
#define VectorSelect(Mask, vec1, vec2) DirectX::XMVectorSelect(vec2, vec1, Mask)
/**
* Combines two vectors using bitwise OR (treating each vector as a 128 bit field)
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(for each bit i: vec1[i] | vec2[i])
*/
#define VectorBitwiseOr(vec1, vec2) DirectX::XMVectorOrInt(vec1, vec2)
/**
* Combines two vectors using bitwise AND (treating each vector as a 128 bit field)
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(for each bit i: vec1[i] & vec2[i])
*/
#define VectorBitwiseAnd(vec1, vec2) DirectX::XMVectorAndInt(vec1, vec2)
/**
* Combines two vectors using bitwise XOR (treating each vector as a 128 bit field)
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(for each bit i: vec1[i] ^ vec2[i])
*/
#define VectorBitwiseXor(vec1, vec2) DirectX::XMVectorXorInt(vec1, vec2)
/**
* Returns an integer bit-mask (0x00 - 0x0f) based on the sign-bit for each component in a vector.
*
* \param vec_mask - vector
*
* \return Bit0 = sign(vec_mask.x), Bit1 = sign(vec_mask.y), Bit2 = sign(vec_mask.z), Bit3 = sign(vec_mask.w)
*/
#define VectorMaskBits(vec_mask) _mm_movemask_ps(vec_mask)
/**
* Calculates the cross product of two vectors (XYZ components). w is set to 0.
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return cross(vec1.xyz, vec2.xyz). w is set to 0.
*/
#define VectorCross(vec1, vec2) DirectX::XMVector3Cross(vec1, vec2)
/**
* Calculates x raised to the power of y (component-wise).
*
* \param base - Base vector
* \param exponent - Exponent vector
*
* \return VectorRegister(base.x^exponent.x, base.y^exponent.y, base.z^exponent.z, base.w^exponent.w)
*/
#define VectorPow(base, exponent) DirectX::XMVectorPow(base, exponent)
/**
* Returns an estimate of 1/sqrt(c) for each component of the vector
*
* \param vec - vector
*
* \return VectorRegister(1/sqrt(t), 1/sqrt(t), 1/sqrt(t), 1/sqrt(t))
*/
#define VectorReciprocalSqrt(vec) DirectX::XMVectorReciprocalSqrtEst(vec)
/**
* Computes an estimate of the reciprocal of a vector (component-wise) and returns the result.
*
* \param vec - 1st vector
*
* \return VectorRegister((Estimate) 1.f / vec.x, (Estimate) 1.f / vec.y, (Estimate) 1.f / vec.z, (Estimate) 1.f / vec.w)
*/
#define VectorReciprocal(vec) DirectX::XMVectorReciprocalEst(vec)
/**
* Return Reciprocal Length of the vector
*
* \param vec - vector
*
* \return VectorRegister(rlen, rlen, rlen, rlen) when rlen = 1/sqrt(dot4(v))
*/
#define VectorReciprocalLen(vec) DirectX::XMVector4ReciprocalLengthEst(vec)
/**
* Return the reciprocal of the square root of each component
*
* \param vec - vector
*
* \return VectorRegister(1/sqrt(vec.x), 1/sqrt(vec.y), 1/sqrt(vec.z), 1/sqrt(vec.w))
*/
#define VectorReciprocalSqrtAccurate(vec) DirectX::XMVectorReciprocalSqrt(vec)
/**
* Computes the reciprocal of a vector (component-wise) and returns the result.
*
* \param vec - 1st vector
*
* \return VectorRegister(1.f / vec.x, 1.f / vec.y, 1.f / vec.z, 1.f / vec.w)
*/
#define VectorReciprocalAccurate(vec) DirectX::XMVectorReciprocal(vec)
/**
* Normalize vector
*
* \param vec - vector to normalize
*
* \return Normalized VectorRegister
*/
#define VectorNormalize(vec) DirectX::XMVector4NormalizeEst(vec)
/**
* Loads XYZ and sets w=0
*
* \param vec - VectorRegister
*
* \return VectorRegister(x, y, z, 0.f)
*/
#define VectorSet_W0(vec) DirectX::XMVectorAndInt(vec , DirectX::g_XMMask3)
/**
* Loads XYZ and sets w=1
*
* \param vec - VectorRegister
*
* \return VectorRegister(x, y, z, 1.f)
*/
#define VectorSet_W1(vec) DirectX::XMVectorPermute<0, 1, 2, 7>(vec, VectorOne())
/**
* Multiplies two 4x4 matrices.
*
* \param result - Pointer to where the result should be stored
* \param matrix1 - Pointer to the first matrix
* \param matrix2 - Pointer to the second matrix
*/
FUN_ALWAYS_INLINE void VectorMatrixMultiply(Matrix* result, const Matrix* matrix1, const Matrix* matrix2) {
using namespace DirectX;
XMMATRIX xm_matrix1 = XMLoadFloat4x4A((const XMFLOAT4X4A*)(matrix1));
XMMATRIX xm_matrix2 = XMLoadFloat4x4A((const XMFLOAT4X4A*)(matrix2));
XMMATRIX xm_matrix_r = XMMatrixMultiply(xm_matrix1, xm_matrix2);
XMStoreFloat4x4A((XMFLOAT4X4A*)(result), xm_matrix_r);
}
/**
* Calculate the inverse of an Matrix.
*
* \param dst_matrix - Matrix pointer to where the result should be stored
* \param src_matrix - Matrix pointer to the matrix to be inversed
*/
FUN_ALWAYS_INLINE void VectorMatrixInverse(Matrix* dst_matrix, const Matrix* src_matrix) {
using namespace DirectX;
XMMATRIX xm_src_matrix = XMLoadFloat4x4A((const XMFLOAT4X4A*)(src_matrix));
XMMATRIX xm_dst_matrix = XMMatrixInverse(nullptr, xm_src_matrix);
XMStoreFloat4x4A((XMFLOAT4X4A*)(dst_matrix), xm_dst_matrix);
}
/**
* Calculate Homogeneous transform.
*
* \param vec_p - VectorRegister
* \param matrix_m - Matrix pointer to the matrix to apply transform
*
* \return VectorRegister = vec_p*matrix_m
*/
FUN_ALWAYS_INLINE VectorRegister VectorTransformVector(const VectorRegister& vec_p, const Matrix* matrix_m) {
using namespace DirectX;
XMMATRIX m1 = XMLoadFloat4x4A((const XMFLOAT4X4A*)(matrix_m));
return XMVector4Transform(vec_p, m1);
}
/**
* Returns the minimum values of two vectors (component-wise).
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(min(vec1.x, vec2.x), min(vec1.y, vec2.y), min(vec1.z, vec2.z), min(vec1.w, vec2.w))
*/
#define VectorMin(vec1, vec2) DirectX::XMVectorMin(vec1, vec2)
/**
* Returns the maximum values of two vectors (component-wise).
*
* \param vec1 - 1st vector
* \param vec2 - 2nd vector
*
* \return VectorRegister(max(vec1.x, vec2.x), max(vec1.y, vec2.y), max(vec1.z, vec2.z), max(vec1.w, vec2.w))
*/
#define VectorMax(vec1, vec2) DirectX::XMVectorMax(vec1, vec2)
/**
* Swizzles the 4 components of a vector and returns the result.
*
* \param vec - Source vector
* \param x - Index for which component to use for x (literal 0-3)
* \param y - Index for which component to use for y (literal 0-3)
* \param z - Index for which component to use for z (literal 0-3)
* \param w - Index for which component to use for w (literal 0-3)
*
* \return The swizzled vector
*/
#define VectorSwizzle(vec, x, y, z, w) DirectX::XMVectorSwizzle<x, y, z, w>(vec)
/**
* Creates a vector through selecting two components from each vector via a shuffle mask.
*
* \param vec1 - Source vector1
* \param vec2 - Source vector2
* \param x - Index for which component of Vector1 to use for x (literal 0-3)
* \param y - Index for which component to Vector1 to use for y (literal 0-3)
* \param z - Index for which component to Vector2 to use for z (literal 0-3)
* \param w - Index for which component to Vector2 to use for w (literal 0-3)
*
* \return The swizzled vector
*/
#define VectorShuffle(vec1, vec2, x, y, z, w) DirectX::XMVectorPermute<x, y, z+4, w+4>(vec1, vec2)
/**
* Merges the XYZ components of one vector with the w component of another vector and returns the result.
*
* \param vec_xyz - Source vector for XYZ_
* \param vec_w - Source register for ___W (note: the fourth component is used, not the first)
*
* \return VectorRegister(vec_xyz.x, vec_xyz.y, vec_xyz.z, vec_w.w)
*/
FUN_ALWAYS_INLINE VectorRegister VectorMergeVecXYZ_VecW(const VectorRegister& vec_xyz, const VectorRegister& vec_w) {
using namespace DirectX;
return DirectX::XMVectorSelect(vec_xyz, vec_w, g_XMMaskW);
}
/**
* Loads 4 BYTEs from unaligned memory and converts them into 4 FLOATs.
* IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!
*
* \param ptr - Unaligned memory pointer to the 4 BYTEs.
*
* \return VectorRegister(float(ptr[0]), float(ptr[1]), float(ptr[2]), float(ptr[3]))
*/
#define VectorLoadByte4(ptr) DirectX::PackedVector::XMLoadUByte4((const DirectX::PackedVector::XMUBYTE4*)(ptr))
/**
* Loads 4 BYTEs from unaligned memory and converts them into 4 FLOATs in reversed order.
* IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!
*
* \param ptr - Unaligned memory pointer to the 4 BYTEs.
*
* \return VectorRegister(float(ptr[3]), float(ptr[2]), float(ptr[1]), float(ptr[0]))
*/
FUN_ALWAYS_INLINE VectorRegister VectorLoadByte4Reverse(const uint8* ptr) {
VectorRegister tmp = VectorLoadByte4(ptr);
return VectorSwizzle(tmp, 3, 2, 1, 0);
}
/**
* Converts the 4 FLOATs in the vector to 4 BYTEs, clamped to [0, 255], and stores to unaligned memory.
* IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!
*
* \param vec - vector containing 4 FLOATs
* \param ptr - Unaligned memory pointer to store the 4 BYTEs.
*/
#define VectorStoreByte4(vec, ptr) DirectX::PackedVector::XMStoreUByte4((DirectX::PackedVector::XMUBYTE4*)(ptr), vec)
/**
* Returns non-zero if any element in vec1 is greater than the corresponding element in vec2, otherwise 0.
*
* \param vec1 - 1st source vector
* \param vec2 - 2nd source vector
*
* \return Non-zero integer if (vec1.x > vec2.x) || (vec1.y > vec2.y) || (vec1.z > vec2.z) || (vec1.w > vec2.w)
*/
FUN_ALWAYS_INLINE uint32 VectorAnyGreaterThan(const VectorRegister& vec1, const VectorRegister& vec2) {
using namespace DirectX;
// Returns a comparison value that can be examined using functions such as XMComparisonAllTrue
uint32_t comparison_value = XMVector4GreaterR(vec1, vec2);
//Returns true if any of the compared components are true
return (uint32)XMComparisonAnyTrue(comparison_value);
}
/**
* Resets the floating point registers so that they can be used again.
* Some intrinsics use these for MMX purposes (e.g. VectorLoadByte4 and VectorStoreByte4).
*
* This is no longer necessary now that we don't use MMX instructions
*/
#define VectorResetFloatRegisters()
/**
* Returns the control register.
*
* \return The uint32 control register
*/
#define VectorGetControlRegister() _mm_getcsr()
/**
* Sets the control register.
*
* \param ControlStatus - The uint32 control status value to set
*/
#define VectorSetControlRegister(ControlStatus) _mm_setcsr(ControlStatus)
/**
* Control status bit to round all floating point math results towards zero.
*/
#define VECTOR_ROUND_TOWARD_ZERO _MM_ROUND_TOWARD_ZERO
/**
* Multiplies two quaternions; the order matters.
*
* Order matters when composing quaternions: C = VectorQuaternionMultiply2(A, B) will yield a quaternion C = AB
* that logically first applies B then A to any subsequent transformation (right first, then left).
*
* \param quat1 - Pointer to the first quaternion
* \param quat2 - Pointer to the second quaternion
*
* \return Quat1Quat2
*/
FUN_ALWAYS_INLINE VectorRegister VectorQuaternionMultiply2(const VectorRegister& quat1, const VectorRegister& quat2) {
// DirectXMath uses reverse parameter order to FunMath
// XMQuaternionMultiply(FXMVECTOR q1, FXMVECTOR q2)
// Returns the product q2*q1 (which is the concatenation of a rotation q1 followed by the rotation q2)
// [ (q2.wQ1.x) + (q2.xQ1.w) + (q2.yQ1.z) - (q2.zQ1.y),
// (q2.wQ1.y) - (q2.xQ1.z) + (q2.yQ1.w) + (q2.zQ1.x),
// (q2.wQ1.z) + (q2.xQ1.y) - (q2.yQ1.x) + (q2.zQ1.w),
// (q2.wQ1.w) - (q2.xQ1.x) - (q2.yQ1.y) - (q2.zQ1.z) ]
return DirectX::XMQuaternionMultiply(quat2, quat1);
}
/**
* Multiplies two quaternions; the order matters.
*
* When composing quaternions: VectorQuaternionMultiply(C, A, B) will yield a quaternion C = AB
* that logically first applies B then A to any subsequent transformation (right first, then left).
*
* \param result - Pointer to where the result Quat1Quat2 should be stored
* \param quat1 - Pointer to the first quaternion (must not be the destination)
* \param quat2 - Pointer to the second quaternion (must not be the destination)
*/
FUN_ALWAYS_INLINE void VectorQuaternionMultiply(Quat* result, const Quat* quat1, const Quat* quat2) {
VectorRegister xm_quat1 = VectorLoadAligned(quat1);
VectorRegister xm_quat2 = VectorLoadAligned(quat2);
VectorRegister xm_result = VectorQuaternionMultiply2(xm_quat1, xm_quat2);
VectorStoreAligned(xm_result, result);
}
/**
* Multiplies two quaternions; the order matters.
*
* When composing quaternions: VectorQuaternionMultiply(C, A, B) will yield a quaternion C = AB
* that logically first applies B then A to any subsequent transformation (right first, then left).
*
* \param result - Pointer to where the result Quat1Quat2 should be stored
* \param quat1 - Pointer to the first quaternion (must not be the destination)
* \param quat2 - Pointer to the second quaternion (must not be the destination)
*/
FUN_ALWAYS_INLINE void VectorQuaternionMultiply(VectorRegister* result, const VectorRegister* vec_quat1, const VectorRegister* vec_quat2) {
*result = VectorQuaternionMultiply2(*vec_quat1, *vec_quat2);
}
FUN_ALWAYS_INLINE void VectorQuaternionVector3Rotate(Vector* result, const Vector* vec, const Quat* quat) {
VectorRegister xm_vec = VectorLoad(vec);
VectorRegister xm_quat = VectorLoadAligned(quat);
VectorRegister xm_result = DirectX::XMVector3Rotate(xm_vec, xm_quat);
VectorStoreFloat3(xm_result, result);
}
FUN_ALWAYS_INLINE void VectorQuaternionVector3InverseRotate(Vector* result, const Vector* vec, const Quat* quat) {
VectorRegister xm_vec = VectorLoad(vec);
VectorRegister xm_quat = VectorLoadAligned(quat);
VectorRegister xm_result = DirectX::XMVector3InverseRotate(xm_vec, xm_quat);
VectorStoreFloat3(xm_result, result);
}
/**
* Computes the sine and cosine of each component of a vector.
*
* \param vec_sin_angles - VectorRegister Pointer to where the Sin result should be stored
* \param vec_cos_angles - VectorRegister Pointer to where the Cos result should be stored
* \param vec_angles - VectorRegister Pointer to the input angles
*/
FUN_ALWAYS_INLINE void VectorSinCos( VectorRegister* __restrict vec_sin_angles,
VectorRegister* __restrict vec_cos_angles,
const VectorRegister* __restrict vec_angles) {
using namespace DirectX;
// Force the value within the bounds of pi
XMVECTOR x = XMVectorModAngles(*vec_angles);
// Map in [-pi/2, pi/2] with sin(y) = sin(x), cos(y) = sign*cos(x).
XMVECTOR sign = _mm_and_ps(x, g_XMNegativeZero);
__m128 c = _mm_or_ps(g_XMPi, sign); // pi when x >= 0, -pi when x < 0
__m128 absx = _mm_andnot_ps(sign, x); // |x|
__m128 rflx = _mm_sub_ps(c, x);
__m128 comp = _mm_cmple_ps(absx, g_XMHalfPi);
__m128 select0 = _mm_and_ps(comp, x);
__m128 select1 = _mm_andnot_ps(comp, rflx);
x = _mm_or_ps(select0, select1);
select0 = _mm_and_ps(comp, g_XMOne);
select1 = _mm_andnot_ps(comp, g_XMNegativeOne);
sign = _mm_or_ps(select0, select1);
__m128 x2 = _mm_mul_ps(x, x);
// Compute polynomial approximation of sine
const XMVECTOR sc1 = g_XMSinCoefficients1;
XMVECTOR v_constants = XM_PERMUTE_PS(sc1, _MM_SHUFFLE(0, 0, 0, 0));
__m128 result = _mm_mul_ps(v_constants, x2);
const XMVECTOR sc0 = g_XMSinCoefficients0;
v_constants = XM_PERMUTE_PS(sc0, _MM_SHUFFLE(3, 3, 3, 3));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(sc0, _MM_SHUFFLE(2, 2, 2, 2));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(sc0, _MM_SHUFFLE(1, 1, 1, 1));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(sc0, _MM_SHUFFLE(0, 0, 0, 0));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
result = _mm_add_ps(result, g_XMOne);
result = _mm_mul_ps(result, x);
*vec_sin_angles = result;
// Compute polynomial approximation of cosine
const XMVECTOR cc1 = g_XMCosCoefficients1;
v_constants = XM_PERMUTE_PS(cc1, _MM_SHUFFLE(0, 0, 0, 0));
result = _mm_mul_ps(v_constants, x2);
const XMVECTOR cc0 = g_XMCosCoefficients0;
v_constants = XM_PERMUTE_PS(cc0, _MM_SHUFFLE(3, 3, 3, 3));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(cc0, _MM_SHUFFLE(2, 2, 2, 2));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(cc0, _MM_SHUFFLE(1, 1, 1, 1));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
v_constants = XM_PERMUTE_PS(cc0, _MM_SHUFFLE(0, 0, 0, 0));
result = _mm_add_ps(result, v_constants);
result = _mm_mul_ps(result, x2);
result = _mm_add_ps(result, g_XMOne);
result = _mm_mul_ps(result, sign);
*vec_cos_angles = result;
}
// Returns true if the vector contains a component that is either NAN or +/-infinite.
FUN_ALWAYS_INLINE bool VectorContainsNaNOrInfinite(const VectorRegister& vec) {
using namespace DirectX;
return (XMVector4IsNaN(vec) || XMVector4IsInfinite(vec));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorExp(const VectorRegister& x) {
return MakeVectorRegister(Math::Exp(VectorGetComponent(x, 0)), Math::Exp(VectorGetComponent(x, 1)), Math::Exp(VectorGetComponent(x, 2)), Math::Exp(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorExp2(const VectorRegister& x) {
return DirectX::XMVectorExp2(x);
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorLog(const VectorRegister& x) {
return MakeVectorRegister(Math::Loge(VectorGetComponent(x, 0)), Math::Loge(VectorGetComponent(x, 1)), Math::Loge(VectorGetComponent(x, 2)), Math::Loge(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorLog2(const VectorRegister& x) {
return DirectX::XMVectorLog2(x);
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorSin(const VectorRegister& x) {
return MakeVectorRegister(Math::Sin(VectorGetComponent(x, 0)), Math::Sin(VectorGetComponent(x, 1)), Math::Sin(VectorGetComponent(x, 2)), Math::Sin(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorCos(const VectorRegister& x) {
return MakeVectorRegister(Math::Cos(VectorGetComponent(x, 0)), Math::Cos(VectorGetComponent(x, 1)), Math::Cos(VectorGetComponent(x, 2)), Math::Cos(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorTan(const VectorRegister& x) {
return MakeVectorRegister(Math::Tan(VectorGetComponent(x, 0)), Math::Tan(VectorGetComponent(x, 1)), Math::Tan(VectorGetComponent(x, 2)), Math::Tan(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorASin(const VectorRegister& x) {
return MakeVectorRegister(Math::Asin(VectorGetComponent(x, 0)), Math::Asin(VectorGetComponent(x, 1)), Math::Asin(VectorGetComponent(x, 2)), Math::Asin(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorACos(const VectorRegister& x) {
return MakeVectorRegister(Math::Acos(VectorGetComponent(x, 0)), Math::Acos(VectorGetComponent(x, 1)), Math::Acos(VectorGetComponent(x, 2)), Math::Acos(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorATan(const VectorRegister& x) {
return MakeVectorRegister(Math::Atan(VectorGetComponent(x, 0)), Math::Atan(VectorGetComponent(x, 1)), Math::Atan(VectorGetComponent(x, 2)), Math::Atan(VectorGetComponent(x, 3)));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorATan2(const VectorRegister& x, const VectorRegister& y) {
return MakeVectorRegister(Math::Atan2(VectorGetComponent(x, 0), VectorGetComponent(y, 0)),
Math::Atan2(VectorGetComponent(x, 1), VectorGetComponent(y, 1)),
Math::Atan2(VectorGetComponent(x, 2), VectorGetComponent(y, 2)),
Math::Atan2(VectorGetComponent(x, 3), VectorGetComponent(y, 3)));
}
FUN_ALWAYS_INLINE VectorRegister VectorCeil(const VectorRegister& x) {
return DirectX::XMVectorCeiling(x);
}
FUN_ALWAYS_INLINE VectorRegister VectorFloor(const VectorRegister& x) {
return DirectX::XMVectorFloor(x);
}
FUN_ALWAYS_INLINE VectorRegister VectorTruncate(const VectorRegister& x) {
return DirectX::XMVectorTruncate(x);
}
FUN_ALWAYS_INLINE VectorRegister VectorFractional(const VectorRegister& x) {
return VectorSubtract(x, VectorTruncate(x));
}
FUN_ALWAYS_INLINE VectorRegister VectorMod(const VectorRegister& x, const VectorRegister& y) {
return DirectX::XMVectorMod(x, y);
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorSign(const VectorRegister& x) {
return MakeVectorRegister(
(float)(VectorGetComponent(x, 0) >= 0.f ? 1.f : 0.f),
(float)(VectorGetComponent(x, 1) >= 0.f ? 1.f : 0.f),
(float)(VectorGetComponent(x, 2) >= 0.f ? 1.f : 0.f),
(float)(VectorGetComponent(x, 3) >= 0.f ? 1.f : 0.f));
}
//TODO: Vectorize
FUN_ALWAYS_INLINE VectorRegister VectorStep(const VectorRegister& x) {
return MakeVectorRegister(
(float)(VectorGetComponent(x, 0) >= 0.f ? 1.f : -1.f),
(float)(VectorGetComponent(x, 1) >= 0.f ? 1.f : -1.f),
(float)(VectorGetComponent(x, 2) >= 0.f ? 1.f : -1.f),
(float)(VectorGetComponent(x, 3) >= 0.f ? 1.f : -1.f));
}
// to be continued...
} // namespace fun
#endif //!__cplusplus_cli
|
1364737713bbd95368e5351bc7328bc962a2c389 | 83ea4112a19c193dcc8a3d36f2ea7f9b70294d53 | /1/kamil.cpp | b8f2aa516100467c3445203bf3a952af242ddf37 | [] | no_license | s-bond/Miscellaneous-Codes | a8240eb8d2ab59528be59a1a60ad9fcd1722e9b2 | 51fa3242230a7c820a58999e3449a755e9fda6f4 | refs/heads/master | 2021-01-02T22:58:50.156483 | 2013-08-12T17:53:36 | 2013-08-12T17:53:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 206 | cpp | kamil.cpp | #include <iostream>
using namespace std;int main(){int i=0,j=0,s=1;char c[21],a;while(i<10){cin>>c;while(c[j]!='\0'){a=c[j];if(a=='T'||a=='D'||a=='L'||a=='F')s*=2;j++;}cout<<s<<endl;s=1;j=0;i++;}return 0;}
|
e574d69a7a30158027a62012cf8f4e98c226adb7 | 36367ce7909547ea38d49cbef13b4d1b6e9c5a98 | /M5StickCSat/M5StickCSat.ino | b45c942b5050f73e2200f157f79b1e85fd498c7a | [] | no_license | OzoraKobo/SWOS2AE | cda6504f981bef8ecea3287bc3869218c3e7da08 | 16814c26e307a17d489b16db3c4966f4fe495339 | refs/heads/main | 2023-08-21T17:39:00.428011 | 2021-09-22T01:06:38 | 2021-09-22T01:06:38 | 404,594,311 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,973 | ino | M5StickCSat.ino |
#include "M5StickC.h"
#include "M5Timer.h"
#include "SerialReceive.h"
// タイマー
M5Timer timer; // M5Timer オブジェクト生成
#define TIMER_1SEC 1000 // タイマー:1秒
bool timer_1sec_flag = false; // 1秒タイマーフラグ
uint32_t run_time = 0; // 起動後の経過時間(秒)
// コマンド受信許可タイマー
#define TIMER_CMD_RECV_EN 180 // コマンド受信許可タイマー[秒] 起動からこの時間経過後コマンド受信処理を開始する
bool cmd_recv_enable = false; // コマンド受信許可フラグ
// シリアル受信
SerialReceive serialReceiver(SerialReceive::LOG_INFO); // シリアル受信クラスインスタンス生成
char seralReceiveBuff[SERIAL_RECEIVE_BUFF_SIZE]; // シリアル受信バッファ
// 1秒周期タイマ割り込みハンドラ関数
void timer_func_1sec(void)
{
run_time++;
//Serial.printf("%d\n", run_time);
timer_1sec_flag = true; // 1秒タイマーフラグセット
}
void setup()
{
// M5 スタート
M5.begin();
// 1秒周期タイマ割り込みスタート
timer.setInterval(TIMER_1SEC, timer_func_1sec);
}
void loop()
{
// M5Timer処理
timer.run();
if (timer_1sec_flag == true) {
// 1秒周期処理
timer_1sec_flag = false; // 1秒タイマーフラグクリア
// コマンド受信許可タイマー時間経過チェック
if (cmd_recv_enable == false) {
// コマンド受信不可
if (run_time >= TIMER_CMD_RECV_EN) {
// コマンド受信許可タイマー時間に達した
// シリアル受信初期化
serialReceiver.Init(false);
// シリアル受信開始
serialReceiver.Start();
// コマンド受信許可フラグセット
cmd_recv_enable = true;
}
}
}
if (cmd_recv_enable == true) {
// コマンド受信許可
// シリアル受信メッセージチェック
SerialReceive::RESULT serialRecvResult = serialReceiver.GetReceiveData(seralReceiveBuff);
if (serialRecvResult == serialReceiver.RESULT_SUCCESS) {
// 受信メッセージ取得成功
//Serial.printf("Received : %s\n", seralReceiveBuff);
if (strcmp(seralReceiveBuff, "start") == 0) {
// "start"コマンド
Serial.printf("*** start ***\n");
}
else if (strcmp(seralReceiveBuff, "stop") == 0) {
// "stop"コマンド
Serial.printf("*** stop ***\n");
}
else {
// 認識できないコマンド
Serial.printf("Invalid command : \"%s\"\n", seralReceiveBuff);
}
}
}
M5.update();
}
|
06a62e20cb6a1f2e241890e7b4f94b1ed20eff69 | 10a3c55e32cabba74f87f0fb71b32b8267de28a6 | /geometry/proximity/bounding_volume_hierarchy.cc | b684421e86f726f3a566885229311811aea4a7be | [
"BSD-3-Clause"
] | permissive | saguilera3/drake | 9510c4cf2efc8bcb03577d5ff0087c451406da8e | 4edd4f900930512a6c4d0e12f7783bdeb5cae4fc | refs/heads/master | 2020-12-04T05:38:01.717875 | 2020-09-30T16:59:12 | 2020-09-30T16:59:12 | 231,632,723 | 0 | 1 | NOASSERTION | 2020-01-03T17:18:45 | 2020-01-03T17:18:44 | null | UTF-8 | C++ | false | false | 13,449 | cc | bounding_volume_hierarchy.cc | #include "drake/geometry/proximity/bounding_volume_hierarchy.h"
#include "drake/common/eigen_types.h"
namespace drake {
namespace geometry {
namespace internal {
using Eigen::Matrix3d;
using Eigen::Vector3d;
using math::RotationMatrixd;
bool Aabb::HasOverlap(const Aabb& a, const Aabb& b,
const math::RigidTransformd& X_AB) {
// We need to split the transform into the position and rotation components,
// `p_AB` and `R_AB`. For the purposes of streamlining the math below, they
// will henceforth be named `t` and `r` respectively.
const Vector3d t = X_AB * b.center() - a.center();
const Matrix3d r = X_AB.rotation().matrix();
// Compute some common subexpressions and add epsilon to counteract
// arithmetic error, e.g. when two edges are parallel. We use the value as
// specified from Gottschalk's OBB robustness tests.
const double kEpsilon = 0.000001;
Matrix3d abs_r = r;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
abs_r(i, j) = abs(abs_r(i, j)) + kEpsilon;
}
}
// First category of cases separating along a's axes.
for (int i = 0; i < 3; ++i) {
if (abs(t[i]) >
a.half_width()[i] + b.half_width().dot(abs_r.block<1, 3>(i, 0))) {
return false;
}
}
// Second category of cases separating along b's axes.
for (int i = 0; i < 3; ++i) {
if (abs(t.dot(r.block<3, 1>(0, i))) >
b.half_width()[i] + a.half_width().dot(abs_r.block<3, 1>(0, i))) {
return false;
}
}
// Third category of cases separating along the axes formed from the cross
// products of a's and b's axes.
int i1 = 1;
for (int i = 0; i < 3; ++i) {
const int i2 = (i1 + 1) % 3; // Calculate common sub expressions.
int j1 = 1;
for (int j = 0; j < 3; ++j) {
const int j2 = (j1 + 1) % 3;
if (abs(t[i2] * r(i1, j) -
t[i1] * r(i2, j)) >
a.half_width()[i1] * abs_r(i2, j) +
a.half_width()[i2] * abs_r(i1, j) +
b.half_width()[j1] * abs_r(i, j2) +
b.half_width()[j2] * abs_r(i, j1)) {
return false;
}
j1 = j2;
}
i1 = i2;
}
return true;
}
bool Aabb::HasOverlap(const Aabb& bv, const Plane<double>& plane_P,
const math::RigidTransformd& X_PH) {
// We want the two corners of the box that lie at the most extreme extents in
// the plane's normal direction. Then we can determine their heights
// -- if the interval of heights includes _zero_, the box overlaps.
// The box's canonical frame B is aligned with H; R_BH = I which implies
// R_PH = R_PB. However, p_HoBo is not necessarily zero.
const auto& R_PH = X_PH.rotation().matrix();
// The corner of the box that will have the *greatest* height value w.r.t.
// the plane measured from the box's frame's origin (Bo) but expressed in the
// plane's frame.
Vector3d p_BoCmax_P = Vector3d::Zero();
// We want to compute the vectors Hᴹᵢ ∈ {Hᵢ, -Hᵢ}, such that Hᴹᵢ ⋅ n̂ₚ is
// positive. The maximum box corner is a combination of those Hᴹᵢ vectors.
for (int i = 0; i < 3; ++i) {
const Vector3d& Hi_P = R_PH.col(i);
const Vector3d& Hi_max_P = Hi_P.dot(plane_P.normal()) > 0 ? Hi_P : -Hi_P;
p_BoCmax_P += Hi_max_P * bv.half_width()(i);
}
const Vector3d& p_HoBo_H = bv.center();
const Vector3d p_PoBo_P = X_PH * p_HoBo_H;
// Minimum corner is merely the reflection of the maximum corner across the
// center of the box.
const Vector3d p_PoCmax_P = p_PoBo_P + p_BoCmax_P;
const Vector3d p_PoCmin_P = p_PoBo_P - p_BoCmax_P;
const double max_height = plane_P.CalcHeight(p_PoCmax_P);
const double min_height = plane_P.CalcHeight(p_PoCmin_P);
return min_height <= 0 && 0 <= max_height;
}
bool Aabb::HasOverlap(const Aabb& bv, const HalfSpace&,
const math::RigidTransformd& X_CH) {
/*
Hy Hx
╲ ╱
By ╱╲ Bx ╲ ╱
╲╱ ╲ ╱ ╲ ╱
╱╲ ╲ ╱ ╲ ╱
╱ ╲ ╲╱ ╲╱
╲ ╲ ╱╲ bv Ho
╲ ╲╱ ╲
╲ Bo ╲
╲ ╲
╲ ╱
╲ ╱
╲ ╱ Cz
╲╱ ^
L ┃ Cx
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┺━━━>┄┄┄┄┄┄┄┄┄┄┄┄┄
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ Half space
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
If any point in the bounding volume has a signed distance φ that is less
than or equal to zero, we consider the box to be overlapping the half space.
We could simply, yet inefficiently, determine this by iterating over all
eight vertices and evaluating the signed distance for each vertex.
However, to provide value as a culling algorithm, we need to be cheaper. So,
if the lowest corner (marked `L`) has a signed distance less than or equal
to zero, the overlapping condition is met.
The point L = Bₒ + ∑ sᵢ * dᵢ * Bᵢ, where:
- i ∈ {x, y, z}.
- dᵢ is the _half_ measure of the box's dimension along axis i.
- sᵢ ∈ {1, -1}, such that sᵢBᵢ ⋅ Cz ≤ 0.
Since, φ(p_CL) = p_CL ⋅ Cz. If p_CL is expressed in C, then the z-component
of p_CL (p_CL_z), is equal to φ(p_CL). So, if p_CL_z ≤ 0, they overlap.
*/
// The z-component of the position vector from box center (Bo) to the lowest
// corner of the box (L) expressed in the half space's canonical frame C.
const auto& R_CH = X_CH.rotation().matrix();
double p_BL_C_z = 0.0;
for (int i = 0; i < 3; ++i) {
// R_CH(2, i) is Hi_C(2) --> the z-component of Hi_C.
const double Hi_C_z = R_CH(2, i);
const double s_i = Hi_C_z > 0 ? -1 : 1;
p_BL_C_z += s_i * bv.half_width()(i) * Hi_C_z;
}
// Now we compute the z-component of the position vector from Co to L,
// expressed in Frame C.
// p_CL_C = p_CB_C + p_BL_C
// = p_CH_C + p_HB_C + p_BL_C
// = p_CH_C + (R_CH * p_HB_H) + p_BL_C
// In all of these calculations, we only need the z-component. So, that means
// we can get the z-component of p_HB_C without the full
// R_CH * p_HB_H calculation; we can simply do Cz_H ⋅ p_HB_H.
const Vector3d& p_HB_H = bv.center();
const Vector3d& Cz_H = R_CH.row(2);
const double p_HB_C_z = Cz_H.dot(p_HB_H);
const double p_CH_C_z = X_CH.translation()(2);
const double p_CB_C_z = p_CH_C_z + p_HB_C_z;
const double p_CL_C_z = p_CB_C_z + p_BL_C_z;
return p_CL_C_z <= 0;
}
void Aabb::PadBoundary() {
const double max_position = center_.cwiseAbs().maxCoeff();
const double max_half_width = half_width_.maxCoeff();
const double scale = std::max(max_position, max_half_width);
const double incr =
std::max(scale * std::numeric_limits<double>::epsilon(), kTolerance);
half_width_ += Vector3d::Constant(incr);
}
template <class MeshType>
BoundingVolumeHierarchy<MeshType>::BoundingVolumeHierarchy(
const MeshType& mesh) {
// Generate element indices and corresponding centroids. These are used
// for calculating the split point of the volumes.
const int num_elements = mesh.num_elements();
std::vector<CentroidPair> element_centroids;
for (IndexType i(0); i < num_elements; ++i) {
element_centroids.emplace_back(i, ComputeCentroid(mesh, i));
}
root_node_ =
BuildBVTree(mesh, element_centroids.begin(), element_centroids.end());
}
template <class MeshType>
std::unique_ptr<BvNode<MeshType>>
BoundingVolumeHierarchy<MeshType>::BuildBVTree(
const MeshType& mesh,
const typename std::vector<CentroidPair>::iterator& start,
const typename std::vector<CentroidPair>::iterator& end) {
// Generate bounding volume.
Aabb aabb = ComputeBoundingVolume(mesh, start, end);
const int num_elements = end - start;
if (num_elements == 1) {
// Store element index in this leaf node.
return std::make_unique<BvNode<MeshType>>(aabb, start->first);
} else {
// Sort the elements by centroid along the axis of greatest spread.
// Note: We tried an alternative strategy for building the BVH using a
// volume-based metric.
// - Given a parent BV P, we would partition all of its contents into a left
// BV, L, and a right BV, R, such that we wanted to minimize (V(L) + V(R))
// / V(P). (V(X) is the volume measure of the bounding volume X).
// - We didn't explore all possible partitions (there are an exponential
// number of such possible partitions).
// - Instead, we ordered the mesh elements along an axis and then would
// consider partitions split between two adjacent elements in the sorted
// set. This was repeated for each of the axes and the partition with the
// minimum value was taken.
// - We did explore several ordering options, including sorting by centroid,
// min, max, and a combination of them when the element overlapped the
// partition boundary.
// This tentative partitioning strategy produced more BV-BV tests in some
// simple examples than the simple bisection shown below and was abandoned.
// Some possible reasons for this:
// - Sorting by an alternate criteria might be a better way to order them.
// - Only considering split points based on adjacent elements may be
// problematic.
// - The elements individual extents are such they are not typically
// axis-aligned so, partitioning between two elements would often produce
// child BVs that have non-trivial overlap.
// Finally, the primitive meshes we are producing are relatively regular and
// are probably nicely compatible with the median split strategy. If we need
// to do irregular distribution of elements, a more sophisticated strategy
// may help. But proceed with caution -- there's no guarantee such a
// strategy will yield performance benefits.
int axis{};
aabb.half_width().maxCoeff(&axis);
std::sort(start, end, [axis](const CentroidPair& a, const CentroidPair& b) {
return a.second[axis] < b.second[axis];
});
// Continue with the next branches.
const typename std::vector<CentroidPair>::iterator mid =
start + num_elements / 2;
return std::make_unique<BvNode<MeshType>>(
aabb, BuildBVTree(mesh, start, mid), BuildBVTree(mesh, mid, end));
}
}
template <class MeshType>
Aabb BoundingVolumeHierarchy<MeshType>::ComputeBoundingVolume(
const MeshType& mesh,
const typename std::vector<CentroidPair>::iterator& start,
const typename std::vector<CentroidPair>::iterator& end) {
// Keep track of the min/max bounds to create the bounding box.
Vector3d max_bounds, min_bounds;
max_bounds.setConstant(std::numeric_limits<double>::lowest());
min_bounds.setConstant(std::numeric_limits<double>::max());
// Check each mesh element in the given range.
for (auto pair = start; pair < end; ++pair) {
const auto& element = mesh.element(pair->first);
// Check each vertex in the element.
for (int v = 0; v < kElementVertexCount; ++v) {
const auto& vertex = mesh.vertex(element.vertex(v)).r_MV();
// Compare its extent along each of the 3 axes.
min_bounds = min_bounds.cwiseMin(vertex);
max_bounds = max_bounds.cwiseMax(vertex);
}
}
const Vector3d center = (min_bounds + max_bounds) / 2;
const Vector3d half_width = max_bounds - center;
return Aabb(center, half_width);
}
template <class MeshType>
Vector3d BoundingVolumeHierarchy<MeshType>::ComputeCentroid(
const MeshType& mesh, const IndexType i) {
Vector3d centroid{0, 0, 0};
const auto& element = mesh.element(i);
// Calculate average from all vertices.
for (int v = 0; v < kElementVertexCount; ++v) {
const auto& vertex = mesh.vertex(element.vertex(v)).r_MV();
centroid += vertex;
}
centroid /= kElementVertexCount;
return centroid;
}
template <class MeshType>
bool BoundingVolumeHierarchy<MeshType>::EqualTrees(const BvNode<MeshType>& a,
const BvNode<MeshType>& b) {
if (&a == &b) return true;
if (!a.aabb().Equal(b.aabb())) return false;
if (a.is_leaf()) {
if (!b.is_leaf()) {
return false;
}
return a.element_index() == b.element_index();
} else {
if (b.is_leaf()) {
return false;
}
return EqualTrees(a.left(), b.left()) && EqualTrees(a.right(), b.right());
}
}
} // namespace internal
} // namespace geometry
} // namespace drake
template class drake::geometry::internal::BoundingVolumeHierarchy<
drake::geometry::SurfaceMesh<double>>;
template class drake::geometry::internal::BoundingVolumeHierarchy<
drake::geometry::VolumeMesh<double>>;
|
62aca96a2b8b62380d3541d60bc6e47e51d36536 | f6737c532718980a62d5d19753be9b1e94f908c1 | /boost/asynchronous/scheduler/multiqueue_threadpool_scheduler.hpp | 67805fcc94e72b300ba31e4d4f90836ff1d057b7 | [] | no_license | Shevchenko-Alexander/asynchronous | 8096228eda9b1e6455edcda746c91722f16973e9 | 1f0acf7bcd628d3ad0db50d8b921d5494f43f8a1 | refs/heads/master | 2020-04-03T11:41:37.695317 | 2018-10-29T15:06:26 | 2018-10-29T15:06:26 | 155,228,999 | 0 | 0 | null | 2018-10-29T14:47:59 | 2018-10-29T14:47:57 | null | UTF-8 | C++ | false | false | 15,112 | hpp | multiqueue_threadpool_scheduler.hpp | // Boost.Asynchronous library
// Copyright (C) Christophe Henry 2013
//
// 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)
//
// For more information, see http://www.boost.org
#ifndef BOOST_ASYNC_SCHEDULER_MULTIQUEUE_THREADPOOL_SCHEDULER_HPP
#define BOOST_ASYNC_SCHEDULER_MULTIQUEUE_THREADPOOL_SCHEDULER_HPP
#include <utility>
#include <vector>
#include <cstddef>
#include <memory>
#include <functional>
#include <future>
#include <boost/thread/thread.hpp>
#include <boost/thread/tss.hpp>
#include <boost/asynchronous/scheduler/detail/scheduler_helpers.hpp>
#include <boost/asynchronous/scheduler/detail/exceptions.hpp>
#include <boost/asynchronous/detail/any_interruptible.hpp>
#include <boost/asynchronous/scheduler/detail/interruptible_job.hpp>
#include <boost/asynchronous/diagnostics/default_loggable_job.hpp>
#include <boost/asynchronous/job_traits.hpp>
#include <boost/asynchronous/scheduler/detail/job_diagnostic_closer.hpp>
#include <boost/asynchronous/queue/find_queue_position.hpp>
#include <boost/asynchronous/queue/any_queue.hpp>
#include <boost/asynchronous/scheduler/detail/multi_queue_scheduler_policy.hpp>
#include <boost/asynchronous/detail/any_joinable.hpp>
#include <boost/asynchronous/queue/lockfree_queue.hpp>
#include <boost/asynchronous/scheduler/tss_scheduler.hpp>
#include <boost/asynchronous/scheduler/cpu_load_policies.hpp>
#include <boost/asynchronous/scheduler/detail/lockable_weak_scheduler.hpp>
#include <boost/asynchronous/scheduler/detail/any_continuation.hpp>
#include <boost/asynchronous/scheduler/detail/execute_in_all_threads.hpp>
namespace boost { namespace asynchronous
{
//TODO boost.parameter
template<class Q,
class FindPosition=boost::asynchronous::default_find_position< >,
class CPULoad =
#ifdef BOOST_ASYNCHRONOUS_NO_SAVING_CPU_LOAD
boost::asynchronous::no_cpu_load_saving
#else
boost::asynchronous::default_save_cpu_load<>
#endif
>
class multiqueue_threadpool_scheduler: public boost::asynchronous::detail::multi_queue_scheduler_policy<Q,FindPosition>
{
public:
typedef Q queue_type;
typedef typename Q::job_type job_type;
typedef typename boost::asynchronous::job_traits<typename Q::job_type>::diagnostic_table_type diag_type;
typedef multiqueue_threadpool_scheduler<Q,FindPosition,CPULoad> this_type;
template<typename... Args>
multiqueue_threadpool_scheduler(size_t number_of_workers, Args... args)
: boost::asynchronous::detail::multi_queue_scheduler_policy<Q,FindPosition>(number_of_workers,std::move(args)...)
, m_number_of_workers(number_of_workers)
{
m_private_queues.reserve(number_of_workers);
for (size_t i = 0; i< number_of_workers;++i)
{
m_private_queues.push_back(
std::make_shared<boost::asynchronous::lockfree_queue<boost::asynchronous::any_callable> >());
}
}
template<typename... Args>
multiqueue_threadpool_scheduler(size_t number_of_workers,std::string const& name, Args... args)
: boost::asynchronous::detail::multi_queue_scheduler_policy<Q,FindPosition>(number_of_workers,std::move(args)...)
, m_number_of_workers(number_of_workers)
, m_name(name)
{
m_private_queues.reserve(number_of_workers);
for (size_t i = 0; i< number_of_workers;++i)
{
m_private_queues.push_back(
std::make_shared<boost::asynchronous::lockfree_queue<boost::asynchronous::any_callable> >());
}
set_name(name);
}
void constructor_done(std::weak_ptr<this_type> weak_self)
{
m_diagnostics = std::make_shared<diag_type>(m_number_of_workers);
m_thread_ids.reserve(m_number_of_workers);
m_group.reset(new boost::thread_group);
for (size_t i = 0; i< m_number_of_workers;++i)
{
std::promise<boost::thread*> new_thread_promise;
std::shared_future<boost::thread*> fu = new_thread_promise.get_future();
boost::thread* new_thread =
m_group->create_thread(std::bind(&multiqueue_threadpool_scheduler::run,this->m_queues,
m_private_queues[i],i,m_diagnostics,fu,weak_self));
new_thread_promise.set_value(new_thread);
m_thread_ids.push_back(new_thread->get_id());
}
}
~multiqueue_threadpool_scheduler()
{
for (size_t i = 0; i< m_number_of_workers;++i)
{
auto fct = m_diagnostics_fct;
auto diag = m_diagnostics;
auto l = [fct,diag]() mutable
{
if (fct)
fct(boost::asynchronous::scheduler_diagnostics(diag->get_map(),diag->get_current()));
};
boost::asynchronous::detail::default_termination_task<typename Q::diagnostic_type,boost::thread_group>
ttask(std::move(l));
// this task has to be executed last => lowest prio
#ifndef BOOST_NO_RVALUE_REFERENCES
boost::asynchronous::any_callable job(std::move(ttask));
m_private_queues[i]->push(std::move(job),std::numeric_limits<std::size_t>::max());
#else
m_private_queues[i]->push(boost::asynchronous::any_callable(ttask),std::numeric_limits<std::size_t>::max());
#endif
}
}
//TODO move?
boost::asynchronous::any_joinable get_worker()const
{
return boost::asynchronous::any_joinable (boost::asynchronous::detail::worker_wrap<boost::thread_group>(m_group));
}
std::vector<boost::thread::id> thread_ids()const
{
return m_thread_ids;
}
boost::asynchronous::scheduler_diagnostics
get_diagnostics(std::size_t =0)const
{
return boost::asynchronous::scheduler_diagnostics(m_diagnostics->get_map(),m_diagnostics->get_current());
}
void clear_diagnostics()
{
m_diagnostics->clear();
}
void register_diagnostics_functor(std::function<void(boost::asynchronous::scheduler_diagnostics)> fct,
boost::asynchronous::register_diagnostics_type =
boost::asynchronous::register_diagnostics_type())
{
m_diagnostics_fct = fct;
}
void set_steal_from_queues(std::vector<boost::asynchronous::any_queue_ptr<job_type> > const&)
{
// this scheduler does not steal
}
void set_name(std::string const& name)
{
for (size_t i = 0; i< m_number_of_workers;++i)
{
boost::asynchronous::detail::set_name_task<typename Q::diagnostic_type> ntask(name);
#ifndef BOOST_NO_RVALUE_REFERENCES
boost::asynchronous::any_callable job(std::move(ntask));
m_private_queues[i]->push(std::move(job),std::numeric_limits<std::size_t>::max());
#else
m_private_queues[i]->push(boost::asynchronous::any_callable(ntask),std::numeric_limits<std::size_t>::max());
#endif
}
}
std::string get_name()const
{
return m_name;
}
void processor_bind(std::vector<std::tuple<unsigned int/*first core*/,unsigned int/*number of threads*/>> p)
{
// our thread (queue) index. 0 means "don't care" and is therefore not desirable)
size_t t = 0;
for(auto const& v : p)
{
for (size_t i = 0; i< std::get<1>(v) && (t < m_number_of_workers);++i)
{
boost::asynchronous::detail::processor_bind_task task(std::get<0>(v)+i);
boost::asynchronous::any_callable job(std::move(task));
m_private_queues[t++]->push(std::move(job),std::numeric_limits<std::size_t>::max());
}
}
}
std::vector<std::future<void>> execute_in_all_threads(boost::asynchronous::any_callable c)
{
std::vector<std::future<void>> res;
res.reserve(m_number_of_workers);
for (size_t i = 0; i< m_number_of_workers;++i)
{
std::promise<void> p;
auto fu = p.get_future();
res.emplace_back(std::move(fu));
boost::asynchronous::detail::execute_in_all_threads_task task(c,std::move(p));
m_private_queues[i]->push(std::move(task),std::numeric_limits<std::size_t>::max());
}
return res;
}
// try to execute a job, return true
static bool execute_one_job(std::vector<std::shared_ptr<queue_type> > const& queues,size_t index,CPULoad& cpu_load,std::shared_ptr<diag_type> diagnostics,
std::list<boost::asynchronous::any_continuation>& waiting)
{
bool popped = false;
// get a job
typename Q::job_type job;
try
{
popped = queues[index]->try_pop(job);
if (!popped)
{
// ok we have nothing to do, maybe we can steal some work?
for (std::size_t i=1; i< queues.size(); ++i)
{
if (index >= i)
{
popped = queues[(index-i)%queues.size()]->try_steal(job);
}
else
{
popped = queues[queues.size()-(i-index)]->try_steal(job);
}
if (popped)
break;
}
}
// did we manage to pop or steal?
if (popped)
{
cpu_load.popped_job();
// log time
boost::asynchronous::job_traits<typename Q::job_type>::set_started_time(job);
// log thread
boost::asynchronous::job_traits<typename Q::job_type>::set_executing_thread_id(job,boost::this_thread::get_id());
// log current
boost::asynchronous::job_traits<typename Q::job_type>::add_current_diagnostic(index,job,diagnostics.get());
// execute job
job();
boost::asynchronous::job_traits<typename Q::job_type>::reset_current_diagnostic(index,diagnostics.get());
boost::asynchronous::job_traits<typename Q::job_type>::set_finished_time(job);
boost::asynchronous::job_traits<typename Q::job_type>::add_diagnostic(job,diagnostics.get());
}
else
{
// look for waiting tasks
if (!waiting.empty())
{
for (std::list<boost::asynchronous::any_continuation>::iterator it = waiting.begin(); it != waiting.end();)
{
if ((*it).is_ready())
{
boost::asynchronous::any_continuation c = std::move(*it);
it = waiting.erase(it);
c();
}
else
{
++it;
}
}
}
}
}
catch(boost::thread_interrupted&)
{
// task interrupted, no problem, just continue
}
catch(std::exception&)
{
if (popped)
{
boost::asynchronous::job_traits<typename Q::job_type>::set_failed(job);
boost::asynchronous::job_traits<typename Q::job_type>::set_finished_time(job);
boost::asynchronous::job_traits<typename Q::job_type>::add_diagnostic(job,diagnostics.get());
boost::asynchronous::job_traits<typename Q::job_type>::reset_current_diagnostic(index,diagnostics.get());
}
}
return popped;
}
static void run(std::vector<std::shared_ptr<queue_type> > const& queues,
std::shared_ptr<boost::asynchronous::lockfree_queue<boost::asynchronous::any_callable> > const& private_queue,
size_t index,std::shared_ptr<diag_type> diagnostics,
std::shared_future<boost::thread*> self,
std::weak_ptr<this_type> this_)
{
boost::thread* t = self.get();
boost::asynchronous::detail::multi_queue_scheduler_policy<Q,FindPosition>::m_self_thread.reset(new thread_ptr_wrapper(t));
// thread scheduler => tss
boost::asynchronous::any_weak_scheduler<job_type> self_as_weak = boost::asynchronous::detail::lockable_weak_scheduler<this_type>(this_);
boost::asynchronous::get_thread_scheduler<job_type>(self_as_weak,true);
boost::asynchronous::get_own_queue_index<>(index+1,true);
std::list<boost::asynchronous::any_continuation>& waiting =
boost::asynchronous::get_continuations(std::list<boost::asynchronous::any_continuation>(),true);
CPULoad cpu_load;
while(true)
{
try
{
{
bool popped = execute_one_job(queues,index,cpu_load,diagnostics,waiting);
if (!popped)
{
cpu_load.loop_done_no_job();
// nothing for us to do, give up our time slice
boost::this_thread::yield();
}
// check for shutdown
boost::asynchronous::any_callable djob;
popped = private_queue->try_pop(djob);
if (popped)
{
djob();
}
} // job destroyed (for destruction useful)
// check if we got an interruption job
boost::this_thread::interruption_point();
}
catch(boost::asynchronous::detail::shutdown_exception&)
{
// we are done, execute jobs posted short before to the end, then shutdown
while(execute_one_job(queues,index,cpu_load,diagnostics,waiting));
delete boost::asynchronous::detail::multi_queue_scheduler_policy<Q,FindPosition>::m_self_thread.release();
return;
}
catch(boost::thread_interrupted&)
{
// task interrupted, no problem, just continue
}
catch(std::exception&)
{
// TODO, user-defined error
}
}
}
private:
size_t m_number_of_workers;
std::shared_ptr<boost::thread_group> m_group;
std::vector<boost::thread::id> m_thread_ids;
std::shared_ptr<diag_type> m_diagnostics;
std::vector<std::shared_ptr<
boost::asynchronous::lockfree_queue<boost::asynchronous::any_callable>>> m_private_queues;
std::function<void(boost::asynchronous::scheduler_diagnostics)> m_diagnostics_fct;
const std::string m_name;
};
}} // boost::async::scheduler
#endif // BOOST_ASYNC_SCHEDULER_MULTIQUEUE_THREADPOOL_SCHEDULER_HPP
|
bdaf11ddb4b80d8a5f319db7fda1a2983d1eacaf | 2c5a5452430ba54b8d3bcb80572e887235d9bdef | /Estrutura_de_Dados/simple_conj_DIN.hpp | 5728a5aad5f2bd9426a96ee34b7ca6653cae6fe5 | [] | no_license | matheus123deimos/Projetos_PEstruturada | 370d683161ec1949ecbfc9752f0c9d284ac0e7e0 | 99fdca042d86487e9087a9d5ab8a9df089e7af44 | refs/heads/master | 2021-01-13T15:54:02.124289 | 2019-01-02T18:34:53 | 2019-01-02T18:34:53 | 76,803,016 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,178 | hpp | simple_conj_DIN.hpp | #include <iostream>
using std::nothrow;
template<typename T>
struct Node{T elem; Node<T> *prox;};
template<typename T>
struct ConjuntoDim{Node<T> *prim;};
template<typename T>
void Inicializar_Conjunto(ConjuntoDim<T> &C){C.prim = NULL;};
template<typename T>
bool Inserir(ConjuntoDim<T> &C,T e){
Node<T> *m = new(nothrow) Node<T>;
if(m){
m->elem = e;
m->prox = C.prim;
C.prim = m;
return false;
}else return true;
}
template<typename T>
bool Pertence(ConjuntoDim<T>&C,T e){
for(Node<T>*n = C.prim;(n);n=n->prox){
if(n->elem==e) return true;
}return false;
}
template<typename T>
bool Remover(ConjuntoDim<T> &C,T e){
if(C.prim){
Node<T> *n = C.prim;
if(n->elem == e){C.prim = n->prox;delete n;return true;}
for(;;){
Node<T> *a = n;
n = n->prox;
if(n==NULL) return false;
if(n->elem==e){a->prox = n->prox;delete n;return true;}
}
}else return false;
}
template<typename T>
void Terminar_Conjunto(ConjuntoDim<T>&C){
for(Node<T>*n = C.prim;(n);){
Node<T> *p = n->prox;
delete n;
n=p;
}
}
template<typename T>
bool Vazio(ConjuntoDim<T>&C){return C.prim == NULL;}
|
ccdfbd3523b6b828561ff07469493cdff977e433 | 0b070626740788d5af23fcd1cd095e56033308de | /727.cpp | 5db90a8c02279ba402baad0202d4d319aad86dbf | [] | no_license | xis19/leetcode | 71cb76c5764f8082155d31abcb024b25fd90bc75 | fb35fd050d69d5d8abf6794ae4bed174aaafb001 | refs/heads/master | 2021-03-24T12:53:34.379480 | 2020-02-24T04:25:36 | 2020-02-24T04:25:36 | 76,006,015 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,705 | cpp | 727.cpp | #include <limits>
#include <string>
#include <vector>
std::string minWindow(const std::string& S, const std::string& T) {
// For this one, we cannot use two pointer strategy since we have
// to preserve the order of the characters in the string.
// We consider the example
// a b c d e b d d e
// b 1 1
// d 3 2 3
// e 4 4
//
// For a new character, we find the nearest match in the prior row. Finally
// we backtrack the last row to find the first match.
const int LEN_S = S.size();
const int LEN_T = T.size();
std::vector<std::vector<int>> dp(LEN_T, std::vector<int>(LEN_S, 0));
for(int i = 0; i < LEN_T; ++i) {
for(int j = 0; j < LEN_S; ++j) {
char s = S[j];
char t = T[i];
if (s == t) {
if (i == 0) {
dp[i][j] = 1;
} else {
int r = j - 1;
while(r >= 0) {
if (dp[i - 1][r] > 0) {
dp[i][j] = j - r + dp[i - 1][r];
break;
}
--r;
}
}
}
}
}
// Now we go to the last row and find the first match
auto& lastRow = dp.back();
int minPos = -1;
int minLen = std::numeric_limits<int>::max();
for(int i = 0; i < LEN_S; ++i) {
if (lastRow[i] != 0 && lastRow[i] < minLen) {
minPos = i;
minLen = lastRow[i];
}
}
if (minPos == -1) {
return "";
} else {
return S.substr(minPos - minLen + 1, minLen);
}
}
|
a196b4314dfc524fa4f0e5e00827d99b78037717 | f7fa8eb004c767dc1120062f2c342147f1a67cd1 | /src/JsonParser.cpp | 093966c54a3aa993167e1075d45e3eab9b79723b | [] | no_license | VisaJE/feedback-system | 08ea042506ceed538b29bb3017a1b4e62f8487d9 | c9b6b9887ac34e296d3f0a9f02830c41c84b26fe | refs/heads/master | 2020-03-20T21:28:16.051751 | 2019-04-21T09:13:40 | 2019-04-21T09:13:40 | 137,742,447 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,317 | cpp | JsonParser.cpp | /*
* JsonParser.cpp
*
* Created on: 18 Jun 2018
* Author: visakoe1
*/
#include <iostream>
#include "JsonParser.h"
#include <string>
#include <sstream>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/filereadstream.h"
#include <cstdio>
#include <fstream>
using namespace feedback;
using namespace std;
using namespace rapidjson;
#include <sys/stat.h>
// Function: fileExists
/**
Check if a file exists
@param[in] filename - the name of the file to check
@return true if the file exists, else false
*/
static bool fileExists(const string filename)
{
struct stat buf;
if (stat(filename.c_str(), &buf) != -1)
{
return true;
}
return false;
}
/*
* The parser can update an existing file only if the subject name and the filenames remain the same. If subject changes,
* the earlier file will be overwritten. The files are updated at the destructor.
*/
JsonParser::JsonParser(std::string file, std::string subject, bool freshStart): filename(file), subject(subject) {
char extension[5] = {'.', 'j', 's', 'o', 'n'};
if (filename.length() < 5) filename = filename.append(".json");
else {
for (int i = 4; i >= 0; i--) {
if (filename.at(filename.length() - i-1) != extension[4-i]) {
filename = filename.append(".json");
}
}
}
if (!fileExists(filename) || freshStart) {
refreshFromData();
}
else if (!refreshFromFile()) {
refreshFromData();
}
}
JsonParser::~JsonParser() {
refreshFromData();
}
void JsonParser::refreshFromData() {
remove (filename.c_str());
Document jsonDoc;
string info = prototype;
jsonDoc.Parse(prototype.c_str());
Value::MemberIterator subjectN = jsonDoc.FindMember("subject");
subjectN->value = StringRef(subject.c_str());
Value::MemberIterator values = jsonDoc.FindMember("score");
for (int i = 0; i < 5; i++) {
values->value[i] = data[i];
}
// Rapidjson document has to be written onto a buffer to be parsed as a string.
rapidjson::StringBuffer buffer;
buffer.Clear();
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
jsonDoc.Accept(writer);
ofstream out(filename.c_str());
if (!out.good()) {
ofstream out2(filename.append( "_updateError").c_str() );
out2 << buffer.GetString();
out2.close();
}
else {
out << buffer.GetString();
out.close();
}
}
bool JsonParser::refreshFromFile() {
std::ifstream ifs (filename, std::ifstream::in);
char c = ifs.get();
stringstream s;
while (ifs.good()) {
if (c != '\n' ) s << c;
c = ifs.get();
}
Document jsonDoc;
string st = s.str();
try {
jsonDoc.Parse(st.c_str());
} catch (int e) {
return false;
}
Value::MemberIterator subjectN = jsonDoc.FindMember("subject");
if (subjectN->value.GetString() != subject) return false;
Value::MemberIterator valuesN = jsonDoc.FindMember("score");
for (int i = 0; i < 5; i++) {
if (valuesN->value[i].IsNumber() ) {
data[i] = valuesN->value[i].GetInt();
}
else return false;
}
ifs.close();
return true;
}
void JsonParser::addData(short value) {
assert (value >= 1 && value <= 5);
data[value-1] += 1;
}
void JsonParser::getData(int values[5]) {
for (int i = 0; i < 5; i++) {
values[i] = data[i];
}
}
|
43888346b25fd471c6796a58e26b77ba87782b72 | 54320ef64dd0548a5b5016feed14c606a5fd1e76 | /Araksya_Hambaryan/Homework/C++/Homework_07_12_2015/Zombi_process.cpp | a9bcfc1268c9ac2d89ee535d146ad8c38d4b94d9 | [] | no_license | ITC-Vanadzor/ITC-7 | 9859ebbd0d824d3a480ea281bbdb14edbb6a374e | d2bfcdc3a1faea4cdc1d7e555404445ac8768c66 | refs/heads/master | 2021-01-17T15:43:29.646485 | 2019-02-17T19:07:36 | 2019-02-17T19:07:36 | 44,699,731 | 0 | 4 | null | 2017-04-13T18:45:36 | 2015-10-21T19:38:34 | JavaScript | UTF-8 | C++ | false | false | 1,062 | cpp | Zombi_process.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
int main()
{
std::cout << "Starting Process"<<std::endl;
int pid = fork();
switch (pid) {
case -1:
perror ("fork");
exit (1);
case 0:
std::cout << "Child process is running! PID =" << getpid()<<std::endl;
sleep(300);
std::cout << "Child process is exiting!"<<std::endl;
exit(2);
default:
std::cout << "Parent process is continuing child's pid is " << pid <<std::endl;
sleep(5);
std::cout << "Parent process is sending SIGKILL to child process...\n"<<std::endl;
if (kill(pid, SIGKILL) != 0)
{
perror("kill");
// waitpid(pid, NULL, 0); // uncomment this to avoid zombie child process
}
std::cout << "Parent process is sleeping... ps aux should show process" << pid << " is a zombie now" << std::endl;
sleep(500); // just for clarity
std::cout <<"Parent process is exiting!"<<std::endl;
exit(2);
}
}
|
85380847fef22f0ba6d614195a8b05a15f6ccaee | 2bec5a52ce1fb3266e72f8fbeb5226b025584a16 | /particles/src/collision.cpp | 2f7f4b68cdc0ec016758312e9877fce6ef33f656 | [
"MIT",
"BSD-3-Clause"
] | permissive | akhikolla/InformationHouse | 4e45b11df18dee47519e917fcf0a869a77661fce | c0daab1e3f2827fd08aa5c31127fadae3f001948 | refs/heads/master | 2023-02-12T19:00:20.752555 | 2020-12-31T20:59:23 | 2020-12-31T20:59:23 | 325,589,503 | 9 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 874 | cpp | collision.cpp | #include <Rcpp.h>
#include "vector.h"
#include "quadTree.h"
using namespace Rcpp;
//[[Rcpp::export]]
NumericMatrix collision(NumericMatrix pos, NumericMatrix vel, NumericVector radii, double strength) {
size_t i;
NumericMatrix res(pos.nrow(), pos.ncol());
QuadTree<2> tree;
std::deque<Body<2> *> bodies;
for (i = 0; i < pos.nrow(); ++i) {
Body<2> * body = new Body<2>();
body->pos.coord[0] = pos(i, 0);
body->pos.coord[1] = pos(i, 1);
body->vel.coord[0] = vel(i, 0);
body->vel.coord[1] = vel(i, 1);
body->radius = radii[i];
body->strength = strength;
bodies.push_back(body);
}
tree.insertBodies(bodies);
for (i = 0; i < pos.nrow(); ++i) {
tree.collideBodies(bodies[i]);
}
for (i = 0; i < pos.nrow(); ++i) {
res(i, 0) = bodies[i]->force.coord[0];
res(i, 1) = bodies[i]->force.coord[1];
}
return res;
}
|
f055c2fcd6fa8b2801a3a7b5a187c3fac77e1835 | 7c2aacac64c1cb773737fab1fae9cb792fe93714 | /src/datastruct.cpp | a9a369b5a618f6144cdd3f88ce6f523205b65e73 | [] | no_license | cycmay/DataStruct | a828fcf8f15034b01d42277df9489b1d26d46f0f | e0f9fa2389368b58a4f377770a642a85ad1d853c | refs/heads/master | 2021-03-17T12:59:10.312145 | 2020-04-10T05:11:47 | 2020-04-10T05:11:47 | 246,992,792 | 2 | 1 | null | 2020-03-13T05:58:12 | 2020-03-13T05:10:20 | C++ | UTF-8 | C++ | false | false | 160 | cpp | datastruct.cpp | #include <iostream>
// #include "BinaryHeap_test.hpp"
#include "sort_test.hpp"
int main(){
// insertsort_test();
quicksort_test();
return 0;
}
|
fb05bfd060eebb8404561e05b048b7e9d75735b8 | 4b4ab8dcab747913d105a687d64b3dec00b0789d | /Switch_Base/Switch_TimerOne.cpp | f595c0e1fcb5538f5df307a6a3238c35a01a5b6b | [
"MIT"
] | permissive | woutercharle/switch | 8f90a1b5266b7aef3ee199de0767910f486c21b7 | 632f48fde60d071fdda0b4e7655db0a8354b5ef4 | refs/heads/master | 2020-04-17T11:12:03.744878 | 2019-01-19T20:02:21 | 2019-01-19T20:02:21 | 166,531,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,429 | cpp | Switch_TimerOne.cpp | /*
* Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
* Original code by Jesse Tane for http://labs.ideo.com August 2008
* Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support
* Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop
* Modified June 2011 by Lex Talionis to add a function to read the timer
* Modified Oct 2011 by Andrew Richards to avoid certain problems:
* - Add (long) assignments and casts to TimerOne::read() to ensure calculations involving tmp, ICR1 and TCNT1 aren't truncated
* - Ensure 16 bit registers accesses are atomic - run with interrupts disabled when accessing
* - Remove global enable of interrupts (sei())- could be running within an interrupt routine)
* - Disable interrupts whilst TCTN1 == 0. Datasheet vague on this, but experiment shows that overflow interrupt
* flag gets set whilst TCNT1 == 0, resulting in a phantom interrupt. Could just set to 1, but gets inaccurate
* at very short durations
* - startBottom() added to start counter at 0 and handle all interrupt enabling.
* - start() amended to enable interrupts
* - restart() amended to point at startBottom()
* Modified 7:26 PM Sunday, October 09, 2011 by Lex Talionis
* - renamed start() to resume() to reflect it's actual role
* - renamed startBottom() to start(). This breaks some old code that expects start to continue counting where it left off
*
* 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/>.
*
* See Google Code project http://code.google.com/p/arduino-timerone/ for latest
*/
#include "Switch_TimerOne.h"
#ifdef ARDUINO
Switch::TimerOne Timer1; // pre-instantiate
ISR(TIMER1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt
{
if (0x0 != Timer1.ISRCallback)
{
Timer1.ISRCallback ();
}
}
/*!
\brief Default constructor.
*/
Switch::TimerOne::TimerOne ()
: ISRCallback (0x0)
{
}
/*!
\brief Destructor.
*/
Switch::TimerOne::~TimerOne ()
{
ISRCallback = 0x0;
}
/*!
\brief Initializes the timer.
You must call this method first to use any of the other methods.
\note This breaks analogWrite () for digital pins 9 and 10 on Arduino Uno.
*/
void Switch::TimerOne::Begin (const uint32_t& i_periodUs)
{
TCCR1A = 0; // clear control register A
TCCR1B = _BV(WGM13); // set mode 8: phase and frequency correct pwm, stop the timer
SetPeriod (i_periodUs); // set the timer period
}
/*!
\brief Sets the timer period in microseconds.
Sets the period in microseconds. The minimum period or highest frequency this library supports is 1 microsecond or 1 MHz.
The maximum period is 8388480 microseconds or about 8.3 seconds.
\param [in] i_periodUs The timer period in microseconds.
\note Setting the period will change the attached interrupt and both PWM outputs' frequencies and duty cycles simultaneously.
*/
void Switch::TimerOne::SetPeriod (const uint32_t& i_periodUs) // AR modified for atomic access
{
uint32_t cycles = (F_CPU / 2000000) * i_periodUs; // the counter runs backwards after TOP, interrupt is at BOTTOM so divide microseconds by 2
if (cycles < RESOLUTION) m_clockSelectBits = _BV(CS10); // no prescale, full xtal
else if ((cycles >>= 3) < RESOLUTION) m_clockSelectBits = _BV(CS11); // prescale by /8
else if ((cycles >>= 3) < RESOLUTION) m_clockSelectBits = _BV(CS11) | _BV(CS10); // prescale by /64
else if ((cycles >>= 2) < RESOLUTION) m_clockSelectBits = _BV(CS12); // prescale by /256
else if ((cycles >>= 2) < RESOLUTION) m_clockSelectBits = _BV(CS12) | _BV(CS10); // prescale by /1024
else cycles = RESOLUTION - 1, m_clockSelectBits = _BV(CS12) | _BV(CS10); // request was out of bounds, set as maximum
uint8_t oldSREG = SREG;
cli (); // Disable interrupts for 16 bit register access
ICR1 = (uint16_t)cycles; // ICR1 is TOP in p & f correct pwm mode
SREG = oldSREG;
TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); // equals pause
TCCR1B |= m_clockSelectBits; // reset clock select register, and starts the clock (equals resume)
}
/*!
\brief Generates a PWM waveform on the specified pin.
Output pins for Timer1 are PORTB pins 1 and 2, so you have to choose between these two, anything else is ignored.
On Arduino, these are digital pins 9 and 10, so those aliases also work. Output pins for Timer3 are from PORTE
and correspond to 2, 3 & 5 on the Arduino Mega. The duty cycle is specified as a 10 bit value, so anything between
0 and 1023.
\param [in] i_pin Pin on which the PWM signal is generated (9 or 10).
\param [in] i_duty 10 bit duty cycle (max value is 1023)
\param [in] i_periodUs The signal period in microseconds.
\note You can optionally set the period with this function if you include a value in microseconds as the last parameter when you call it.
*/
void Switch::TimerOne::PWM (uint8_t i_pin, uint16_t i_duty, const uint32_t& i_periodUs) // expects duty cycle to be 10 bit (1024)
{
// set the period
if (i_periodUs > 0)
{
SetPeriod (i_periodUs);
}
// configure the PWM pins
if (i_pin == 9)
{
DDRB |= _BV(PORTB1); // sets data direction register for pwm output pin
TCCR1A |= _BV(COM1A1); // activates the output pin
}
else if (i_pin == 10)
{
DDRB |= _BV(PORTB2);
TCCR1A |= _BV(COM1B1);
}
// configure the duty
SetPWMDuty (i_pin, i_duty);
// make sure the clock is running
Resume (); // Lex - make sure the clock is running. We don't want to restart the count, in case we are starting the second WGM
// and the first one is in the middle of a cycle
}
/*!
\brief Sets the PWM duty regardless the period.
A fast shortcut for setting the PWM duty for a given pin if you have already set it up by calling pwm () earlier.
This avoids the overhead of enabling PWM mode for the pin, setting the data direction register, checking for
optional period adjustments etc. that are mandatory when you call PWM ().
\param [in] i_pin Pin on which the PWM signal is generated (9 or 10).
\param [in] i_duty 10 bit duty cycle (max value is 1023)
*/
void Switch::TimerOne::SetPWMDuty (uint8_t i_pin, uint16_t i_duty)
{
// compute the duty cycle
uint32_t dutyCycle = ((uint32_t)ICR1*i_duty) >> 10; // ICR1 holds the total cycle
// set in the corresponding output compare register
uint8_t oldSREG = SREG;
cli ();
if (i_pin == 9)
{
OCR1A = dutyCycle;
}
else if (i_pin == 10)
{
OCR1B = dutyCycle;
}
SREG = oldSREG;
}
/*!
\brief Turns PWM off for the specified pin so you can use that pin for something else.
\param [in] i_pin Pin for which to turn off the PWM signal (either 9 or 10).
*/
void Switch::TimerOne::DisablePWM (uint8_t i_pin)
{
if (i_pin == 9)
{ // clear the bit that enables PWM on PB1
TCCR1A &= ~_BV(COM1A1);
}
else if (i_pin == 10)
{ // clear the bit that enables PWM on PB2
TCCR1A &= ~_BV(COM1B1);
}
}
/*!
\brief Calls a function at the specified interval in microseconds.
Be careful about trying to execute too complicated of an interrupt at too high of a frequency, or the CPU may never enter the
main loop and your program will 'lock up'.
\param [in] i_pISR Pointer to the interrupt service routine that will handle the interrupt.
*/
void Switch::TimerOne::AttachInterrupt (void (*i_pISR) ())
{
ISRCallback = i_pISR; // register the user's callback with the real ISR
TIMSK1 = _BV(TOIE1); // sets the timer overflow interrupt enable bit
// might be running with interrupts disabled (eg inside an ISR), so don't touch the global state
// sei();
}
/*!
\brief Disables the attached interrupt.
*/
void Switch::TimerOne::DetachInterrupt ()
{
TIMSK1 &= ~_BV(TOIE1); // clears the timer overflow interrupt enable bit
ISRCallback = 0x0;
// timer continues to count without calling the isr
}
/*!
\brief Resets the timer counter and starts the timer.
\note Clears the interrupt.
*/
void Switch::TimerOne::Start () // AR addition, renamed by Lex to reflect it's actual role
{
uint16_t tcnt1;
TIMSK1 &= ~_BV(TOIE1); // AR added - clears the timer overflow interrupt enable bit
GTCCR |= _BV(PSRSYNC); // AR added - reset prescaler (NB: shared with all 16 bit timers);
// reset the counter
uint8_t oldSREG = SREG; // AR - save status register
cli(); // AR - Disable interrupts
TCNT1 = 0;
SREG = oldSREG; // AR - Restore status register
// resume the clock
Resume();
do
{ // Nothing -- wait until timer moved on from zero - otherwise get a phantom interrupt
oldSREG = SREG;
cli();
tcnt1 = TCNT1;
SREG = oldSREG;
}
while (tcnt1 == 0);
// TIFR1 = 0xff; // AR - Clear interrupt flags
// TIMSK1 = _BV(TOIE1); // sets the timer overflow interrupt enable bit
}
/*!
\brief Stops the timer.
Clears all clock select bits.
*/
void Switch::TimerOne::Pause ()
{
TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
}
/*!
\brief Resumes the clock.
Call this method to ensure the clock is running.
*/
void Switch::TimerOne::Resume () // AR suggested
{
TCCR1B |= m_clockSelectBits;
}
/*!
\brief Gets the value of the timer in microseconds.
\return The value of the timer in microseconds.
*/
uint32_t Switch::TimerOne::Read ()
{ //rember! phase and freq correct mode counts up to then down again
uint32_t tmp; // AR amended to hold more than 65536 (could be nearly double this)
uint16_t tcnt1; // AR added
// read the counter
uint8_t oldSREG = SREG;
cli ();
tmp = TCNT1;
SREG = oldSREG;
uint8_t scale = 0; // no prescale if 1 == m_clockSelectBits
if (2 == m_clockSelectBits)
{ // x8 prescale
scale = 3;
}
else if (3 == m_clockSelectBits)
{ // x64
scale = 6;
}
else if (4 == m_clockSelectBits)
{ // x256
scale = 8;
}
else if (5 == m_clockSelectBits)
{ // x1024
scale = 10;
}
do
{ // Nothing -- max delay here is ~1023 cycles. AR modified
oldSREG = SREG;
cli ();
tcnt1 = TCNT1;
SREG = oldSREG;
}
while (tcnt1==tmp); //if the timer has not ticked yet
//if we are counting down add the top value to how far we have counted down
if (tcnt1 < tmp)
{
tmp = (uint32_t)(ICR1 - tcnt1) + (uint32_t)ICR1; // AR amended to add casts and reuse previous TCNT1
}
return ((tmp*1000L)/(F_CPU /1000L)) << scale;
}
#endif // ARDUINO
|
c80b9bc674ce2db7dd51ea6051d9f229bdddc303 | 3c0ded2d66f189d4ae6ca5fbab10d43e8677175f | /Algorithm-Analysis/AA.cpp | d8ff5a67df5377011b0a9de17aae02efa0c3ddc2 | [] | no_license | kk2849/cs2134-data-structures-algorithms | e698ae8f80fa7fbb3b8db0d830d6079efdc0e737 | f8a141c87353d4f3e4d7342441dca1d5a854dc2b | refs/heads/master | 2020-03-17T04:06:36.045106 | 2018-05-19T02:51:36 | 2018-05-19T02:51:36 | 133,263,110 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,226 | cpp | AA.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int func1(vector<int>& v, int item){
for (int i = 0; i < v.size(); i++)
if (item == v[i]) //controlling line of code
return i;
return -1;
}
int func2(vector<int>& v, int item){
int a = 0;
int b = v.size() - 1;
int c = (b + a) / 2;
while (a <= b){
if (item == v[c]) //controlling line of code
return c;
else if (item < v[c])
b = c - 1;
else
a = c + 1;
c = (b + a) / 2;
}
return -1;
}
void func3(vector<int>& v){
for (int i = 0; i < v.size(); i++){
int a = i;
for (int j = i + 1; j < v.size(); j++)
if (v[j] < v[a]) //controlling line of code
a = j;
int b = v[a];
v[a] = v[i];
v[i] = b;
}
}
void func4(vector<int>& v){
for (int i = 0; i < v.size(); i++)
cout << v[i] << endl;
int b = 0;
for (int i = 1; i < v.size(); i++)
if (v[i] < v[b])
b = i;
cout << v[b] << endl;
}
int func5(int n){
int a = 0;
while (n > 0){
a += n % 10;
n /= 10;
}
return a;
}
void func6(vector<int>& v){
for (int i = 0; i < v.size(); i++)
for (int j = 0; j < v.size(); j++)
cout << v[i] << "," << v[j] << endl;
}
void func7(vector<int>& v){
for (int i = 0; i < v.size(); i++)
for (int j = 0; j < v.size(); j++)
if (i == j)
for (int k = 0; k < v.size(); k++)
cout << v[i] << "," << v[j] << "," << v[k] << endl; //CLOC
}
void func8(vector<int>& v){
for (int i = 0; i < v.size(); i += 2)
cout << v[i] << endl;
}
class Point{
public:
int x;
int y;
Point(int newx = 0, int newy = 0) :x(newx), y(newy){}
};
double distance(Point a, Point b){
return sqrt(((a.x - b.x)*(a.x - b.x)) + ((a.y - b.y)*(a.y - b.y)));
}
double closestToOrigin(vector<Point>& vp){ //O(N)
Point origin;
double min = distance(vp[0], vp[1]);
for (int i = 0; i < vp.size(); i++){
double dist = distance(vp[i], origin);
if (dist < min)
min = dist;
}
return min;
}
double closestPairOfPoints(vector<Point>& vp){//O(N^2)
double min = distance(vp[0], vp[1]);
for (int i = 0; i < vp.size(); i++)
for (int j = i + 1; j < vp.size(); j++){
double dist = distance(vp[i], vp[j]);
if (dist < min)
min = dist;
}
return min;
}
bool colinearPoints(vector<Point>& vp){ //O(N^3)
}
|
06796e1323efbaf0df67c43cd4d6127ddf262800 | cfddc57c95f3dce1c9e4cd71fa727267019c4357 | /QuadraticCurve.h | 55c8709cc9b96bbb2cffa7eed9185fd94bf0fd10 | [] | no_license | GraGLeS/TopoRecognizer | 1543131205f91f76659e4c2032c92b2ebfc3e402 | f47b52088f935f09754471b9b753161d895433a2 | refs/heads/master | 2021-01-19T10:18:27.391261 | 2017-02-16T11:58:34 | 2017-02-16T11:58:34 | 82,174,252 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 973 | h | QuadraticCurve.h |
/*
* File: QuadraticCurve.h
* Author: Arbeit
* Created on 18. Dezember 201
*/
#ifndef QUADRATICCURVE_H
#define QUADRATICCURVE_H
#include <Eigen/Dense>
using namespace std;
class QuadraticCurve {
public:
QuadraticCurve();
QuadraticCurve(const QuadraticCurve& orig);
virtual ~QuadraticCurve();
void output_ParameterIntoTxtFile(string);
void input_WLSsolution(Eigen::Vector3d*);
double get_y(double); // get y(x) value; y= Ax^2+Bx+D
void output_FctValues_TextFile(double, double, double, string);
inline double get_A(){
return A;
}
inline double get_B(){
return B;
}
inline double get_C(){
return C;
}
inline double get_D(){
return D;
}
private:
// general equation of a QuadraticCurve 2D: Ax^2+Bx+Cy+D=0; WLS C=-1 --> y=Ax^2+Bx+D
double A,B,C,D;
};
#endif /* QUADRATICCURVE_H */
|
5e07d06736ace3f669e5bf6b3f150714eee70d48 | 492976adfdf031252c85de91a185bfd625738a0c | /src/Game/AI/Action/actionLastBossRailWarpAction.h | 198acdaa785b62aa04db45a082034f39f5b4888a | [] | no_license | zeldaret/botw | 50ccb72c6d3969c0b067168f6f9124665a7f7590 | fd527f92164b8efdb746cffcf23c4f033fbffa76 | refs/heads/master | 2023-07-21T13:12:24.107437 | 2023-07-01T20:29:40 | 2023-07-01T20:29:40 | 288,736,599 | 1,350 | 117 | null | 2023-09-03T14:45:38 | 2020-08-19T13:16:30 | C++ | UTF-8 | C++ | false | false | 1,052 | h | actionLastBossRailWarpAction.h | #pragma once
#include "KingSystem/ActorSystem/actAiAction.h"
namespace uking::action {
class LastBossRailWarpAction : public ksys::act::ai::Action {
SEAD_RTTI_OVERRIDE(LastBossRailWarpAction, ksys::act::ai::Action)
public:
explicit LastBossRailWarpAction(const InitArg& arg);
~LastBossRailWarpAction() override;
bool init_(sead::Heap* heap) override;
void enter_(ksys::act::ai::InlineParamPack* params) override;
void leave_() override;
void loadParams_() override;
protected:
void calc_() override;
// static_param at offset 0x20
const float* mWarpTime_s{};
// static_param at offset 0x28
const float* mYOffset_s{};
// static_param at offset 0x30
const bool* mIsUpdateHomePos_s{};
// static_param at offset 0x38
const bool* mIsTurnToPlayer_s{};
// dynamic_param at offset 0x40
int* mRailIndex_d{};
// dynamic_param at offset 0x48
bool* mIsPartsActorTgOn_d{};
// dynamic_param at offset 0x50
sead::Vector3f* mTargetPos_d{};
};
} // namespace uking::action
|
598285936f3b49f036f79a3dfbf3f171a160aee7 | 768371d8c4db95ad629da1bf2023b89f05f53953 | /applayerpluginsandutils/httpprotocolplugins/WspProtocolHandler/MConnectInvokerCallback.h | a0e97ed4f468a4b2a8c340dddfa0f1d8f251b41b | [] | no_license | SymbianSource/oss.FCL.sf.mw.netprotocols | 5eae982437f5b25dcf3d7a21aae917f5c7c0a5bd | cc43765893d358f20903b5635a2a125134a2ede8 | refs/heads/master | 2021-01-13T08:23:16.214294 | 2010-10-03T21:53:08 | 2010-10-03T21:53:08 | 71,899,655 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,420 | h | MConnectInvokerCallback.h | // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
#ifndef __MCONNECTINVOKERCALLBACK_H__
#define __MCONNECTINVOKERCALLBACK_H__
#include <e32base.h>
/** The MConnectInvokerCallback is used to perform an automatic session connect.
An active object uses this callback to get the protocol handler to initiate
the session connect.
*/
class MConnectInvokerCallback
{
public: // Methods
/** @fn HandleConnectInvocationL() =0
Intended Usage :
@since 7.0
@post A session connect has been initiated with the new proxy.
*/
virtual void HandleConnectInvocationL() =0;
/** @fn ConnectInvokerCallbackError(TInt aError) =0
Intended Usage : Error handling function for when RunL() leaves.
@since 7.0
@param aError The error with which RunL() left.
@return An error code. If the input error value could be handled,
then KErrNone is returned, otherwise the input error code
is returned.
*/
virtual TInt ConnectInvokerCallbackError(TInt aError) =0;
};
#endif // __MPROXYREDIRECTIONCALLBACK_H__
|
f5e85041d1013e90bd413d0b1a4c9e5bf835b1b3 | ff010526baef07afb0424b13cac83ee12a0ed543 | /exp13_3.cpp | f88c8f62c40bed6d31efe2970e464e35d6e1a524 | [] | no_license | DeepFlying/C- | c89f92cbd5ccc5adf9694d55f74b43535e4ae11f | 3008d4d40b60293751d625665bbc2fc7a4454d6f | refs/heads/master | 2020-03-28T23:48:18.366476 | 2018-09-24T14:32:57 | 2018-09-24T14:32:57 | 149,309,608 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 358 | cpp | exp13_3.cpp | //给二维数组输入数据,并以行列输出
#include <iostream>
using namespace std;
int main()
{
int A[3][4],i,j;
for (i=0;i<3;i++)
for (j=0;j<4;j++) cin >> A[i][j];
for (i=0;i<3;i++) {
for (j=0;j<4;j++) //内循环输出一行
cout<<A[i][j]<<" ";
cout<<endl; //每输出一行换行
}
return 0;
}
|
94b9da9b1a5578c39495f4b930004395b264acbe | a7abbfbed7e441005d00cc91a3e3ff22e3f40539 | /Porxy/include/proto/LogServer.pb.h | 2183e3f944011805cd19d8379721e81fe051a16d | [] | no_license | Original-Adios/ByteTalk | 3833e3b6b00d57f2f0bb35a10230bff76e5a7766 | ff8425b7dc28b9b847b76c7cf78a22938c6ed403 | refs/heads/main | 2023-07-18T02:05:02.876806 | 2021-05-05T07:07:00 | 2021-05-05T07:07:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 21,502 | h | LogServer.pb.h | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: LogServer.proto
#ifndef PROTOBUF_LogServer_2eproto__INCLUDED
#define PROTOBUF_LogServer_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3000000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/service.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/empty.pb.h>
// @@protoc_insertion_point(includes)
namespace ik {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_LogServer_2eproto();
void protobuf_AssignDesc_LogServer_2eproto();
void protobuf_ShutdownFile_LogServer_2eproto();
class ErrorMsg;
class LogRequest;
class LogResponse;
// ===================================================================
class LogRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:ik.LogRequest) */ {
public:
LogRequest();
virtual ~LogRequest();
LogRequest(const LogRequest& from);
inline LogRequest& operator=(const LogRequest& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const LogRequest& default_instance();
void Swap(LogRequest* other);
// implements Message ----------------------------------------------
inline LogRequest* New() const { return New(NULL); }
LogRequest* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const LogRequest& from);
void MergeFrom(const LogRequest& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(LogRequest* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// optional bytes name = 1;
void clear_name();
static const int kNameFieldNumber = 1;
const ::std::string& name() const;
void set_name(const ::std::string& value);
void set_name(const char* value);
void set_name(const void* value, size_t size);
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
// optional bytes msg = 2;
void clear_msg();
static const int kMsgFieldNumber = 2;
const ::std::string& msg() const;
void set_msg(const ::std::string& value);
void set_msg(const char* value);
void set_msg(const void* value, size_t size);
::std::string* mutable_msg();
::std::string* release_msg();
void set_allocated_msg(::std::string* msg);
// @@protoc_insertion_point(class_scope:ik.LogRequest)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::internal::ArenaStringPtr msg_;
mutable int _cached_size_;
friend void protobuf_AddDesc_LogServer_2eproto();
friend void protobuf_AssignDesc_LogServer_2eproto();
friend void protobuf_ShutdownFile_LogServer_2eproto();
void InitAsDefaultInstance();
static LogRequest* default_instance_;
};
// -------------------------------------------------------------------
class ErrorMsg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:ik.ErrorMsg) */ {
public:
ErrorMsg();
virtual ~ErrorMsg();
ErrorMsg(const ErrorMsg& from);
inline ErrorMsg& operator=(const ErrorMsg& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const ErrorMsg& default_instance();
void Swap(ErrorMsg* other);
// implements Message ----------------------------------------------
inline ErrorMsg* New() const { return New(NULL); }
ErrorMsg* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const ErrorMsg& from);
void MergeFrom(const ErrorMsg& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(ErrorMsg* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// optional bool state = 1;
void clear_state();
static const int kStateFieldNumber = 1;
bool state() const;
void set_state(bool value);
// optional bytes error_msg = 2;
void clear_error_msg();
static const int kErrorMsgFieldNumber = 2;
const ::std::string& error_msg() const;
void set_error_msg(const ::std::string& value);
void set_error_msg(const char* value);
void set_error_msg(const void* value, size_t size);
::std::string* mutable_error_msg();
::std::string* release_error_msg();
void set_allocated_error_msg(::std::string* error_msg);
// @@protoc_insertion_point(class_scope:ik.ErrorMsg)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
::google::protobuf::internal::ArenaStringPtr error_msg_;
bool state_;
mutable int _cached_size_;
friend void protobuf_AddDesc_LogServer_2eproto();
friend void protobuf_AssignDesc_LogServer_2eproto();
friend void protobuf_ShutdownFile_LogServer_2eproto();
void InitAsDefaultInstance();
static ErrorMsg* default_instance_;
};
// -------------------------------------------------------------------
class LogResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:ik.LogResponse) */ {
public:
LogResponse();
virtual ~LogResponse();
LogResponse(const LogResponse& from);
inline LogResponse& operator=(const LogResponse& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const LogResponse& default_instance();
void Swap(LogResponse* other);
// implements Message ----------------------------------------------
inline LogResponse* New() const { return New(NULL); }
LogResponse* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const LogResponse& from);
void MergeFrom(const LogResponse& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(LogResponse* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// optional .ik.ErrorMsg msg = 1;
bool has_msg() const;
void clear_msg();
static const int kMsgFieldNumber = 1;
const ::ik::ErrorMsg& msg() const;
::ik::ErrorMsg* mutable_msg();
::ik::ErrorMsg* release_msg();
void set_allocated_msg(::ik::ErrorMsg* msg);
// @@protoc_insertion_point(class_scope:ik.LogResponse)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
::ik::ErrorMsg* msg_;
mutable int _cached_size_;
friend void protobuf_AddDesc_LogServer_2eproto();
friend void protobuf_AssignDesc_LogServer_2eproto();
friend void protobuf_ShutdownFile_LogServer_2eproto();
void InitAsDefaultInstance();
static LogResponse* default_instance_;
};
// ===================================================================
class LogServerRpc_Stub;
class LogServerRpc : public ::google::protobuf::Service {
protected:
// This class should be treated as an abstract interface.
inline LogServerRpc() {};
public:
virtual ~LogServerRpc();
typedef LogServerRpc_Stub Stub;
static const ::google::protobuf::ServiceDescriptor* descriptor();
virtual void Log_INFO(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
virtual void Log_ERROR(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
virtual void Log_FATAL(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
// implements Service ----------------------------------------------
const ::google::protobuf::ServiceDescriptor* GetDescriptor();
void CallMethod(const ::google::protobuf::MethodDescriptor* method,
::google::protobuf::RpcController* controller,
const ::google::protobuf::Message* request,
::google::protobuf::Message* response,
::google::protobuf::Closure* done);
const ::google::protobuf::Message& GetRequestPrototype(
const ::google::protobuf::MethodDescriptor* method) const;
const ::google::protobuf::Message& GetResponsePrototype(
const ::google::protobuf::MethodDescriptor* method) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LogServerRpc);
};
class LogServerRpc_Stub : public LogServerRpc {
public:
LogServerRpc_Stub(::google::protobuf::RpcChannel* channel);
LogServerRpc_Stub(::google::protobuf::RpcChannel* channel,
::google::protobuf::Service::ChannelOwnership ownership);
~LogServerRpc_Stub();
inline ::google::protobuf::RpcChannel* channel() { return channel_; }
// implements LogServerRpc ------------------------------------------
void Log_INFO(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
void Log_ERROR(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
void Log_FATAL(::google::protobuf::RpcController* controller,
const ::ik::LogRequest* request,
::google::protobuf::Empty* response,
::google::protobuf::Closure* done);
private:
::google::protobuf::RpcChannel* channel_;
bool owns_channel_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LogServerRpc_Stub);
};
// ===================================================================
// ===================================================================
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
// LogRequest
// optional bytes name = 1;
inline void LogRequest::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline const ::std::string& LogRequest::name() const {
// @@protoc_insertion_point(field_get:ik.LogRequest.name)
return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void LogRequest::set_name(const ::std::string& value) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:ik.LogRequest.name)
}
inline void LogRequest::set_name(const char* value) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:ik.LogRequest.name)
}
inline void LogRequest::set_name(const void* value, size_t size) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:ik.LogRequest.name)
}
inline ::std::string* LogRequest::mutable_name() {
// @@protoc_insertion_point(field_mutable:ik.LogRequest.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* LogRequest::release_name() {
// @@protoc_insertion_point(field_release:ik.LogRequest.name)
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void LogRequest::set_allocated_name(::std::string* name) {
if (name != NULL) {
} else {
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:ik.LogRequest.name)
}
// optional bytes msg = 2;
inline void LogRequest::clear_msg() {
msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline const ::std::string& LogRequest::msg() const {
// @@protoc_insertion_point(field_get:ik.LogRequest.msg)
return msg_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void LogRequest::set_msg(const ::std::string& value) {
msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:ik.LogRequest.msg)
}
inline void LogRequest::set_msg(const char* value) {
msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:ik.LogRequest.msg)
}
inline void LogRequest::set_msg(const void* value, size_t size) {
msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:ik.LogRequest.msg)
}
inline ::std::string* LogRequest::mutable_msg() {
// @@protoc_insertion_point(field_mutable:ik.LogRequest.msg)
return msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* LogRequest::release_msg() {
// @@protoc_insertion_point(field_release:ik.LogRequest.msg)
return msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void LogRequest::set_allocated_msg(::std::string* msg) {
if (msg != NULL) {
} else {
}
msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), msg);
// @@protoc_insertion_point(field_set_allocated:ik.LogRequest.msg)
}
// -------------------------------------------------------------------
// ErrorMsg
// optional bool state = 1;
inline void ErrorMsg::clear_state() {
state_ = false;
}
inline bool ErrorMsg::state() const {
// @@protoc_insertion_point(field_get:ik.ErrorMsg.state)
return state_;
}
inline void ErrorMsg::set_state(bool value) {
state_ = value;
// @@protoc_insertion_point(field_set:ik.ErrorMsg.state)
}
// optional bytes error_msg = 2;
inline void ErrorMsg::clear_error_msg() {
error_msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline const ::std::string& ErrorMsg::error_msg() const {
// @@protoc_insertion_point(field_get:ik.ErrorMsg.error_msg)
return error_msg_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void ErrorMsg::set_error_msg(const ::std::string& value) {
error_msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:ik.ErrorMsg.error_msg)
}
inline void ErrorMsg::set_error_msg(const char* value) {
error_msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:ik.ErrorMsg.error_msg)
}
inline void ErrorMsg::set_error_msg(const void* value, size_t size) {
error_msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:ik.ErrorMsg.error_msg)
}
inline ::std::string* ErrorMsg::mutable_error_msg() {
// @@protoc_insertion_point(field_mutable:ik.ErrorMsg.error_msg)
return error_msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* ErrorMsg::release_error_msg() {
// @@protoc_insertion_point(field_release:ik.ErrorMsg.error_msg)
return error_msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void ErrorMsg::set_allocated_error_msg(::std::string* error_msg) {
if (error_msg != NULL) {
} else {
}
error_msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error_msg);
// @@protoc_insertion_point(field_set_allocated:ik.ErrorMsg.error_msg)
}
// -------------------------------------------------------------------
// LogResponse
// optional .ik.ErrorMsg msg = 1;
inline bool LogResponse::has_msg() const {
return !_is_default_instance_ && msg_ != NULL;
}
inline void LogResponse::clear_msg() {
if (GetArenaNoVirtual() == NULL && msg_ != NULL) delete msg_;
msg_ = NULL;
}
inline const ::ik::ErrorMsg& LogResponse::msg() const {
// @@protoc_insertion_point(field_get:ik.LogResponse.msg)
return msg_ != NULL ? *msg_ : *default_instance_->msg_;
}
inline ::ik::ErrorMsg* LogResponse::mutable_msg() {
if (msg_ == NULL) {
msg_ = new ::ik::ErrorMsg;
}
// @@protoc_insertion_point(field_mutable:ik.LogResponse.msg)
return msg_;
}
inline ::ik::ErrorMsg* LogResponse::release_msg() {
// @@protoc_insertion_point(field_release:ik.LogResponse.msg)
::ik::ErrorMsg* temp = msg_;
msg_ = NULL;
return temp;
}
inline void LogResponse::set_allocated_msg(::ik::ErrorMsg* msg) {
delete msg_;
msg_ = msg;
if (msg) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:ik.LogResponse.msg)
}
#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace ik
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_LogServer_2eproto__INCLUDED
|
0800bd5de6b636840409164ee21fb164d92d45a3 | f3f83758741ae8b328e7aff3af75e6043adf98a9 | /ApryxEngine/src/ui/LinearLayout.cpp | 3758bfdf731d601921b4715b36c7852d9414707f | [] | no_license | folkerthoogenraad/ApryxEngine | 0db7547976c14cbf7d2c29ca83babc9305c32023 | 272eeee7b05e8ee3a24fbe7b037e2c9bbbc5007b | refs/heads/master | 2020-04-01T08:05:42.016852 | 2018-12-26T21:44:39 | 2018-12-26T21:44:39 | 153,017,359 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,334 | cpp | LinearLayout.cpp | #include "LinearLayout.h"
namespace apryx {
void LinearLayout::updateLayout(Rectanglef newSize)
{
// TODO implement Exact scaling.
UIComponent::updateLayout(newSize);
if (getChildCount() == 0)
return;
Rectanglef rect = getLocalBounds();
float weightSum = 0;
float sizeSum = 0;
// Calculate the weightSum and sizeSum
for (int i = 0; i < getChildCount(); i++) {
auto child = getChild(i);
Size prefSize = child->getPreferredSize();
if (m_Direction == Horizontal) {
if (child->getLayoutParams().m_WidthScaling == LayoutParams::MatchParent) {
weightSum += child->getLayoutParams().m_Weight.x;
}
else {
sizeSum += prefSize.x;
}
}
if (m_Direction == Vertical) {
if (child->getLayoutParams().m_HeightScaling == LayoutParams::MatchParent) {
weightSum += child->getLayoutParams().m_Weight.y;
}
else {
sizeSum += prefSize.y;
}
}
}
// Calculate how much size 1 'weight' is worth
float sizePerWeight = 1.0;
if(m_Direction == Horizontal){
sizePerWeight = (rect.width() - sizeSum - (getChildCount() - 1) * m_Gap) / weightSum;
}
else {
sizePerWeight = (rect.width() - sizeSum - (getChildCount() - 1) * m_Gap) / weightSum;
}
// Current position for the layout
Vector2f position;
// Actually do the layouting
for (int i = 0; i < getChildCount(); i++) {
auto child = getChild(i);
Size prefSize = child->getPreferredSize();
const LayoutParams ¶ms = child->getLayoutParams();
if(m_Direction == Horizontal){
Size size = prefSize;
if (params.m_WidthScaling == LayoutParams::MatchParent) {
size.width = sizePerWeight * params.m_Weight.x;
}
if (params.m_HeightScaling == LayoutParams::MatchParent) {
size.height = rect.height();
}
child->updateLayout(Rectanglef(position, size));
position.x += m_Gap + size.x;
}
}
}
void LinearLayout::init(ApryxUI *ui)
{
UIComponent::init(ui);
for (auto &c : m_Children) {
c->init(ui);
}
}
void LinearLayout::update()
{
for (auto &c : m_Children) {
c->update();
}
}
void LinearLayout::draw(Graphics2D & graphics)
{
for (auto &c : m_Children) {
c->draw(graphics);
}
}
void LinearLayout::addComponent(std::shared_ptr<UIComponent> component)
{
m_Children.push_back(component);
}
}
|
9fa29fb3b97cf1874b7042fa79730ae8e670a1af | 1f25f8adb39ece73ce111d759e2104bd0b0b4cd2 | /acm/srm/CountBinarySequences.cpp | 3258b78dc43ccdd15ff9b71d7d2d5377fb5d7e2f | [] | no_license | LTzycLT/code | 75f31ecc02ddd1ca8d264f7640d37c02fb7750b9 | 47cb2cfa7c6f3318a35e4763e1827197227e468b | refs/heads/master | 2021-01-10T16:51:05.866008 | 2018-04-25T12:33:06 | 2018-04-25T12:33:06 | 36,212,582 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 3,704 | cpp | CountBinarySequences.cpp | // BEGIN CUT HERE
// END CUT HERE
#line 5 "CountBinarySequences.cpp"
#include<stdio.h>
#include<string.h>
#include<sstream>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#define MP(x,y) make_pair(x,y)
#define clr(x,y) memset(x,y,sizeof(x))
#define ll long long
using namespace std;
class CountBinarySequences
{
public:
int countSequences(int n, int k, vector <int> L, vector <int> R)
{
$CARETPOSITION$
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { int Arg0 = 4; int Arg1 = 2; int Arr2[] = {2}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {3}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 5; verify_case(0, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
void test_case_1() { int Arg0 = 4; int Arg1 = 1; int Arr2[] = {2}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {2}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 6; verify_case(1, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
void test_case_2() { int Arg0 = 6; int Arg1 = 3; int Arr2[] = {1, 2, 3}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {6, 5, 4}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 6; verify_case(2, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
void test_case_3() { int Arg0 = 1000; int Arg1 = 4; int Arr2[] = {10, 101, 201, 110, 121}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {100, 200, 300, 120, 130}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 444743885; verify_case(3, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
void test_case_4() { int Arg0 = 1; int Arg1 = 5; int Arr2[] = {1}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {1}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 1; verify_case(4, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
void test_case_5() { int Arg0 = 998; int Arg1 = 2; int Arr2[] = {313,365,189,913,334,360,160,931,313,402,389,328,376,47,906,383,381,927,338,178,934,933,162,332,191,188,380,912,970,360,161,179,966,405,971,381}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arr3[] = {313,365,189,913,334,362,160,931,340,405,389,329,398,425,907,383,382,927,338,178,934,933,162,332,191,188,384,912,970,365,161,179,966,405,971,381}; vector <int> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); int Arg4 = 420889003; verify_case(5, Arg4, countSequences(Arg0, Arg1, Arg2, Arg3)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main()
{
CountBinarySequences ___test;
___test.run_test(-1);
system("pause");
}
// END CUT HERE
|
b63fec51d027aaf361d781f2bb7f84303baf5eb5 | 82bef373811a746ff84d6f723a2336c4ab8c548a | /mainwindow.h | 432c784b790ed9588acb017e2a03aadec4773bb0 | [] | no_license | Henrai/Particle-Demo | c2d9e2e86cd88c1e5b8bb788c778660bbab2f85d | e8c7965aee7db07131d4e5570124bd1b0be9f496 | refs/heads/master | 2020-04-14T21:37:40.501039 | 2019-01-04T17:07:06 | 2019-01-04T17:12:25 | 164,134,516 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 666 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPainter>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
signals:
void generateParticles();
void clearScreen();
void run();
void stop();
void updateParticleCount(int value);
private slots:
void on_generateButton_clicked();
void on_particlesCount_actionTriggered(int action);
void on_clearButton_clicked();
void on_runButton_clicked();
void on_stopButton_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
|
9a8fc1b2973e5b53ba00c93fa912d387e7bbe6b3 | 2af91f07b907ba1020e7e05a973e81750d345cc6 | /D05/ex01/Bureaucrat.cpp | 2c0cb391a99a2fbe01b082040e09ae13c5d3b534 | [] | no_license | NormanSchilling/PiscineCplusplus | aa612d7619d98f224212d31850e8217ec01d4f92 | 77087bc87dec57c2c70ee4d7a04f978b13c714c9 | refs/heads/master | 2021-01-17T14:35:17.803534 | 2015-04-18T09:52:16 | 2015-04-18T09:52:16 | 30,865,699 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,169 | cpp | Bureaucrat.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nschilli <nschilli@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/12 10:19:06 by nschilli #+# #+# */
/* Updated: 2015/01/12 16:12:56 by nschilli ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
#include "Bureaucrat.hpp"
#include "Form.hpp"
#include <stdexcept>
/**
CONSTRUCTOR
**/
Bureaucrat::Bureaucrat( void ) : _name("default")
{
this->_grade = 1;
}
Bureaucrat::Bureaucrat( std::string name, int grade ) : _name(name)
{
try {
if ( grade < 1 ) {
this->_grade = 1;
throw Bureaucrat::GradeTooHighException( );
} else if ( grade > 150) {
this->_grade = 150;
throw Bureaucrat::GradeTooLowException( );
} else {
this->_grade = grade;
}
} catch ( std::exception & e ) {
std::cout << e.what() << std::endl;
}
return ;
}
Bureaucrat::Bureaucrat( Bureaucrat const &b ) : _name( b.getName( ) )
{
*this = b;
return ;
}
Bureaucrat::GradeTooHighException::GradeTooHighException( void ) : exception()
{
return ;
}
Bureaucrat::GradeTooHighException::GradeTooHighException( GradeTooHighException const &e ) : exception()
{
*this = e;
return ;
}
Bureaucrat::GradeTooLowException::GradeTooLowException( void ) : exception()
{
return ;
}
Bureaucrat::GradeTooLowException::GradeTooLowException( GradeTooLowException const &e) : exception()
{
*this = e;
return ;
}
/**
DESTRUCTOR
**/
Bureaucrat::~Bureaucrat( void )
{
return ;
}
Bureaucrat::GradeTooHighException::~GradeTooHighException() throw()
{
return ;
}
Bureaucrat::GradeTooLowException::~GradeTooLowException() throw()
{
return ;
}
/**
ASSIGN OPERATOR
**/
Bureaucrat & Bureaucrat::operator=( Bureaucrat const & b )
{
if ( this != &b ) {
this->_grade = b.getGrade( );
}
return *this;
}
Bureaucrat::GradeTooHighException & Bureaucrat::GradeTooHighException::operator=( GradeTooHighException const & b ) throw()
{
(void)b;
return *this;
}
Bureaucrat::GradeTooLowException & Bureaucrat::GradeTooLowException::operator=( GradeTooLowException const & b ) throw()
{
(void)b;
return *this;
}
std::ostream & operator<<( std::ostream &o, Bureaucrat const &b )
{
o << b.getName( ) << ", bureaucrat grade " << b.getGrade( ) << std::endl;
return o;
}
/**
FUNCTIONS
**/
void Bureaucrat::signForm( Form &f )
{
if ( f.getCheckSign( ) == true ) {
std::cout << this->_name << " signs " << f.getName() << std::endl;
} else {
std::cout << this->_name << " cannot sign " << f.getName() << " because the minimum grade to sign is "<< f.getGradeToSign() << std::endl;
}
return ;
}
void Bureaucrat::upGrade( void )
{
try {
if ( this->_grade <= 1 )
throw Bureaucrat::GradeTooHighException( );
else if ( this->_grade >= 150)
throw Bureaucrat::GradeTooLowException( );
else
this->_grade--;
} catch ( std::exception & e ) {
std::cout << e.what() << std::endl;
}
}
void Bureaucrat::downGrade( void )
{
try {
if ( this->_grade <= 1 )
throw Bureaucrat::GradeTooHighException( );
else if ( this->_grade >= 150)
throw Bureaucrat::GradeTooLowException( );
else
this->_grade++;
} catch ( std::exception & e ) {
std::cout << e.what() << std::endl;
}
}
const char* Bureaucrat::GradeTooHighException::what() const throw()
{
return ("Grade is too high");
}
const char* Bureaucrat::GradeTooLowException::what() const throw()
{
return ("Grade is too low");
}
/**
GETTER
**/
const std::string Bureaucrat::getName( void ) const
{
return this->_name;
}
int Bureaucrat::getGrade( void ) const
{
return this->_grade;
} |
562b62e3f2526e10699c5430ea45c73aa63dd16f | 858f12541d3dfa97dab9d15bca890b3e4b5e065a | /ast/AstLet.cpp | dc9c3483ca793ee4deea30cc3d6f5af2de6dd332 | [] | no_license | kevinrtai/cs345h_lemonade | 8d0a81993552021150c8ec980edd424f9d3197b4 | ca2ca9981eeacd85566fe1c13fcca22c6c840ea0 | refs/heads/master | 2021-01-19T01:37:34.178751 | 2016-12-01T01:39:25 | 2016-12-01T01:39:25 | 73,323,851 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,619 | cpp | AstLet.cpp | #include "AstLet.h"
AstLet* AstLet::make(AstIdentifier* id, Expression* val, Expression* body)
{
AstLet* l = new AstLet(id, val, body);
Expression* res = get_exp(l);
assert(res->get_type() == AST_LET);
return static_cast<AstLet*>(res);
}
AstLet::AstLet(AstIdentifier* id, Expression* val, Expression* body)
{
this->et = AST_LET;
this->id = id;
this->val = val;
this->body = body;
this->hash_c = 1 + id->get_hash() + 6*val->get_hash() + 484*body->get_hash();
}
string AstLet::to_string(int d)
{
string res = get_depth(d) + "Let " + id->get_id() + "\n";
res += get_depth(d) + "VAL\n";
res += val->to_string(d+1);
res += get_depth(d) + "BODY\n";
res += body->to_string(d+1);
return res;
}
string AstLet::to_value()
{
return "let " + id->to_value() + " = " + val->to_value() + " in " + body->to_value();
}
AstIdentifier* AstLet::get_id()
{
return id;
}
Expression* AstLet::get_val()
{
return val;
}
Expression* AstLet::get_body()
{
return body;
}
Expression* AstLet::substitute(Expression* e1, Expression* e2)
{
//avoid capture of bound variable
if(e1 == id) return this;
Expression* _new_id = id->substitute(e1, e2);
assert(_new_id->get_type() == AST_IDENTIFIER);
AstIdentifier* new_id = static_cast<AstIdentifier*>(_new_id);
Expression* new_val = val->substitute(e1, e2);
Expression* new_body = body->substitute(e1, e2);
return AstLet::make(new_id, new_val, new_body);
}
bool AstLet::operator==(const Expression& other)
{
if(other.get_type() != AST_LET) return false;
AstLet& l = (AstLet&) other;
return id == l.id && val == l.val && body == l.body;
}
|
bf7b5d4fddd9fb79df3388e460c7bc7e04231747 | f5add335feb88b57e1b2f5a23217298b6f698586 | /iEngine/Network/NSession/Pool.cpp | c50100f28fcdda2994d7db3654ffcddd3d6cb647 | [] | no_license | truelsy/iEngine | bdd5de84cae5974c1ea2ceebc4df5dca2b3b8ba9 | 7932b34fafda4d44ccd5e38b5bd4445cc299c108 | refs/heads/master | 2021-01-18T13:54:51.101233 | 2016-02-29T08:23:52 | 2016-02-29T08:23:52 | 24,037,259 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,456 | cpp | Pool.cpp | /*
* Pool.cpp
*
* Created on: 2014. 6. 27.
* Author: mega
*/
#include "../Session.h"
namespace BoostAsioNetwork {
Session::Pool::Pool()
{
pthread_cond_init(&m_Cond, NULL);
pthread_mutex_init(&m_Lock, NULL);
}
Session::Pool::~Pool()
{
for (Session * pSession : clsSessionList)
delete pSession;
clsSessionList.clear();
}
Session *
Session::Pool::NEW()
{
//std::cout << "NEW Before Session Count : " << clsSessionList.size() << std::endl;
Session * pSession = NULL;
{
pthread_mutex_lock(&m_Lock);
if (true == clsSessionList.empty())
{
pthread_cond_wait(&m_Cond, &m_Lock);
}
pSession = clsSessionList.front();
clsSessionList.pop_front();
pthread_mutex_unlock(&m_Lock);
}
//std::cout << "NEW After Session Count : " << clsSessionList.size() << std::endl;
return pSession;
}
void
Session::Pool::DEL(Session * pSession)
{
pSession->Finalize();
pthread_mutex_lock(&m_Lock);
//std::cout << "DEL Before Session Count : " << clsSessionList.size() << std::endl;
clsSessionList.push_back(pSession);
//std::cout << "DEL After Session Count : " << clsSessionList.size() << std::endl;
std::cout << "Remain SessionCount(" << clsSessionList.size() << ")" << std::endl;
pthread_cond_signal(&m_Cond);
pthread_mutex_unlock(&m_Lock);
}
void
Session::Pool::POST(Session * pSession)
{
pthread_mutex_lock(&m_Lock);
clsSessionList.push_back(pSession);
pthread_mutex_unlock(&m_Lock);
}
} /*BoostAsioNetwork*/
|
73ce69612478cee93ec42a931f36ca086e33df70 | 007265a4351662f37e6d3f59581fd4575ece5093 | /include/pcsc-cpp/pcsc-cpp-utils.hpp | 0017d0f381f1f2a2a8f82a0bd0e965894e12b9b0 | [
"MIT"
] | permissive | Counter178/libpcsc-cpp | 04a41ece49113e5006ac0d221a728c4e9f3486d3 | 820160ad99820f23a0114f70959b47514b993aa7 | refs/heads/main | 2023-03-22T17:58:45.178406 | 2021-03-02T19:33:26 | 2021-03-05T07:58:50 | 347,892,727 | 0 | 0 | MIT | 2021-03-15T08:35:56 | 2021-03-15T08:35:56 | null | UTF-8 | C++ | false | false | 2,343 | hpp | pcsc-cpp-utils.hpp | /*
* Copyright (c) 2020 The Web eID Project
*
* 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.
*/
#pragma once
#include <string>
#include <sstream>
#include <iomanip>
namespace pcsc_cpp
{
/** Convert the given integer to a hex string. */
template <typename T>
inline std::string int2hexstr(const T value)
{
std::ostringstream hexStringBuilder;
hexStringBuilder << "0x" << std::setfill('0') << std::setw(sizeof(long) * 2) << std::hex
<< value;
return hexStringBuilder.str();
}
/** Remove absolute path prefix until "src" from the given path, '/path/to/src/main.cpp' becomes
* 'src/main.cpp'. */
inline std::string removeAbsolutePathPrefix(const std::string& filePath)
{
const auto lastSrc = filePath.rfind("src");
return lastSrc == std::string::npos ? filePath : filePath.substr(lastSrc);
}
} // namespace pcsc_cpp
#define THROW_WITH_CALLER_INFO(ExceptionType, message, file, line, func) \
throw ExceptionType(std::string(message) + " in " + pcsc_cpp::removeAbsolutePathPrefix(file) \
+ ':' + std::to_string(line) + ':' + func)
#define THROW(ExceptionType, message) \
THROW_WITH_CALLER_INFO(ExceptionType, message, __FILE__, __LINE__, __func__)
|
ae92f87513cb3d0d514e9b5650b50e921feac203 | 93b63e96111dd9781df655cae66e0b5b31662fcd | /inc/EllipseEnv.h | 1ca7934ad106e45a7371f06fdf1168ebca1c37f8 | [
"MIT"
] | permissive | sunjinbo/Ellipse | 970e08705373977b15820b3d1f732dc57fba4b6d | 61c88982046f8239cb17c897af86322c657f7f5d | refs/heads/master | 2021-07-21T07:02:51.065936 | 2017-10-31T01:54:28 | 2017-10-31T01:54:28 | 108,852,263 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 700 | h | EllipseEnv.h | /*
============================================================================
Name : EllipseEnv.h
Author : Sun Jinbo
Copyright : Your copyright notice
Description : This file contains declarations for constants of Ellipse.
The file can be included in C++ or resource file.
============================================================================
*/
#ifndef __ELLIPSEENV_H__
#define __ELLIPSEENV_H__
class CFbsBitGc;
class CEikonEnv;
// CLASS DECLARATION
/**
* MEllipseEnv
*
*/
class MEllipseEnv
{
public: // interface function
virtual CFbsBitGc*& Gc() = 0;
virtual CEikonEnv* EikonEnv() = 0;
virtual TRect ViewRect() = 0;
};
#endif // __ELLIPSEENV_H__
|
1f3d4a1a9af27230fb16a0e60c0bd15d503ac43a | 2fe5cc7977fe083ecd260ad8c9cbd213ba99365f | /ps3emu/spu/SPUThread.h | 3de4e9090f3e93e0579d73161ec5ee43eff46b64 | [] | no_license | lasyka/ps3emu | f5feaf2fb5d3ae16652f985c2b4720b52a20a51d | 69f36338d4aa7f729d3832b91188d26c95760661 | refs/heads/master | 2023-03-18T16:43:42.507305 | 2021-02-26T23:22:33 | 2021-02-26T23:22:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,832 | h | SPUThread.h | #pragma once
#include "ps3emu/libs/ConcurrentQueue.h"
#include "ps3emu/libs/sync/queue.h"
#include "ps3emu/constants.h"
#include "ps3emu/BitField.h"
#include "ps3emu/ReservationMap.h"
#include "ps3emu/enum.h"
#include "ps3emu/utils/debug.h"
#include "ps3emu/OneTimeEvent.h"
#include "ps3emu/profiler.h"
#include "SPUChannels.h"
#include "R128.h"
#include <boost/thread.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/noncopyable.hpp>
#include <atomic>
#include <assert.h>
#include <algorithm>
#include <stdexcept>
#include <string.h>
#include <functional>
#include <vector>
#include <optional>
#include <x86intrin.h>
#include <signal.h>
static constexpr uint32_t LSLR = 0x3ffff;
class DisableSuspend {
bool _detach;
SPUThread* _sth;
public:
DisableSuspend(SPUThread* sth, bool detach = false);
~DisableSuspend();
};
class StopSignalException : public virtual std::runtime_error {
uint32_t _type;
public:
StopSignalException(uint32_t type) : std::runtime_error("stop signal"), _type(type) { }
uint32_t type() {
return _type;
}
};
ENUM(SPUThreadExitCause,
(Exit, 0),
(GroupExit, 1),
(GroupTerminate, 2),
(StillRunning, 3))
class SPUThreadFinishedException : public virtual std::exception {
int32_t _errorCode;
SPUThreadExitCause _cause;
public:
inline SPUThreadFinishedException(int32_t errorCode, SPUThreadExitCause cause)
: _errorCode(errorCode), _cause(cause) {}
inline int32_t errorCode() {
return _errorCode;
}
inline SPUThreadExitCause cause() {
return _cause;
}
};
enum class SPUThreadEvent {
Breakpoint,
SingleStepBreakpoint,
Started,
Finished,
InvalidInstruction,
Failure
};
struct SPUThreadExitInfo {
SPUThreadExitCause cause;
int32_t status;
};
struct InterruptThreadInfo {
uint32_t mask2;
std::function<void()> handler;
};
struct EventQueueInfo {
uint32_t port;
std::shared_ptr<IConcurrentQueue<sys_event_t>> queue;
};
struct ThreadGroup;
class SPUThread : boost::noncopyable, public ISPUChannelsThread {
uint32_t _nip;
R128 _rs[128];
R128 _fpscr;
uint8_t _ls[LocalStorageSize];
uint32_t _srr0;
uint32_t _spu = -1u;
std::string _name;
boost::thread _thread;
SPUChannels _channels;
std::function<void(SPUThread*, SPUThreadEvent)> _eventHandler;
// see the rationale for leaving these variables without an ifdef
// in the PPUThread.cpp file
std::atomic<bool> _dbgPaused;
std::atomic<bool> _singleStep;
int32_t _exitCode;
SPUThreadExitCause _cause;
uint32_t _elfSource;
std::optional<InterruptThreadInfo> _interruptHandler;
uint64_t _id;
boost::mutex _eventQueuesMutex;
std::vector<EventQueueInfo> _eventQueuesToPPU;
std::vector<EventQueueInfo> _eventQueuesToSPU;
void loop(OneTimeEvent* started);
void handleInterrupt(uint32_t interruptValue);
void handleReceiveEvent();
bool _hasStarted;
ReservationGranule _granule;
std::atomic<bool> _suspended = false;
boost::mutex _suspendMutex;
boost::condition_variable _suspendCv;
bool _needsJoin = false;
pthread_t _pthread;
ThreadGroup* _group;
bool _suspendEnabled = true;
__itt_string_handle* _profilerSuspendedTask = nullptr;
friend void suspend_handler(int);
public:
SPUThread(std::string name,
std::function<void(SPUThread*, SPUThreadEvent)> eventHandler);
#if TESTS
SPUThread();
#endif
template <typename V>
inline R128& r(V i) {
if (getUValue(i) == 98) {
int i = 0;
i++;
}
return _rs[getUValue(i)];
}
inline uint8_t* ptr(uint32_t lsa) {
EMU_ASSERT(lsa < sizeof(_ls));
return &_ls[lsa];
}
inline void setNip(uint32_t nip) override {
EMU_ASSERT(nip < LSLR);
_nip = nip;
}
inline uint32_t getNip() {
return _nip;
}
inline uint32_t getSrr0() {
return _srr0;
}
inline void setSrr0(uint32_t val) {
EMU_ASSERT(val < LSLR);
_srr0 = val;
}
inline void setSpu(uint32_t num) {
EMU_ASSERT(num != -1u && num <= 255);
_spu = num;
}
inline R128& fpscr() {
return _fpscr;
}
inline uint32_t getSpu() {
EMU_ASSERT(_spu != -1u && _spu <= 255);
return _spu;
}
inline ReservationGranule* granule() {
return &_granule;
}
void singleStepBreakpoint(bool value);
void dbgPause(bool val);
bool dbgIsPaused();
void run(bool suspended = false) override;
void cancel();
SPUThreadExitInfo tryJoin(unsigned ms);
SPUThreadExitInfo join();
void setElfSource(uint32_t src);
uint32_t getElfSource();
void setInterruptHandler(uint32_t mask2, std::function<void()> interruptHandler);
// TODO: removeInterruptHandler
void setId(uint64_t id);
uint64_t getId();
pthread_t getHostId();
void connectQueue(std::shared_ptr<IConcurrentQueue<sys_event_t>> queue,
uint32_t portNumber);
void bindQueue(std::shared_ptr<IConcurrentQueue<sys_event_t>> queue,
uint32_t portNumber);
void disconnectQueue(uint32_t portNumber);
void unbindQueue(uint32_t portNumber);
bool isQueuePortAvailableToConnect(uint32_t portNumber);
std::string getName();
SPUChannels* channels();
void suspend();
void resume();
bool suspended();
void disableSuspend();
void enableSuspend();
void waitSuspended();
void setGroup(ThreadGroup* group);
ThreadGroup* group();
// ISPUChannelsThread
inline uint8_t* ls(uint32_t i) override { return ptr(i); }
};
void set_mxcsr_for_spu();
|
309bc54d5d7b696c06f0ec8bed282f98741e559c | 4e1190455394bb008b9299082cdbd236477e293a | /CodeForces/Educational/2/d.cpp | b215a942b459e44b1df6b3cd48d9214efcf7b5d1 | [] | no_license | Leonardosu/competitive_programming | 64b62fc5a1731763a1bee0f99f9a9d7df15e9e8a | 01ce1e4f3cb4dc3c5973774287f2e32f92418987 | refs/heads/master | 2023-08-04T06:27:26.384700 | 2023-07-24T19:47:57 | 2023-07-24T19:47:57 | 202,539,762 | 4 | 6 | null | 2022-10-25T00:24:54 | 2019-08-15T12:46:33 | C++ | UTF-8 | C++ | false | false | 1,712 | cpp | d.cpp | #include "bits/stdc++.h"
#define f first
#define s second
#define pb push_back
#define sz(x) (int)(x).size()
#define ALL(x) x.begin(),x.end()
#define present(c, x) (c.find(x) != c.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1e-6;
const double PI = acos(-1);
struct pt {
long double x, y;
pt(double x_ = 0, double y_ = 0) : x(x_), y(y_) {};
long double dist(pt o){ return sqrt((o.x - x)*(o.x - x) + (o.y - y)*(o.y - y));}
};
struct circle {
pt center;
long double radius;
circle(pt p = pt(), double radius_ = 0): center(p), radius(radius_) {};
};
long double angle(long double r1, long double d, long double r2) {
//r2^2 = r1^2 + d^2 - 2r1dcos
return acos((r1*r1 + d*d - r2*r2)/(r1*d*2.0));
}
long double circleIntersectionArea(circle c1, circle c2) {
long double totalArea = 0, r1 = c1.radius, r2 = c2.radius;
long double dist = c1.center.dist(c2.center);
if (r1 + r2 < dist) {
totalArea = 0;
} else if (dist <= fabs(r1 - r2)) {
double r = min(r1, r2);
totalArea = r * r * PI;
} else {
long double tetha1 = angle(r1, dist, r2);
long double s1 = r1 * r1 *(tetha1 - sin(2*tetha1)/2.0);
long double tetha2 = angle(r2, dist, r1);
long double s2 = r2 * r2 * (tetha2 - sin(2*tetha2)/2.0);
// cout<<tetha1<<" | "<<tetha2<<"\n";
totalArea += s1 + s2;
}
return totalArea;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
circle c1, c2;
pt center;
cin>>center.x>>center.y>>c1.radius;
c1.center = center;
cin>>center.x>>center.y>>c2.radius;
c2.center = center;
cout<<fixed<<setprecision(16);
cout<<circleIntersectionArea(c1, c2)<<"\n";
} |
eaeec3b340a8a9ddaae84ee4cc74818ba96e36c6 | 45ae089c7d939488e56e87a71309c56f51b01f0c | /HDServer/Account/SmAccountNumGenerator.h | 617fb9b82efa6e5bb045edde10ce6c4372d4a5e6 | [] | no_license | wangscript007/HDServer | 3f22472800dcdf34f75abd4f96528cf314e37e08 | c8d1c6533a0da0bc46523b5fee0f130caee71730 | refs/heads/master | 2022-12-09T22:29:01.213842 | 2020-09-03T11:38:42 | 2020-09-03T11:38:42 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 295 | h | SmAccountNumGenerator.h | #pragma once
#include <string>
class SmAccountNumGenerator
{
public:
// type : 0 -> 해외 계좌, 1 -> 국내 계좌
std::string GetNewAccountNumber(int type = 0);
void SaveAccountNumber(int type = 0);
private:
int _First = 100;
int _Second = 1000;
int _Last = 1000;
int _Level = 0;
};
|
1fd55d2b69bd9326ef4e8a07a044a1aef431a818 | 5f0b1eb1f56d9eb8b7250041e362e639cfe90fca | /BinaryTree/BinaryTreeUtils.h | 1462369d9e1c9ac9aebd34cd4cb00493393c0473 | [] | no_license | yang747046912/Algorithm | 9e6eb0cdf4ffa3b38eb2ea1f7d9e08b2729fe0a8 | 239a946e9a00d52717fc27b1dbb566ec089730a0 | refs/heads/master | 2021-01-12T16:43:39.760739 | 2016-10-25T14:25:15 | 2016-10-25T14:25:15 | 71,439,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 972 | h | BinaryTreeUtils.h |
#ifndef BinaryTreeUtils_h
#define BinaryTreeUtils_h
#include "BinaryTree.h"
#include <stdio.h>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
using namespace std;
void logTreeNode(BinaryTree tree);
BinaryTree buildTree(int array[], int n);
void logLevel(BinaryTree tree);
void _logPreOrder(BinaryTree tree);
void _logInOrder(BinaryTree tree);
void _logPostorder(BinaryTree tree);
void logPreOrder(BinaryTree tree);
void logInOrder(BinaryTree tree);
void logPostorder(BinaryTree tree);
//在复合二叉树查找的情况下
void creatTree(BinaryTree &tree, int array[], int n);
void _creatTree(BinaryTree &tree, int array[], int n);
void insertNode(BinaryTree &tree, int value);
void _insertNode(BinaryTree &tree, int value);
void deleteNode(BinaryTree &tree, int value);
BinaryTree searchNode(BinaryTree &tree, int value);
int getTreeHeight (BinaryTree tree);
void printTree(BinaryTree tree);
#endif /* BinaryTreeUtils_h */
|
2b1ca79e4ead06544063f7b228d1a59ebbd35d59 | c1f3cf1bb6e2a0be181630ea2a992d971b37b278 | /lalsa_test/snd_pcm_delay_test.cc | 4e4d9ef44a1e1a0bc5fd519d1fca9465c5432940 | [] | no_license | leeonky/clayer | 1f00b7ccafec6450b6672f714dd4e9c39bf962e9 | 26216dac5c1979118f207a502a662afd04a8b353 | refs/heads/master | 2023-08-24T08:45:01.410961 | 2021-10-07T14:43:34 | 2021-10-07T14:43:34 | 107,023,342 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,104 | cc | snd_pcm_delay_test.cc | #include <cstdio>
#include <cstdlib>
#include <cunitexd.h>
#include "stdexd/stdexd.h"
#include "lalsa/lalsa.h"
#include "mock_alsa/mock_alsa.h"
SUITE_START("snd_pcm_delay_test");
static snd_pcm_t *arg_pcm;
static int arg_rate;
static snd_pcm_sframes_t ret_delay;
static int stub_snd_pcm_delay(snd_pcm_t *, snd_pcm_sframes_t *t) {
*t = ret_delay;
return 0;
}
BEFORE_EACH() {
init_subject("");
app_stdin = actxt.input_stream;
app_stdout = actxt.output_stream;
app_stderr = actxt.error_stream;
arg_pcm = (snd_pcm_t *)&arg_pcm;
arg_rate = 1000;
ret_delay = 100;
init_mock_function_with_function(snd_pcm_delay, stub_snd_pcm_delay);
return 0;
}
AFTER_EACH() {
return close_subject();
}
SUBJECT(int) {
return snd_pcm_delay(arg_pcm, arg_rate);
}
SUITE_CASE("get delay with rate in us") {
CUE_ASSERT_EQ(CALL_SUBJECT(snd_pcm_sframes_t), 100000);
}
SUITE_CASE("get delay failed should return 0") {
init_mock_function_with_return(snd_pcm_delay, -100);
CUE_ASSERT_EQ(CALL_SUBJECT(snd_pcm_sframes_t), 0);
CUE_ASSERT_STDERR_EQ("Error[liblalsa]: -100\n");
}
SUITE_END(snd_pcm_delay_test);
|
f101637c2c1620f9e5b970599bbc887c7bda015f | 7270bc2c9acf6b0e1a711d03433d102627a3e84a | /MattEngine/sprite.cpp | ff0e603421b1226eeb6cc1dca01dda0cf020b9f4 | [] | no_license | mgordon34/cppGame | 6f56d02e923ed89d21917a65322e3f393506d4d3 | 96127cbdb51631f0f28d8fb72392c291907131b7 | refs/heads/master | 2021-01-20T12:05:05.285357 | 2017-09-07T13:14:24 | 2017-09-07T13:14:24 | 101,698,230 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,450 | cpp | sprite.cpp | #include "sprite.h"
#include "vertex.h"
#include <SOIL/SOIL.h>
#include "window.h"
#include "ResourceManager.h"
namespace MattEngine {
Sprite::Sprite(Window *window) {
_window = window;
_vboID = 0;
}
Sprite::~Sprite() {
if (_vboID != 0) {
glDeleteBuffers(1, &_vboID);
}
if (_textureID != 0) {
glDeleteTextures(1, &_textureID);
}
}
void Sprite::init(Vector2 position, float width, float height, const char *filepath) {
_position = position;
_velocity = makeVector2(0, 0);
_width = width;
_height = height;
//_textureID = loadpng("res/xd2.png");
_textureID = ResourceManager::getTexture(filepath);
if (_vboID == 0) {
glGenBuffers(1, &_vboID);
}
Vertex vertexData[4];
vertexData[0].setPosition(position.x, position.y + height);
vertexData[0].setUV(0.5f, 1.0f);
//vertexData[0].texturepos.x = 0.5f;
//vertexData[0].texturepos.y = 0.0f;
vertexData[1].setPosition(position.x, position.y);
vertexData[1].setUV(0.5f, 0.0f);
//vertexData[1].texturepos.x = 0.5f;
//vertexData[1].texturepos.y = 1.0f;
vertexData[2].setPosition(position.x + width, position.y);
vertexData[2].setUV(1.0f, 0.0f);
//vertexData[2].texturepos.x = 1.0f;
//vertexData[2].texturepos.y = 1.0f;
vertexData[3].setPosition(position.x + width, position.y + height);
vertexData[3].setUV(1.0f, 1.0f);
//vertexData[3].texturepos.x = 1.0f;
//vertexData[3].texturepos.y = 0.0f;
for (int i = 0; i < 4; i++) {
vertexData[i].setColor(255, 0, 255, 255);
}
vertexData[0].setColor(0, 0, 255, 255);
vertexData[2].setColor(0, 255, 0, 255);
glBindBuffer(GL_ARRAY_BUFFER, _vboID);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
//_textureID = loadpng(filepath);
//_textureID = textureID;
std::cout << _textureID << std::endl;
//glBindBuffer(GL_TEXTURE_2D, textureID);
}
void Sprite::setVelocity(Vector2 newVector) {
_velocity = newVector;
}
Vector2 Sprite::getVelocity() {
return _velocity;
}
GLuint Sprite::loadbmp(const char *filepath) {
unsigned char header[54];
unsigned int dataPos;
unsigned int width, height;
unsigned int imageSize;
unsigned char * data;
FILE * file = fopen(filepath, "rb");
if (!file) {
std::cout << "file not loaded!" << std::endl;
exit(0);
}
fread(header, sizeof(unsigned char), 54, file);
dataPos = *(int*)&(header[0x0A]);
imageSize = *(int*)&(header[0x22]);
width = *(int*)&(header[18]);
height = *(int*)&(header[22]);
if (imageSize == 0) {
imageSize = width * height * 3;
}
if (dataPos == 0) {
dataPos = 54;
}
data = new unsigned char[imageSize];
fread(data, 1, imageSize, file);
fclose(file);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
return textureID;
}
GLuint Sprite::loadpng(const char *filepath) {
//GLuint textureID = SOIL_load_OGL_texture // load an image file directly as a new OpenGL texture
//(
// filepath,
// SOIL_LOAD_AUTO,
// SOIL_CREATE_NEW_ID,
// SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
//);
int w = 100;
int h = 100;
unsigned char* image = SOIL_load_image(filepath, &w, &h, 0, SOIL_LOAD_RGBA);
if (image == NULL) {
std::cout << "shits wrong" << std::endl;
}
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
SOIL_free_image_data(image);
_textureID = textureID;
return textureID;
}
void Sprite::update() {
//_velocity = makeVector2(0, 0);
//if (glfwGetKey(_window, GLFW_KEY_UP)) {
// _velocity = addVector2(_velocity, makeVector2(0.0f, 1.0f));
//}
//_position = addVector2(_position, _velocity);
}
void Sprite::draw() {
glBindTexture(GL_TEXTURE_2D, _textureID);
glBindBuffer(GL_ARRAY_BUFFER, _vboID);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
//Position Attribute Pointer
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, position));
//Color Attribute Pointer
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void *)offsetof(Vertex, color));
//UV Attribute Pointer
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, uv));
//glLoadIdentity();
//glTranslatef(_position.x, _position.y, 0);
//glActiveTexture(GL_TEXTURE0);
//glBindTexture(GL_TEXTURE_2D, _textureID);
//glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), (void *)offsetof(Vertex, texturepos));
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, 0);
//glBindTexture(GL_TEXTURE_2D, 0);
}
} |
654942da5fba5d5199e82c3690321c4161f8363c | f2dc46d7603448694f2c5b10f2b018b5bc4fd3d0 | /Projects/WeatherCheck/mainwindow.h | bc7f019739a64bb8d39dd1630b57c582b4773012 | [] | no_license | Flyte27/Personal-Work | f9ed863413f2ed24e08bff71601261c77e95cee8 | ecceb4d64307c7d5c252840f19bc97debe86a956 | refs/heads/master | 2021-03-12T19:56:14.091939 | 2014-10-07T00:47:12 | 2014-10-07T00:47:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | h | mainwindow.h | /*Created by Alex Payne
*mainwindow.h is a header file containing a interface for the MainWindow object class
*October 7, 2013
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtNetwork/QNetworkReply>
#include <weathermodel.h>
#include <fstream>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0); //Constructor for MainWindow object
~MainWindow(); //Deconstructor for MainWindow object
private:
Ui::MainWindow *ui; //User interface attribute
WeatherModel _data; //Weathermodel data attribute
bool _buttonSwitch = false; //Boolean switch used to show when getWeatherButton has been clicked
void saveUserData(); //Method used to save user data
private slots:
void weatherButtonClicked(); //Slot to get new weather information
void updateWeatherUI(); //Slot to update GUI with new weather information
void celsiusButtonClicked(); //Slot to select celsius radio button
void fahrenheitButtonClicked(); //Slot to select fahrenheit radio button
void kelvinButtonClicked(); //Slot to select kelvin radio button
void cityBoxChanged(); //Slot to query new city
};
#endif // MAINWINDOW_H
|
d515bb7b90fadc975cc1bc007b49a1c84c026f67 | 26cc428b3d87f0cd0f1a2e6a51e9da25cd0b651a | /upperPosition/Blasius_6/upwind/0.2/phi_0 | b2c0d812f5548ceba8fb461866bf2e63050a108d | [] | no_license | CagriMetin/BlasiusProblem | 8f4fe708df8f3332d054b233d99a33fbb3c15c2a | 32c4aafd6ddd6ba4c39aef04d01b77a9106125b2 | refs/heads/master | 2020-12-24T19:37:14.665700 | 2016-12-27T19:13:04 | 2016-12-27T19:13:04 | 57,833,097 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 50,419 | phi_0 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.2";
object phi_0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
3859
(
2.80115e-08
2.9144e-09
-3.09258e-08
2.51176e-08
2.89388e-09
2.24033e-08
2.71428e-09
1.99035e-08
2.4998e-09
1.76356e-08
2.26786e-09
1.56113e-08
2.02429e-09
1.38335e-08
1.77789e-09
1.22965e-08
1.53698e-09
1.09878e-08
1.30863e-09
9.88921e-09
1.09864e-09
8.97798e-09
9.11227e-10
8.22915e-09
7.4883e-10
7.61714e-09
6.12013e-10
7.11741e-09
4.99722e-10
6.70772e-09
4.09692e-10
6.36881e-09
3.38912e-10
6.08473e-09
2.84082e-10
5.84275e-09
2.41977e-10
5.63306e-09
2.09688e-10
5.44831e-09
1.84757e-10
5.28309e-09
1.65212e-10
5.13356e-09
1.49538e-10
4.99694e-09
1.36618e-10
4.87128e-09
1.25657e-10
4.75518e-09
1.16104e-10
4.64759e-09
1.07589e-10
4.54772e-09
9.98676e-11
4.45494e-09
9.27778e-11
4.36873e-09
8.62129e-11
4.28863e-09
8.00994e-11
4.21425e-09
7.43835e-11
4.14522e-09
6.9023e-11
4.08124e-09
6.39819e-11
4.02201e-09
5.92281e-11
3.96728e-09
5.47321e-11
3.91682e-09
5.04665e-11
3.87041e-09
4.64067e-11
3.82788e-09
4.25299e-11
3.78906e-09
3.88156e-11
3.75382e-09
3.52432e-11
3.72203e-09
3.17883e-11
3.69362e-09
2.84148e-11
3.66855e-09
2.5064e-11
3.64691e-09
2.16421e-11
3.6289e-09
1.80083e-11
3.61497e-09
1.39323e-11
3.60586e-09
9.11501e-12
3.60246e-09
3.39454e-12
3.60424e-09
-1.77535e-12
3.60987e-09
-5.63497e-12
3.61845e-09
-8.58276e-12
3.6293e-09
-1.08496e-11
3.64171e-09
-1.24028e-11
3.655e-09
-1.32895e-11
3.66857e-09
-1.35739e-11
3.68193e-09
-1.33567e-11
3.69469e-09
-1.27665e-11
3.70662e-09
-1.1929e-11
3.71757e-09
-1.09503e-11
3.72748e-09
-9.91192e-12
3.73636e-09
-8.87157e-12
3.74422e-09
-7.86743e-12
3.75115e-09
-6.92252e-12
3.75719e-09
-6.0491e-12
3.76245e-09
-5.2521e-12
3.76698e-09
-4.53166e-12
3.77086e-09
-3.88511e-12
3.77417e-09
-3.3082e-12
3.77697e-09
-2.79594e-12
3.77931e-09
-2.34312e-12
3.78126e-09
-1.9447e-12
3.78285e-09
-1.5958e-12
3.78414e-09
-1.29192e-12
3.78517e-09
-1.02889e-12
3.78597e-09
-8.02839e-13
3.78658e-09
-6.1017e-13
3.78703e-09
-4.4772e-13
3.78735e-09
-3.12687e-13
3.78755e-09
-2.02709e-13
3.78766e-09
-1.15825e-13
3.78771e-09
-4.95646e-14
3.78771e-09
1.74479e-15
3.78767e-09
4.62266e-14
3.78758e-09
8.21093e-14
3.78747e-09
1.10665e-13
3.78734e-09
1.32073e-13
3.7872e-09
1.40337e-13
3.78706e-09
1.41587e-13
3.78692e-09
1.3966e-13
3.78678e-09
1.35487e-13
3.78665e-09
1.28729e-13
3.78654e-09
1.17899e-13
3.78643e-09
1.05753e-13
3.78634e-09
9.31446e-14
3.78626e-09
8.05871e-14
3.78619e-09
6.83661e-14
3.78613e-09
5.64004e-14
3.78609e-09
4.42203e-14
3.78606e-09
3.10268e-14
1.72563e-14
3.59222e-08
3.19615e-09
-3.62039e-08
3.53157e-08
3.50037e-09
3.44655e-08
3.56448e-09
3.34497e-08
3.51562e-09
3.23252e-08
3.39228e-09
3.11395e-08
3.21003e-09
2.99311e-08
2.98629e-09
2.87299e-08
2.73818e-09
2.75581e-08
2.48043e-09
2.64315e-08
2.22523e-09
2.53605e-08
1.98222e-09
2.43511e-08
1.75826e-09
2.34058e-08
1.55733e-09
2.25246e-08
1.38092e-09
2.17058e-08
1.2285e-09
2.09464e-08
1.09822e-09
2.02431e-08
9.87446e-10
1.95918e-08
8.93276e-10
1.89886e-08
8.12879e-10
1.84296e-08
7.43701e-10
1.79113e-08
6.8357e-10
1.74301e-08
6.30709e-10
1.6983e-08
5.83711e-10
1.65672e-08
5.41485e-10
1.61801e-08
5.03194e-10
1.58195e-08
4.68202e-10
1.54833e-08
4.36015e-10
1.51699e-08
4.0625e-10
1.48775e-08
3.78601e-10
1.46048e-08
3.52812e-10
1.43505e-08
3.28669e-10
1.41135e-08
3.05985e-10
1.38929e-08
2.84593e-10
1.36878e-08
2.64344e-10
1.34974e-08
2.45099e-10
1.33212e-08
2.26734e-10
1.31584e-08
2.09136e-10
1.30088e-08
1.92197e-10
1.28718e-08
1.75817e-10
1.27471e-08
1.59893e-10
1.26346e-08
1.44312e-10
1.25341e-08
1.28932e-10
1.24456e-08
1.13566e-10
1.23693e-08
9.7962e-11
1.23055e-08
8.18058e-11
1.22546e-08
6.47459e-11
1.22173e-08
4.64521e-11
1.21942e-08
2.64852e-11
1.21867e-08
5.74438e-12
1.21929e-08
-1.18621e-11
1.22088e-08
-2.44467e-11
1.22315e-08
-3.36063e-11
1.2259e-08
-3.98688e-11
1.22894e-08
-4.36709e-11
1.23212e-08
-4.53529e-11
1.23531e-08
-4.52954e-11
1.23843e-08
-4.39196e-11
1.2414e-08
-4.16257e-11
1.24418e-08
-3.87565e-11
1.24674e-08
-3.55812e-11
1.24909e-08
-3.22986e-11
1.2512e-08
-2.90467e-11
1.2531e-08
-2.59155e-11
1.25479e-08
-2.29595e-11
1.25629e-08
-2.02083e-11
1.2576e-08
-1.76745e-11
1.25875e-08
-1.53597e-11
1.25975e-08
-1.32589e-11
1.2606e-08
-1.13634e-11
1.26134e-08
-9.66221e-12
1.26196e-08
-8.14374e-12
1.26248e-08
-6.79601e-12
1.26291e-08
-5.60714e-12
1.26326e-08
-4.56554e-12
1.26355e-08
-3.65988e-12
1.26377e-08
-2.87911e-12
1.26395e-08
-2.21267e-12
1.26408e-08
-1.65055e-12
1.26418e-08
-1.18328e-12
1.26425e-08
-8.01792e-13
1.2643e-08
-4.96953e-13
1.26432e-08
-2.60716e-13
1.26433e-08
-8.19433e-14
1.26434e-08
5.33864e-14
1.26433e-08
1.70133e-13
1.26432e-08
2.60752e-13
1.2643e-08
3.1241e-13
1.26428e-08
3.40844e-13
1.26426e-08
3.54379e-13
1.26424e-08
3.56115e-13
1.26422e-08
3.46895e-13
1.2642e-08
3.24508e-13
1.26418e-08
2.96188e-13
1.26416e-08
2.64639e-13
1.26414e-08
2.31852e-13
1.26413e-08
1.98942e-13
1.26412e-08
1.66141e-13
1.26411e-08
1.32449e-13
1.2641e-08
9.60366e-14
4.82795e-14
4.05853e-08
3.02261e-09
-4.04118e-08
4.06765e-08
3.40916e-09
4.06406e-08
3.6004e-09
4.04794e-08
3.67681e-09
4.02008e-08
3.67089e-09
3.98171e-08
3.59378e-09
3.93447e-08
3.45869e-09
3.88014e-08
3.28148e-09
3.82044e-08
3.07742e-09
3.75695e-08
2.86015e-09
3.69104e-08
2.64125e-09
3.62389e-08
2.42976e-09
3.55643e-08
2.23198e-09
3.48937e-08
2.05154e-09
3.42324e-08
1.8898e-09
3.35841e-08
1.74645e-09
3.29515e-08
1.62008e-09
3.23361e-08
1.50868e-09
3.17389e-08
1.41006e-09
3.11605e-08
1.32208e-09
3.06013e-08
1.24285e-09
3.00612e-08
1.17079e-09
2.95403e-08
1.10457e-09
2.90386e-08
1.04319e-09
2.8556e-08
9.85835e-10
2.80923e-08
9.31902e-10
2.76474e-08
8.80911e-10
2.72211e-08
8.32491e-10
2.68134e-08
7.8634e-10
2.6424e-08
7.42208e-10
2.60528e-08
6.99878e-10
2.56996e-08
6.59159e-10
2.53643e-08
6.19875e-10
2.50468e-08
5.81861e-10
2.4747e-08
5.44962e-10
2.44647e-08
5.09032e-10
2.41999e-08
4.73927e-10
2.39526e-08
4.39506e-10
2.37227e-08
4.05627e-10
2.35105e-08
3.72132e-10
2.3316e-08
3.38845e-10
2.31394e-08
3.05548e-10
2.29809e-08
2.71979e-10
2.28411e-08
2.37829e-10
2.27201e-08
2.02787e-10
2.26182e-08
1.66655e-10
2.2535e-08
1.29608e-10
2.2469e-08
9.25119e-11
2.24184e-08
5.63118e-11
2.23862e-08
2.04114e-11
2.23742e-08
-1.25046e-11
2.23787e-08
-3.80527e-11
2.23952e-08
-5.64365e-11
2.24207e-08
-6.91576e-11
2.24525e-08
-7.71007e-11
2.24883e-08
-8.10908e-11
2.25263e-08
-8.19643e-11
2.25652e-08
-8.05013e-11
2.26038e-08
-7.73796e-11
2.26414e-08
-7.31554e-11
2.26773e-08
-6.82627e-11
2.27113e-08
-6.30256e-11
2.27431e-08
-5.76775e-11
2.27725e-08
-5.23803e-11
2.27995e-08
-4.72421e-11
2.28242e-08
-4.23321e-11
2.28465e-08
-3.76925e-11
2.28666e-08
-3.33468e-11
2.28846e-08
-2.93064e-11
2.29005e-08
-2.55744e-11
2.29145e-08
-2.21489e-11
2.29267e-08
-1.90246e-11
2.29373e-08
-1.61939e-11
2.29464e-08
-1.36471e-11
2.29541e-08
-1.13731e-11
2.29606e-08
-9.35975e-12
2.2966e-08
-7.59335e-12
2.29704e-08
-6.05939e-12
2.29739e-08
-4.74225e-12
2.29767e-08
-3.62498e-12
2.29789e-08
-2.68894e-12
2.29806e-08
-1.91428e-12
2.29818e-08
-1.28038e-12
2.29826e-08
-7.77539e-13
2.29832e-08
-3.95416e-13
2.29836e-08
-1.20747e-13
2.29838e-08
6.49231e-14
2.29839e-08
2.09683e-13
2.2984e-08
3.18073e-13
2.29839e-08
3.90001e-13
2.29839e-08
4.28851e-13
2.29838e-08
4.33452e-13
2.29836e-08
4.19079e-13
2.29835e-08
3.91245e-13
2.29834e-08
3.54856e-13
2.29833e-08
3.13029e-13
2.29832e-08
2.67388e-13
2.29831e-08
2.17141e-13
2.2983e-08
1.59216e-13
7.26772e-14
4.50807e-08
2.80894e-09
-4.4867e-08
4.53114e-08
3.17842e-09
4.55075e-08
3.40432e-09
4.5653e-08
3.53127e-09
4.57389e-08
3.585e-09
4.57584e-08
3.57428e-09
4.57095e-08
3.50757e-09
4.55946e-08
3.39645e-09
4.54187e-08
3.25331e-09
4.51889e-08
3.08992e-09
4.49134e-08
2.91677e-09
4.46005e-08
2.74266e-09
4.42582e-08
2.57428e-09
4.38937e-08
2.41607e-09
4.3513e-08
2.27049e-09
4.31211e-08
2.13833e-09
4.2722e-08
2.01922e-09
4.23186e-08
1.91205e-09
4.19133e-08
1.81533e-09
4.15079e-08
1.72748e-09
4.11038e-08
1.64698e-09
4.07021e-08
1.5725e-09
4.03038e-08
1.5029e-09
3.99097e-08
1.43728e-09
3.95206e-08
1.3749e-09
3.91373e-08
1.3152e-09
3.87605e-08
1.25772e-09
3.83909e-08
1.20212e-09
3.80291e-08
1.14811e-09
3.76759e-08
1.09546e-09
3.73318e-08
1.04397e-09
3.69975e-08
9.93459e-10
3.66736e-08
9.43756e-10
3.63607e-08
8.94708e-10
3.60595e-08
8.46161e-10
3.57706e-08
7.97967e-10
3.54946e-08
7.49978e-10
3.5232e-08
7.02041e-10
3.49837e-08
6.53994e-10
3.47501e-08
6.05659e-10
3.45321e-08
5.56834e-10
3.43304e-08
5.07284e-10
3.41456e-08
4.56753e-10
3.39785e-08
4.04996e-10
3.38294e-08
3.51863e-10
3.36986e-08
2.97459e-10
3.35858e-08
2.42356e-10
3.34906e-08
1.87769e-10
3.34115e-08
1.35397e-10
3.33451e-08
8.67662e-11
3.3291e-08
4.16319e-11
3.32528e-08
1.47312e-13
3.32311e-08
-3.46925e-11
3.32233e-08
-6.14422e-11
3.32273e-08
-8.11041e-11
3.32409e-08
-9.46407e-11
3.3262e-08
-1.03066e-10
3.32889e-08
-1.0737e-10
3.33199e-08
-1.0846e-10
3.33539e-08
-1.07125e-10
3.33897e-08
-1.04018e-10
3.34263e-08
-9.96621e-11
3.34631e-08
-9.44617e-11
3.34994e-08
-8.87256e-11
3.35349e-08
-8.26842e-11
3.35691e-08
-7.65075e-11
3.36017e-08
-7.03207e-11
3.36326e-08
-6.42159e-11
3.36615e-08
-5.82614e-11
3.36884e-08
-5.25088e-11
3.37133e-08
-4.69978e-11
3.3736e-08
-4.17595e-11
3.37567e-08
-3.68183e-11
3.37752e-08
-3.21938e-11
3.37917e-08
-2.79005e-11
3.38063e-08
-2.39487e-11
3.38191e-08
-2.03444e-11
3.38301e-08
-1.70888e-11
3.38395e-08
-1.41788e-11
3.38475e-08
-1.16059e-11
3.38542e-08
-9.35641e-12
3.38597e-08
-7.41238e-12
3.38641e-08
-5.75322e-12
3.38677e-08
-4.36182e-12
3.38706e-08
-3.21733e-12
3.38727e-08
-2.291e-12
3.38744e-08
-1.55929e-12
3.38755e-08
-9.87398e-13
3.38764e-08
-5.53877e-13
3.38771e-08
-2.41519e-13
3.38775e-08
-2.76037e-14
3.38778e-08
1.06978e-13
3.38781e-08
1.98222e-13
3.38782e-08
2.50758e-13
3.38783e-08
2.72808e-13
3.38783e-08
2.70999e-13
3.38783e-08
2.50573e-13
3.38783e-08
2.13034e-13
3.38783e-08
1.56568e-13
5.36152e-14
4.99553e-08
2.62373e-09
-4.97701e-08
5.01846e-08
2.94911e-09
5.04161e-08
3.17286e-09
5.06331e-08
3.3143e-09
5.08262e-08
3.39187e-09
5.09865e-08
3.41394e-09
5.11072e-08
3.3869e-09
5.11844e-08
3.31924e-09
5.12171e-08
3.22058e-09
5.12067e-08
3.1004e-09
5.1156e-08
2.96739e-09
5.10696e-08
2.82911e-09
5.09522e-08
2.69163e-09
5.0809e-08
2.55932e-09
5.06445e-08
2.43495e-09
5.0463e-08
2.3199e-09
5.02677e-08
2.21446e-09
5.00616e-08
2.11818e-09
4.98468e-08
2.03015e-09
4.9625e-08
1.94927e-09
4.93976e-08
1.87439e-09
4.91656e-08
1.80444e-09
4.89301e-08
1.73846e-09
4.86917e-08
1.67564e-09
4.84513e-08
1.61533e-09
4.82095e-08
1.55698e-09
4.7967e-08
1.50017e-09
4.77246e-08
1.44454e-09
4.74829e-08
1.38982e-09
4.72426e-08
1.33576e-09
4.70044e-08
1.28214e-09
4.67691e-08
1.22879e-09
4.65373e-08
1.17552e-09
4.63099e-08
1.12217e-09
4.60875e-08
1.06857e-09
4.58709e-08
1.01457e-09
4.56609e-08
9.59992e-10
4.54582e-08
9.04676e-10
4.52638e-08
8.48443e-10
4.50783e-08
7.91102e-10
4.49027e-08
7.32448e-10
4.47377e-08
6.72265e-10
4.45841e-08
6.10355e-10
4.44425e-08
5.46589e-10
4.43134e-08
4.81011e-10
4.41969e-08
4.13982e-10
4.40929e-08
3.46338e-10
4.40012e-08
2.79464e-10
4.39215e-08
2.15125e-10
4.38532e-08
1.55074e-10
4.37942e-08
1.00574e-10
4.37425e-08
5.1872e-11
4.36992e-08
8.56087e-12
4.36663e-08
-2.85006e-11
4.36433e-08
-5.81259e-11
4.36296e-08
-8.09207e-11
4.36243e-08
-9.7783e-11
4.36265e-08
-1.09599e-10
4.36353e-08
-1.17237e-10
4.36497e-08
-1.21494e-10
4.36687e-08
-1.23066e-10
4.36916e-08
-1.22537e-10
4.37175e-08
-1.20383e-10
4.37458e-08
-1.16986e-10
4.37758e-08
-1.12648e-10
4.38069e-08
-1.07605e-10
4.38386e-08
-1.02044e-10
4.38705e-08
-9.61122e-11
4.39021e-08
-8.99283e-11
4.39332e-08
-8.35903e-11
4.39634e-08
-7.71814e-11
4.39924e-08
-7.07741e-11
4.402e-08
-6.44338e-11
4.40461e-08
-5.82201e-11
4.40703e-08
-5.2188e-11
4.40928e-08
-4.6388e-11
4.41133e-08
-4.08658e-11
4.41319e-08
-3.56615e-11
4.41485e-08
-3.08087e-11
4.41632e-08
-2.63334e-11
4.41761e-08
-2.2253e-11
4.41873e-08
-1.85764e-11
4.41968e-08
-1.53049e-11
4.42049e-08
-1.24352e-11
4.42117e-08
-9.95537e-12
4.42172e-08
-7.84258e-12
4.42217e-08
-6.07119e-12
4.42253e-08
-4.60741e-12
4.42282e-08
-3.41901e-12
4.42304e-08
-2.47329e-12
4.42321e-08
-1.73487e-12
4.42334e-08
-1.17542e-12
4.42344e-08
-7.5727e-13
4.42351e-08
-4.54785e-13
4.42356e-08
-2.44732e-13
4.4236e-08
-1.07888e-13
4.42363e-08
-2.77463e-14
4.42365e-08
6.85016e-15
4.42366e-08
2.37492e-15
-5.88462e-14
5.53334e-08
2.46871e-09
-5.51783e-08
5.55365e-08
2.74599e-09
5.57558e-08
2.95359e-09
5.59744e-08
3.09567e-09
5.61833e-08
3.18293e-09
5.63749e-08
3.22236e-09
5.65425e-08
3.21926e-09
5.66817e-08
3.18005e-09
5.67901e-08
3.11221e-09
5.68671e-08
3.02337e-09
5.69139e-08
2.92066e-09
5.69326e-08
2.81043e-09
5.69263e-08
2.69793e-09
5.68984e-08
2.5872e-09
5.68523e-08
2.48101e-09
5.67912e-08
2.38098e-09
5.67178e-08
2.28783e-09
5.66345e-08
2.20156e-09
5.65429e-08
2.12175e-09
5.64445e-08
2.04768e-09
5.63403e-08
1.97853e-09
5.62313e-08
1.91349e-09
5.6118e-08
1.85176e-09
5.60009e-08
1.79268e-09
5.58806e-08
1.73564e-09
5.57575e-08
1.68014e-09
5.56318e-08
1.62577e-09
5.55042e-08
1.57219e-09
5.53749e-08
1.51909e-09
5.52445e-08
1.46621e-09
5.51133e-08
1.41334e-09
5.49818e-08
1.36026e-09
5.48506e-08
1.30677e-09
5.472e-08
1.25268e-09
5.45908e-08
1.19783e-09
5.44633e-08
1.14202e-09
5.43383e-08
1.08507e-09
5.42161e-08
1.02681e-09
5.40975e-08
9.67041e-10
5.39831e-08
9.05579e-10
5.38733e-08
8.42232e-10
5.37687e-08
7.76829e-10
5.36698e-08
7.09246e-10
5.35769e-08
6.39474e-10
5.34902e-08
5.67705e-10
5.34098e-08
4.94455e-10
5.33354e-08
4.20663e-10
5.32672e-08
3.4771e-10
5.32051e-08
2.77266e-10
5.31491e-08
2.11008e-10
5.30994e-08
1.50319e-10
5.30551e-08
9.61094e-11
5.30151e-08
4.85958e-11
5.29793e-08
7.33663e-12
5.29489e-08
-2.78122e-11
5.29243e-08
-5.62741e-11
5.29054e-08
-7.88409e-11
5.2892e-08
-9.62276e-11
5.28839e-08
-1.0918e-10
5.28808e-08
-1.18407e-10
5.28823e-08
-1.24547e-10
5.28879e-08
-1.28156e-10
5.28973e-08
-1.29697e-10
5.29098e-08
-1.29554e-10
5.29252e-08
-1.28037e-10
5.2943e-08
-1.25398e-10
5.29628e-08
-1.21836e-10
5.29842e-08
-1.17514e-10
5.30068e-08
-1.12567e-10
5.30304e-08
-1.07108e-10
5.30544e-08
-1.01235e-10
5.30787e-08
-9.50389e-11
5.31028e-08
-8.86021e-11
5.31266e-08
-8.20053e-11
5.31498e-08
-7.53272e-11
5.3172e-08
-6.86454e-11
5.31932e-08
-6.20361e-11
5.32131e-08
-5.55727e-11
5.32316e-08
-4.9325e-11
5.32486e-08
-4.33567e-11
5.32641e-08
-3.77237e-11
5.3278e-08
-3.24725e-11
5.32904e-08
-2.764e-11
5.33012e-08
-2.32533e-11
5.33105e-08
-1.93272e-11
5.33186e-08
-1.58618e-11
5.33253e-08
-1.28474e-11
5.3331e-08
-1.02628e-11
5.33357e-08
-8.07996e-12
5.33394e-08
-6.26602e-12
5.33425e-08
-4.78252e-12
5.33449e-08
-3.59177e-12
5.33468e-08
-2.6506e-12
5.33483e-08
-1.92083e-12
5.33494e-08
-1.36708e-12
5.33502e-08
-9.574e-13
5.33509e-08
-6.63997e-13
5.33513e-08
-4.65229e-13
5.33517e-08
-3.42966e-13
-2.86808e-13
6.12766e-08
2.33671e-09
-6.11446e-08
6.14528e-08
2.56977e-09
6.16505e-08
2.75584e-09
6.18541e-08
2.8921e-09
6.20541e-08
2.98294e-09
6.22434e-08
3.03305e-09
6.24161e-08
3.04655e-09
6.25679e-08
3.02825e-09
6.26963e-08
2.98385e-09
6.28002e-08
2.91939e-09
6.28802e-08
2.84066e-09
6.29377e-08
2.75294e-09
6.29749e-08
2.66074e-09
6.29945e-08
2.56767e-09
6.29991e-08
2.47637e-09
6.29915e-08
2.3886e-09
6.2974e-08
2.30535e-09
6.29485e-08
2.22697e-09
6.29169e-08
2.15341e-09
6.28802e-08
2.08432e-09
6.28396e-08
2.01918e-09
6.27957e-08
1.95742e-09
6.2749e-08
1.89846e-09
6.26999e-08
1.84174e-09
6.26488e-08
1.78676e-09
6.25958e-08
1.73309e-09
6.25412e-08
1.68036e-09
6.24852e-08
1.62821e-09
6.24279e-08
1.57637e-09
6.23696e-08
1.52457e-09
6.23104e-08
1.47257e-09
6.22505e-08
1.42016e-09
6.21901e-08
1.36713e-09
6.21295e-08
1.31329e-09
6.20689e-08
1.25843e-09
6.20085e-08
1.20237e-09
6.19487e-08
1.14492e-09
6.18896e-08
1.0859e-09
6.18315e-08
1.02512e-09
6.17747e-08
9.62411e-10
6.17193e-08
8.97618e-10
6.16655e-08
8.30619e-10
6.16134e-08
7.61367e-10
6.15629e-08
6.89944e-10
6.1514e-08
6.16633e-10
6.14664e-08
5.42006e-10
6.14201e-08
4.66983e-10
6.1375e-08
3.92823e-10
6.13313e-08
3.21006e-10
6.12893e-08
2.53021e-10
6.12494e-08
1.90154e-10
6.12122e-08
1.33355e-10
6.11776e-08
8.31672e-11
6.11454e-08
3.95482e-11
6.11156e-08
1.99202e-12
6.10889e-08
-2.96051e-11
6.10657e-08
-5.55782e-11
6.10459e-08
-7.65153e-11
6.10298e-08
-9.30475e-11
6.10172e-08
-1.0579e-10
6.1008e-08
-1.15312e-10
6.10019e-08
-1.22119e-10
6.09989e-08
-1.26647e-10
6.09986e-08
-1.29261e-10
6.10008e-08
-1.30262e-10
6.10053e-08
-1.29899e-10
6.10118e-08
-1.28372e-10
6.10202e-08
-1.25846e-10
6.10301e-08
-1.22458e-10
6.10413e-08
-1.18321e-10
6.10536e-08
-1.13539e-10
6.10667e-08
-1.08201e-10
6.10805e-08
-1.02396e-10
6.10947e-08
-9.62081e-11
6.11091e-08
-8.97233e-11
6.11235e-08
-8.30286e-11
6.11377e-08
-7.62126e-11
6.11515e-08
-6.93646e-11
6.11647e-08
-6.25735e-11
6.11773e-08
-5.59251e-11
6.11891e-08
-4.95001e-11
6.12e-08
-4.33718e-11
6.121e-08
-3.7604e-11
6.12189e-08
-3.22499e-11
6.1227e-08
-2.7349e-11
6.1234e-08
-2.29256e-11
6.12402e-08
-1.89896e-11
6.12454e-08
-1.5537e-11
6.12499e-08
-1.25523e-11
6.12537e-08
-1.00109e-11
6.12568e-08
-7.87931e-12
6.12593e-08
-6.12005e-12
6.12613e-08
-4.68989e-12
6.1263e-08
-3.54608e-12
6.12642e-08
-2.6473e-12
6.12652e-08
-1.95459e-12
6.1266e-08
-1.43243e-12
6.12666e-08
-1.04985e-12
6.1267e-08
-7.77389e-13
-5.78064e-13
6.78421e-08
2.22226e-09
-6.77276e-08
6.79943e-08
2.41751e-09
6.81692e-08
2.58095e-09
6.83536e-08
2.70772e-09
6.85383e-08
2.79828e-09
6.87163e-08
2.85498e-09
6.88822e-08
2.88064e-09
6.90318e-08
2.87871e-09
6.91623e-08
2.85336e-09
6.92725e-08
2.8092e-09
6.93623e-08
2.7508e-09
6.94328e-08
2.68245e-09
6.94856e-08
2.60794e-09
6.95229e-08
2.53043e-09
6.95469e-08
2.45236e-09
6.956e-08
2.3755e-09
6.95643e-08
2.301e-09
6.95618e-08
2.22949e-09
6.9554e-08
2.1612e-09
6.95423e-08
2.0961e-09
6.95275e-08
2.03394e-09
6.95105e-08
1.9744e-09
6.94919e-08
1.91707e-09
6.94721e-08
1.86157e-09
6.94513e-08
1.80752e-09
6.94298e-08
1.75456e-09
6.94078e-08
1.70237e-09
6.93854e-08
1.65065e-09
6.93626e-08
1.59915e-09
6.93395e-08
1.54762e-09
6.93163e-08
1.49583e-09
6.92929e-08
1.44357e-09
6.92694e-08
1.39065e-09
6.92458e-08
1.33686e-09
6.92222e-08
1.28202e-09
6.91986e-08
1.22595e-09
6.91751e-08
1.16846e-09
6.91516e-08
1.1094e-09
6.91281e-08
1.04859e-09
6.91046e-08
9.8589e-10
6.90811e-08
9.21194e-10
6.90572e-08
8.54434e-10
6.9033e-08
7.85626e-10
6.9008e-08
7.14916e-10
6.8982e-08
6.42629e-10
6.89547e-08
5.69329e-10
6.89258e-08
4.95851e-10
6.88954e-08
4.23282e-10
6.88635e-08
3.52871e-10
6.88306e-08
2.8588e-10
6.87974e-08
2.23427e-10
6.87643e-08
1.66379e-10
6.87322e-08
1.15289e-10
6.87014e-08
7.03458e-11
6.86721e-08
3.13374e-11
6.86445e-08
-2.06844e-12
6.86192e-08
-3.02384e-11
6.85963e-08
-5.36023e-11
6.85759e-08
-7.26804e-11
6.85581e-08
-8.79989e-11
6.85429e-08
-1.00056e-10
6.85301e-08
-1.09307e-10
6.85196e-08
-1.16151e-10
6.85112e-08
-1.20933e-10
6.85049e-08
-1.23944e-10
6.85004e-08
-1.25426e-10
6.84977e-08
-1.25582e-10
6.84964e-08
-1.24578e-10
6.84965e-08
-1.22554e-10
6.84978e-08
-1.19629e-10
6.85002e-08
-1.1591e-10
6.85035e-08
-1.11491e-10
6.85075e-08
-1.06463e-10
6.85122e-08
-1.00915e-10
6.85174e-08
-9.49362e-11
6.8523e-08
-8.86188e-11
6.85289e-08
-8.20564e-11
6.85349e-08
-7.5345e-11
6.85409e-08
-6.85812e-11
6.85468e-08
-6.18603e-11
6.85526e-08
-5.5274e-11
6.85581e-08
-4.89075e-11
6.85633e-08
-4.28378e-11
6.85682e-08
-3.71311e-11
6.85727e-08
-3.18405e-11
6.85768e-08
-2.70039e-11
6.85804e-08
-2.26441e-11
6.85837e-08
-1.87693e-11
6.85865e-08
-1.53743e-11
6.85889e-08
-1.24426e-11
6.8591e-08
-9.94762e-12
6.85927e-08
-7.85602e-12
6.85942e-08
-6.12826e-12
6.85953e-08
-4.72275e-12
6.85963e-08
-3.59782e-12
6.85971e-08
-2.71299e-12
6.85977e-08
-2.0302e-12
6.85981e-08
-1.5144e-12
6.85985e-08
-1.13102e-12
-8.38177e-13
6.80042e-08
2.13051e-09
-6.79124e-08
6.81246e-08
2.29706e-09
6.82646e-08
2.441e-09
6.84147e-08
2.55756e-09
6.85676e-08
2.64544e-09
6.87172e-08
2.70536e-09
6.88588e-08
2.73902e-09
6.89887e-08
2.7488e-09
6.91044e-08
2.73772e-09
6.92043e-08
2.70923e-09
6.92882e-08
2.66689e-09
6.93565e-08
2.61418e-09
6.94102e-08
2.55423e-09
6.94509e-08
2.48977e-09
6.94802e-08
2.423e-09
6.95001e-08
2.35562e-09
6.95122e-08
2.28885e-09
6.95183e-08
2.22348e-09
6.95195e-08
2.15993e-09
6.95172e-08
2.09839e-09
6.95123e-08
2.03885e-09
6.95056e-08
1.98115e-09
6.94976e-08
1.92509e-09
6.94887e-08
1.87041e-09
6.94794e-08
1.81685e-09
6.94698e-08
1.76414e-09
6.94602e-08
1.71202e-09
6.94506e-08
1.66025e-09
6.94411e-08
1.60862e-09
6.94318e-08
1.5569e-09
6.94228e-08
1.5049e-09
6.94139e-08
1.45242e-09
6.94053e-08
1.39928e-09
6.93968e-08
1.3453e-09
6.93886e-08
1.29031e-09
6.93804e-08
1.23414e-09
6.93722e-08
1.17664e-09
6.93639e-08
1.11766e-09
6.93555e-08
1.05706e-09
6.93466e-08
9.94748e-10
6.93371e-08
9.30642e-10
6.93269e-08
8.64725e-10
6.93154e-08
7.97063e-10
6.93025e-08
7.27836e-10
6.92877e-08
6.57383e-10
6.92708e-08
5.86231e-10
6.92516e-08
5.1512e-10
6.92299e-08
4.44974e-10
6.92059e-08
3.76839e-10
6.918e-08
3.11774e-10
6.91527e-08
2.50733e-10
6.91246e-08
1.94481e-10
6.90964e-08
1.43533e-10
6.90686e-08
9.81288e-11
6.90417e-08
5.82316e-11
6.9016e-08
2.36196e-11
6.89918e-08
-6.05093e-12
6.89694e-08
-3.11533e-11
6.89488e-08
-5.21109e-11
6.89302e-08
-6.93698e-11
6.89135e-08
-8.33656e-11
6.88987e-08
-9.45043e-11
6.88857e-08
-1.03152e-10
6.88744e-08
-1.09632e-10
6.88647e-08
-1.14223e-10
6.88564e-08
-1.17161e-10
6.88495e-08
-1.18647e-10
6.88437e-08
-1.18853e-10
6.88391e-08
-1.17922e-10
6.88354e-08
-1.1598e-10
6.88327e-08
-1.1314e-10
6.88307e-08
-1.09502e-10
6.88294e-08
-1.05166e-10
6.88287e-08
-1.00224e-10
6.88285e-08
-9.47717e-11
6.88288e-08
-8.89061e-11
6.88295e-08
-8.27254e-11
6.88305e-08
-7.63297e-11
6.88317e-08
-6.98194e-11
6.88331e-08
-6.32939e-11
6.88347e-08
-5.68486e-11
6.88364e-08
-5.05732e-11
6.88381e-08
-4.45486e-11
6.88398e-08
-3.88457e-11
6.88415e-08
-3.35222e-11
6.88431e-08
-2.86216e-11
6.88446e-08
-2.41723e-11
6.88461e-08
-2.01886e-11
6.88474e-08
-1.66709e-11
6.88485e-08
-1.36081e-11
6.88496e-08
-1.09789e-11
6.88505e-08
-8.75401e-12
6.88512e-08
-6.89816e-12
6.88519e-08
-5.37285e-12
6.88524e-08
-4.13855e-12
6.88529e-08
-3.15617e-12
6.88532e-08
-2.38821e-12
6.88535e-08
-1.79936e-12
6.88537e-08
-1.35525e-12
-1.0201e-12
7.52435e-08
2.04853e-09
-7.51615e-08
7.53493e-08
2.19133e-09
7.54725e-08
2.31773e-09
7.56063e-08
2.42375e-09
7.57443e-08
2.50744e-09
7.58812e-08
2.56851e-09
7.60125e-08
2.60773e-09
7.61347e-08
2.62658e-09
7.62453e-08
2.62712e-09
7.63427e-08
2.61185e-09
7.64262e-08
2.58343e-09
7.64958e-08
2.54457e-09
7.65522e-08
2.49781e-09
7.65965e-08
2.44542e-09
7.66302e-08
2.38934e-09
7.66547e-08
2.33115e-09
7.66715e-08
2.27204e-09
7.66821e-08
2.21288e-09
7.66877e-08
2.15426e-09
7.66896e-08
2.09651e-09
7.66887e-08
2.03979e-09
7.66857e-08
1.98414e-09
7.66813e-08
1.92949e-09
7.6676e-08
1.87573e-09
7.66701e-08
1.8227e-09
7.6664e-08
1.77023e-09
7.66579e-08
1.71814e-09
7.66519e-08
1.66624e-09
7.66462e-08
1.61437e-09
7.66407e-08
1.56234e-09
7.66356e-08
1.51e-09
7.66309e-08
1.45717e-09
7.66265e-08
1.40369e-09
7.66224e-08
1.34942e-09
7.66185e-08
1.29419e-09
7.66147e-08
1.23788e-09
7.6611e-08
1.18035e-09
7.66072e-08
1.12148e-09
7.66031e-08
1.06118e-09
7.65985e-08
9.99361e-10
7.65931e-08
9.36007e-10
7.65867e-08
8.71137e-10
7.65789e-08
8.0485e-10
7.65694e-08
7.3735e-10
7.65578e-08
6.6897e-10
7.65438e-08
6.00193e-10
7.65273e-08
5.31659e-10
7.65081e-08
4.64147e-10
7.64864e-08
3.98522e-10
7.64626e-08
3.3566e-10
7.64369e-08
2.76362e-10
7.64101e-08
2.21289e-10
7.63827e-08
1.70909e-10
7.63554e-08
1.25478e-10
7.63286e-08
8.50428e-11
7.63027e-08
4.94866e-11
7.62781e-08
1.85713e-11
7.6255e-08
-8.01552e-12
7.62335e-08
-3.06183e-11
7.62137e-08
-4.96082e-11
7.61957e-08
-6.53582e-11
7.61794e-08
-7.82252e-11
7.61648e-08
-8.85395e-11
7.61518e-08
-9.65986e-11
7.61402e-08
-1.02666e-10
7.613e-08
-1.0697e-10
7.61211e-08
-1.09711e-10
7.61133e-08
-1.1106e-10
7.61065e-08
-1.11166e-10
7.61007e-08
-1.10162e-10
7.60957e-08
-1.08165e-10
7.60915e-08
-1.05287e-10
7.6088e-08
-1.01632e-10
7.60851e-08
-9.73018e-11
7.60827e-08
-9.23977e-11
7.60808e-08
-8.70223e-11
7.60794e-08
-8.12788e-11
7.60783e-08
-7.52715e-11
7.60776e-08
-6.91042e-11
7.60772e-08
-6.28785e-11
7.6077e-08
-5.6692e-11
7.60771e-08
-5.06357e-11
7.60773e-08
-4.47922e-11
7.60777e-08
-3.92335e-11
7.60782e-08
-3.4019e-11
7.60788e-08
-2.91944e-11
7.60794e-08
-2.47911e-11
7.608e-08
-2.08264e-11
7.60807e-08
-1.73049e-11
7.60813e-08
-1.42191e-11
7.60819e-08
-1.1552e-11
7.60824e-08
-9.27853e-12
7.60829e-08
-7.36745e-12
7.60833e-08
-5.78395e-12
7.60836e-08
-4.49154e-12
7.60839e-08
-3.45361e-12
7.60842e-08
-2.63453e-12
7.60844e-08
-2.00046e-12
7.60845e-08
-1.51936e-12
-1.1637e-12
8.3239e-08
1.97603e-09
-8.31665e-08
8.33309e-08
2.09946e-09
8.34379e-08
2.21071e-09
8.3555e-08
2.30669e-09
8.3677e-08
2.38541e-09
8.37995e-08
2.44607e-09
8.39184e-08
2.48878e-09
8.40306e-08
2.51433e-09
8.41338e-08
2.52402e-09
8.4226e-08
2.51955e-09
8.43066e-08
2.50285e-09
8.43753e-08
2.47594e-09
8.44322e-08
2.44083e-09
8.44783e-08
2.39935e-09
8.45145e-08
2.35316e-09
8.4542e-08
2.30365e-09
8.45621e-08
2.25197e-09
8.45759e-08
2.19901e-09
8.45848e-08
2.14541e-09
8.45897e-08
2.09164e-09
8.45915e-08
2.03799e-09
8.4591e-08
1.98464e-09
8.45888e-08
1.93165e-09
8.45855e-08
1.87902e-09
8.45815e-08
1.82672e-09
8.45771e-08
1.77464e-09
8.45725e-08
1.7227e-09
8.4568e-08
1.67077e-09
8.45636e-08
1.61873e-09
8.45595e-08
1.56645e-09
8.45557e-08
1.5138e-09
8.45522e-08
1.46064e-09
8.45491e-08
1.40685e-09
8.45462e-08
1.3523e-09
8.45435e-08
1.29686e-09
8.4541e-08
1.24042e-09
8.45384e-08
1.18289e-09
8.45357e-08
1.12417e-09
8.45327e-08
1.06419e-09
8.45292e-08
1.00292e-09
8.45248e-08
9.40359e-10
8.45194e-08
8.7657e-10
8.45126e-08
8.11675e-10
8.4504e-08
7.45887e-10
8.44935e-08
6.79527e-10
8.44806e-08
6.13028e-10
8.44654e-08
5.46944e-10
8.44476e-08
4.81926e-10
8.44274e-08
4.18688e-10
8.44051e-08
3.57952e-10
8.43811e-08
3.00387e-10
8.43558e-08
2.46558e-10
8.43298e-08
1.96886e-10
8.43037e-08
1.51628e-10
8.42779e-08
1.10881e-10
8.42527e-08
7.46012e-11
8.42287e-08
4.26381e-11
8.42059e-08
1.47653e-11
8.41846e-08
-9.29675e-12
8.41648e-08
-2.9848e-11
8.41467e-08
-4.72028e-11
8.41301e-08
-6.16699e-11
8.41151e-08
-7.35425e-11
8.41016e-08
-8.30912e-11
8.40895e-08
-9.05614e-11
8.40787e-08
-9.61723e-11
8.40691e-08
-1.00118e-10
8.40606e-08
-1.0257e-10
8.40531e-08
-1.0368e-10
8.40466e-08
-1.03587e-10
8.40408e-08
-1.02415e-10
8.40358e-08
-1.00281e-10
8.40315e-08
-9.72978e-11
8.40277e-08
-9.35746e-11
8.40246e-08
-8.92197e-11
8.40219e-08
-8.43414e-11
8.40196e-08
-7.90482e-11
8.40178e-08
-7.34483e-11
8.40164e-08
-6.76487e-11
8.40152e-08
-6.17532e-11
8.40144e-08
-5.58609e-11
8.40138e-08
-5.00638e-11
8.40135e-08
-4.4445e-11
8.40133e-08
-3.9077e-11
8.40133e-08
-3.40198e-11
8.40135e-08
-2.93203e-11
8.40137e-08
-2.50118e-11
8.4014e-08
-2.11139e-11
8.40143e-08
-1.76339e-11
8.40146e-08
-1.45681e-11
8.4015e-08
-1.19027e-11
8.40153e-08
-9.61648e-12
8.40157e-08
-7.68214e-12
8.40159e-08
-6.06845e-12
8.40162e-08
-4.74212e-12
8.40164e-08
-3.66928e-12
8.40166e-08
-2.8166e-12
8.40167e-08
-2.1522e-12
8.40169e-08
-1.64629e-12
-1.2735e-12
9.20707e-08
1.91332e-09
-9.2008e-08
9.21489e-08
2.02128e-09
9.22397e-08
2.11993e-09
9.23394e-08
2.20694e-09
9.24443e-08
2.28055e-09
9.25506e-08
2.33979e-09
9.2655e-08
2.38436e-09
9.27548e-08
2.41455e-09
9.28477e-08
2.43111e-09
9.29321e-08
2.43511e-09
9.30071e-08
2.42788e-09
9.30721e-08
2.41091e-09
9.31273e-08
2.3857e-09
9.31729e-08
2.35371e-09
9.32098e-08
2.3163e-09
9.32387e-08
2.2747e-09
9.32608e-08
2.22993e-09
9.32769e-08
2.18286e-09
9.32882e-08
2.13417e-09
9.32954e-08
2.0844e-09
9.32995e-08
2.03392e-09
9.33011e-08
1.98302e-09
9.33009e-08
1.93187e-09
9.32993e-08
1.88058e-09
9.32968e-08
1.82918e-09
9.32938e-08
1.77768e-09
9.32904e-08
1.72606e-09
9.3287e-08
1.67424e-09
9.32835e-08
1.62217e-09
9.32802e-08
1.56974e-09
9.32772e-08
1.51689e-09
9.32743e-08
1.46349e-09
9.32717e-08
1.40946e-09
9.32693e-08
1.3547e-09
9.3267e-08
1.29912e-09
9.32648e-08
1.24262e-09
9.32626e-08
1.18513e-09
9.32602e-08
1.12659e-09
9.32574e-08
1.06698e-09
9.3254e-08
1.00627e-09
9.32499e-08
9.445e-10
9.32447e-08
8.81757e-10
9.32382e-08
8.18179e-10
9.32301e-08
7.53983e-10
9.32202e-08
6.8947e-10
9.32082e-08
6.25028e-10
9.3194e-08
5.61134e-10
9.31776e-08
4.98336e-10
9.3159e-08
4.37225e-10
9.31386e-08
3.78398e-10
9.31166e-08
3.22416e-10
9.30934e-08
2.69761e-10
9.30694e-08
2.20808e-10
9.30453e-08
1.75809e-10
9.30212e-08
1.3489e-10
9.29978e-08
9.80622e-11
9.29752e-08
6.52405e-11
9.29537e-08
3.62686e-11
9.29334e-08
1.0939e-11
9.29146e-08
-1.09959e-11
9.28972e-08
-2.97901e-11
9.28812e-08
-4.57094e-11
9.28667e-08
-5.90102e-11
9.28535e-08
-6.99355e-11
9.28417e-08
-7.87117e-11
9.2831e-08
-8.5546e-11
9.28216e-08
-9.06258e-11
9.28131e-08
-9.41206e-11
9.28056e-08
-9.61841e-11
9.2799e-08
-9.69572e-11
9.27931e-08
-9.65705e-11
9.2788e-08
-9.51476e-11
9.27835e-08
-9.28075e-11
9.27796e-08
-8.96662e-11
9.27762e-08
-8.58385e-11
9.27733e-08
-8.14385e-11
9.27709e-08
-7.65798e-11
9.27688e-08
-7.13748e-11
9.27671e-08
-6.59333e-11
9.27657e-08
-6.03617e-11
9.27646e-08
-5.47605e-11
9.27637e-08
-4.92225e-11
9.27631e-08
-4.38315e-11
9.27627e-08
-3.86604e-11
9.27625e-08
-3.37697e-11
9.27623e-08
-2.92073e-11
9.27623e-08
-2.50076e-11
9.27624e-08
-2.11925e-11
9.27626e-08
-1.77715e-11
9.27627e-08
-1.47436e-11
9.27629e-08
-1.20984e-11
9.27631e-08
-9.81776e-12
9.27633e-08
-7.87787e-12
9.27635e-08
-6.25074e-12
9.27637e-08
-4.90606e-12
9.27638e-08
-3.81256e-12
9.27639e-08
-2.93917e-12
9.2764e-08
-2.25599e-12
9.27641e-08
-1.73525e-12
-1.35612e-12
1.01827e-07
1.86125e-09
-1.01775e-07
1.01891e-07
1.95721e-09
1.01965e-07
2.04582e-09
1.02047e-07
2.1253e-09
1.02133e-07
2.1942e-09
1.02222e-07
2.25151e-09
1.02309e-07
2.29677e-09
1.02394e-07
2.32994e-09
1.02474e-07
2.35135e-09
1.02547e-07
2.36165e-09
1.02613e-07
2.36171e-09
1.02672e-07
2.35257e-09
1.02722e-07
2.33534e-09
1.02765e-07
2.31117e-09
1.028e-07
2.28117e-09
1.02828e-07
2.24634e-09
1.0285e-07
2.20764e-09
1.02867e-07
2.16585e-09
1.0288e-07
2.12165e-09
1.02889e-07
2.07562e-09
1.02894e-07
2.02819e-09
1.02898e-07
1.9797e-09
1.02899e-07
1.93042e-09
1.02899e-07
1.88053e-09
1.02898e-07
1.83015e-09
1.02897e-07
1.77934e-09
1.02894e-07
1.72815e-09
1.02892e-07
1.67657e-09
1.0289e-07
1.62458e-09
1.02887e-07
1.57214e-09
1.02885e-07
1.51919e-09
1.02883e-07
1.46566e-09
1.02881e-07
1.41149e-09
1.02879e-07
1.35661e-09
1.02877e-07
1.30096e-09
1.02875e-07
1.24446e-09
1.02873e-07
1.18707e-09
1.02871e-07
1.12875e-09
1.02869e-07
1.06951e-09
1.02866e-07
1.00935e-09
1.02862e-07
9.48326e-10
1.02857e-07
8.86541e-10
1.02851e-07
8.24147e-10
1.02844e-07
7.61356e-10
1.02835e-07
6.98448e-10
1.02824e-07
6.35774e-10
1.02811e-07
5.73747e-10
1.02797e-07
5.12832e-10
1.0278e-07
4.53526e-10
1.02763e-07
3.96329e-10
1.02743e-07
3.41713e-10
1.02723e-07
2.90095e-10
1.02702e-07
2.41811e-10
1.02681e-07
1.97101e-10
1.02659e-07
1.56108e-10
1.02639e-07
1.18881e-10
1.02618e-07
8.53849e-11
1.02599e-07
5.55179e-11
1.02581e-07
2.91283e-11
1.02564e-07
6.02738e-12
1.02548e-07
-1.40021e-11
1.02534e-07
-3.11795e-11
1.0252e-07
-4.5729e-11
1.02508e-07
-5.78669e-11
1.02497e-07
-6.78012e-11
1.02488e-07
-7.57262e-11
1.02479e-07
-8.18214e-11
1.02471e-07
-8.62527e-11
1.02464e-07
-8.91735e-11
1.02458e-07
-9.07268e-11
1.02452e-07
-9.10474e-11
1.02447e-07
-9.02641e-11
1.02443e-07
-8.85015e-11
1.02439e-07
-8.58818e-11
1.02436e-07
-8.25257e-11
1.02433e-07
-7.8553e-11
1.0243e-07
-7.40819e-11
1.02428e-07
-6.92289e-11
1.02426e-07
-6.41074e-11
1.02425e-07
-5.8826e-11
1.02424e-07
-5.3487e-11
1.02423e-07
-4.81846e-11
1.02422e-07
-4.30032e-11
1.02421e-07
-3.80162e-11
1.02421e-07
-3.32848e-11
1.0242e-07
-2.88575e-11
1.0242e-07
-2.47697e-11
1.0242e-07
-2.10446e-11
1.0242e-07
-1.76937e-11
1.0242e-07
-1.47179e-11
1.0242e-07
-1.21091e-11
1.0242e-07
-9.85194e-12
1.0242e-07
-7.92504e-12
1.0242e-07
-6.30305e-12
1.0242e-07
-4.95808e-12
1.0242e-07
-3.86108e-12
1.0242e-07
-2.98292e-12
1.0242e-07
-2.29519e-12
1.0242e-07
-1.77027e-12
-1.38155e-12
1.12607e-07
1.82122e-09
-1.12567e-07
1.12656e-07
1.90842e-09
1.12712e-07
1.98952e-09
1.12774e-07
2.06316e-09
1.1284e-07
2.12813e-09
1.12908e-07
2.18351e-09
1.12977e-07
2.22872e-09
1.13043e-07
2.26355e-09
1.13106e-07
2.2881e-09
1.13165e-07
2.3027e-09
1.13219e-07
2.30791e-09
1.13267e-07
2.30446e-09
1.13309e-07
2.29317e-09
1.13345e-07
2.27493e-09
1.13376e-07
2.25063e-09
1.13401e-07
2.22114e-09
1.13422e-07
2.18728e-09
1.13438e-07
2.1498e-09
1.1345e-07
2.10934e-09
1.13459e-07
2.06647e-09
1.13466e-07
2.02166e-09
1.1347e-07
1.97531e-09
1.13473e-07
1.92773e-09
1.13474e-07
1.87914e-09
1.13474e-07
1.82974e-09
1.13474e-07
1.77964e-09
1.13473e-07
1.72893e-09
1.13472e-07
1.67765e-09
1.13471e-07
1.62583e-09
1.1347e-07
1.57346e-09
1.13468e-07
1.5205e-09
1.13467e-07
1.46694e-09
1.13466e-07
1.41272e-09
1.13465e-07
1.3578e-09
1.13464e-07
1.30214e-09
1.13462e-07
1.24569e-09
1.13461e-07
1.18844e-09
1.13459e-07
1.13036e-09
1.13457e-07
1.07147e-09
1.13455e-07
1.0118e-09
1.13452e-07
9.51424e-10
1.13448e-07
8.90455e-10
1.13443e-07
8.29047e-10
1.13437e-07
7.67408e-10
1.1343e-07
7.05802e-10
1.13421e-07
6.44545e-10
1.13411e-07
5.84003e-10
1.13399e-07
5.24581e-10
1.13386e-07
4.66705e-10
1.13371e-07
4.10805e-10
1.13356e-07
3.57288e-10
1.13339e-07
3.06519e-10
1.13322e-07
2.58803e-10
1.13305e-07
2.1437e-10
1.13288e-07
1.73371e-10
1.13271e-07
1.35877e-10
1.13254e-07
1.01889e-10
1.13238e-07
7.13468e-11
1.13223e-07
4.41404e-11
1.13209e-07
2.01235e-11
1.13196e-07
-8.77461e-13
1.13184e-07
-1.90677e-11
1.13173e-07
-3.46227e-11
1.13163e-07
-4.77429e-11
1.13154e-07
-5.86204e-11
1.13145e-07
-6.74366e-11
1.13138e-07
-7.43633e-11
1.13131e-07
-7.95621e-11
1.13125e-07
-8.3185e-11
1.1312e-07
-8.53759e-11
1.13115e-07
-8.62725e-11
1.13111e-07
-8.60074e-11
1.13107e-07
-8.471e-11
1.13104e-07
-8.25077e-11
1.13101e-07
-7.95264e-11
1.13098e-07
-7.58909e-11
1.13096e-07
-7.17242e-11
1.13094e-07
-6.71468e-11
1.13092e-07
-6.22755e-11
1.1309e-07
-5.72217e-11
1.13089e-07
-5.20897e-11
1.13087e-07
-4.69754e-11
1.13086e-07
-4.19641e-11
1.13086e-07
-3.71301e-11
1.13085e-07
-3.25349e-11
1.13084e-07
-2.82276e-11
1.13084e-07
-2.42443e-11
1.13083e-07
-2.06089e-11
1.13083e-07
-1.73338e-11
1.13083e-07
-1.44211e-11
1.13082e-07
-1.18641e-11
1.13082e-07
-9.64875e-12
1.13082e-07
-7.75536e-12
1.13082e-07
-6.16017e-12
1.13082e-07
-4.83691e-12
1.13082e-07
-3.75809e-12
1.13081e-07
-2.89616e-12
1.13081e-07
-2.22419e-12
1.13081e-07
-1.71607e-12
-1.34867e-12
1.24522e-07
1.79561e-09
-1.24496e-07
1.24553e-07
1.87722e-09
1.24589e-07
1.95347e-09
1.24629e-07
2.02321e-09
1.24672e-07
2.0854e-09
1.24716e-07
2.13918e-09
1.24761e-07
2.18398e-09
1.24805e-07
2.21949e-09
1.24847e-07
2.24568e-09
1.24887e-07
2.26271e-09
1.24924e-07
2.27095e-09
1.24958e-07
2.27095e-09
1.24987e-07
2.26333e-09
1.25014e-07
2.24883e-09
1.25036e-07
2.2282e-09
1.25055e-07
2.2022e-09
1.25071e-07
2.17156e-09
1.25083e-07
2.13698e-09
1.25094e-07
2.09907e-09
1.25102e-07
2.05841e-09
1.25108e-07
2.01547e-09
1.25113e-07
1.97066e-09
1.25116e-07
1.92432e-09
1.25118e-07
1.87672e-09
1.2512e-07
1.82807e-09
1.25121e-07
1.77855e-09
1.25122e-07
1.72825e-09
1.25122e-07
1.67726e-09
1.25123e-07
1.62562e-09
1.25123e-07
1.57336e-09
1.25123e-07
1.52046e-09
1.25123e-07
1.46693e-09
1.25123e-07
1.41273e-09
1.25123e-07
1.35783e-09
1.25123e-07
1.30221e-09
1.25122e-07
1.24585e-09
1.25122e-07
1.18874e-09
1.25122e-07
1.13086e-09
1.25121e-07
1.07226e-09
1.2512e-07
1.01298e-09
1.25118e-07
9.5309e-10
1.25116e-07
8.92719e-10
1.25113e-07
8.32022e-10
1.25109e-07
7.71202e-10
1.25104e-07
7.10509e-10
1.25099e-07
6.50238e-10
1.25092e-07
5.90723e-10
1.25084e-07
5.32329e-10
1.25075e-07
4.75439e-10
1.25066e-07
4.20436e-10
1.25055e-07
3.67686e-10
1.25044e-07
3.17523e-10
1.25033e-07
2.70227e-10
1.25021e-07
2.26019e-10
1.2501e-07
1.85054e-10
1.24998e-07
1.47417e-10
1.24987e-07
1.13131e-10
1.24976e-07
8.21593e-11
1.24966e-07
5.44208e-11
1.24956e-07
2.97987e-11
1.24947e-07
8.18155e-12
1.24939e-07
-1.07185e-11
1.24931e-07
-2.69475e-11
1.24924e-07
-4.07322e-11
1.24918e-07
-5.22462e-11
1.24912e-07
-6.16612e-11
1.24907e-07
-6.91424e-11
1.24902e-07
-7.48471e-11
1.24898e-07
-7.89257e-11
1.24894e-07
-8.15222e-11
1.2489e-07
-8.27761e-11
1.24887e-07
-8.28229e-11
1.24884e-07
-8.17962e-11
1.24881e-07
-7.98278e-11
1.24879e-07
-7.70487e-11
1.24877e-07
-7.35886e-11
1.24874e-07
-6.95755e-11
1.24872e-07
-6.51346e-11
1.24871e-07
-6.03867e-11
1.24869e-07
-5.5447e-11
1.24867e-07
-5.04227e-11
1.24866e-07
-4.54119e-11
1.24864e-07
-4.05015e-11
1.24863e-07
-3.57666e-11
1.24861e-07
-3.12693e-11
1.2486e-07
-2.70585e-11
1.24859e-07
-2.31702e-11
1.24858e-07
-1.96275e-11
1.24857e-07
-1.64423e-11
1.24857e-07
-1.3616e-11
1.24856e-07
-1.11413e-11
1.24855e-07
-9.00373e-12
1.24855e-07
-7.18321e-12
1.24854e-07
-5.65589e-12
1.24854e-07
-4.39558e-12
1.24853e-07
-3.37517e-12
1.24853e-07
-2.56781e-12
1.24853e-07
-1.9476e-12
1.24852e-07
-1.48844e-12
-1.1545e-12
1.37681e-07
-1.37673e-07
1.37691e-07
1.37702e-07
1.37716e-07
1.37731e-07
1.37747e-07
1.37764e-07
1.37781e-07
1.37797e-07
1.37814e-07
1.37829e-07
1.37844e-07
1.37857e-07
1.37869e-07
1.37881e-07
1.37891e-07
1.379e-07
1.37908e-07
1.37915e-07
1.37921e-07
1.37926e-07
1.37931e-07
1.37935e-07
1.37939e-07
1.37943e-07
1.37946e-07
1.37949e-07
1.37952e-07
1.37955e-07
1.37957e-07
1.3796e-07
1.37962e-07
1.37965e-07
1.37967e-07
1.37969e-07
1.37972e-07
1.37974e-07
1.37975e-07
1.37977e-07
1.37979e-07
1.3798e-07
1.37981e-07
1.37981e-07
1.37981e-07
1.37981e-07
1.3798e-07
1.37979e-07
1.37977e-07
1.37975e-07
1.37972e-07
1.37969e-07
1.37965e-07
1.37962e-07
1.37958e-07
1.37954e-07
1.37949e-07
1.37945e-07
1.37941e-07
1.37937e-07
1.37933e-07
1.3793e-07
1.37926e-07
1.37923e-07
1.3792e-07
1.37917e-07
1.37915e-07
1.37912e-07
1.37909e-07
1.37907e-07
1.37905e-07
1.37903e-07
1.379e-07
1.37898e-07
1.37896e-07
1.37893e-07
1.37891e-07
1.37889e-07
1.37886e-07
1.37884e-07
1.37882e-07
1.37879e-07
1.37877e-07
1.37874e-07
1.37872e-07
1.3787e-07
1.37868e-07
1.37866e-07
1.37864e-07
1.37862e-07
1.3786e-07
1.37858e-07
1.37857e-07
1.37856e-07
1.37854e-07
1.37853e-07
1.37852e-07
1.37852e-07
1.37851e-07
1.3785e-07
3.44588e-08
5.08848e-12
3.44535e-08
1.09929e-11
3.44459e-08
1.77749e-11
3.4436e-08
2.54602e-11
3.44236e-08
3.40996e-11
3.44086e-08
4.37635e-11
3.43908e-08
5.45381e-11
3.437e-08
6.65228e-11
3.43459e-08
7.98327e-11
3.43182e-08
9.46045e-11
3.42864e-08
1.11006e-10
3.42501e-08
1.2925e-10
3.42087e-08
1.49615e-10
3.41614e-08
1.72479e-10
3.41073e-08
1.98369e-10
3.40451e-08
2.28044e-10
3.39731e-08
2.62638e-10
3.38886e-08
3.03913e-10
3.37877e-08
3.54754e-10
3.36641e-08
4.20223e-10
3.35064e-08
5.10074e-10
3.32921e-08
6.45723e-10
3.29683e-08
8.83985e-10
3.23695e-08
1.43154e-09
3.05526e-09
3.80456e-08
8.15129e-12
3.80399e-08
1.67039e-11
3.80316e-08
2.60728e-11
3.80207e-08
3.63607e-11
3.80071e-08
4.76899e-11
3.79907e-08
6.01969e-11
3.79712e-08
7.4024e-11
3.79484e-08
8.93205e-11
3.7922e-08
1.06252e-10
3.78916e-08
1.25012e-10
3.78568e-08
1.45834e-10
3.7817e-08
1.69017e-10
3.77717e-08
1.94951e-10
3.772e-08
2.24171e-10
3.76609e-08
2.57427e-10
3.75932e-08
2.95808e-10
3.75149e-08
3.40948e-10
3.74234e-08
3.95389e-10
3.73148e-08
4.63295e-10
3.71832e-08
5.51905e-10
3.70184e-08
6.74846e-10
3.68037e-08
8.60402e-10
3.6514e-08
1.17371e-09
3.6169e-08
1.77652e-09
3.02033e-09
4.20059e-08
1.14365e-11
4.19997e-08
2.29198e-11
4.19906e-08
3.51117e-11
4.19788e-08
4.82459e-11
4.19639e-08
6.25183e-11
4.1946e-08
7.81338e-11
4.19247e-08
9.52944e-11
4.18998e-08
1.14204e-10
4.1871e-08
1.35082e-10
4.18378e-08
1.58181e-10
4.17999e-08
1.83803e-10
4.17566e-08
2.12333e-10
4.17072e-08
2.44277e-10
4.16511e-08
2.80321e-10
4.15871e-08
3.21436e-10
4.15139e-08
3.69021e-10
4.14296e-08
4.25166e-10
4.13319e-08
4.93091e-10
4.12173e-08
5.77973e-10
4.10806e-08
6.88529e-10
4.09152e-08
8.4025e-10
4.07135e-08
1.0621e-09
4.0478e-08
1.40924e-09
4.02762e-08
1.97834e-09
2.88474e-09
4.63784e-08
1.49616e-11
4.63716e-08
2.96521e-11
4.63618e-08
4.49173e-11
4.63489e-08
6.11489e-11
4.63328e-08
7.86259e-11
4.63133e-08
9.7623e-11
4.62902e-08
1.18405e-10
4.62632e-08
1.41235e-10
4.62319e-08
1.66388e-10
4.61959e-08
1.94176e-10
4.61547e-08
2.2497e-10
4.61078e-08
2.59239e-10
4.60545e-08
2.97596e-10
4.5994e-08
3.40873e-10
4.59252e-08
3.90231e-10
4.58468e-08
4.47337e-10
4.57574e-08
5.14641e-10
4.56546e-08
5.95845e-10
4.55359e-08
6.9671e-10
4.53979e-08
8.26462e-10
4.5238e-08
1.00024e-09
4.50571e-08
1.24291e-09
4.48733e-08
1.59305e-09
4.47538e-08
2.09788e-09
2.77148e-09
5.1206e-08
1.87337e-11
5.11987e-08
3.69024e-11
5.11882e-08
5.54993e-11
5.11742e-08
7.50838e-11
5.11568e-08
9.60298e-11
5.11358e-08
1.18684e-10
5.11108e-08
1.43378e-10
5.10816e-08
1.70433e-10
5.10478e-08
2.00183e-10
5.1009e-08
2.32997e-10
5.09646e-08
2.69312e-10
5.09142e-08
3.09674e-10
5.0857e-08
3.54788e-10
5.07923e-08
4.05604e-10
5.07191e-08
4.63433e-10
5.06363e-08
5.30125e-10
5.05426e-08
6.08344e-10
5.04364e-08
7.01994e-10
5.03163e-08
8.1688e-10
5.0181e-08
9.6171e-10
5.00318e-08
1.14943e-09
4.98764e-08
1.39839e-09
4.97384e-08
1.731e-09
4.96729e-08
2.16336e-09
2.67433e-09
5.65362e-08
2.27517e-11
5.65284e-08
4.46585e-11
5.65171e-08
6.68436e-11
5.65021e-08
9.00331e-11
5.64834e-08
1.14707e-10
5.64608e-08
1.41288e-10
5.6434e-08
1.70173e-10
5.64027e-08
2.01745e-10
5.63665e-08
2.36393e-10
5.6325e-08
2.74542e-10
5.62776e-08
3.16684e-10
5.62238e-08
3.63427e-10
5.61631e-08
4.15543e-10
5.60946e-08
4.74061e-10
5.60177e-08
5.40373e-10
5.59314e-08
6.16398e-10
5.58349e-08
7.04822e-10
5.57275e-08
8.09417e-10
5.56089e-08
9.35484e-10
5.54803e-08
1.09035e-09
5.5346e-08
1.28368e-09
5.52175e-08
1.52693e-09
5.51185e-08
1.82999e-09
5.50896e-08
2.19226e-09
2.58556e-09
6.24212e-08
2.70023e-11
6.24129e-08
5.28866e-11
6.24009e-08
7.89001e-11
6.2385e-08
1.05932e-10
6.23651e-08
1.34575e-10
6.23411e-08
1.65331e-10
6.23126e-08
1.98663e-10
6.22793e-08
2.35013e-10
6.22409e-08
2.74823e-10
6.21969e-08
3.18562e-10
6.21468e-08
3.66767e-10
6.20901e-08
4.2008e-10
6.20264e-08
4.7931e-10
6.19549e-08
5.45504e-10
6.18752e-08
6.20044e-10
6.17869e-08
7.04785e-10
6.16895e-08
8.02212e-10
6.15832e-08
9.15644e-10
6.14693e-08
1.04941e-09
6.13507e-08
1.20893e-09
6.12341e-08
1.40034e-09
6.11318e-08
1.62916e-09
6.10647e-08
1.89712e-09
6.10606e-08
2.19632e-09
2.50164e-09
6.89188e-08
3.14546e-11
6.89102e-08
6.15196e-11
6.88975e-08
9.1569e-11
6.88808e-08
1.22649e-10
6.88599e-08
1.55468e-10
6.88346e-08
1.90608e-10
6.88047e-08
2.28599e-10
6.87697e-08
2.69937e-10
6.87295e-08
3.15107e-10
6.86834e-08
3.64613e-10
6.86312e-08
4.19012e-10
6.85723e-08
4.78955e-10
6.85064e-08
5.45236e-10
6.8433e-08
6.1885e-10
6.8352e-08
7.0107e-10
6.82632e-08
7.93533e-10
6.81671e-08
8.98322e-10
6.80647e-08
1.01803e-09
6.79584e-08
1.15575e-09
6.78525e-08
1.31482e-09
6.77546e-08
1.49821e-09
6.76766e-08
1.70717e-09
6.76348e-08
1.93891e-09
6.76476e-08
2.18358e-09
2.42157e-09
6.89191e-08
3.5637e-11
6.89109e-08
6.963e-11
6.8899e-08
1.03486e-10
6.88833e-08
1.38382e-10
6.88636e-08
1.75131e-10
6.88399e-08
2.1439e-10
6.88117e-08
2.56744e-10
6.87789e-08
3.02733e-10
6.87411e-08
3.52874e-10
6.86981e-08
4.07686e-10
6.86494e-08
4.67723e-10
6.85947e-08
5.33611e-10
6.85339e-08
6.06082e-10
6.84667e-08
6.86022e-10
6.83932e-08
7.74513e-10
6.83139e-08
8.72878e-10
6.82295e-08
9.82695e-10
6.81418e-08
1.10577e-09
6.80536e-08
1.24398e-09
6.79694e-08
1.39895e-09
6.78963e-08
1.57138e-09
6.78434e-08
1.76001e-09
6.78222e-08
1.96019e-09
6.78432e-08
2.16254e-09
2.35234e-09
7.60931e-08
3.99147e-11
7.60848e-08
7.79273e-11
7.60727e-08
1.15684e-10
7.60565e-08
1.54492e-10
7.60364e-08
1.95264e-10
7.60121e-08
2.38728e-10
7.59833e-08
2.85522e-10
7.59498e-08
3.36224e-10
7.59113e-08
3.91369e-10
7.58675e-08
4.51473e-10
7.58182e-08
5.17066e-10
7.57631e-08
5.8871e-10
7.57021e-08
6.6703e-10
7.56354e-08
7.52738e-10
7.55633e-08
8.46647e-10
7.54865e-08
9.49676e-10
7.54064e-08
1.06281e-09
7.53251e-08
1.18703e-09
7.5246e-08
1.32306e-09
7.51739e-08
1.4711e-09
7.5115e-08
1.63025e-09
7.50771e-08
1.79788e-09
7.50684e-08
1.96888e-09
7.50957e-08
2.13529e-09
2.2865e-09
8.40141e-08
4.41908e-11
8.40058e-08
8.62193e-11
8.39936e-08
1.27879e-10
8.39775e-08
1.706e-10
8.39574e-08
2.1539e-10
8.39331e-08
2.63044e-10
8.39043e-08
3.14247e-10
8.3871e-08
3.69603e-10
8.38327e-08
4.29653e-10
8.37892e-08
4.94893e-10
8.37405e-08
5.658e-10
8.36864e-08
6.4284e-10
8.36269e-08
7.26487e-10
8.35624e-08
8.17226e-10
8.34935e-08
9.15544e-10
8.34213e-08
1.0219e-09
8.33474e-08
1.13668e-09
8.32744e-08
1.26005e-09
8.32057e-08
1.3918e-09
8.31457e-08
1.53105e-09
8.31e-08
1.67597e-09
8.30746e-08
1.82334e-09
8.3075e-08
1.96842e-09
8.31054e-08
2.10489e-09
2.22537e-09
9.27597e-08
4.83253e-11
9.27517e-08
9.42309e-11
9.27399e-08
1.39663e-10
9.27243e-08
1.86166e-10
9.27049e-08
2.34834e-10
9.26814e-08
2.8652e-10
9.26537e-08
3.41949e-10
9.26215e-08
4.01742e-10
9.25848e-08
4.6643e-10
9.25432e-08
5.36473e-10
9.24967e-08
6.12271e-10
9.24454e-08
6.94167e-10
9.23894e-08
7.82452e-10
9.23293e-08
8.77349e-10
9.22659e-08
9.78993e-10
9.22004e-08
1.08739e-09
9.21347e-08
1.20234e-09
9.20714e-08
1.32334e-09
9.20138e-08
1.44945e-09
9.19657e-08
1.57913e-09
9.19316e-08
1.71006e-09
9.19159e-08
1.83903e-09
9.19224e-08
1.96197e-09
9.19531e-08
2.07412e-09
2.17046e-09
1.02416e-07
5.21243e-11
1.02408e-07
1.01582e-10
1.02398e-07
1.50475e-10
1.02383e-07
2.00448e-10
1.02365e-07
2.52667e-10
1.02344e-07
3.08037e-10
1.02319e-07
3.67312e-10
1.02289e-07
4.31119e-10
1.02256e-07
4.9997e-10
1.02218e-07
5.74275e-10
1.02176e-07
6.54342e-10
1.0213e-07
7.40377e-10
1.0208e-07
8.32474e-10
1.02026e-07
9.30591e-10
1.01971e-07
1.03452e-09
1.01914e-07
1.14385e-09
1.01859e-07
1.2579e-09
1.01806e-07
1.37565e-09
1.0176e-07
1.49567e-09
1.01723e-07
1.61605e-09
1.01699e-07
1.73435e-09
1.0169e-07
1.84763e-09
1.017e-07
1.95256e-09
1.01728e-07
2.04565e-09
2.12352e-09
1.13077e-07
5.53259e-11
1.13071e-07
1.07764e-10
1.13062e-07
1.59565e-10
1.1305e-07
2.12453e-10
1.13035e-07
2.67654e-10
1.13017e-07
3.26112e-10
1.12996e-07
3.88598e-10
1.12971e-07
4.5574e-10
1.12943e-07
5.28026e-10
1.12911e-07
6.0581e-10
1.12876e-07
6.89311e-10
1.12838e-07
7.78602e-10
1.12797e-07
8.73595e-10
1.12754e-07
9.7401e-10
1.12709e-07
1.07935e-09
1.12664e-07
1.18887e-09
1.1262e-07
1.30152e-09
1.1258e-07
1.41593e-09
1.12545e-07
1.53039e-09
1.12518e-07
1.64281e-09
1.12502e-07
1.75084e-09
1.12498e-07
1.85185e-09
1.12507e-07
1.94317e-09
1.1253e-07
2.02225e-09
2.08679e-09
1.24849e-07
5.75866e-11
1.24844e-07
1.12113e-10
1.24838e-07
1.65957e-10
1.24829e-07
2.20897e-10
1.24819e-07
2.78197e-10
1.24806e-07
3.38825e-10
1.24791e-07
4.03568e-10
1.24774e-07
4.73047e-10
1.24754e-07
5.4773e-10
1.24732e-07
6.27927e-10
1.24708e-07
7.13787e-10
1.24681e-07
8.05282e-10
1.24652e-07
9.02188e-10
1.24622e-07
1.00406e-09
1.24591e-07
1.11019e-09
1.24561e-07
1.21961e-09
1.24531e-07
1.33104e-09
1.24504e-07
1.44291e-09
1.24481e-07
1.55335e-09
1.24464e-07
1.66026e-09
1.24453e-07
1.76134e-09
1.24451e-07
1.85428e-09
1.24457e-07
1.93683e-09
1.24472e-07
2.00699e-09
2.06312e-09
1.37846e-07
1.37844e-07
1.37841e-07
1.37838e-07
1.37834e-07
1.37828e-07
1.37822e-07
1.37815e-07
1.37807e-07
1.37798e-07
1.37787e-07
1.37776e-07
1.37763e-07
1.3775e-07
1.37737e-07
1.37723e-07
1.37709e-07
1.37696e-07
1.37685e-07
1.37676e-07
1.37669e-07
1.37665e-07
1.37664e-07
1.37667e-07
)
;
boundaryField
{
top
{
type calculated;
value nonuniform List<scalar>
125
(
1.78807e-09
1.86747e-09
1.94166e-09
2.00962e-09
2.07038e-09
2.12314e-09
2.16733e-09
2.20263e-09
2.22897e-09
2.24647e-09
2.25545e-09
2.25637e-09
2.24982e-09
2.23647e-09
2.21701e-09
2.19216e-09
2.16262e-09
2.12906e-09
2.09208e-09
2.05224e-09
2.01002e-09
1.96582e-09
1.91999e-09
1.87282e-09
1.82453e-09
1.77528e-09
1.7252e-09
1.67438e-09
1.62288e-09
1.57072e-09
1.51792e-09
1.46445e-09
1.41032e-09
1.3555e-09
1.29996e-09
1.2437e-09
1.1867e-09
1.12898e-09
1.07056e-09
1.0115e-09
9.51878e-10
8.91821e-10
8.31487e-10
7.71075e-10
7.10831e-10
6.51041e-10
5.92025e-10
5.34135e-10
4.77734e-10
4.23188e-10
3.70848e-10
3.21032e-10
2.74011e-10
2.30002e-10
1.89158e-10
1.5157e-10
1.17268e-10
8.6225e-11
5.8371e-11
3.35983e-11
1.17703e-11
-7.2879e-12
-2.37124e-11
-3.76809e-11
-4.93674e-11
-5.89385e-11
-6.65553e-11
-7.23729e-11
-7.65406e-11
-7.92027e-11
-8.04993e-11
-8.05682e-11
-7.95454e-11
-7.75663e-11
-7.47656e-11
-7.12771e-11
-6.72332e-11
-6.27633e-11
-5.79924e-11
-5.3039e-11
-4.80134e-11
-4.3016e-11
-3.81352e-11
-3.34469e-11
-2.90132e-11
-2.4882e-11
-2.10879e-11
-1.76522e-11
-1.45842e-11
-1.1883e-11
-9.53843e-12
-7.53343e-12
-5.84552e-12
-4.44867e-12
-3.31493e-12
-2.41611e-12
-1.72556e-12
-1.22071e-12
-8.89448e-13
-7.55751e-13
5.84836e-11
1.13836e-10
1.68508e-10
2.24295e-10
2.82473e-10
3.44022e-10
4.09734e-10
4.80231e-10
5.55971e-10
6.3725e-10
7.24187e-10
8.16715e-10
9.14554e-10
1.01719e-09
1.12384e-09
1.23343e-09
1.3446e-09
1.45568e-09
1.56475e-09
1.66969e-09
1.76824e-09
1.85817e-09
1.93738e-09
2.00411e-09
2.05692e-09
)
;
}
inlet
{
type calculated;
value nonuniform List<scalar>
16
(
-6.89232e-08
-7.60974e-08
-8.40184e-08
-9.27638e-08
-1.0242e-07
-1.1308e-07
-1.24851e-07
-1.37846e-07
-3.44616e-08
-3.80487e-08
-4.20092e-08
-4.63819e-08
-5.12098e-08
-5.65402e-08
-6.24254e-08
-6.89232e-08
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
16
(
6.88539e-08
7.60847e-08
8.4017e-08
9.27642e-08
1.0242e-07
1.13081e-07
1.24852e-07
1.3785e-07
3.78604e-09
1.2641e-08
2.2983e-08
3.38784e-08
4.42367e-08
5.33519e-08
6.12673e-08
6.85987e-08
)
;
}
plate
{
type calculated;
value uniform 0;
}
symmBound
{
type calculated;
value nonuniform List<scalar>
25
(
-2.24873e-12
-5.74943e-12
-1.01883e-11
-1.55102e-11
-2.17001e-11
-2.8773e-11
-3.67648e-11
-4.57282e-11
-5.57311e-11
-6.68579e-11
-7.9214e-11
-9.29319e-11
-1.08183e-10
-1.25194e-10
-1.44276e-10
-1.65864e-10
-1.90595e-10
-2.1943e-10
-2.53901e-10
-2.96607e-10
-3.52378e-10
-4.31436e-10
-5.60174e-10
-8.32765e-10
-1.61158e-09
)
;
}
frontAndBack
{
type empty;
value nonuniform 0();
}
}
// ************************************************************************* //
| |
06182bd4e66bb69120d917188194acb9eb0d9845 | 9fcffeb6c8427f1fd61a1d5d792774f881371ae2 | /EssentialCPP/chapter2/2.3.cpp | 762e6bf8e8b2be2d5c02f0dbaba518e55b2ff584 | [] | no_license | leicj/books | e5b5ab8bdda7e67b0105a144c4c21f98cb833f7c | 1f3dcabd53aac3663d8bd5482fcd433d022c09d3 | refs/heads/master | 2020-12-25T15:29:45.797631 | 2016-07-30T05:01:28 | 2016-07-30T05:01:28 | 34,327,167 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 591 | cpp | 2.3.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
int isOk(int n)
{
return (0 < n && n < 1024);
}
void pen(vector<int> &ivec, int n)
{
if (!isOk(n)) {
return;
}
for (int i = 0; i < n; i++) {
ivec.push_back(i * (3 * i - 1) / 2);
}
}
template <typename T>
void print(const vector<T> &vec, const string &type)
{
for (int i = 0; i < vec.size(); i++) {
cout << vec[i] << ' ';
}
cout << endl;
}
int main(void)
{
vector<int> ivec;
pen(ivec, 6);
print(ivec, "int");
return 0;
}
|
0624682397c34e5f3343dcf393f813648cfeab80 | 28c000caf6617ba2074e0f2a8fc936ccb8c01fb3 | /poj/2257/6184032_AC_0MS_180K.cpp | 95cfe2b3f4b7de99379c2ae60cf6e301422cdf6c | [] | no_license | ATM006/acm_problem_code | f597fa31033fd663b14d74ad94cae3f7c1629b99 | ac40d230cd450bcce60df801eb3b8ce9409dfaac | refs/heads/master | 2020-08-31T21:34:00.707529 | 2014-01-23T05:30:42 | 2014-01-23T05:30:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,535 | cpp | 6184032_AC_0MS_180K.cpp | #include <map>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int n,t;
char name[21][12];
struct node{
int id;
int wi;
bool operator <(const node a)const
{
return a.wi>wi;
}
}nod[21];
int main()
{
int nca=0;
while(scanf("%d%d",&n,&t),n||t)
{
nca++;
map<string,int>mp;
map<string,int>::iterator p;
for(int i=0;i<n;i++)
{
scanf("%s",name[i]);
mp[name[i]]=i;nod[i].id=i;nod[i].wi=0;
}
for(int i=0;i<t;i++)
{
int d;
char name1[12],name2[12];
scanf("%s%s%d",name1,name2,&d);
p=mp.find(name1);
nod[p->second].wi+=d;
p=mp.find(name2);
nod[p->second].wi-=d;
}
sort(nod,nod+n);
//for(int i=0;i<n;i++)
// printf("%d %d\n",nod[i].id,nod[i].wi);
printf("Case #%d\n",nca);
int u=nod[0].id;
for(int i=1;i<n;i++)
{
if(nod[i].wi<0)
{
int v=nod[i].id;
printf("%s %s %d\n",name[v],name[u],-nod[i].wi);
nod[0].wi+=nod[i].wi;
nod[i].wi=0;
}
}
for(int i=1;i<=n;i++)
{
int v=nod[i].id;
if(nod[i].wi>0)
printf("%s %s %d\n",name[u],name[v],nod[i].wi);
}
puts("");
}
return 0;
}
|
6f3516fd1aab8f5dbd51aee4f335486b0702ccb5 | c917ce9cf68b2b4e018657fd4bfb0dd5fd5587d3 | /driver_customhmd/ServerDriver.cpp | 4705b49ae77273f41790efcb4c014e193add246f | [] | no_license | zodsoft/openvr-customhmd | 31b1ad578919470844a44c6f4f0d4de3f019d144 | eb5fa5bd3ae413a259f4194b80331da61ad82819 | refs/heads/master | 2021-01-14T13:47:30.460690 | 2016-09-01T23:31:58 | 2016-09-01T23:31:58 | 67,395,300 | 1 | 0 | null | 2016-09-05T06:49:53 | 2016-09-05T06:49:53 | null | UTF-8 | C++ | false | false | 7,281 | cpp | ServerDriver.cpp | #include "ServerDriver.h"
#include "TrackedHMD.h"
#include "TrackedController.h"
#include <process.h>
EVRInitError CServerDriver::Init(IDriverLog * pDriverLog, IServerDriverHost * pDriverHost, const char * pchUserDriverConfigDir, const char * pchDriverInstallDir)
{
timeBeginPeriod(1);
m_CurrTick = m_LastTick = GetTickCount();
m_pLog = new CDriverLog(pDriverLog);
_LOG(__FUNCTION__" start");
m_pDriverHost = pDriverHost;
m_UserDriverConfigDir = pchUserDriverConfigDir;
m_DriverInstallDir = pchDriverInstallDir;
m_HMDAdded = m_RightCtlAdded = m_LeftCtlAdded = false;
m_pSettings = pDriverHost ? pDriverHost->GetSettings(IVRSettings_Version) : nullptr;
m_Align = { 0 };
m_Relative = { 0 };
if (m_pSettings)
{
m_Align.v[0] = m_pSettings->GetFloat("driver_customhmd", "eoX", 0.0f);
m_Align.v[1] = m_pSettings->GetFloat("driver_customhmd", "eoY", 0.0f);
m_Align.v[2] = m_pSettings->GetFloat("driver_customhmd", "eoZ", 0.0f);
}
m_TrackedDevices.push_back(new CTrackedHMD("HMD", this)); //only add hmd
//m_TrackedDevices.push_back(new CTrackedController(TrackedControllerRole_RightHand, "RIGHT CONTROLLER", this));
//m_TrackedDevices.push_back(new CTrackedController(TrackedControllerRole_LeftHand, "LEFT CONTROLLER", this));
m_hThread = nullptr;
m_IsRunning = false;
m_hThread = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, ProcessThread, this, CREATE_SUSPENDED, nullptr));
if (m_hThread)
{
m_IsRunning = true;
ResumeThread(m_hThread);
}
_LOG(__FUNCTION__" end");
return VRInitError_None;
}
void CServerDriver::Cleanup()
{
m_IsRunning = false;
if (m_hThread)
{
WaitForSingleObject(m_hThread, INFINITE);
CloseHandle(m_hThread);
m_hThread = nullptr;
}
_LOG(__FUNCTION__);
for (auto iter = m_TrackedDevices.begin(); iter != m_TrackedDevices.end(); iter++)
delete (*iter);
m_TrackedDevices.clear();
m_pDriverHost = nullptr;
m_UserDriverConfigDir.clear();
m_DriverInstallDir.clear();
delete m_pLog;
m_pLog = nullptr;
timeEndPeriod(1);
}
unsigned int WINAPI CServerDriver::ProcessThread(void *p)
{
auto serverDriver = static_cast<CServerDriver *>(p);
if (serverDriver)
serverDriver->Run();
_endthreadex(0);
return 0;
}
void CServerDriver::OpenUSB(hid_device **ppHandle)
{
CloseUSB(ppHandle);
hid_device *handle = hid_open(0x1974, 0x0001, nullptr);
if (!handle)
return;
*ppHandle = handle;
hid_set_nonblocking(handle, 1);
}
void CServerDriver::CloseUSB(hid_device **ppHandle)
{
if (!ppHandle || !*ppHandle)
return;
hid_close(*ppHandle);
*ppHandle = nullptr;
}
void CServerDriver::SendUSBCommand(USBPacket &command)
{
m_CommandQueue.push_back(command);
}
void CServerDriver::ScanSyncReceived(uint64_t syncTime)
{
_LOG(__FUNCTION__" sync @ %I64u" , syncTime);
}
void CServerDriver::RemoveTrackedDevice(CTrackedDevice *pDevice)
{
for (auto iter = m_TrackedDevices.begin(); iter != m_TrackedDevices.end(); iter++)
{
if (*iter == pDevice)
{
delete (*iter);
return;
}
}
}
void CServerDriver::Run()
{
int pos = 0;
int res;
hid_init();
long count = 0;
unsigned char buf[33] = { 0 };
struct USBPacket *pUSBPacket = (struct USBPacket *)buf;
hid_device *pHandle = nullptr;
DWORD lastTick = GetTickCount();
while (m_IsRunning)
{
//pOverlayManager->HandleEvents();
if (!pHandle)
{
OpenUSB(&pHandle);
lastTick = GetTickCount();
if (!pHandle)
{
//MessageBox(nullptr, L"No USB", L"Info", 0);
Sleep(1000);
continue;
}
}
else
{
if (m_CommandQueue.size() > 0)
{
buf[0] = 0x00;
*((USBPacket*)(buf + 1)) = m_CommandQueue.front();;
m_CommandQueue.pop_front();
res = hid_write(pHandle, buf, sizeof(buf));
}
res = hid_read_timeout(pHandle, buf, sizeof(buf), 10);
if (res > 0)
{
lastTick = GetTickCount();
//auto crcTemp = pUSBPacket->Header.Crc8;
//pUSBPacket->Header.Crc8 = 0;
//uint8_t* data = (uint8_t*)pUSBPacket;
//uint8_t crc = 0;
//for (int i = 0; i<sizeof(USBPacket); i++)
// crc ^= data[i];
//if (crc == crcTemp)
if (CheckPacketCrc(pUSBPacket))
{
switch (pUSBPacket->Header.Type & 0x0F)
{
case BASESTATION_SOURCE:
if ((pUSBPacket->Header.Type & 0xF0) == COMMAND_DATA)
ScanSyncReceived(pUSBPacket->Command.Data.Sync.SyncTime);
break;
case LEFTCTL_SOURCE:
if (!m_LeftCtlAdded)
{
m_LeftCtlAdded = true;
m_TrackedDevices.push_back(new CTrackedController(TrackedControllerRole_LeftHand, "LEFT CONTROLLER", this));
}
break;
case RIGHTCTL_SOURCE:
if (!m_RightCtlAdded)
{
m_RightCtlAdded = true;
m_TrackedDevices.push_back(new CTrackedController(TrackedControllerRole_RightHand, "RIGHT CONTROLLER", this));
}
break;
}
for (auto iter = m_TrackedDevices.begin(); iter != m_TrackedDevices.end(); iter++)
(*iter)->PoseUpdate(pUSBPacket, &m_Align, &m_Relative);
}
}
else if (res < 0)
{
//usb fucked up?
//MessageBox(nullptr, L"Disco", L"Info", 0);
CloseUSB(&pHandle);
Sleep(1000);
}
else
{
if (GetTickCount() - lastTick >= 5000)
{
CloseUSB(&pHandle);
Sleep(1000);
}
}
Sleep(1);
}
//m_pDriverHost->TrackedDevicePoseUpdated(m_unObjectId, m_HMDData.Pose);
}
CloseUSB(&pHandle);
hid_exit();
}
uint32_t CServerDriver::GetTrackedDeviceCount()
{
_LOG(__FUNCTION__" returns %d", m_TrackedDevices.size());
return (uint32_t)m_TrackedDevices.size();
}
ITrackedDeviceServerDriver * CServerDriver::GetTrackedDeviceDriver(uint32_t unWhich)
{
_LOG(__FUNCTION__" idx: %d", unWhich);
//if (0 != _stricmp(pchInterfaceVersion, ITrackedDeviceServerDriver_Version))
// return nullptr;
if (unWhich >= m_TrackedDevices.size())
return nullptr;
return m_TrackedDevices.at(unWhich);
}
ITrackedDeviceServerDriver * CServerDriver::FindTrackedDeviceDriver(const char * pchId)
{
_LOG(__FUNCTION__" id: %s", pchId);
for (auto iter = m_TrackedDevices.begin(); iter != m_TrackedDevices.end(); iter++)
{
if (0 == std::strcmp(pchId, (*iter)->Prop_SerialNumber.c_str()))
{
return *iter;
}
}
return nullptr;
}
void CServerDriver::RunFrame()
{
DWORD currTick = GetTickCount();
for (auto iter = m_TrackedDevices.begin(); iter != m_TrackedDevices.end(); iter++)
(*iter)->RunFrame(currTick);
}
bool CServerDriver::ShouldBlockStandbyMode()
{
_LOG(__FUNCTION__);
return false;
}
void CServerDriver::EnterStandby()
{
_LOG(__FUNCTION__);
}
void CServerDriver::LeaveStandby()
{
_LOG(__FUNCTION__);
}
const char * const * CServerDriver::GetInterfaceVersions()
{
return k_InterfaceVersions;
}
void CServerDriver::AlignHMD(HmdVector3d_t *pAlign)
{
m_Align = *pAlign;
if (m_pSettings)
{
m_pSettings->SetFloat("driver_customhmd", "eoX", (float)m_Align.v[0]);
m_pSettings->SetFloat("driver_customhmd", "eoY", (float)m_Align.v[1]);
m_pSettings->SetFloat("driver_customhmd", "eoZ", (float)m_Align.v[2]);
m_pSettings->Sync(true);
}
} |
897aa9966683528b7eff0c84a985805888b8f6c8 | 842fc3ea5d387406fd07f1466f6253fd30da32e4 | /11.cpp | 237d6ad7e1ac8244ec6f996028995f07381d8a96 | [] | no_license | alex49knight/assignment-3 | d15d14f136822d1e7101d32970cc7bee2ea1e146 | dd996a52895fad0de3538d9bf01eb0b1a54be7ef | refs/heads/master | 2021-01-23T10:22:12.895839 | 2017-09-15T15:32:44 | 2017-09-15T15:32:44 | 102,612,441 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 397 | cpp | 11.cpp | #include<iostream>
using namespace std;
main () {
int a;
cout<<"week number "<<endl;
cin>> a;
if(a==1){
cout<<"sunday "<<endl;
}else if
(a==2){
cout<<"monday"<<endl;
}else if(a==3)
{cout<<"tuesday"<<endl;
}else if (a==4){
cout<<"wednesday"<<endl;
}else if(a==5){
cout<<"thursday"<<endl;}
else if(a==6){
cout<<"friday"<<endl;
}else if(a==7){
cout<<"saturday"<<endl;
}else{
cout<<"not valid ";
}
}
|
6cfa2028cc5cbb2e27ff9e3ec0bf1a490028dc9e | ce20d0de4822644e2a553d33cfa5d1ba21d2ee5e | /aoj/1186.cpp | 97d58325f3f792729bf3565040252c3cd2c29cee | [] | no_license | yana87gt/procon | 08bfc87756d43a7cac9d61fad271880c421e4aca | 3f420f0b242f3e9108c780ca37288696e09522eb | refs/heads/master | 2023-08-31T01:50:13.592343 | 2023-08-26T17:11:02 | 2023-08-26T17:11:02 | 92,819,190 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 615 | cpp | 1186.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int h,w,D;
while(cin>>h>>w, h|w){
bool notFound=true;
for(D=h*h+w*w; notFound; h=0,++D){
/*高さを1ずつ伸ばして探索*/
while(++h, h*h<D/2){
/*高さ固定で幅を伸ばして整長方形になるか調べる*/
for(w=h; w*w+h*h<D; ++w);
if(w*w+h*h==D){
cout<<h<<" "<<w<<endl;
notFound=false;
break;
}
}
}
}
return 0;
}
|
6853aa51701bc8769cf10fead53da88ee90fc693 | c9efc906edacba400d1e984fd165bcb13a4dae9d | /Engine/applicationclass.cpp | 984ce8c30d78bfe278f8296eca91488c91b62436 | [] | no_license | RynoT/Procedural-Methods-Abertay | fbec8723efef51332f236aa8c1f557c75db36d63 | c4555c2391581791a1ded857ea4dee734324bf31 | refs/heads/master | 2021-03-22T04:27:41.163645 | 2017-05-02T19:52:59 | 2017-05-02T19:52:59 | 88,818,565 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,563 | cpp | applicationclass.cpp | #include "applicationclass.h"
#include "game/scene/default_scene.h"
#include "game/scene/dungeon_scene.h"
int ApplicationClass::SCREEN_WIDTH = 800;
int ApplicationClass::SCREEN_HEIGHT = 600;
ApplicationClass::ApplicationClass(InputClass *input) : m_HWND(nullptr), m_Direct3D(nullptr), m_Scene(nullptr), m_Input(input), m_Timer(nullptr)
{
}
bool ApplicationClass::Initialize(HINSTANCE hinstance, HWND& hwnd, int screenWidth, int screenHeight)
{
bool result;
char videoCard[128];
int videoMemory;
this->m_HWND = &hwnd;
// Create the Direct3D object.
m_Direct3D = new D3DClass;
if (!m_Direct3D)
{
return false;
}
// Initialize the Direct3D object.
result = m_Direct3D->Initialize(screenWidth, screenHeight, VSYNC_ENABLED, hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR);
if (!result)
{
MessageBox(hwnd, L"Could not initialize DirectX 11.", L"Error", MB_OK);
return false;
}
// Create the timer object.
m_Timer = new TimerClass;
if (!m_Timer)
{
return false;
}
// Initialize the timer object.
result = m_Timer->Initialize();
if (!result)
{
MessageBox(hwnd, L"Could not initialize the timer object.", L"Error", MB_OK);
return false;
}
// Retrieve the video card information.
m_Direct3D->GetVideoCardInfo(videoCard, videoMemory);
this->m_Scene = new DefaultScene(this->m_Direct3D, hwnd, this->m_Input);
//this->m_Scene = new DungeonScene(this->m_Direct3D, hwnd, this->m_Input);
if (WIREFRAME_MODE)
{
this->m_Direct3D->TurnOnWireframe();
}
return true;
}
void ApplicationClass::Shutdown()
{
// Release the timer object.
if (m_Timer)
{
delete m_Timer;
m_Timer = 0;
}
// Release the Direct3D object.
if (m_Direct3D)
{
m_Direct3D->Shutdown();
delete m_Direct3D;
m_Direct3D = 0;
}
if (this->m_Scene != nullptr)
{
delete this->m_Scene;
this->m_Scene = nullptr;
}
}
void ApplicationClass::SetScene(const SceneId& id)
{
if (this->m_Scene != nullptr)
{
if (this->m_Scene->GetSceneId() == id)
{
this->m_Scene->OnRefresh(this->m_Direct3D);
return;
}
delete this->m_Scene;
}
Scene *scene = nullptr;
switch (id)
{
case SceneId::DEFAULT:
scene = new DefaultScene(this->m_Direct3D, *this->m_HWND, this->m_Input);
break;
case SceneId::DUNGEON:
scene = new DungeonScene(this->m_Direct3D, *this->m_HWND, this->m_Input);
break;
default:break;
}
this->m_Scene = scene;
}
void ApplicationClass::OnResize(const int& width, const int& height) const
{
this->m_Direct3D->Resize(width, height);
if (this->m_Scene != nullptr)
{
this->m_Scene->OnResize(this->m_Direct3D, width, height);
}
}
bool ApplicationClass::Frame()
{
bool result;
// Update the system stats.
m_Timer->Frame();
if (this->m_Input->IsKeyPressed(VK_NUMPAD1) || this->m_Input->IsKeyPressed(VK_Z))
{
this->SetScene(SceneId::DEFAULT);
}
else if (this->m_Input->IsKeyPressed(VK_NUMPAD2) || this->m_Input->IsKeyPressed(VK_X))
{
this->SetScene(SceneId::DUNGEON);
}
if (this->m_Scene != nullptr)
{
result = this->m_Scene->Update(this->m_Timer->GetTime());
if (!result)
{
return false;
}
}
// Render the graphics.
result = RenderGraphics();
if (!result)
{
return false;
}
return result;
}
bool ApplicationClass::RenderGraphics() const
{
D3DXMATRIX projection;
this->m_Direct3D->GetProjectionMatrix(projection);
//this->m_Direct3D->BeginScene(0.15f, 0.16f, 0.17f, 1.0f);
this->m_Direct3D->BeginScene(CLEAR_COLOR);
if (this->m_Scene != nullptr)
{
this->m_Scene->Render(this->m_Direct3D, projection);
}
this->m_Direct3D->EndScene();
return true;
}
|
b2a41eeaa266144e7ee08bfefa212f637b76b87e | 68f9c7aa5a78222bd009392fc82886329162b6f9 | /CH07/CH07/FANMEETING.cpp | 593ef26a7afbb9d35647466ffa945d8930f22f44 | [] | no_license | wbluke/Algorithm_PS | 1cb20f7d393a6c1cc155cb2b53f5dd19a64c595e | 9e810739a51410654a1cde686ab5376fea20bc70 | refs/heads/master | 2020-04-05T03:48:52.527347 | 2019-03-15T04:39:20 | 2019-03-15T04:39:20 | 156,528,237 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,611 | cpp | FANMEETING.cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
/*
void normalize(vector<int> &num) {
num.push_back(0);
for (int i = 0; i < num.size(); i++) {
if (num[i] < 0) {
int borrow = (abs(num[i]) + 9) / 10;
num[i + 1] -= borrow;
num[i] += borrow * 10;
}
else {
num[i + 1] += num[i] / 10;
num[i] %= 10;
}
}
while (num.size() > 1 && num.back() == 0) num.pop_back();
}
*/
vector<int> multiply(const vector<int> &a, const vector<int> &b) {
vector<int> c(a.size() + b.size() + 1, 0);
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < b.size(); j++) {
c[i + j] += a[i] * b[j];
}
}
//normalize(c);
return c;
}
//a += b * (10^k);
void addTo(vector<int> &a, const vector<int> &b, int k) {
a.resize(max(a.size(), b.size() + k));
for (int i = 0; i < b.size(); i++) {
a[i + k] += b[i];
}
}
// a -= b; when a >= b
void subFrom(vector<int> &a, const vector<int> &b) {
a.resize(max(a.size(), b.size()) + 1);
for (int i = 0; i < b.size(); i++) {
a[i] -= b[i];
}
}
vector<int> karatsuba(const vector<int> &a, const vector<int> &b) {
int an = a.size(), bn = b.size();
//if a is short than b, switch them.
if (an < bn) return karatsuba(b, a);
//base case : a or b is emtpy
if (an == 0 || bn == 0) return vector<int>();
//base case : if a is relatively short, change multiply
if (an <= 50) return multiply(a, b);
int half = an / 2;
vector<int> a0(a.begin(), a.begin() + half);
vector<int> a1(a.begin() + half, a.end());
vector<int> b0(b.begin(), b.begin() + min<int>(b.size(), half));
vector<int> b1(b.begin() + min<int>(b.size(), half), b.end());
//z2=a1*b1
vector<int> z2 = karatsuba(a1, b1);
//z0=a0*b0
vector<int> z0 = karatsuba(a0, b0);
//a0=a0+a1; b0=b0+b1;
addTo(a0, a1, 0);
addTo(b0, b1, 0);
//z1=(a0+a1)*(b0+b1)-z0-z2
vector<int> z1 = karatsuba(a0, b0);
subFrom(z1, z0);
subFrom(z1, z2);
//result=z0+z1*10^half+z2*10^(half*2)
vector<int> ret;
addTo(ret, z0, 0);
addTo(ret, z1, half);
addTo(ret, z2, half + half);
return ret;
}
int hugs(string &members, string &fans) {
int N = members.size(), M = fans.size();
vector<int> A(N), B(M);
for (int i = 0; i < N; i++) A[i] = (members[i] == 'M');
for (int i = 0; i < M; i++) B[M-i-1] = (fans[i] == 'M');
vector<int> C = karatsuba(A, B);
int allHugs = 0;
for (int i = N - 1; i < M; i++) {
if (C[i] == 0) allHugs++;
}
return allHugs;
}
int main(void) {
int num;
cin >> num;
for (int a = 0; a < num; a++) {
string members;
string fans;
cin >> members >> fans;
cout << hugs(members, fans) << endl;
}
return 0;
} |
438b7dad6406eb1c0eceee04e4b0efc174a2cffa | cfce1e28f1bc7e7bfe92d467454192bb9c30e9b8 | /sketchbook/rfid_led/rfid_led.ino | 75bf0e66f70376346ab487d51404a463f9177ede | [] | no_license | markgauzza/arduino | 0f88b3aa7f922b299031f689a38092429aab95ec | 1390d344d831b90ca57b9fc0d328f812de5cf4bc | refs/heads/master | 2021-01-25T05:15:42.524866 | 2016-03-01T16:55:49 | 2016-03-01T16:55:49 | 18,268,345 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 40 | ino | rfid_led.ino | Card detected #3973483339
#3973446155
|
e35761691a8bb7b1cffa6b0a21ce676eca6acad2 | 87b81def15fc20214d7b3adebe28a60f714fe4fc | /extractor/DinoCrisis2.h | 2b1ba056959850347b8a4e1eedb59513e1bbc413 | [] | no_license | Gemini-Loboto3/DC2-Mod-SDK | 482acd3f32027721d5b69395470a2915a60c15d8 | 6fc27d4d8ed4b54694f772941b45377b5a7ad191 | refs/heads/master | 2020-08-05T19:47:57.395370 | 2019-11-25T21:18:20 | 2019-11-25T21:18:20 | 212,683,446 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,703 | h | DinoCrisis2.h | #pragma once
#include <stdafx.h>
#include <vector>
enum GEntryType
{
GET_DATA, // generic literal data
GET_TEXTURE, // stripped TIM pixel
GET_PALETTE, // stripped TIM clut
GET_SNDH, // VAG header 'Gian'
GET_SNDB, // VAG body
GET_SNDE, // configuration for sound samples?
GET_UNK,
GET_LZSS0,
GET_LZSS1 // compressed texture
};
// dino crisis 2 pc entries
enum GEntryTypePC
{
GPC_DATA,
GPC_TEXTURE,
GPC_PALETTE,
GPC_SOUND, // info+riff samples (SNDH+SNDB)
GPC_MP3,
GPC_LZSS0,
GPC_LZSS1, // compressed texture
GPC_UNK,
GPC_LZSS2, // another compressed texture
};
/////////////////////////////////
// Dino crisis package system //
/////////////////////////////////
// standard entry in packed headers
typedef struct tagDc2GenericEntry
{
u32 type; // check generic entry type enumation
u32 size; // real size to read
u32 reserve[6]; // round entry to 32 bytes
} DC2_ENTRY_GENERIC;
// alternate structure for 4 word entries
typedef struct tagDc2GenericEntry16
{
u32 type; // check generic entry type enumation
u32 size; // real size to read
u32 reserve[2]; // round entry to 16 bytes
} DC2_ENTRY_GENERIC16;
// works for both TEXTURE and PALETTE types
typedef struct tagDc2EntryGfx
{
u32 type;
u32 size;
u16 x, y; // framebuffer coordinates
u16 w, h; // framebuffer size
} DC2_ENTRY_GFX;
typedef struct tagDc2EntryMp3
{
u32 type;
u32 size;
u32 id; // bgm id
u32 loop; // 1 = loop, 0 = non looping
} DC2_ENTRY_MP3;
/////////////////////////////////
// GIAN - Dino crisis sounds //
/////////////////////////////////
typedef struct tagGianEntry
{
u8 reverb; // only bit 1<<3 is checked
u8 unk1;
u8 unk2;
u8 sample_note; // *8 to obtain the actual value
u16 note;
u16 note_copy; // unused, contains the same value as note>>8
u16 reserved; // unused
u16 adsr1; // always 0x80FF
u16 adsr2;
u16 addr; // entry base-addr*8 to obtain the sample address
} GIAN_ENTRY;
/////////////////////////////////
// DCM - Dino crisis models //
/////////////////////////////////
typedef struct tagDcmMapping
{
s16 xyz[3];
u8 super, child;
u32 tri_ptr;
u32 quad_ptr;
u16 tri_cnt;
u16 quad_cnt;
} DCM_MAPPING;
typedef struct tagDcmHeader
{
u32 vertex_ptr; // vectors
u32 normal_ptr; // normals
u32 tri_ptr; // first entry of the triangle data [ram mirror]
u32 quad_ptr; // first entry of the rect data [ram mirror]
u16 tri_cnt; // total of triangles
u16 quad_cnt; // total of quadrilaterals
u32 obj_cnt; // total of objects in the model
u16 tpage, clut;
DCM_MAPPING map[1]; // mapping data
} DCM_HEADER;
typedef struct tagDcm1Header
{
u32 unk_ptr;
u32 unk_ptr1[6];
u32 vertex_ptr; // vectors
u32 normal_ptr; // normals
u32 tri_ptr; // first entry of the triangle data [ram mirror]
u32 quad_ptr; // first entry of the rect data [ram mirror]
u16 tri_cnt; // total of triangles
u16 quad_cnt; // total of quadrilaterals
u32 obj_cnt; // total of objects in the model
DCM_MAPPING map[1]; // mapping data
} DCM1_HEADER;
typedef struct tagDcmTriMap
{
u16 vertex[3];
u8 uv[3][2];
} DCM_TRIMAP;
typedef struct tagDcm1TriMap
{
u16 vertex[3];
u8 uv0[2];
u8 uv1[2];
u16 clut;
u8 uv2[2];
u16 tpage;
} DCM1_TRIMAP;
typedef struct tagDcmRectMap
{
u16 vertex[4];
u8 uv[4][2];
} DCM_QUADMAP;
typedef struct tagDcm1RectMap
{
u16 vertex[4];
u8 uv0[2];
u16 clut;
u8 uv1[2];
u16 tpage;
u8 uv2[2];
u8 uv3[2];
} DCM1_QUADMAP;
/////////////////////////////////
// RDT - Dino crisis rooms //
/////////////////////////////////
typedef struct tagRdtHeader
{
u32 rgb0, rgb1;
} RDT_HEADER;
//////////////////////////////////
// Functions and classes //
//////////////////////////////////
u32 Dc2LzssDec(u8* src, u8* &dst, u32 src_size);
void UnswizzleGfx(DC2_ENTRY_GFX *gfx_p, u8 *buf_p);
class CPackageDC
{
public:
CPackageDC();
~CPackageDC();
void Reset();
void Open(LPCTSTR filename, bool is_pc = false);
size_t Open(u8* data);
size_t OpenPC(u8* data);
void ExtractRaw(LPCTSTR dest);
void ExtractRawPC(LPCSTR dest);
int GetIDByAddress(u32 address);
__inline size_t GetCount() { return segment.size(); }
int SearchByType(u32 type)
{
for (size_t i = 0, si = GetCount(); i < si; i++)
if (type == ent[i].type)
return i;
return -1;
}
int SearchByType(u32 type, int cnt)
{
for (size_t i = 0, c = 0, si = GetCount(); i < si; i++)
if (type == ent[i].type && c++ == cnt)
return i;
return -1;
}
int CountByType(u32 type)
{
int cnt = 0;
for (size_t i = 0, c = 0, si = GetCount(); i < si; i++)
if (type == ent[i].type)
cnt++;
return cnt;
}
std::vector<DC2_ENTRY_GENERIC> ent;
std::vector<u8*> segment;
int pack_type;
enum
{
Type_DC1,
Type_DC2
};
};
|
9dae1bfe071d1c8e8a6e574b8f3dd08d92ca7bf6 | 821f12cb1b5700c3f85b907476712e82f498d47d | /C++Projects/Homework-10/Homwork-10/Node_JunjieFeng.h | b4f0344c1e2ca4ff1ed7ee81552f8af8252ec8d2 | [] | no_license | Junjie-Feng/Previous-Projects | bfb19134d79b83f0a5a08b2624ee8f39831736f9 | 7d1f22c5f5a4134f43297d64f36f8341c36d4431 | refs/heads/master | 2021-01-11T04:16:43.688141 | 2016-10-18T00:59:11 | 2016-10-18T00:59:11 | 71,194,272 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 494 | h | Node_JunjieFeng.h | #ifndef NODE_H
#define NODE_H
#include <string>
using namespace std;
using std::string;
class Node
{
friend class LinkedList;//make LinkedLIst a friend
public:
//constructor
Node(string name, int no)
:itemName(name), itemNo(no)
{
this->next = NULL;//the innitialization of pointer next is NULL
}
//destructor
~Node(){}
private:
//store the node information
string itemName;
int itemNo;
//store the pointer point to the next node
Node *next;
};
#endif
|
f7d8ca2ebb91f1ec52d9a00ec198c1358ad68b1f | 0b431412de715f7ee9000e46d40c337422ab9d0c | /src/game/entities/subsystems/lifeanddeathsystem.h | e1254728f457956b21e853c9cfc50efc6045b287 | [] | no_license | gered/MonsterDefense | 66f53c7459e96acab4d194919fe92657dd23e7ac | 4960df2ea152049a2348fc48c0821977a6606c1c | refs/heads/master | 2020-04-26T07:24:29.793861 | 2019-03-02T02:17:33 | 2019-03-02T02:23:29 | 173,393,236 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 733 | h | lifeanddeathsystem.h | #ifndef __GAME_ENTITIES_SUBSYSTEMS_LIFEANDDEATHSYSTEM_H_INCLUDED__
#define __GAME_ENTITIES_SUBSYSTEMS_LIFEANDDEATHSYSTEM_H_INCLUDED__
#include "../../../framework/common.h"
#include "../../../entities/componentsystem.h"
class EntityManager;
class EventManager;
struct Event;
class LifeAndDeathSystem : public ComponentSystem
{
public:
static COMPONENTSYSTEM_TYPE GetType()
{
static COMPONENTSYSTEM_TYPE typeName = "LifeAndDeathSystem";
return typeName;
}
COMPONENTSYSTEM_TYPE GetTypeOf() const { return GetType(); }
LifeAndDeathSystem(EntityManager *entityManager, EventManager *eventManager);
virtual ~LifeAndDeathSystem();
void OnUpdate(float delta);
BOOL Handle(const Event *event);
};
#endif
|
9d82cfb7a7ab87925b2a09931d7e6c20c4041da1 | b9ee0ea8b5c16eeb4d5d69017e9a9335e4de386e | /DMC/Player.h | dd4bd7e24906410953b68f7aa90e85f7098272e6 | [] | no_license | diegodem/dmc-nes | 629a1230513a66c2048521f1807cfe303baee632 | 19e3475ec35ea682a0b4f2943df1ec5f9eab383c | refs/heads/master | 2023-03-20T09:19:24.924204 | 2021-03-19T00:00:48 | 2021-03-19T00:00:48 | 344,885,700 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 888 | h | Player.h | // Code by Diego de Miguel (https://github.com/diegodem) - March 2021
#pragma once
#include <SDL.h>
#include "State.h"
#include "Timer.h"
class Player
{
public:
Player();
void update();
void moveRight(float deltaTime);
void moveLeft(float deltaTime);
int attackSword();
void fire();
void noButtonPressed();
SDL_Rect *getRect();
SDL_Rect *getAttackRect();
SDL_Rect* getSwordRect();
int getCurrentFrame();
State getState();
int getSwordDamage();
void takeDamage(int damage);
int getHealth();
int getMaxHealth();
int getImmunityState();
bool getCanShoot();
void heal();
void sideEffect();
int getAmmo();
private:
SDL_Rect rect;
SDL_Rect attackRect;
SDL_Rect swordRect;
State state;
Timer frameTimer;
Timer immunityTimer;
int currentFrame;
int speed;
int swordDamage;
int maxHealth;
int health;
int immuneState;
bool canShoot;
int ammo;
}; |
d1e6da3315bc1dd4c500890ee75f6a76cb2b4d3c | eaea9b15bcbfcf86fc946e0855ad0a0c91beb8e0 | /SP1Framework- UPDATED/SP1Framework/Gamestory.cpp | 1681eff09d9b1ad26d94bca31fbc387adced2dec | [] | no_license | Siongyu/SP1Framework | 66a19a8517cbf331acf0a3797761bb0a559f57c1 | 9a906ba16d3bbf5129601ee347b0fb3c40d3d681 | refs/heads/master | 2021-01-22T19:17:56.045487 | 2016-08-26T09:18:05 | 2016-08-26T09:18:05 | 65,705,759 | 0 | 0 | null | 2016-08-15T05:03:08 | 2016-08-15T05:03:07 | null | UTF-8 | C++ | false | false | 377 | cpp | Gamestory.cpp | #include "game.h"
extern Console g_Console;
void Story()
{
COORD c = g_Console.getConsoleSize();
c.Y = 3; // Story at y 9
c.X = g_Console.getConsoleSize().X / 2 - 9;
c.Y += 3;
c.X = 0;
string line;
ifstream myfile("Story.txt");
if (myfile.is_open())
{
while (getline(myfile, line))
{
c.Y += 1;
g_Console.writeToBuffer(c, line);
}
myfile.close();
}
} |
302fad9d004e5350eeda2aa6c98ccd30a5dcd486 | 617eea0130bd6910c67bb5c2d95e33d368f0b90d | /Delete_Person.cpp | 39c7f94ab95eba361c6b5aafe5567ffe0a06b1c8 | [] | no_license | xu254zhu/test | de3eb7d77e8eba506dd05641afe9daa58d084a1a | f7f9df3cb3521009ed380eb84085dcc4dc720c8e | refs/heads/main | 2023-03-14T04:41:05.050776 | 2021-02-23T02:37:44 | 2021-02-23T02:37:44 | 340,795,722 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 486 | cpp | Delete_Person.cpp | #include"Delete_Person.h"
#include"Rank_Person.h"
#include"Add_Person.h"
void Delete_Person(A_Person All_person[], int &count)
{
string delete_name;
cout << "请输入你想要删除人的姓名:" << endl;
cin >> delete_name;
for (int i = 0; i < count; i++)
{
if (All_person[i].Name == delete_name)
{
All_person[i] = All_person[count - 1];
All_person[count - 1] = { "zblank","blank",0,"0","blank" };
}
}
Rank_Person(All_person, count);
count--;
} |
57b38b9401dd1bf7df1198d42b9d4880d46e87a8 | 9ca6885d197aaf6869e2080901b361b034e4cc37 | /JetMETCorrections/Utilities/src/SealModule.cc | 794a1ce3f689bbb78848f64ee126bca771905ad9 | [] | no_license | ktf/cmssw-migration | 153ff14346b20086f908a370029aa96575a2c51a | 583340dd03481dff673a52a2075c8bb46fa22ac6 | refs/heads/master | 2020-07-25T15:37:45.528173 | 2013-07-11T04:54:56 | 2013-07-11T04:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 206 | cc | SealModule.cc | #include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "JetMETCorrections/Utilities/interface/TriggerFilter.h"
DEFINE_FWK_MODULE(TriggerFilter);
|
64043cf262c0b9d914385f80b7cdb1e21c21994b | e0de5239c18c983dd46ce5803b1871db9f8d34f8 | /src-qt/printerinterface.cpp | b6bfa081a9d8d54af931f6097691dd49a219a8e4 | [] | no_license | spachev/davpro | a2a0ce53fcd74f6b5bbdcfe748acf9d083f57f0b | 3b0c60150b80347bd52883f51a651c9f3532eba0 | refs/heads/master | 2020-06-13T18:45:02.675334 | 2016-12-03T21:25:24 | 2016-12-03T21:25:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,870 | cpp | printerinterface.cpp |
#include "printerinterface.h"
#include <QJsonDocument>
#define GETSTATUSCMD "/home/steve/Development/davpro/davpro -j 192.168.1.7 9100"
PrinterInterface::PrinterInterface()
{
connect( &proc, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(statusupdate(int, QProcess::ExitStatus)) ) ;
state=INIT ;
statusstring = "Initialising" ;
rawdata="" ;
}
void PrinterInterface::setIPAddress(QString ipaddress, int portnum)
{
if (state!=IDLE) return ;
confIpAddress = ipaddress ;
confPortNum = portnum ;
}
void PrinterInterface::updateStatus()
{
if (state==IDLE || state==INIT) {
state=GETSTATUS ;
proc.start(GETSTATUSCMD) ;
}
}
// When busy or Error, printer only returns status and no further information
// Busy when printer responds but can't give details
bool PrinterInterface::isBusy()
{
return json["busy"].toBool() ;
}
// Error when unable to connect etc.
bool PrinterInterface::isError()
{
return (json["error"].toBool()) ;
}
// Printer is idle when waiting for commands
bool PrinterInterface::isIdle()
{
if (isBusy()) return false ;
else return json["idle"].toBool() ;
}
// Printer is printing when heating / printing / cooling / pausing etc.
bool PrinterInterface::isPrinting()
{
if (isBusy()) return false ;
else return json["printing"].toBool() ;
}
QString PrinterInterface::rawData()
{
return rawdata ;
}
void PrinterInterface::statusupdate(int exitCode, QProcess::ExitStatus exitStatus)
{
Q_UNUSED(exitStatus) ;
Q_UNUSED(exitCode) ;
QByteArray buffer = proc.readAll() ;
rawdata = buffer ;
QJsonParseError handler ;
QJsonDocument statusdata = QJsonDocument::fromJson(buffer, &handler) ;
if (!statusdata.isNull()) {
if (statusdata.isObject()) {
json = statusdata.object() ;
statusstring = json.value("status").toString() ;
if (statusstring.isEmpty()) {
statusstring = "Error, printer returned no data" ;
} else {
statusstring = json.value("status").toString() ;
}
} else {
statusstring = "Error, returned data is not a correctly formatted JSON document object" ;
}
} else {
statusstring = QString("Error in JSON from printer interface: ") + handler.errorString() ;
}
proc.close() ;
state=IDLE ;
emit(statusupdated()) ;
}
QString PrinterInterface::serialNumber() {
QJsonValue o = json.value("serial") ;
QString s = o.toString() ;
return s ;
}
QString PrinterInterface::modelNumber() { return json.value("model").toString() ;}
int PrinterInterface::nozzles() { return json["nozzles"].toInt() ;}
float PrinterInterface::filamentRemaining(int nozzlenumber) {
QJsonObject filament = json["filamentremaining"].toObject() ;
double remaining = filament[QString::number(nozzlenumber+1)].toDouble() ;
return (float)remaining ;
}
float PrinterInterface::nozzleTemperature(int nozzlenumber) {
QJsonObject nozzle = json["nozzletemperature"].toObject() ;
double temperature = nozzle[QString::number(nozzlenumber+1)].toDouble() ;
return (float)temperature ;
}
float PrinterInterface::bedTemperature() {return (float)json["bedtemperature"].toDouble() ;}
QString PrinterInterface::status() { return statusstring ; }
QString PrinterInterface::ipAddress() { return json["ipaddress"].toString() ;}
bool PrinterInterface::isDoorOpen()
{
return json["dooropen"].toBool() ;
}
bool PrinterInterface::isLidOpen()
{
return json["lidopen"].toBool() ;
}
int PrinterInterface::percentComplete()
{
return json["percentcomplete"].toInt() ;
}
float PrinterInterface::remainingMinutes()
{
return (float)json["remainingmins"].toDouble() ;
}
float PrinterInterface::elapsedMinutes()
{
return (float)json["elapsedmins"].toDouble() ;
}
|
60acde58a8a8fc1ac4a6c7b52ce05fdfe404f6ee | 14b5c1086f278ce63f1ff67cc61058917924b153 | /sopnet/sopnet/inference/Problems.h | 8818191dbba47e376eded6dafc4062d1a6809740 | [
"MIT"
] | permissive | funkey/sopnet | 7a1f6a16101c2028b55d28d9bbb16265134b942e | 70df598211d00e7f5f5b39dabc5c67f89a5da43d | refs/heads/master | 2020-05-16T23:12:13.959045 | 2015-06-25T20:21:45 | 2015-06-25T20:21:45 | 4,703,605 | 0 | 1 | null | 2014-08-04T11:51:08 | 2012-06-18T17:01:24 | C++ | UTF-8 | C++ | false | false | 1,054 | h | Problems.h | #ifndef SOPNET_INFERENCE_PROBLEMS_H__
#define SOPNET_INFERENCE_PROBLEMS_H__
#include <pipeline/all.h>
#include "Problem.h"
/**
* A collection of problems.
*/
class Problems : public pipeline::Data {
public:
typedef std::vector<boost::shared_ptr<Problem> > problems_type;
typedef problems_type::iterator iterator;
typedef problems_type::const_iterator const_iterator;
void addProblem(boost::shared_ptr<Problem> problem) {
_problems.push_back(problem);
}
boost::shared_ptr<Problem> getProblem(unsigned int i) {
return _problems[i];
}
unsigned int size() const {
return _problems.size();
}
void clear() {
_problems.clear();
}
problems_type::iterator end() {
return _problems.end();
}
problems_type::iterator begin() {
return _problems.begin();
}
problems_type::const_iterator end() const {
return _problems.end();
}
problems_type::const_iterator begin() const {
return _problems.begin();
}
private:
problems_type _problems;
};
#endif // SOPNET_INFERENCE_PROBLEMS_H__
|
fae16d20343b820f36b5058da1aa5826923ae505 | 10571cc8e30797b2bdad94817580e420b4a89742 | /fon9/framework/SeedImporter.cpp | 5f392421f56f291b7a5c58c41e3bd7348cdbfbc3 | [
"Apache-2.0"
] | permissive | fonwin/libfon9 | 3651cab44470ca353dd779280f0a1e550001af9b | ff682e272798a9a65d4b18852eb6522a715f48f2 | refs/heads/master | 2023-08-28T06:54:05.250118 | 2023-07-25T02:36:46 | 2023-07-25T02:36:46 | 115,598,127 | 30 | 12 | Apache-2.0 | 2023-02-24T07:08:05 | 2017-12-28T07:36:02 | C++ | UTF-8 | C++ | false | false | 10,522 | cpp | SeedImporter.cpp | /// \file fon9/framework/SeedImporter.cpp
///
/// - 僅適合匯入少量初始化資料, 不適合處理整批大量資料.
/// 如果需要匯入整批大量資料(例: 客戶庫存, 全市場商品...), 建議使用專用匯入模組.
///
/// - SeedImporter factory plugin:
/// - EntryName: SeedImporter
/// - 參數設定 Args: "Name=SeedImporter|AuthMgr=|AddTo=..."
/// - Name= 若沒提供 Name 則預設為 "SeedImporter"
/// - AuthMgr= 透過哪個 auth mgr 取得 Acl.
/// - AddTo= 或 SessionFactoryPark= 加入到哪個 session factory park.
/// - IoMgr= 或 IoManager= 加入到哪個 IoManager 所參考的 session factory park.
///
/// - SeedImporter session:
/// - 參數設定 SessionArgs: "Role=roleId|OutputTo=Dev"
/// - 連線後直接使用設定的 role 取得 Acl, 不用登入.
/// - 預設為 "OutputTo=Log": 當有錯誤時記錄到 log,
/// 且不論成功或失敗都不會透過 Dev 回覆任何訊息.
///
/// - 連線到 SeedImporter session 之後, 指令範例(使用 '\n' 換行):
/// ss,PriRef=35.7,PriUpLmt=39.25,PriDnLmt=32.15 /SymbIn/1101^Ref
///
/// \author fonwinz@gmail.com
#include "fon9/framework/SessionFactoryConfigWithAuthMgr.hpp"
#include "fon9/auth/AuthMgr.hpp"
#include "fon9/auth/PolicyAcl.hpp"
#include "fon9/seed/SeedVisitor.hpp"
namespace fon9 {
enum class OutputTo {
/// 錯訊息輸出到 Log, 一般訊息直接拋棄.
Log,
/// 訊息透過 Device 回覆.
Dev,
};
fon9_WARN_DISABLE_PADDING;
struct SeedImporterArgs {
SeedImporterArgs() = delete;
SeedImporterArgs(auth::AuthMgrSP authMgr) : Authr_{std::move(authMgr)} {
}
auth::AuthResult Authr_;
seed::AclConfig Acl_;
OutputTo OutputTo_{OutputTo::Log};
};
fon9_WARN_POP;
struct SeedImporterVisitor : public seed::SeedVisitor {
fon9_NON_COPY_NON_MOVE(SeedImporterVisitor);
using base = seed::SeedVisitor;
const io::DeviceSP Dev_;
SeedImporterVisitor(const SeedImporterArgs& args, io::Device& dev)
: base(args.Authr_.AuthMgr_->MaRoot_, args.Authr_.MakeUFrom(ToStrView(dev.WaitGetDeviceId())), args.Authr_)
, Dev_(args.OutputTo_ == OutputTo::Dev ? &dev : nullptr) {
this->Fairy_->ResetAclConfig(args.Acl_);
}
template <class... ArgsT>
void OnError(ArgsT&&... args) {
RevBufferList rbuf{fon9::kLogBlockNodeSize};
fon9::RevPrint(rbuf, "SeedImporter.", std::forward<ArgsT>(args)..., '\n');
this->OutputError(std::move(rbuf));
}
void OutputError(RevBufferList&& rbuf) {
if ((this->Dev_ && this->Dev_->OpImpl_GetState() == io::State::LinkReady))
this->Dev_->Send(rbuf.MoveOut());
else if (LogLevel::Error >= fon9::LogLevel_)
fon9::LogWrite(LogLevel::Error, std::move(rbuf));
}
void OnTicketRunnerDone(seed::TicketRunner& runner, DcQueue&& extmsg) override {
(void)extmsg;
if (runner.OpResult_ >= seed::OpResult::no_error)
return;
if (!this->Dev_) { // 使用 Log 記錄失敗.
if (dynamic_cast<seed::TicketRunnerRemove*>(&runner))
// Remove 在 SeedVisitor.cpp: TicketRunnerRemove::OnBeforeRemove(); 已處理.
return;
}
this->OnError(runner.Bookmark_,
"|path=", runner.OrigPath_,
"|err=", runner.OpResult_, ':', seed::GetOpResultMessage(runner.OpResult_));
}
void OnTicketRunnerWrite(seed::TicketRunnerWrite& runner, const seed::SeedOpResult& res, const seed::RawWr& wr) override {
// runner.ParseSetValues() 已經有寫log: SeedVisitor.cpp;
// 沒有消息就是好消息, 所以成功時不回覆.
RevBufferList rbuf{runner.ParseSetValues(res, wr)};
if (rbuf.cfront() != nullptr)
this->OutputError(std::move(rbuf));
}
void OnTicketRunnerRemoved(seed::TicketRunnerRemove&, const seed::PodRemoveResult& res) override {
(void)res;
// Remove 不論成功或失敗, 都有寫log: SeedVisitor.cpp: TicketRunnerRemove::OnBeforeRemove();
// 所以只要考慮失敗時需要送 Dev_ 的情況: 在 OnTicketRunnerDone() 處理.
}
};
using VisitorSP = intrusive_ptr<SeedImporterVisitor>;
/// SeedImporter 僅支援 Write, Remove.
class SeedImporterSession : public io::Session {
fon9_NON_COPY_NON_MOVE(SeedImporterSession);
SeedImporterArgs Args_;
LinePeeker LinePeeker_;
VisitorSP Visitor_;
uint32_t LineCount_;
uint32_t LineDisplayed_;
uint32_t SsCount_;
uint32_t RsCount_;
public:
SeedImporterSession(SeedImporterArgs&& args) : Args_(std::move(args)) {
}
SeedImporterSession(const SeedImporterArgs& args) : Args_(args) {
}
void OnDevice_CommonTimer(io::Device& dev, TimeStamp now) override {
(void)now;
if (this->LineDisplayed_ != this->LineCount_) {
RevBufferFixedSize<256> rbuf;
RevPrint(rbuf, "Lc=", this->LineDisplayed_ = this->LineCount_, "|ss=", this->SsCount_, "|rs=", this->RsCount_);
dev.Manager_->OnSession_StateUpdated(dev, ToStrView(rbuf), LogLevel::Info);
}
dev.CommonTimerRunAfter(TimeInterval_Second(1));
}
void OnDevice_StateChanged(io::Device&, const io::StateChangedArgs& e) override {
if (e.BeforeState_ == io::State::LinkReady) {
this->Visitor_.reset();
this->LinePeeker_.Clear();
}
}
io::RecvBufferSize OnDevice_LinkReady(io::Device& dev) override {
this->LineCount_ = this->LineDisplayed_ = this->SsCount_ = this->RsCount_ = 0;
this->Visitor_.reset(new SeedImporterVisitor(this->Args_, dev));
dev.CommonTimerRunAfter(TimeInterval_Second(1));
return io::RecvBufferSize::Default;
}
io::RecvBufferSize OnDevice_Recv(io::Device&, DcQueue& rxbuf) override {
while (const char* pln = this->LinePeeker_.PeekUntil(rxbuf, '\n')) {
++this->LineCount_;
StrView cmdln{pln, this->LinePeeker_.LineSize_};
if (StrTrimTail(&cmdln).empty())
goto __POP_CONSUMED_AND_CONTINUE;
// SeedImporter 僅支援 "ss", "rs"
if (cmdln.size() > 2) {
switch (auto ch0 = cmdln.Get1st()) {
case 's': case 'r':
if (cmdln.begin()[1] == 's') {
seed::SeedFairy::Request req(*this->Visitor_, cmdln);
if (fon9_LIKELY(req.Runner_)) {
if (ch0 == 's')
++this->SsCount_;
else
++this->RsCount_;
req.Runner_->Bookmark_.assign(cmdln.begin(), 2);
req.Runner_->Run();
goto __POP_CONSUMED_AND_CONTINUE;
}
}
break;
}
}
this->Visitor_->OnError("Unknown command: ", cmdln);
__POP_CONSUMED_AND_CONTINUE:
this->LinePeeker_.PopConsumed(rxbuf);
}
return io::RecvBufferSize::Default;
}
};
struct SeedImporterServer : public io::SessionServer {
fon9_NON_COPY_NON_MOVE(SeedImporterServer);
SeedImporterArgs Args_;
SeedImporterServer(SeedImporterArgs&& args) : Args_(std::move(args)) {
}
io::SessionSP OnDevice_Accepted(io::DeviceServer&) override {
return new SeedImporterSession{this->Args_};
}
};
//--------------------------------------------------------------------------//
struct SeedImporterFactory : public SessionFactory {
fon9_NON_COPY_NON_MOVE(SeedImporterFactory);
auth::AuthMgrSP AuthMgr_;
SeedImporterFactory(std::string name, auth::AuthMgrSP&& authMgr)
: SessionFactory(std::move(name))
, AuthMgr_{std::move(authMgr)} {
}
bool ParseSeedImporterArgs(StrView cfgstr, std::string& errReason, SeedImporterArgs& args) {
StrView roleId;
StrView tag, value;
while (StrFetchTagValue(cfgstr, tag, value)) {
if (tag == "Role")
roleId = value;
else if (tag == "OutputTo") {
if (value == "Dev" || value == "Device")
args.OutputTo_ = OutputTo::Dev;
else if (value == "Log")
args.OutputTo_ = OutputTo::Log;
else {
errReason = value.ToString("Unknown value: OutputTo=");
return false;
}
}
else {
errReason = tag.ToString("Unknown tag: ");
return false;
}
}
args.Authr_.AuthzId_.assign(&this->Name_);
args.Authr_.AuthcId_.assign(roleId);
this->AuthMgr_->RoleMgr_->GetRole(roleId, args.Authr_, auth::RoleMgr::GetRoleMode_Renew);
if (!this->AuthMgr_->GetPolicy<auth::PolicyAclAgent>(fon9_kCSTR_PolicyAclAgent_Name, args.Authr_, args.Acl_)) {
errReason = "AuthMgr.GetPolicy." fon9_kCSTR_PolicyAclAgent_Name "|err=Not found.";
return false;
}
if (args.Acl_.IsAccessDeny()) {
errReason = "err=Acl is empty.";
return false;
}
return true;
}
template <class SessionT>
SessionT* CreateSeedImporter(const IoConfigItem& cfg, std::string& errReason) {
SeedImporterArgs args{this->AuthMgr_};
if (this->ParseSeedImporterArgs(ToStrView(cfg.SessionArgs_), errReason, args))
return new SessionT(std::move(args));
return nullptr;
}
io::SessionSP CreateSession(IoManager&, const IoConfigItem& cfg, std::string& errReason) override {
return this->CreateSeedImporter<SeedImporterSession>(cfg, errReason);
}
io::SessionServerSP CreateSessionServer(IoManager&, const IoConfigItem& cfg, std::string& errReason) override {
return this->CreateSeedImporter<SeedImporterServer>(cfg, errReason);
}
};
class SeedImporterArgsParser : public SessionFactoryConfigWithAuthMgr {
fon9_NON_COPY_NON_MOVE(SeedImporterArgsParser);
using base = SessionFactoryConfigWithAuthMgr;
public:
using base::base;
SessionFactorySP CreateSessionFactory() override {
if (auto authMgr = this->GetAuthMgr())
return new SeedImporterFactory(this->Name_, std::move(authMgr));
return nullptr;
}
};
static bool SeedImporter_Start(seed::PluginsHolder& holder, StrView args) {
return SeedImporterArgsParser{holder, "SeedImporter"}.Parse(holder, args);
}
} // namespaces
//--------------------------------------------------------------------------//
extern "C" fon9_API fon9::seed::PluginsDesc f9p_SeedImporter;
static fon9::seed::PluginsPark f9pRegister{"SeedImporter", &f9p_SeedImporter};
fon9::seed::PluginsDesc f9p_SeedImporter{"", &fon9::SeedImporter_Start, nullptr, nullptr,};
|
64fdcd488ec0afd6c1587e7d40e67a3605e55a0e | 039a64f162815f44343f88f476050052681399a1 | /empty_simply_wx/src/MyApp.cpp | e8cd8ce2862553520b1d32d2732b823d541bb6ff | [] | no_license | Jamesder/wxWidgets | 142f8f1503d8f85ba0eb2b903eb0a93e3ef6bc44 | 20b4dd3839461623eb22e23cc0de1419069de9ef | refs/heads/master | 2020-03-30T15:51:30.645514 | 2018-10-03T08:35:49 | 2018-10-03T08:35:49 | 151,382,770 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 184 | cpp | MyApp.cpp | #include "MyApp.h"
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame("Hello World", wxPoint(50,50), wxSize(450,340) );
frame->Show( true );
return true;
}
|
80e5806f550fadd851b11693baec926f48695833 | 67298ca8528b753930a3dc043972dceab5e45d6a | /Asteroids/include/main.h | 82ca172112d0af42212e9028f8812f751475982d | [] | no_license | WhyKay92/cs260assignment3 | 3cf28dd92b9956b2cd4f850652651cb11f25c753 | 77ad90cd2dc0b44f3ba0a396dc8399021de4faa5 | refs/heads/master | 2021-05-30T14:59:21.297733 | 2010-12-13T09:18:17 | 2010-12-13T09:18:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,997 | h | main.h | // ---------------------------------------------------------------------------
// Project Name : Asteroid
// File Name : main.h
// Author : Sun Tjen Fam
// Creation Date : 2008/02/05
// Purpose : main header file for the asteroid game
// History :
// - 2007/02/05 : - initial implementation
// ---------------------------------------------------------------------------
#ifndef MAIN_H
#define MAIN_H
#include <vector>
#include "MessageTypes.hpp"
#include "UDPSocket.hpp"
// ******************************************************** //
// NEED TO CHANGE THIS DEFINE IN ORDER TO RUN AS THE SERVER //
// ******************************************************** //
#define CLIENT_APP 0
// edit this to change default round time
// *** MAKING THIS CHANGE ONLY HAS AN EFFECT IF RUNNING AS THE SERVER *** //
#define GAME_TIME_SEC 60.0
// ---------------------------------------------------------------------------
#define USE_CUSTOM_GAME_STATE_MGR 1
// ---------------------------------------------------------------------------
#if USE_CUSTOM_GAME_STATE_MGR
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// includes
#include "AEEngine.h"
// game state manager
#include "GameStateMgr.h"
// ---------------------------------------------------------------------------
#else // USE_CUSTOM_GAME_STATE_MGR
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// includes
#include "AEEngine.h"
// ---------------------------------------------------------------------------
// game state list
enum
{
// list of all game states
GS_PLAY = 0,
GS_MENU,
GS_RESULT,
// special game state. Do not change
GS_RESTART = AE_GS_RESTART,
GS_QUIT = AE_GS_QUIT
};
// ---------------------------------------------------------------------------
// define the state related variables and functions to use the one
// from the Alpha Engine
#define gGameStateInit gAEGameStateInit
#define gGameStateCurr gAEGameStateCurr
#define gGameStatePrev gAEGameStatePrev
#define gGameStateNext gAEGameStateNext
#define GameStateLoad AEGameStateLoad
#define GameStateInit AEGameStateInit
#define GameStateUpdate AEGameStateUpdate
#define GameStateDraw AEGameStateDraw
#define GameStateFree AEGameStateFree
#define GameStateUnload AEGameStateUnload
#define GameStateMgrInit AEGameStateMgrInit
#define GameStateMgrUpdate AEGameStateMgrUpdate
// ---------------------------------------------------------------------------
#endif // USE_CUSTOM_GAME_STATE_MGR
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
#endif // MAIN_H
|
1a653fecb4e719f86d2e16d8df9159e6981b4df2 | ad6ec880535edbe1f682e6b7347b641688607234 | /Player.h | 49c821d2a2dd8aee7f85bad81195e3e7ae400467 | [] | no_license | amichaiman/jasmine-cpp-2 | de53d5a4485fd76697cbd1e87fef9a9ec18af600 | be00938516507af8929be0944706bf1d4b267291 | refs/heads/master | 2020-04-06T19:43:22.409191 | 2018-11-16T01:25:50 | 2018-11-16T01:25:50 | 157,747,109 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 381 | h | Player.h | //
// Created by amichai on 15/11/18.
//
#ifndef YASMIN_CPP_2_PLAYER_H
#define YASMIN_CPP_2_PLAYER_H
#include <string>
using namespace std;
class Board;
using namespace std;
class Player {
public:
string getInput(Board *board);
bool cinGoodStatus();
void setColor(char color);
char getColor() const;
private:
char color;
};
#endif //YASMIN_CPP_2_PLAYER_H
|
fe856067f7cc294cff156a3e6262485558dc0926 | f75a4415bb34ba1c1b9aefbe44f4949a1efd6aea | /lab1/src/Sort.hpp | 871b82b1ada6ef642d7e0790a0874b9ab9f0e470 | [] | no_license | YuMolly/CS3353-Baohua | 5fb39dc7c5698f2f4e7b94251f359485558f9ff9 | 7ae1033ebd754f9a12c542436b88ee60d661d62c | refs/heads/master | 2022-03-12T06:31:09.821536 | 2019-12-05T15:29:34 | 2019-12-05T15:29:34 | 204,796,737 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 665 | hpp | Sort.hpp | //
// Sort.hpp
// data_generator
//
// Created by MollyYu on 9/11/19.
// Copyright © 2019 MollyYu. All rights reserved.
//
#ifndef Sort_hpp
#define Sort_hpp
#include <stdio.h>
#include <vector>
#include "Algorithm.hpp"
class Sort : public Algorithm{
public:
Sort();
~Sort();
std::vector<int> load(std::string);
void Setselect(Sort::selection);
selection select();
void execute(std::vector<int>&,int,int);
void display();
void state();
void save(std::string,std::string);
private:
std::vector<int> sorted;
selection my_select;
int counter;
std::chrono::duration<double> time_span;
};
#endif /* Sort_hpp */
|
1e77a5c369224562f9de7e07f3f23d60be841cb1 | d2249116413e870d8bf6cd133ae135bc52021208 | /Advanced MFC Programming/Chap10/10.3/Gdi/GDIDoc.cpp | 271fafd25c6f761f8268285a4fc51132f3c35892 | [] | no_license | Unknow-man/mfc-4 | ecbdd79cc1836767ab4b4ca72734bc4fe9f5a0b5 | b58abf9eb4c6d90ef01b9f1203b174471293dfba | refs/heads/master | 2023-02-17T18:22:09.276673 | 2021-01-20T07:46:14 | 2021-01-20T07:46:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,428 | cpp | GDIDoc.cpp | #include "stdafx.h"
#include "GDI.h"
#include "GDIDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CGDIDoc, CDocument)
BEGIN_MESSAGE_MAP(CGDIDoc, CDocument)
//{{AFX_MSG_MAP(CGDIDoc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CGDIDoc::CGDIDoc()
{
m_hDIB=NULL;
}
CGDIDoc::~CGDIDoc()
{
if(m_hDIB != NULL)
{
::GlobalFree(m_hDIB);
m_hDIB=NULL;
}
}
BOOL CGDIDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
return TRUE;
}
void CGDIDoc::Serialize(CArchive& ar)
{
if(ar.IsStoring())
{
}
else
{
BITMAPFILEHEADER bf;
DWORD dwSize;
LPSTR lpDIB;
if(m_hDIB != NULL)
{
::GlobalFree(m_hDIB);
m_hDIB=NULL;
}
if
(
ar.Read
(
(LPSTR)&bf,
sizeof(BITMAPFILEHEADER)
) != sizeof(BITMAPFILEHEADER)
)return;
if(bf.bfType != 'MB')return;
dwSize=bf.bfSize-sizeof(BITMAPFILEHEADER);
m_hDIB=::GlobalAlloc(GHND, dwSize);
ASSERT(m_hDIB);
lpDIB=(LPSTR)::GlobalLock(m_hDIB);
ASSERT(lpDIB);
if(ar.Read(lpDIB, dwSize) != dwSize)
{
::GlobalUnlock(m_hDIB);
::GlobalFree(m_hDIB);
m_hDIB=NULL;
}
else ::GlobalUnlock(m_hDIB);
}
}
#ifdef _DEBUG
void CGDIDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CGDIDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif
|
9ecf61b0debac9c5909b98438b73dd2570f87b4a | 5161f140491b8ccddb282ef58e716d56d982e516 | /time.cpp | 911efd7630178c2d66e1690706e91a45445b2cdc | [] | no_license | lizhonglz/excerciseForProgram | 9d54cb78e8b2fb473ce51aea6c9715fdd4bc054a | ec1037afeea041ec0fbf5017099789cfdbda25e0 | refs/heads/master | 2020-03-11T03:26:06.466964 | 2018-04-16T13:57:16 | 2018-04-16T13:57:16 | 129,747,149 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 958 | cpp | time.cpp | #include "time.h"
#include<iostream>
#include<iomanip>
using namespace std;
Time::Time(int h, int m, int s)
{
setTime(h,m,s);
}
Time::~Time()
{
}
Time&Time::setTime(int h, int m, int s)
{
setHour(h);
setMinute(m);
setSecond(s);
return *this;
}
Time&Time::setHour(int h)
{
hour=(h>=0&&h<=24)?h:0;
return *this;
}
Time &Time::setMinute(int m)
{
minute=(m>=0&&m<=60)? m:0;
return *this;
}
Time&Time::setSecond(int s)
{
second=(s>=0&&s<=60)? s:0;
return *this;
}
int Time::getHour() const
{
return hour;
}
int Time::getMinute() const
{
return minute;
}
int Time::getSecond() const
{
return second;
}
void Time::printUniversal() const
{
cout<<setfill('0')<<setw(2)<<hour<<":"
<<setw(2)<<minute<<":"<<setw(2)<<second;
}
void Time::printStandard()
{
cout<<((hour==0||hour==12)?12:hour%12)
<<":"<<setfill('0')<<setw(2)<<minute<<":"<<setw(2)<<second<<(hour<12?"AM":"PM");
}
|
f03524531bcd6bc7799157140bae8dbb4d69f321 | 748514a0e8d110a7ade9365c40497ae1ae2cad56 | /Source/UnrealBattleArena/Public/Character/ArenaAbilitySystem.h | d639361068bf01f4be46a46bf36c35429d415e20 | [
"MIT"
] | permissive | jidevil/UnrealBattleArena | b55886b3c052188b8e8cf321e3d64153e879f064 | 03fd5bab3c0e987b3e0c599aaf091c0a34263448 | refs/heads/main | 2023-07-16T17:17:24.748613 | 2021-09-10T08:57:45 | 2021-09-10T08:57:45 | 399,450,084 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 784 | h | ArenaAbilitySystem.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ArenaAbilitySystem.generated.h"
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class UNREALBATTLEARENA_API UArenaAbilitySystem : public UActorComponent
{
GENERATED_BODY()
public:
UArenaAbilitySystem();
bool IsAbilityRunning(TSubclassOf<class UArenaAbility> AbilityClass);
bool AddAbility(TSubclassOf<class UArenaAbility> AbilityClass, bool bStart = true);
protected:
UFUNCTION()
void OnAbilityStarted(class UArenaAbility* Ability);
UFUNCTION()
void OnAbilityEnded(class UArenaAbility* Ability);
protected:
UPROPERTY(Replicated)
TArray<class UArenaAbility*> RunningAbilities;
};
|
d0f7556cfa59aac7e017efdaa8f47f1d195ee99f | 28f65056ec611c69bfce6d914448f286da58b000 | /rtdb/RtdbDll/TcpListener.h | 5d088850950af5c43719816b7d67021e49179d1f | [] | no_license | icprog/SmartLight | 856562f20bdc341fe26903d66ad55e3047b287d7 | 8799b5be823c046b101d8b41d79e8e7d75fb3bd9 | refs/heads/master | 2020-04-04T16:44:35.576577 | 2018-07-01T23:52:26 | 2018-07-02T00:00:56 | 156,091,413 | 0 | 4 | null | 2018-11-04T14:37:13 | 2018-11-04T14:37:13 | null | GB18030 | C++ | false | false | 1,238 | h | TcpListener.h | /////////////////////////////////////////////////////////////////////////////
// TcpListener.h: 定义一个负责在服务器上监听客户端连接请求类CTcpWorker
/////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_TCP_LISTENER_H_2004_03_02__
#define __AFX_TCP_LISTENER_H_2004_03_02__
class CTcpReceiver;
#include "MultiDataBase.h"
#define MAX_ACCEPT_COUNT 20
/////////////////////////////////////////////////////////////////////////////
class CTcpListener : public CSocketEx
{
public:
CTcpListener(CMultiDataBase * pMDB);
virtual ~CTcpListener();
CMultiDataBase* m_pMultiDataBase;
int m_nPort;
public:
CTcpReceiver* m_pTcpReceiver[MAX_ACCEPT_COUNT];
bool m_bTcpReceiverOk[MAX_ACCEPT_COUNT];
public:
bool Init(int nPort,char * pSocketAddress = NULL);
virtual bool SendCommand(int nCommand,char * pBuffer,int nBufferSize, bool bSendNow=true);
virtual bool SendCommand();
virtual void KeepLive();
private:
bool AcceptInfo(SOCKET sAccept, char *strIP, int& iUseNet);
static ThreadFuncRet ListenThread(LPVOID pListener);
bool m_bListenRun;
};
/////////////////////////////////////////////////////////////////////////////
#endif // __AFX_TCP_LISTENER_H_2004_03_02__
|
0601531a4642d53290c4c249db7f0a7449270322 | 4d3c61db53d1b043981698e8468582c6ddb14955 | /TicTac2/Amateur.h | 13ac2d253f2d7fe6af299b78c2158a915413eac9 | [] | no_license | jnisitha/TicTacToe | aa74ec66121689d44d7a9c54f0489942e31817b5 | 274954c3affea5f18eb2e034fe37809cd1bf6fb0 | refs/heads/master | 2021-01-10T09:13:15.026156 | 2016-02-29T23:44:49 | 2016-02-29T23:44:49 | 52,830,206 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 149 | h | Amateur.h | #pragma once
#include"Board.h"
#include <stdlib.h>
class Amateur {
public:
void move(Board& board, int amateurPlayer);
Amateur();
~Amateur();
};
|
797fe90063ec3977298bc9f4f6b2c6181066f8bf | a6ec75ad548c88df8b3d478919eb85653da294b3 | /Source/DungeonDeathmatch/Private/AI/Decorators/BTDecorator_CheckDistance.cpp | c41504e400dc8e7bc49e1738e93e8320ffbd9a27 | [
"MIT"
] | permissive | nik3122/Dungeon-Deathmatch | 112f2a4c636ff4d62db86772565173dca40cc589 | 0b86c613ea9bdfd974ca78db85bd7d8b4d9af37c | refs/heads/master | 2022-01-05T12:39:31.567613 | 2019-04-14T02:17:07 | 2019-04-14T02:17:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,901 | cpp | BTDecorator_CheckDistance.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "BTDecorator_CheckDistance.h"
#include "DungeonCharacter.h"
#include "AIGlobals.h"
#include <BehaviorTree/BlackboardComponent.h>
#include <BehaviorTree/Blackboard/BlackboardKeyAllTypes.h>
UBTDecorator_CheckDistance::UBTDecorator_CheckDistance(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// Accept only actors and vectors for target
Target.AddObjectFilter(this, GET_MEMBER_NAME_CHECKED(UBTDecorator_CheckDistance, Target), AActor::StaticClass());
Target.AddVectorFilter(this, GET_MEMBER_NAME_CHECKED(UBTDecorator_CheckDistance, Target));
}
bool UBTDecorator_CheckDistance::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
{
Super::CalculateRawConditionValue(OwnerComp, NodeMemory);
bool Result = false;
UBlackboardComponent* BlackboardComponent = OwnerComp.GetBlackboardComponent();
ADungeonCharacter* Character = Cast<ADungeonCharacter>(BlackboardComponent->GetValueAsObject(BLACKBOARD_KEYNAME_SELFACTOR));
if (Character)
{
FVector TargetLocation;
AActor* Actor = Cast<AActor>(BlackboardComponent->GetValueAsObject(Target.SelectedKeyName));
if (Actor)
{
TargetLocation = Actor->GetActorLocation();
}
else
{
TargetLocation = BlackboardComponent->GetValueAsVector(Target.SelectedKeyName);
}
float Distance = FVector::Distance(Character->GetActorLocation(), TargetLocation);
bool WithinMinRange = (Distance >= DistanceMinimum || DistanceMinimum < 0);
bool WithinMaxRange = (Distance <= DistanceMaximum || DistanceMaximum < 0);
Result = (WithinMinRange && WithinMaxRange);
}
return Result;
}
FString UBTDecorator_CheckDistance::GetStaticDescription() const
{
return FString::Printf(TEXT("Distance to %s >= %.2f & <= %.2f"), *Target.SelectedKeyName.ToString(), DistanceMinimum, DistanceMaximum);
}
|
569e2431f905ca701d5940dc755bc83539bc92dc | df21a8c7af8e46f7bc5c815ffe124cd30d70c3f5 | /3年前期三校合同/1.FLAG CAPTOR ROAD TO WAR/ゲーム本体/03_プロジェクト一式/tutorial2D.h | e933679dbc828f677003b903ceb92fde31cb32db | [] | no_license | Doge-Coin-Tsukae/GameProgram | 4f6b5476cb5cf773954b845a3ec18d5fa8d5b060 | fed3b8b4a58fbee94237c9f75d14721d266b6daf | refs/heads/main | 2023-02-28T22:12:41.472881 | 2021-02-12T02:42:53 | 2021-02-12T02:42:53 | 320,138,164 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 278 | h | tutorial2D.h | #pragma once
#include "gameobject.h"
class CTUTORIAL2D :public CGameObject
{
private:
CPolygon *Gamename;
public:
void Init();
void Uninit();
void Update();
void Draw();
void ChangeTexture(char* SetTextureName); //チュートリアルのテクスチャチェンジ
}; |
589886ab6a00e5dd60d3f590eb7ada442b194c03 | c68c88d8bcaf91806a5326e12c79fddd8ad26a8b | /server_gui/Graph.cpp | 16a03d2bd5736f7928e2168abcf8756d9b842f46 | [] | no_license | dilin993/MultiCameraPeopleTrackingSystem1-0-UDP | d5138c9e21a570b7f5f70a3c41f73920fff974ac | c481eedf218b982070ccf75719c1e0b574559c3c | refs/heads/master | 2021-09-04T19:16:22.767868 | 2018-01-21T16:15:58 | 2018-01-21T16:15:58 | 111,350,368 | 1 | 1 | null | 2018-01-15T12:55:49 | 2017-11-20T02:06:02 | C++ | UTF-8 | C++ | false | false | 4,058 | cpp | Graph.cpp | #include "Graph.h"
TrackedPoint::TrackedPoint(uint8_t cameraID,
cv::MatND histogram,
cv::Point2f location,
cv::Scalar color):
cameraID(cameraID),
histogram(histogram),
location(location),
color(color)
{
}
void TrackedPoint::setTimeStamp(Time timeStamp)
{
this->timeStamp = timeStamp;
}
const Time TrackedPoint::getTimeStamp()
{
return timeStamp;
}
Graph::Graph(double DIST_TH):
DIST_TH(DIST_TH)
{
}
void Graph::addNode(TrackedPoint trackedPoint)
{
nodes.push_back(trackedPoint);
}
void Graph::addNodes(std::vector<TrackedPoint> trackedPoints)
{
for(auto trackedPoint:trackedPoints)
{
nodes.push_back(trackedPoint);
}
}
std::vector<TrackedPoint> Graph::getUniquePoints()
{
std::vector<TrackedPoint> uniquePoints;
double minPosVal = DBL_MAX;
int minI,minJ;
while(minPosVal>0)
{
minPosVal = DBL_MAX;
minI = -1;
minJ = -1;
calculateCosts(); // calculate cost matrix
for(int i=0;i<nodes.size();i++)
{
for(int j=0;j<nodes.size();j++)
{
if(cost[i][j]>0 && cost[i][j]<minPosVal)
{
minI = i;
minJ = j;
minPosVal = cost[i][j];
}
}
}
if(minI>-1 && minJ>-1)
{
cv::Point2f p1 = nodes[minI].location;
cv::Point2f p2 = nodes[minJ].location;
cv::Point2f p3((p1.x+p2.x)/2,(p1.y+p2.y)/2);
cv::Mat hist = combineHistograms(nodes[minI].histogram,
nodes[minJ].histogram);
cv::Scalar color = combineColor(nodes[minI].color,
nodes[minJ].color);
TrackedPoint trp(nodes[minI].cameraID,
hist,
p3,
color);
nodes.push_back(trp);
if(minI>minJ)
{
nodes.erase(nodes.begin()+minI);
nodes.erase(nodes.begin()+minJ);
}
else
{
nodes.erase(nodes.begin()+minJ);
nodes.erase(nodes.begin()+minI);
}
}
else
{
minPosVal = 0;
}
}
for(auto const &node:nodes)
{
uniquePoints.push_back(node);
}
return uniquePoints;
}
void Graph::clear()
{
nodes.clear();
}
void Graph::calculateCosts()
{
cost.clear();
for(auto const& node1:nodes)
{
std::vector<double> row;
for(auto const& node2:nodes)
{
if((node1.cameraID)==(node2.cameraID))
row.push_back(0);
else
{
double d;
d = averageError(node1.location,
node2.location,
node1.histogram,
node2.histogram);
if(d<DIST_TH)
row.push_back(d);
else
row.push_back(0);
}
}
cost.push_back(row);
}
}
cv::Mat Graph::combineHistograms(cv::Mat &hist1, cv::Mat &hist2)
{
cv::Mat hist = 0.5*hist1 + 0.5*hist2;
return hist;
}
cv::Scalar Graph::combineColor(cv::Scalar color1, cv::Scalar color2)
{
return cv::Scalar(std::max(color1.val[0],color2.val[0]),
std::max(color1.val[1],color2.val[1]),
std::max(color1.val[2],color2.val[2]));
}
double Graph::averageError(cv::Point2f a, cv::Point2f b, cv::MatND histA, cv::MatND histB)
{
double constGaus = 1.0/sqrt(2*M_PI*var_m);
double dist = pow(a.x-b.x,2.0);
dist += pow(a.y-b.y,2.0);
dist /= (2.0*var_m);
double w_d = constGaus * exp(-dist);
double w_c = compareHist(histA,histB,cv::HISTCMP_BHATTACHARYYA);
w_c = 1 - w_c;
double w = (1-alpha)*w_d + alpha * w_c;
return 1 - w;
}
|
9aebb662c1971c368234cb82ab4a716fcea9dab0 | 6fbc2163d58c5a5f7199f1b295fe5116c25d8c84 | /analyser/outstreams.cpp | c8530e30de3b1781975df44b10b6ca8105a12796 | [
"WTFPL"
] | permissive | sensorphalanx/sc2-map-analyzer | b37fbe315a6115de25e61656da71cc97ed6a2908 | b5adb13fb72a0f0a8c278241700791e7907ad4ad | refs/heads/master | 2021-05-30T14:59:12.175120 | 2016-02-10T06:49:45 | 2016-02-10T06:49:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,085 | cpp | outstreams.cpp | #include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "utility.hpp"
#include "outstreams.hpp"
#include "Common.h"
static bool warningOrErrorReported = false;
static bool printMessages = true;
static bool printWarnings = true;
static bool printErrors = true;
static int numWarnings = 0;
static int numErrors = 0;
void printOutstreamStatus()
{
printf( "\n%d warnings and %d errors were reported.\n",
numWarnings,
numErrors );
fflush( stdout );
}
void printMessage( const char* format, ... )
{
if( !printMessages ) { return; }
va_list argptr;
va_start( argptr, format );
vfprintf( stdout, format, argptr );
va_end( argptr );
fflush( stdout );
warningOrErrorReported = true;
}
void printWarning( const char* format, ... )
{
++numWarnings;
if( !printWarnings ) { return; }
fprintf( stderr, "Warning: " );
va_list argptr;
va_start( argptr, format );
vfprintf( stderr, format, argptr );
va_end( argptr );
fflush( stderr );
}
//void printError( const char* format, ... )
//{
// ++numErrors;
// if( !printErrors ) { return; }
// fprintf( stderr, "ERROR: " );
// va_list argptr;
// va_start( argptr, format );
// vfprintf( stderr, format, argptr );
// va_end( argptr );
// fprintf( stderr,
// "Help improve the map analyzer: send map files that cause errors to %s.\n",
// adminEmail );
// fflush( stderr );
// warningOrErrorReported = true;
//}
void printError( const char* format, ... )
{
char sp[2048];
++numErrors;
va_list va_args;
va_start(va_args, format);
vsnprintf(sp, 2048, format, va_args);
va_end(va_args);
warningOrErrorReported = true;
Common::Log(&(sp[0]));
}
void enableMessages() { printMessages = true; }
void enableWarnings() { printWarnings = true; }
void enableErrors() { printErrors = true; }
void disableMessages(){ printMessages = false; }
void disableWarnings(){ printWarnings = false; }
void disableErrors() { printErrors = false; }
|
9e592d3b69e2f5b3cff39a4ae02cfe4a63b5fb18 | fedfd83c0762e084235bf5562d46f0959b318b6f | /L4 信息学奥赛一本通/0. 程序部分/ch05/第03节 字符类型和字符数组/1142.cpp | 4d6833eda219fa4bb19d348b5f1bd028242d3cde | [] | no_license | mac8088/noip | 7843b68b6eeee6b45ccfb777c3e389e56b188549 | 61ee051d3aff55b3767d0f2f7d5cc1e1c8d3cf20 | refs/heads/master | 2021-08-17T21:25:37.951477 | 2020-08-14T02:03:50 | 2020-08-14T02:03:50 | 214,208,724 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 185 | cpp | 1142.cpp | #include <iostream>
#include <cstring>
using namespace std;
int f = 1;
string s;
int main()
{
while(cin >> s)
{
if(f) f = 0;
else cout << ",";
cout << s.size();
}
return 0;
}
|
11ec0680d0da6cacdd309194c301ec9ffed78130 | 6d7f2381b8f1c5c0e0d96156ae36cac12be3017b | /codeforces/350div2/D1/main.cpp | 0e748b03089134f5aa06d6003fdd1e9c31123648 | [
"Unlicense"
] | permissive | Johniel/contests | 708ccf944d6aeb0ef0404eec47e8ff7819ea00f0 | 15d465b08cac56e394509bcf8f24764e3dc6ca7d | refs/heads/master | 2023-09-04T07:32:49.822786 | 2023-09-02T13:44:28 | 2023-09-02T13:44:50 | 48,701,889 | 0 | 0 | null | 2019-10-25T09:21:20 | 2015-12-28T16:38:38 | C++ | UTF-8 | C++ | false | false | 975 | cpp | main.cpp | #include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
os << "(" << p.first << "," << p.second << ")";
return os;
}
const int N = 1000 + 10;
int dp[N][N];
int main(int argc, char *argv[])
{
int n, k;
while (scanf("%d%d", &n, &k) == 2) {
int a[n];
for (int i = 0; i < n; ++i) {
scanf("%d", a + i);
}
int b[n];
for (int i = 0; i < n; ++i) {
scanf("%d", b + i);
}
int c = 0;
while (true) {
for (int i = 0; i < n; ++i) {
if (a[i] > b[i]) {
k -= abs(b[i] - a[i]);
b[i] = a[i];
}
}
if (k < 0) break;
++c;
for (int i = 0; i < n; ++i) {
b[i] -= a[i];
}
}
printf("%d\n", c);
}
return 0;
}
|
52f4519f04d7ab58eb23dca33a58cecc2480de2e | ae0434c20e5604a2beeb8183e577e8f1d91020f8 | /C++/CopyListWithRandomPointer.cc | 948bd4d956aa3e8ee5731490aaea94adba738f19 | [] | no_license | savadev/leetcode-4 | d0324078b9cdded4801888427ce1a13a83ef9e07 | aec4b06b3bccc640ecfe5c349ccf9e71d5a33474 | refs/heads/master | 2020-12-31T20:04:22.904153 | 2016-05-07T20:46:43 | 2016-05-07T20:46:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,163 | cc | CopyListWithRandomPointer.cc | // A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
// Return a deep copy of the list.
class Solution {
void buildNode(RandomListNode* oldNode, RandomListNode* &newNode, unordered_map<RandomListNode*, RandomListNode*>& nodesMap) {
if (nodesMap.find(oldNode) != nodesMap.end()) {
newNode = nodesMap[oldNode];
} else {
newNode = new RandomListNode(oldNode->label);
nodesMap.emplace(oldNode, newNode);
}
}
public:
RandomListNode *copyRandomList(RandomListNode *head) {
if (!head) return nullptr;
unordered_map<RandomListNode*, RandomListNode*> nodesMap;
RandomListNode* newHead = new RandomListNode(head->label);
nodesMap.emplace(head, newHead);
RandomListNode* runner = newHead;
while (head) {
if (head->next) buildNode(head->next, runner->next, nodesMap);
if (head->random) buildNode(head->random, runner->random, nodesMap);
head = head->next;
runner = runner->next;
}
return newHead;
}
};
|
7d2668351b62f6d198f65cd916c208c5fd532b0f | 189f52bf5454e724d5acc97a2fa000ea54d0e102 | /interFoam/laminar/altered/sample/8/p_rgh | 44a3e848e22eb5cce988c778b4ce047a50fd62d2 | [] | no_license | pyotr777/openfoam_samples | 5399721dd2ef57545ffce68215d09c49ebfe749d | 79c70ac5795decff086dd16637d2d063fde6ed0d | refs/heads/master | 2021-01-12T16:52:18.126648 | 2016-11-05T08:30:29 | 2016-11-05T08:30:29 | 71,456,654 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 37,562 | p_rgh | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "8";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField nonuniform List<scalar>
4608
(
0
-0.0421383
-0.0626976
-0.0722804
-0.0315839
-0.00555268
0.0521521
0.223418
1.05628
0.104594
0.599066
0.713257
2.05173
2.03064
2.04078
2.08818
2.16513
2.27923
2.383
2.64284
2.56934
2.76326
2.91115
3.18345
3.64712
3.67464
3.74506
3.85327
4.01512
4.27421
4.51711
4.73177
4.91977
5.09781
5.24506
5.31383
5.61453
5.64346
5.72189
5.8521
6.14734
7.035
7.00335
7.35376
7.6239
7.85729
8.06244
8.22467
7.86569
7.91344
8.04057
8.25156
9.24298
10.9319
10.0435
10.203
10.4998
10.7672
11.0146
11.2396
10.3354
10.4405
10.6463
10.9699
12.1621
13.33
13.6309
13.1446
13.4366
13.7372
14.0224
14.2891
12.9841
13.1755
13.4692
13.8788
14.7033
16.5311
16.6881
16.0677
16.393
16.7353
17.049
17.3457
15.7992
16.1266
16.5328
17.0509
17.6393
18.2936
18.7163
19.1488
19.4433
19.7752
20.0838
20.3805
18.7421
19.2889
19.8096
20.4505
21.1422
21.9872
22.0049
22.2306
22.4619
22.7819
23.0779
23.3527
21.7629
22.6605
23.2326
23.9759
24.762
26.1576
26.4386
25.7909
25.3953
25.6799
25.9786
26.2186
24.7196
26.2028
26.8051
27.4781
27.9977
28.2111
28.3877
28.9215
29.319
28.5388
28.7004
28.8875
26.7101
29.4933
30.0559
30.6987
31.0729
31.19
30.9547
30.2362
30.4374
30.7831
31.146
31.258
0.628088
1.46897
1.70167
1.80419
1.71713
0.931871
1.35261
1.2438
1.25853
2.05036
1.18952
1.30161
4.14573
3.3908
3.55127
3.50825
3.48896
3.48546
3.49686
3.42985
3.60354
3.90083
3.81781
3.88643
5.26626
5.46402
5.56721
5.6798
5.73966
5.73552
5.67054
5.52753
5.33396
5.20998
4.95258
4.91556
8.34603
8.51511
8.62257
8.63028
8.61998
8.53421
8.3632
8.10334
7.773
7.39978
7.02574
6.67322
11.4711
11.6463
11.7345
11.736
11.7022
11.5755
11.3421
10.9935
10.5395
10.0013
9.46736
9.05037
14.5265
14.7235
14.8929
14.9114
14.8957
14.7745
14.5322
14.1525
13.6325
12.9793
12.2871
11.6757
17.6083
17.8205
17.9796
18.0754
18.0926
18.0153
17.819
17.4966
17.0063
16.2953
15.5104
14.7427
20.6402
20.8569
21.0298
21.1513
21.2028
21.1962
21.0917
20.8638
20.5039
19.8822
19.1174
18.2539
23.5936
23.7907
23.9542
24.095
24.2034
24.2445
24.2497
24.1702
24.0003
23.6137
23.0456
22.2232
26.4272
26.5854
26.7231
26.849
26.9688
27.0992
27.2112
27.3024
27.3655
27.2982
27.154
26.588
29.0622
29.1675
29.2661
29.3677
29.5132
29.7061
29.907
30.1515
30.4407
30.7449
31.2623
31.1573
31.4072
31.5421
31.5935
31.6359
31.7252
31.9933
32.2571
32.6091
33.0329
33.6234
34.8396
35.929
1.53117
1.49998
1.47865
1.70643
1.51804
1.5533
1.55943
1.55659
1.62498
1.76817
1.7954
1.75726
3.6434
3.61578
3.61874
3.63856
3.64085
3.87353
3.86798
3.90393
3.97279
4.06198
4.15011
4.27205
5.29527
5.30666
5.37824
5.47274
5.57667
6.13386
5.85467
6.01255
6.18313
6.33246
6.49061
6.6404
7.29143
7.34013
7.46405
7.64924
7.84626
8.41156
8.27567
8.52485
8.76704
8.98975
9.21549
9.40185
9.43384
9.522
9.6959
9.941
10.303
10.6613
10.9582
11.2765
11.5779
11.8742
12.1433
12.3815
11.8096
11.94
12.1681
12.7312
13.3134
13.4319
13.815
14.1901
14.5486
14.8947
15.2
15.4754
14.4221
14.6324
14.9368
15.8334
16.33
16.4329
16.846
17.255
17.6372
17.9951
18.325
18.6121
17.2035
17.547
18.0281
18.6357
19.5139
19.6037
20.0365
20.4366
20.8108
21.151
21.4653
21.7372
20.1138
20.6321
21.2508
21.9144
22.5103
22.939
23.3379
23.6764
24.0094
24.2933
24.5851
24.8152
23.177
24.0456
24.8178
25.4454
25.8954
26.2575
26.614
26.8639
27.1402
27.333
27.5743
27.7541
26.235
27.5549
28.311
28.9469
29.2623
29.4416
29.7287
29.8489
30.0582
30.1394
30.3464
30.4747
28.4924
30.8411
31.4464
32.0181
32.2084
32.2823
32.4721
32.4333
32.5654
32.5065
32.7274
32.8213
1.85418
1.95413
2.07148
2.075
2.25435
2.41988
2.47763
2.35188
2.31139
2.30711
2.29837
2.30187
4.38624
4.46642
4.65441
4.7432
4.63992
4.60511
4.60787
4.53369
4.38122
4.25199
4.30678
4.10358
6.77663
6.82617
7.01936
6.92268
6.91982
6.85622
6.74453
6.59243
6.3862
6.14661
6.04292
6.2818
9.64945
9.79725
9.79386
9.80897
9.72895
9.57872
9.35309
9.07874
8.76401
8.42448
8.06909
7.72885
12.6601
12.8942
12.8829
12.8406
12.7555
12.5755
12.4301
12.2007
11.6272
11.0313
10.5214
10.0927
15.7027
15.8593
15.9707
16.0042
15.9432
15.7872
15.6652
15.3752
14.879
14.1839
13.326
12.7695
18.8514
19.0307
19.1516
19.1988
19.165
19.0416
18.8257
18.5379
18.0871
17.3629
16.5693
15.8191
21.9702
22.1441
22.2627
22.3216
22.3112
22.2398
22.1039
21.8798
21.5196
20.9488
20.2063
19.3395
25.0062
25.1543
25.2513
25.304
25.3032
25.2772
25.2233
25.1909
25.0628
24.7526
24.2593
23.5939
27.9153
28.0186
28.0785
28.1026
28.0902
28.084
28.1453
28.2538
28.4144
28.5391
28.5878
28.0195
30.5987
30.6673
30.6877
30.6648
30.6517
30.6142
30.7173
31.2
31.8111
32.3362
32.893
32.9721
32.9475
33.02
32.9881
32.8966
32.8672
32.7779
32.8226
33.307
34.12
35.2905
37.0125
37.9812
1.80663
1.79462
1.82035
1.65744
2.94923
1.6157
1.82912
1.9554
2.12702
2.21603
2.79395
3.21482
3.6811
3.66187
3.84514
5.30143
5.18118
4.40439
4.39952
4.39701
4.40784
4.45367
4.42914
4.59987
5.38356
5.40341
5.6724
7.76458
5.89898
5.86494
6.0384
6.16487
6.21948
8.04792
8.05928
6.78764
7.20789
7.25675
7.54452
7.70499
7.81116
8.12784
8.38486
9.30636
10.9435
10.8897
9.85213
9.48515
9.27945
9.39894
9.59253
9.87896
10.1953
10.5371
10.8457
11.5284
12.162
11.8512
12.0297
12.2607
11.5462
11.7465
12.0427
12.4236
12.8335
13.2426
13.6417
13.9657
14.3493
14.6648
14.9787
15.2808
13.9967
14.2932
14.6749
15.1687
15.669
16.1476
16.6167
17.0195
17.4181
17.7774
18.12
18.4402
16.643
17.0354
17.4578
18.0719
18.6489
19.1806
19.7342
20.1743
20.5913
20.9726
21.3134
21.6126
19.5069
20.0055
20.6163
21.3109
21.8783
22.3211
22.9318
23.3519
23.7779
24.1184
24.4265
24.7047
22.6243
23.3676
24.082
25.8599
26.7859
27.036
26.9842
26.532
26.8813
27.172
27.4075
27.6265
25.7357
26.9587
27.295
28.06
28.6372
29.7348
30.2331
29.6661
29.7751
30.0017
30.1629
30.2888
28.0345
30.378
30.4131
30.7391
31.2718
31.9407
31.9959
32.1688
32.3255
32.4515
32.5576
32.608
2.68181
2.29642
2.46712
2.64728
2.81224
2.69885
2.49195
3.09854
2.66312
2.98945
2.95157
2.88605
4.80673
4.93644
5.01736
5.12245
5.92658
5.89132
5.77081
5.44425
5.07288
4.84715
4.6519
4.62373
7.02508
7.11316
7.18729
7.25635
8.26001
8.65782
7.24046
7.70879
7.06342
7.37639
7.52916
7.44481
9.6759
9.81749
9.92489
9.94629
9.90296
9.75906
9.78071
9.81211
9.50518
9.15115
8.69717
9.04649
12.5158
12.7304
12.8843
12.9624
12.9661
12.8841
12.7598
12.5569
12.1984
11.6875
11.3363
10.8055
15.5778
15.8352
16.0322
16.1525
16.1841
16.125
15.9646
15.6789
15.337
14.7605
13.9812
13.4866
18.7472
19.014
19.2343
19.3887
19.4661
19.4329
19.2988
19.0052
18.5858
17.9989
17.2255
16.4524
21.9067
22.1672
22.3912
22.5709
22.6773
22.7029
22.6353
22.4276
22.0836
21.5031
20.7778
19.8758
24.9614
25.1911
25.4123
25.5957
25.7457
25.8175
25.8417
25.7613
25.6129
25.2187
24.7581
24.0159
27.8311
28.0118
28.1996
28.4096
28.5647
28.6998
28.8073
28.8634
28.9622
28.8688
28.9395
28.4153
30.4352
30.5763
30.7518
30.9327
31.0869
31.244
31.4327
31.6072
31.9257
32.1659
33.1312
33.0792
32.6746
32.7605
32.8685
33.1039
33.3241
33.4934
33.6687
33.9054
34.3162
34.7818
36.4754
37.8645
3.32416
3.34871
2.88685
1.53684
0.890626
1.00038
1.09034
1.24629
1.9856
2.09802
1.96176
2.03231
2.76638
2.63265
2.63132
2.68502
2.77448
2.89059
2.84989
3.42103
5.27557
3.03036
3.14391
3.25366
4.13925
4.1665
4.24062
4.35226
4.46488
4.66416
4.7653
4.70769
4.5745
4.90667
5.27782
5.69008
6.0204
6.08817
6.21969
6.3877
6.57064
7.01577
6.92845
7.14001
7.34281
7.6462
7.98166
8.29279
8.07344
8.19958
8.39845
8.64512
8.9381
9.21172
9.50476
9.83538
10.1759
10.5463
10.9176
11.355
10.326
10.5251
10.8067
11.1535
11.526
11.9247
12.337
12.7631
13.1887
13.6131
14.0142
14.3773
12.7696
13.073
13.4426
13.8892
14.3619
14.865
15.3726
15.8744
16.3533
16.8043
17.2174
17.5868
15.4034
15.8598
16.3077
16.8358
17.3934
17.9915
18.5773
19.1298
19.6266
20.0671
20.4558
20.8033
18.237
18.9198
19.4105
19.9464
20.5589
21.2467
21.898
22.4793
22.9559
23.3451
23.6651
23.9591
21.2185
22.2891
22.7551
23.1089
23.7195
24.5252
25.2482
25.8508
26.2679
26.5625
26.7609
26.9799
24.2097
25.9565
26.3164
26.1094
26.5928
27.6447
28.5066
29.113
29.3982
29.5819
29.6137
29.7633
26.4416
29.4305
29.6003
28.4122
28.6511
30.3221
31.3056
31.9678
32.1837
32.2039
32.0435
32.1684
2.19705
2.44913
2.705
1.79961
2.73306
2.45336
2.83152
2.59786
2.56333
2.86652
2.90728
2.90764
3.46533
3.58751
3.59161
3.77102
4.08998
3.93014
3.73838
3.82481
3.76637
3.65597
3.57065
3.61597
5.63045
5.88216
5.86697
6.07282
6.18884
6.14713
6.02281
5.88828
5.722
5.51709
5.35292
5.18121
8.71673
8.71027
8.88684
8.96407
8.98071
8.89072
8.71006
8.45483
8.13368
7.81137
7.46328
7.34584
11.9153
11.8066
11.9411
12.0223
12.0205
11.9057
11.6757
11.3329
10.8876
10.3842
10.0354
9.593
14.6973
14.9419
15.1299
15.2314
15.2439
15.1322
14.8904
14.5089
13.9917
13.3519
12.7117
12.5125
17.9121
18.1761
18.3801
18.5063
18.5265
18.4437
18.2309
17.8688
17.3545
16.662
15.8814
15.1263
21.1076
21.368
21.5698
21.715
21.7587
21.7195
21.571
21.2889
20.8733
20.2298
19.4745
18.594
24.2171
24.4513
24.6359
24.7828
24.8562
24.8623
24.7943
24.6376
24.4217
23.9745
23.4034
22.5334
27.1737
27.3692
27.5268
27.6815
27.7604
27.7966
27.7954
27.7515
27.7673
27.6447
27.5261
26.8654
29.8878
30.0479
30.1848
30.3368
30.4091
30.4517
30.4746
30.5131
30.7314
30.971
31.5064
31.3806
32.2505
32.3879
32.4988
32.6816
32.7438
32.7596
32.7435
32.7862
33.0979
33.6181
34.9391
36.0433
30.447
31.8403
32.0144
32.4775
32.7538
32.7654
32.4163
31.5013
31.8517
32.2662
32.6384
32.6723
31.7868
32.8859
32.9968
33.2524
33.5519
33.5039
33.2064
31.9449
32.5066
33.0098
33.499
33.4739
32.7935
33.5013
33.5154
33.6615
34.0773
33.9135
34.7044
32.0698
33.1651
33.6994
34.2646
34.1263
33.6191
34.0482
34.0072
33.9575
34.4842
34.1168
34.3646
36.2891
35.642
34.6168
34.8024
34.6529
34.2823
34.5023
34.4111
34.151
34.8093
34.2778
34.9581
35.1742
38.8544
36.2698
34.7703
34.9916
34.7678
34.855
34.7356
34.2803
35.1039
34.4574
35.6495
35.9512
38.3496
36.7373
35.524
35.5562
34.9129
35.047
34.9578
34.3616
35.3968
34.4875
36.5134
36.5748
38.2083
36.9949
36.0464
36.0048
35.6639
35.4478
35.1239
34.4013
35.6836
34.4092
37.5205
37.348
38.2804
37.2087
36.4375
36.3891
36.4589
36.1252
35.9145
34.4631
35.9269
34.2349
38.7436
38.2429
38.3593
37.3822
36.7399
36.706
37.0723
36.8271
37.2689
34.6156
35.864
33.9273
40.309
39.215
38.2473
37.4982
36.9638
36.9475
38.0225
37.5461
37.7282
35.7114
34.6885
33.2322
42.3729
40.9918
37.5414
37.5144
37.0968
37.0878
37.5028
37.3912
37.0609
42.1615
42.2389
30.5862
44.231
45.7178
37.96
37.6091
37.2212
37.1749
32.832
32.9349
32.9881
33.007
33.2086
33.5123
33.7276
34.1171
34.53
35.0037
35.777
35.7224
33.6523
33.7845
33.8123
33.88
34.0019
34.3746
34.6715
35.0064
35.371
35.73
36.1625
35.997
34.3331
34.5287
34.533
34.5697
34.7816
35.1848
35.4404
35.7862
36.119
36.3298
36.4956
36.51
34.8778
35.1728
35.1436
35.1161
35.3033
35.6912
36.1192
36.4817
36.7888
36.8249
36.759
36.9924
35.1319
35.7056
35.6773
35.6395
35.7893
36.2379
36.7359
37.0928
37.4162
37.2461
36.9321
37.3991
35.1722
35.0359
35.6664
35.872
36.0314
36.619
37.2767
37.6575
38.1113
37.6059
36.9591
37.769
35.7547
35.8337
36.3795
36.3139
36.2925
37.1811
37.9367
38.1354
38.6494
37.9198
36.8295
38.1447
36.2642
36.5409
37.133
37.032
37.0193
38.2914
38.748
38.2829
39.0869
38.1487
36.4783
38.5838
36.6863
37.1735
37.8492
37.6336
37.6793
38.6397
40.2078
38.6466
38.9599
38.0607
35.7789
39.1625
37.0301
37.7983
38.581
38.2141
38.5649
38.868
41.077
39.7067
39.8164
37.8751
34.0229
39.8576
37.2512
38.4377
39.3856
38.6649
40.3232
46.9899
44.4447
37.9726
41.0777
38.37
43.3497
40.2817
37.3679
39.0054
40.172
39.0697
39.7075
45.9239
48.1979
48.7793
38.3542
34.8002
37.7281
44.2463
32.1434
33.2598
33.4482
33.856
33.8766
33.8744
34.0357
33.9215
34.004
33.8145
34.1118
34.1987
33.3901
34.2827
34.3942
35.0971
35.2042
35.1694
35.0072
34.7269
34.7708
34.5022
34.8876
34.9715
34.369
35.0395
35.0485
35.4339
35.4995
35.5276
35.65
35.4106
35.4609
35.118
35.6422
35.654
35.1497
35.6542
35.5964
36.0413
35.9935
36.1163
36.2351
35.9804
35.8329
35.3292
36.0664
36.1401
35.7924
36.1421
36.036
36.5286
36.3679
36.4552
36.6368
36.4453
36.1609
35.5045
36.5374
36.5539
36.3069
36.5342
36.3875
36.9225
36.6221
36.783
37.0453
36.9024
36.3534
35.5021
36.97
36.8673
36.7166
36.8391
36.6679
37.3081
36.8054
36.9636
37.3153
37.2437
36.4395
35.3168
37.4001
37.0724
37.0227
37.0455
36.8958
37.6546
36.9088
37.1326
37.5939
37.5527
36.3942
34.9248
37.901
37.14
37.2246
37.1709
37.105
37.9642
36.9047
37.2476
37.9983
37.934
37.4852
34.423
38.6943
37.0464
37.207
37.1193
37.2784
38.2463
36.6924
37.2373
38.5161
38.3423
36.895
34.8436
41.3423
37.7967
36.1486
36.4317
37.2092
38.6404
36.5268
37.8927
38.8383
38.4658
35.2473
33.8793
44.0351
43.5927
36.3034
36.1532
39.3334
41.4053
36.7545
42.0124
38.5567
37.0971
31.324
32.7903
45.4437
42.1032
34.3639
34.4338
34.4058
34.2556
34.2203
34.0874
33.998
34.5999
35.505
36.628
37.8374
37.6027
35.1815
35.2764
35.4035
35.2453
35.1553
34.8629
34.6149
35.3085
36.252
37.3245
38.152
37.5815
35.8814
35.9974
35.9479
35.8833
35.787
35.5385
35.064
35.8791
36.8579
37.8862
38.4221
37.9839
36.5276
36.6808
36.5758
36.4388
36.2439
36.1033
35.3386
36.3772
37.3823
38.3438
38.6825
38.3574
37.0133
37.2083
37.1201
36.9615
36.7141
36.612
36.2342
37.5831
38.2316
38.7557
38.8975
38.6552
37.5025
37.7514
37.607
37.436
37.1612
37.099
38.1211
41.1325
40.2947
39.9241
39.0987
38.8792
37.981
38.2841
38.0568
37.8845
37.5856
37.6572
38.5881
41.7183
40.9584
40.5724
39.7246
39.0282
38.4824
38.8234
38.4784
38.3332
37.9382
38.2145
38.9169
42.014
41.4752
41.1114
40.9159
39.2588
39.0482
39.3736
38.8737
38.7785
38.2288
38.7572
40.2328
42.5518
41.9522
41.67
41.4627
40.2566
39.8935
39.9258
39.2391
39.1708
38.4568
39.4067
40.6311
43.0356
42.342
42.133
42.0968
42.9499
41.1372
40.3619
39.5292
39.5142
38.642
38.4703
40.8297
43.8572
42.7185
42.4009
42.6658
45.3183
59.568
67.4937
46.3673
39.8397
38.6505
54.3809
49.1036
43.3978
42.4541
42.2862
42.1123
41.8874
32.1809
33.0234
32.3763
32.2492
32.908
33.6946
33.7575
33.7936
33.8155
33.9309
33.9984
34.0218
33.608
34.0001
33.2626
32.7278
33.6433
34.5087
34.5954
34.5948
34.6157
34.7114
34.7493
34.7551
34.6145
34.6515
33.8853
33.2708
34.6098
35.2776
35.2016
35.1185
35.0631
35.1383
35.2059
35.2577
35.4032
35.1354
34.3733
34.4787
37.5651
37.0064
36.0787
35.6669
35.4216
35.4003
35.5757
35.7461
36.019
35.5153
34.8265
36.9027
40.18
38.0649
37.0445
36.5435
36.2982
36.3224
36.5266
36.6859
36.4929
35.8275
35.248
36.3898
40.2874
38.7348
37.7644
37.2543
37.0249
37.0846
37.3263
37.4946
36.8402
36.0731
35.5822
36.6983
40.206
39.1332
38.2947
37.7931
37.5889
37.7118
38.03
38.228
37.0551
36.2321
35.8437
36.7387
40.1029
39.5025
38.7059
38.1964
38.0197
38.2126
38.6061
38.8227
36.9816
36.2887
36.0567
36.8379
39.4979
39.8343
39.0167
38.4853
38.3351
38.6405
39.1659
39.3855
36.831
36.1664
36.2398
37.2211
38.5195
40.1621
39.2457
38.67
38.5408
38.9983
39.6977
39.9166
38.1542
35.9365
36.3272
37.9726
37.8948
40.2199
39.397
38.7521
38.6255
39.2795
40.2198
40.4292
43.2359
35.497
36.3631
38.2532
37.3655
39.0036
39.0077
38.5997
38.4831
39.3356
40.6188
40.906
34.0555
33.9438
34.17
34.4375
34.7001
34.8674
35.0637
35.279
35.5306
35.8507
36.7184
36.2989
34.807
34.8616
34.9233
35.2016
35.6442
35.7912
35.9127
36.0768
36.1958
36.377
36.7303
36.0518
35.3352
35.3415
35.4057
35.8477
36.3742
36.4571
36.673
36.7761
36.737
36.7956
36.7542
36.2873
35.8332
36.0142
36.4435
36.5021
37.123
37.308
37.2074
37.3759
37.1955
37.1324
36.8317
36.5079
36.7817
36.9571
37.3352
37.3308
37.4013
37.7758
37.7202
37.8868
37.5966
37.4058
36.9426
36.6243
37.5971
37.7771
38.1439
38.2135
38.443
38.702
38.5193
38.3592
37.9559
37.6168
37.0765
36.6701
38.2983
38.4864
38.873
39.0481
39.4146
39.7419
40.0128
39.1421
38.2945
37.7674
37.2214
36.6474
38.8945
39.1045
39.524
39.807
40.3152
40.7888
41.1583
40.7245
38.5734
37.842
37.3763
36.5491
39.4041
39.6403
40.0984
40.4847
41.1492
41.8105
42.2873
42.6968
38.8001
37.836
37.541
36.7524
39.8552
40.1051
40.5906
41.0732
41.9261
42.8064
43.4196
44.2227
40.3717
37.7639
37.6814
37.8839
40.2518
40.5157
40.994
41.5444
42.6524
43.8071
44.4555
45.0883
44.0383
37.6578
37.851
38.1329
40.3847
40.7554
41.2429
41.8487
43.1972
44.6558
44.8876
43.3019
41.7386
37.765
38.0218
38.4167
30.5464
31.9261
31.4018
32.9237
31.7056
32.4852
33.0359
33.6626
33.75
33.8643
33.7665
33.5907
31.9012
32.8325
32.1674
31.9799
40.8609
37.0307
34.8979
34.262
34.5324
34.5946
34.6784
34.3807
32.971
33.5364
32.818
32.8397
34.0226
37.4451
36.0409
34.7883
34.675
34.7098
35.0788
35.039
33.8381
34.1134
33.4328
33.3565
34.1268
37.0338
36.5619
35.656
35.5278
34.9578
34.8257
35.0155
34.5727
34.6303
33.9673
33.8233
34.5786
36.9698
37.0058
36.3619
36.2353
35.7594
35.6229
35.3184
35.2213
35.1087
34.4544
34.2546
34.8874
36.6637
37.4319
36.9501
36.8443
36.4797
36.3881
36.1623
35.8091
35.5624
34.9041
34.6492
35.3214
36.1482
37.8618
37.4652
37.3812
37.1143
37.0708
36.9189
36.4005
36.0055
35.3073
35.0057
35.5769
36.0067
38.1704
37.943
37.8751
37.6888
37.6831
37.5804
37.2276
36.5653
35.6554
35.329
35.8188
36.5586
37.8983
38.3942
38.336
38.2189
38.2411
38.1716
40.4322
38.2824
36.2083
35.5605
36.12
37.3008
37.4242
38.7646
38.7645
38.7165
38.7584
38.716
41.3942
40.094
37.2311
35.4826
36.2819
38.7663
37.4017
38.5674
39.1567
39.1777
39.2279
39.2305
39.5282
40.8536
39.2855
35.0074
35.9312
39.5557
45.1593
37.6678
39.4692
39.6062
39.6201
39.6715
33.6703
33.817
33.9348
34.1723
34.2301
34.1935
34.0984
34.0869
34.2754
34.7265
35.4457
35.2223
34.6157
34.6502
34.761
35.0639
35.1253
35.0339
34.8774
34.8076
34.8775
35.259
35.5689
35.2222
35.2182
35.4013
35.4731
35.8566
35.9273
35.7598
35.5265
35.3929
35.3295
35.6704
35.6682
35.5581
35.6349
35.8619
35.987
36.5391
36.6371
36.3317
36.0287
35.8459
35.6513
35.9873
35.7573
35.8858
35.113
35.7449
36.2585
37.2536
37.3583
36.6541
36.2405
36.2708
35.9833
36.0123
35.7362
36.1047
36.1848
36.7447
37.2443
38.6674
38.7568
37.5623
37.0391
36.9768
36.3338
35.9301
35.408
36.0083
37.0977
37.5941
38.1234
40.1346
40.2783
38.4084
37.7668
37.6278
36.6698
36.3143
35.3216
35.9697
37.9186
38.3454
38.9197
41.6474
41.8622
39.048
38.3569
38.2115
36.9607
36.7105
34.9558
36.4249
38.7035
38.9116
39.5913
43.3441
43.5914
39.4835
38.864
38.7183
37.194
37.135
34.2745
37.0322
39.474
39.2656
40.0521
45.2793
45.5532
39.6387
39.1959
39.1094
37.8684
37.8942
33.2412
37.9584
40.2574
39.8726
40.9824
47.3753
48.3982
39.6524
39.4659
39.3726
38.3714
40.1641
46.1733
43.3181
40.7193
39.4122
59.6185
61.9556
68.0938
52.4383
39.5674
39.3615
38.2412
40.4573
44.9122
47.1938
37.4389
36.8762
36.6451
35.775
40.3333
45.8276
46.6144
42.4021
38.5756
37.5885
37.4418
37.3762
38.6855
37.5003
36.8901
36.1275
34.9736
40.5969
47.0563
44.6973
38.2319
37.6979
37.6911
37.674
38.1926
37.7373
37.0436
36.3919
35.5044
36.758
31.2899
31.697
36.9879
37.4787
37.6935
37.7154
38.5677
37.6637
37.1639
36.5994
35.831
36.5208
32.5643
32.8776
36.1917
36.8247
37.1494
37.5221
38.3507
38.4238
37.2709
36.7633
36.0775
36.4426
33.4882
33.8852
36.1037
36.7663
37.1369
37.5423
38.2301
37.9178
37.7951
36.9972
36.2909
36.4145
34.2118
34.5297
36.1209
36.7582
37.1523
37.5283
38.2754
37.9451
37.4918
37.0234
36.4675
36.4431
34.7962
35.0158
36.0829
36.7062
37.1244
37.4914
38.3082
37.9856
37.5708
37.1217
36.6051
36.5326
35.294
35.4305
36.2736
36.8732
37.1413
37.4235
38.3256
38.0086
37.6243
37.197
36.72
36.4949
35.5454
35.7024
36.3472
36.7735
37.081
37.3553
38.3309
38.0203
37.6595
37.2532
36.8123
36.5545
35.8187
35.9177
36.401
36.7558
37.0536
37.2738
38.3281
38.0238
37.6817
37.2945
36.8852
36.6126
36.0345
36.0919
36.4599
36.7503
37.0148
37.1701
38.3205
38.0216
37.6944
37.3245
36.9424
36.6658
36.2031
36.2285
36.5097
36.7417
36.9628
36.9824
37.5485
39.1144
40.8511
40.3446
39.8016
40.9858
37.5699
37.9578
46.2332
48.3346
48.7423
47.1952
37.8697
39.0104
39.7419
40.3166
39.9026
40.3637
38.0972
38.1144
37.0215
40.7718
43.9612
35.2148
38.0065
38.9084
39.7488
40.0466
39.8698
39.9763
38.4335
38.304
37.5614
39.6135
41.1757
36.0327
38.3396
39.1226
39.6243
39.8849
39.7982
39.7418
38.6754
38.5074
38.0285
39.479
40.3446
36.6837
38.408
39.0969
39.258
39.3944
39.4901
39.5284
38.8491
38.6853
38.359
39.3487
39.7982
37.1113
38.4225
39.046
39.213
39.2604
39.2211
39.1683
38.8233
38.8035
38.5969
39.2272
39.4206
37.406
38.4261
38.9988
39.1722
39.2517
39.1942
39.0772
38.7589
38.7048
38.6873
39.1168
39.1513
37.6137
38.4343
38.979
39.1328
39.2063
39.1542
39.0387
38.7958
38.6323
38.5602
38.9012
38.9338
37.7651
38.4453
38.9543
39.1146
39.212
39.1349
39.0075
38.8057
38.6586
38.5434
38.614
38.5882
37.7934
38.4609
38.9526
39.0888
39.1563
39.0902
38.9757
38.8164
38.6676
38.5538
38.5144
38.2306
37.6115
38.4989
38.9662
39.0815
39.1361
39.0676
38.9505
38.7864
38.6695
38.5478
38.4619
38.1661
37.5096
38.6389
38.9948
39.0769
39.1164
39.0472
38.9329
38.7837
38.6629
38.5308
38.4092
38.1059
37.5141
36.1086
36.5862
38.5719
43.3565
36.3927
33.1312
45.8651
49.4618
41.2346
29.3981
44.6421
37.6189
36.2584
36.4227
35.9642
32.4011
32.9163
37.1477
35.3072
34.2628
30.9041
43.6955
55.6139
51.0086
36.5502
36.4234
35.8207
33.0845
32.8644
31.7636
36.9433
36.2569
35.0676
38.1825
36.5942
44.6283
36.7663
36.4991
35.826
33.6716
33.2218
31.5021
28.2167
29.5928
30.241
38.1035
37.0031
41.4125
36.9528
36.5944
35.8911
34.1637
33.6023
31.9703
29.5208
30.1132
31.1252
37.7512
36.9145
40.4419
37.1067
36.6882
35.9895
34.5795
33.9587
32.5225
30.7828
31.1688
32.3028
37.4856
36.8494
39.5746
37.2341
36.7765
36.1016
34.932
34.2899
33.0549
31.7963
32.0917
33.2213
37.2621
36.8028
38.8011
37.3381
36.857
36.2154
35.2319
34.5954
33.5487
32.6228
32.8742
33.9349
37.0924
36.7506
38.0226
37.4146
36.9299
36.3253
35.4895
34.8752
33.9973
33.3097
33.5408
34.5064
36.979
36.6596
37.312
37.3645
36.97
36.4297
35.7158
35.1323
34.4026
33.8909
34.1151
34.9814
36.909
36.5868
37.1996
37.0984
36.7701
36.4165
35.9012
35.3693
34.7698
34.3982
34.6103
35.3792
36.6946
36.553
37.1005
37.0602
36.5509
36.0892
35.6772
35.3303
34.9454
34.7003
34.7403
35.1048
35.8504
36.2971
36.5283
38.7707
41.7992
40.4442
40.0901
39.4446
37.623
38.3125
41.5233
41.7676
41.7831
41.3414
39.9201
43.6632
41.7419
40.5327
39.9217
38.9252
38.0803
38.7817
40.9396
41.3444
41.4188
40.9183
39.4993
41.8725
41.6509
40.5926
39.9902
39.1609
38.5936
39.2442
40.7164
41.0768
41.1161
40.6216
39.3379
39.7994
41.381
40.628
40.0514
39.3399
38.9534
39.5437
40.5753
40.8942
40.8457
40.3802
39.229
39.3328
40.7872
40.4833
40.0945
39.483
39.2073
39.7326
40.4854
40.7208
40.6022
40.1588
39.1214
38.5444
39.8453
39.8712
39.7789
39.4046
39.3483
39.8476
40.4061
40.5799
40.3774
39.9636
39.0381
39.2676
39.6917
39.7501
39.7149
39.5708
39.7266
40.1688
40.3611
40.4678
40.1586
39.7945
38.9853
38.8783
39.7001
39.8569
39.8726
39.7812
39.9967
40.6562
40.4937
40.3408
39.9401
39.642
38.9518
38.8374
39.7389
39.9873
40.0341
39.9789
40.2196
40.9768
40.8668
40.0746
39.7221
39.5043
38.9297
39.4613
39.844
40.1402
40.1916
40.1563
40.4131
41.1175
41.4739
40.0324
39.5406
39.3796
38.9175
39.6814
39.9804
40.1703
40.348
40.3128
40.5747
41.2562
41.9566
40.473
39.397
39.2716
38.9132
39.7318
40.2176
40.0917
40.4821
40.451
40.7081
41.3901
42.1377
41.1576
39.2491
39.1837
38.9164
36.7942
37.5986
39.2275
39.9623
37.5458
38.2151
38.6171
38.5059
38.4349
39.2997
40.8403
41.2504
37.0215
35.9337
36.2766
37.5296
37.8753
38.6189
38.8736
38.6375
38.4654
39.1782
40.6434
41.2682
37.3924
36.4206
36.3542
37.4372
37.7947
38.8738
39.1954
38.7671
38.266
38.6731
40.1151
40.6589
37.6364
36.6659
36.7416
37.8547
38.1671
39.1981
39.3715
38.9504
38.2839
38.5584
40.1814
40.8027
37.8022
36.8957
37.1164
38.5327
38.5267
39.386
39.5693
39.0186
38.2389
38.3474
40.175
40.9566
37.9459
37.5796
39.4052
40.1466
39.2221
39.6751
39.7481
39.0799
38.1215
38.1763
40.2161
41.0025
38.0816
37.5867
41.6607
41.4039
39.9486
39.6602
39.884
39.0668
37.9596
37.8895
40.3057
41.1835
38.2058
37.9211
39.8475
42.2597
40.6683
39.5224
39.9621
39.06
37.801
37.6942
40.7487
41.3591
38.3288
38.1167
39.8108
42.4285
41.327
39.3714
40.0388
39.0208
37.5887
45.7319
43.0552
41.1989
38.4366
38.2059
39.918
42.2572
41.9443
39.3805
40.0497
38.9788
43.8776
44.0308
43.4578
40.4194
38.5219
38.3434
39.5609
42.1033
42.2595
39.8288
39.6117
38.9544
39.2655
40.4524
39.4536
45.9843
38.5976
38.4839
39.374
42.1155
42.3378
40.5655
39.4993
38.9667
39.1893
40.1683
39.4718
38.4394
40.8266
40.9382
41.2722
41.7643
42.8343
44.1276
44.2131
42.4981
39.7387
38.9941
43.6996
41.4778
41.1296
41.3476
41.5617
41.8944
42.6749
43.511
43.563
42.2667
40.1313
38.4981
38.1179
38.3222
41.0424
41.4663
41.7511
42.0952
42.7091
43.2939
43.1931
42.1293
40.4216
39.1311
38.7047
38.8045
41.1181
41.5778
41.8927
42.2273
42.7115
43.109
42.9408
42.042
40.6538
39.5936
39.1555
39.1965
41.1725
41.6349
41.9996
42.3201
42.7058
42.9625
42.7554
41.9823
40.8303
39.9345
39.5066
39.5022
41.258
41.698
42.0819
42.3877
42.6933
42.8398
42.61
41.9405
40.9658
40.192
39.7827
39.7401
41.1766
41.7023
42.3069
42.4541
42.6772
42.7381
42.4943
41.9116
41.07
40.387
39.9977
39.9253
41.3256
41.7202
42.3323
42.5533
42.6558
42.6535
42.4299
41.8947
41.1482
40.5336
40.1631
40.0667
41.4013
41.6891
42.4303
42.4743
42.6367
42.5811
42.3845
41.9328
41.3194
40.7854
40.4039
40.1761
41.3617
41.6006
42.5068
42.4985
42.6107
42.5144
42.2534
41.7557
41.2171
40.7542
40.4269
40.2838
43.7603
41.8412
42.51
42.5012
42.5941
42.5447
42.2022
41.7457
41.2448
40.81
40.489
40.3245
45.4247
43.5116
42.0953
42.3648
42.5741
42.498
42.1802
41.7281
41.2609
40.8509
40.5403
40.3713
38.9106
40.1213
40.0142
51.8031
56.9029
58.7335
44.6549
38.273
38.4285
38.8837
39.3569
39.4812
39.2131
40.0235
40.0163
37.8521
40.3119
40.8435
38.2492
38.7579
38.6857
39.0084
39.4122
39.5419
39.4309
39.9998
39.9036
38.6476
40.103
40.2994
38.6853
38.969
38.9308
39.1659
39.4681
39.5314
39.6218
40.0267
39.9177
39.189
40.1035
40.1309
39.0567
39.1551
39.1179
39.2832
39.5124
39.5024
39.7819
40.0693
39.9661
39.5439
40.1045
40.05
39.321
39.3122
39.265
39.3723
39.548
39.4632
39.914
40.1147
40.0251
39.782
40.1081
40.0162
39.5034
39.4391
39.379
39.4383
39.5752
39.4188
40.0215
40.1569
40.0794
39.9391
40.1137
40.0064
39.6295
39.5367
39.4652
39.4859
39.5951
39.3683
40.1075
40.1938
40.1245
40.0416
40.1198
40.0075
39.7168
39.6089
39.5283
39.5192
39.6095
39.3139
40.1753
40.2241
40.1602
40.1086
40.1256
40.0129
39.7764
39.6599
39.5729
39.542
39.6221
39.2595
40.2277
40.2484
40.1873
40.1517
40.1303
40.0189
39.8155
39.6943
39.6025
39.5566
39.6409
39.2057
40.2687
40.2684
40.2078
40.1799
40.1344
40.0238
39.8401
39.7159
39.6078
39.4689
39.4385
39.234
40.2979
40.2826
40.2228
40.1982
40.1383
40.0288
39.8508
39.6413
39.4273
39.2536
39.2203
39.1808
39.8431
39.5055
56.7871
48.7923
41.1332
39.8234
39.9904
38.4079
38.3213
40.2672
56.707
49.5186
39.9266
40.1195
39.4302
44.8891
43.0632
41.2751
40.4533
39.3612
39.9887
40.5975
43.4187
39.8065
39.8008
39.8197
38.7627
36.934
35.8816
39.6391
41.5645
39.5772
40.4236
40.7287
41.6312
39.2257
39.6779
39.6197
38.7648
37.717
37.0387
39.7347
41.2386
39.2365
40.1304
40.7012
40.8341
39.0921
39.5675
39.4626
38.7672
38.0711
37.5051
38.8841
39.5054
38.6859
39.8327
40.5541
40.3316
39.0474
39.4725
39.3387
38.782
38.2785
37.824
38.3844
38.5686
38.2514
39.6404
40.3746
39.9943
38.9717
39.3896
39.2427
38.7958
38.4501
38.1405
38.3953
38.4515
38.199
39.4845
40.2445
39.7586
38.9382
39.3188
39.1674
38.8044
38.5942
38.4106
38.5185
38.5524
38.37
39.4156
40.0157
39.5793
38.8984
39.2545
39.1032
38.8087
38.7121
38.6305
38.6331
38.6509
38.5195
39.3479
39.8597
39.4373
38.8531
39.2458
39.0251
38.8147
38.8075
38.8092
38.7308
38.7314
38.6315
39.2811
39.7068
39.3181
38.8065
39.6712
39.1046
38.8182
38.8853
38.9586
38.8116
38.7949
38.7131
39.219
39.5654
39.2149
38.7603
39.9208
39.3871
38.5728
38.9617
39.0843
38.8765
38.8433
38.7721
39.1635
39.4398
39.1254
38.7164
38.3104
38.016
37.7004
37.3458
36.9872
36.7131
36.3347
36.3354
36.5501
36.7309
36.9045
36.6118
38.2994
38.0086
37.7019
37.3608
37.0221
36.7542
36.4375
36.4193
36.5827
36.7212
36.862
36.6548
38.2887
38.0006
37.7006
37.371
37.0495
36.7893
36.5181
36.4854
36.6093
36.7144
36.8333
36.6964
38.2786
37.9925
37.6976
37.3779
37.0708
36.819
36.5815
36.5378
36.6313
36.7107
36.8134
36.7195
38.2808
37.9973
37.7039
37.3831
37.0875
36.8437
36.6314
36.5796
36.6498
36.7093
36.7991
36.7306
38.2598
37.977
37.6898
37.3862
37.101
36.8643
36.6707
36.6131
36.6657
36.7095
36.7879
36.7366
38.2525
37.9699
37.685
37.3861
37.1103
36.8808
36.7016
36.6399
36.6794
36.7108
36.7794
36.7388
38.2456
37.9631
37.6799
37.3863
37.1175
36.8939
36.7254
36.6613
36.6905
36.7134
36.7729
36.7376
38.2392
37.9563
37.6746
37.3852
37.1222
36.9038
36.7434
36.678
36.6999
36.7161
36.7678
36.7333
38.233
37.9495
37.6689
37.3829
37.1246
36.9106
36.7564
36.6909
36.7078
36.7188
36.7635
36.7259
38.2268
37.9424
37.6629
37.3794
37.1248
36.9144
36.7648
36.7002
36.7146
36.7216
36.76
36.7153
38.2215
37.9361
37.6574
37.3754
37.1235
36.9157
36.7691
36.7057
36.7197
36.7239
36.7577
36.7027
38.9874
39.0283
39.0729
39.0974
39.0281
38.9167
38.7774
38.6537
38.5124
38.3609
38.0526
37.5067
39.0635
39.0463
39.0678
39.0792
39.0104
38.9017
38.769
38.6417
38.4916
38.3174
38.0063
37.4958
39.0485
39.05
39.0611
39.0622
38.9942
38.8878
38.7595
38.6283
38.4701
38.2785
37.9661
37.4835
39.0365
39.0482
39.0537
39.0468
38.9797
38.8752
38.7497
38.6147
38.4493
38.2442
37.9312
37.4708
39.0334
39.0454
39.0466
39.0332
38.9669
38.8639
38.7401
38.6016
38.43
38.2145
37.901
37.4583
39.0332
39.0428
39.0404
39.0216
38.956
38.8542
38.7313
38.5897
38.4127
38.1894
37.8758
37.4468
39.0338
39.041
39.0354
39.0121
38.947
38.846
38.7235
38.5793
38.398
38.1687
37.855
37.4367
39.0352
39.04
39.0317
39.0047
38.94
38.8394
38.717
38.5706
38.3859
38.1522
37.8386
37.4285
39.0376
39.04
39.0292
38.9992
38.9347
38.8345
38.7118
38.5638
38.3765
38.1398
37.8264
37.422
39.0413
39.041
39.0279
38.9955
38.9312
38.831
38.7081
38.559
38.3699
38.1313
37.818
37.4177
39.0464
39.0429
39.0275
38.9935
38.9294
38.829
38.7058
38.556
38.366
38.1264
37.8133
37.4152
39.0521
39.0451
39.0278
38.9928
38.9289
38.8282
38.7047
38.5547
38.3643
38.1245
37.8117
37.4142
37.0556
36.5515
36.0148
35.4365
34.9832
34.5747
34.3682
34.4858
34.8844
35.6301
36.1653
35.8156
37.0474
36.5512
36.031
35.4874
35.0428
34.6546
34.466
34.6036
34.9811
35.6089
36.0604
35.774
37.0386
36.5501
36.044
35.5283
35.1024
34.7499
34.585
34.7112
35.0523
35.5849
35.9756
35.8462
37.0297
36.549
36.0554
35.5625
35.1525
34.8282
34.6813
34.7965
35.1053
35.5622
35.9075
35.865
37.0209
36.5478
36.0648
35.5907
35.1946
34.8928
34.7591
34.8639
35.1452
35.5428
35.8538
35.8514
37.0128
36.5464
36.0723
35.6134
35.2292
34.9449
34.8212
34.9167
35.1754
35.527
35.8122
35.8316
37.0057
36.545
36.078
35.6314
35.2569
34.9863
34.87
34.9578
35.1984
35.5145
35.7804
35.8125
36.9998
36.5438
36.0824
35.6451
35.2784
35.0182
34.9074
34.9893
35.2159
35.5052
35.7562
35.7954
36.9951
36.5427
36.0853
35.655
35.2942
35.0416
34.935
35.0126
35.2291
35.4995
35.7382
35.7796
36.9918
36.5418
36.087
35.6613
35.3045
35.0571
34.9535
35.0288
35.2389
35.4967
35.726
35.7647
36.9897
36.541
36.0872
35.664
35.3096
35.0652
34.9636
35.0385
35.2459
35.4964
35.7194
35.7506
36.9887
36.5403
36.0865
35.664
35.3104
35.0674
34.9669
35.0428
35.2502
35.4979
35.7179
35.7378
40.2831
40.352
40.177
40.3476
40.5683
40.8132
41.5139
42.2653
41.607
39.232
39.1154
38.9249
40.4769
40.4191
40.2931
40.3104
40.5453
40.8853
41.6264
42.4269
41.8285
39.2977
39.0672
38.937
40.506
40.4619
40.3652
40.4582
40.3919
40.8815
41.7222
42.6543
41.8424
39.3185
39.0344
38.9505
40.5152
40.491
40.4138
40.5221
40.4502
40.7438
41.5374
42.8755
41.9143
39.35
39.007
38.9608
40.5252
40.5092
40.4479
40.541
40.5761
40.6067
41.2035
42.2571
41.8775
39.5417
38.9739
38.965
40.5314
40.5186
40.4693
40.5509
40.5971
40.5497
40.7466
41.2026
41.4591
39.2474
38.9297
38.9646
40.5318
40.5211
40.4809
40.554
40.5918
40.5327
40.4336
40.5392
39.9837
41.4988
38.8969
38.9598
40.5278
40.5188
40.485
40.5515
40.5853
40.5302
40.3559
40.1277
39.153
37.9563
38.8917
38.9529
40.5209
40.513
40.4835
40.5456
40.5793
40.5252
40.3427
40.0531
39.1012
38.0705
38.9082
38.9503
40.5122
40.5047
40.4774
40.5376
40.5742
40.5235
40.3372
40.0241
39.1563
38.1162
38.9051
38.9507
40.5023
40.4947
40.4676
40.5285
40.5711
40.5266
40.3406
40.0194
39.1864
38.1147
38.8873
38.9523
40.4929
40.4852
40.4567
40.5201
40.5701
40.5327
40.3491
40.0299
39.1955
38.0922
38.869
38.9546
38.6657
38.5932
39.1684
42.0684
42.4457
41.3419
39.7901
38.919
39.1434
39.9432
39.3641
38.3047
38.7263
38.6919
39.102
41.2563
42.5979
41.8558
40.0386
38.8775
39.0647
39.7581
39.2895
38.4653
38.7805
38.7953
39.139
40.3012
42.7746
42.3487
40.4591
38.8414
38.9737
39.6042
39.2254
38.5965
38.8278
38.8955
39.266
40.0572
42.873
42.8692
40.7009
38.8049
38.8688
39.4778
39.1695
38.6898
38.8677
38.9798
39.353
40.0587
41.9125
43.2021
41.1576
38.6729
38.7705
39.3746
39.1218
38.7545
38.9005
39.0447
39.4114
39.9928
40.8221
42.1589
43.9305
38.614
38.702
39.2915
39.082
38.8002
38.9271
39.0929
39.4613
40.0243
40.4759
40.7
38.8983
38.6846
38.6699
39.2245
39.05
38.8327
38.948
39.1272
39.4987
40.0428
40.4689
40.4365
38.6683
38.5996
38.6813
39.1676
39.0263
38.8561
38.9636
39.1491
39.5229
40.0565
40.4565
40.4091
38.7976
38.6491
38.6932
39.1232
39.0084
38.8717
38.9739
39.1588
39.5348
40.0685
40.4576
40.4039
38.8962
38.68
38.6945
39.0897
38.9952
38.8811
38.9787
39.1571
39.5358
40.0802
40.4769
40.4225
38.9625
38.6917
38.683
39.0654
38.9866
38.8862
38.9787
39.1477
39.5298
40.0913
40.5068
40.4591
38.9975
38.6896
38.6636
39.0504
38.9812
38.8889
39.0933
42.8995
42.5107
42.1988
42.4892
42.5133
42.1651
41.7147
41.2695
40.8796
40.5768
40.4023
39.0355
43.3252
42.3276
41.9986
41.9422
42.1283
41.9981
41.6392
41.2352
40.8649
40.5628
40.376
40.9583
42.8666
42.1525
41.9288
41.7349
41.5985
41.4182
41.1802
40.8291
40.4895
40.2234
40.0629
41.3016
42.1606
41.9722
41.8531
41.6968
41.5524
41.3404
41.0802
40.7247
40.3959
40.1493
39.9943
41.8855
41.4783
41.8045
41.7745
41.6583
41.5212
41.3138
41.0613
40.7264
40.4138
40.1712
40.01
42.1852
41.1718
41.6665
41.7032
41.6219
41.4923
41.2896
41.0434
40.7252
40.4259
40.187
40.0219
42.4459
41.1038
41.5616
41.6437
41.5897
41.4669
41.2686
41.0277
40.7229
40.4343
40.1985
40.0308
42.6077
41.4069
41.4791
41.5967
41.5626
41.4453
41.2507
41.0142
40.72
40.4397
40.2064
40.037
42.6935
41.8595
41.3839
41.5606
41.5409
41.4275
41.2359
41.0028
40.7168
40.4427
40.2114
40.0411
42.7422
42.172
41.2415
41.534
41.525
41.4137
41.2238
40.9932
40.7132
40.4436
40.2137
40.0432
42.7611
42.2494
41.2075
41.5194
41.5156
41.4036
41.2142
40.9852
40.7094
40.4424
40.2133
40.0436
42.7671
42.3255
41.3885
41.5173
41.5116
41.3972
41.2074
40.9795
40.7059
40.4402
40.2114
40.043
40.3174
40.2935
40.2337
40.2108
40.1443
39.9458
39.616
39.4162
39.3046
39.2007
39.1906
38.849
40.2725
40.2379
40.1317
39.998
39.739
39.5298
39.4547
39.3982
39.314
39.2093
39.1821
38.8642
39.915
39.7932
39.6559
39.5759
39.5207
39.4844
39.4587
39.4007
39.3219
39.2174
39.1815
38.9615
39.8538
39.7306
39.6252
39.5636
39.5262
39.4867
39.4603
39.4026
39.3284
39.2256
39.1853
39.0276
39.8654
39.7405
39.6366
39.5723
39.5298
39.4889
39.461
39.4043
39.3342
39.2336
39.1906
39.0657
39.8746
39.7488
39.6455
39.579
39.533
39.4907
39.4616
39.4058
39.3393
39.2411
39.1963
39.0913
39.8816
39.7552
39.6522
39.584
39.5354
39.4922
39.4621
39.4075
39.3441
39.248
39.202
39.1104
39.8869
39.7601
39.6573
39.5876
39.5371
39.4932
39.4626
39.4094
39.3487
39.2542
39.207
39.1244
39.8905
39.7636
39.6608
39.59
39.5382
39.494
39.4634
39.4118
39.3535
39.2597
39.2111
39.1335
39.8928
39.7658
39.6629
39.5912
39.5387
39.4944
39.4645
39.4149
39.3586
39.265
39.214
39.1379
39.8938
39.7668
39.6636
39.5915
39.5385
39.4946
39.466
39.4187
39.3644
39.2697
39.2162
39.1378
39.8939
39.7668
39.6634
39.591
39.538
39.4944
39.4676
39.4224
39.37
39.2732
39.2177
39.1343
40.1604
39.5592
38.4735
39.0472
39.1802
38.9278
38.8786
38.815
39.1157
39.3316
39.0486
38.6764
40.1075
39.5699
39.0306
38.6676
39.2516
38.9676
38.9024
38.8462
39.0756
39.2408
38.9835
38.6411
39.9858
39.5579
39.3354
37.78
39.3282
38.9936
38.9164
38.8691
39.0429
39.1664
38.9287
38.6108
39.8944
39.5494
39.4274
38.5117
39.3953
38.9995
38.9228
38.8861
39.0171
39.1116
38.9203
38.596
39.8323
39.5432
39.4232
38.9234
38.4718
38.9826
38.9263
38.8991
39.008
39.0652
38.8603
38.5733
39.7872
39.5357
39.4207
39.1346
38.1503
38.9797
38.9352
38.9241
38.9918
38.9973
38.8299
38.5511
39.7522
39.5273
39.4249
39.2643
38.3604
39.0038
38.9397
38.9329
38.9804
38.9686
38.8069
38.5375
39.7255
39.5192
39.4282
39.3237
38.7067
38.9109
38.9445
38.9327
38.9729
38.9469
38.7894
38.5267
39.705
39.5123
39.4263
39.3307
39.0368
38.7065
38.942
38.9421
38.9695
38.9316
38.776
38.5172
39.6923
39.5044
39.419
39.3403
39.2711
38.5992
38.9391
38.9486
38.9689
38.922
38.7674
38.5104
39.6878
39.4955
39.4071
39.348
39.4747
38.5681
38.937
38.9584
38.9711
38.9175
38.7626
38.5052
39.6905
39.4867
39.3942
39.3513
39.938
39.5326
38.9321
38.9688
38.9749
38.9169
38.7611
38.5016
)
;
boundaryField
{
rotor
{
type zeroGradient;
}
stator
{
type zeroGradient;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //
| |
8e56b72b8cd39aa3fac0c76ab83b181851f8b068 | 89154640716cc405b9390f2fca09508a45bbe9df | /05-产品原料/06-视频服务器/1.4G视频服务器SDK/2.厂家英码4G服务器资料/SDK程序包/SDK程序包/4000sdk/English/DemoCode/ConfigDemo/NetServerVVEye.h | 41dc28e8443b83dcd86de2aa35ad0f3f955aec68 | [] | no_license | zzfd97/07-CRAB310 | 1f046ce0a54f30630dfcb1e6f97012c07874fe33 | 10e0dd9fbcff0c241d6b59b594ca086ab6822e31 | refs/heads/master | 2021-12-14T09:21:07.628146 | 2017-04-22T03:49:18 | 2017-04-22T03:49:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,707 | h | NetServerVVEye.h | #if !defined(AFX_NETSERVERVVEYE_H__02DF8B21_B2AC_4D8E_BC7F_FA92F9B5444C__INCLUDED_)
#define AFX_NETSERVERVVEYE_H__02DF8B21_B2AC_4D8E_BC7F_FA92F9B5444C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// NetServerVVEye.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CNetServerVVEye dialog
class CNetServerVVEye : public CDialog
{
// Construction
public:
void InitDlgInfo(SDK_CONFIG_NET_VVEYE *pNetVVEyeCfg);
CNetServerVVEye(CWnd* pParent = NULL); // standard constructor
BOOL m_ensure;
SDK_CONFIG_NET_VVEYE m_netVVEyeCfg;
// Dialog Data
//{{AFX_DATA(CNetServerVVEye)
enum { IDD = IDD_CONFIG_NETSERVER_VVEye };
CButton m_checkEnable;
CButton m_checkCorp;
CString m_sDevName;
CString m_sPwd;
CString m_sServerIP;
int m_nPort;
CString m_sUserName;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNetServerVVEye)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNetServerVVEye)
afx_msg void OnCheckEnable();
afx_msg void OnCheckCorp();
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditDeviceName();
afx_msg void OnChangeEditPwd();
afx_msg void OnChangeEditServerIp();
afx_msg void OnChangeEditServerPort();
afx_msg void OnChangeEditUsername();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NETSERVERVVEYE_H__02DF8B21_B2AC_4D8E_BC7F_FA92F9B5444C__INCLUDED_)
|
c96088d3e21b5c8c0732376a9c2307ee26ca086b | 54a977bf8988c33d59b23a76b7ba26a38907834e | /SONAR_buzz.ino | 751b3b6c8cd10b47a7585e4de2ead056589be7bc | [] | no_license | Vishnulalm/Arduino-Based-Projects | 3f85a8e1d754942dd3615728fbc106ede61ba1e0 | 0357f1f91eab7a0ce7d1000cdfdf0e8fb7509f2f | refs/heads/master | 2022-11-26T15:43:23.951318 | 2020-08-01T08:50:00 | 2020-08-01T08:50:00 | 284,119,314 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | ino | SONAR_buzz.ino | int trigPin=10;
int echoPin=9;
int distance;
long duration;
void setup() {
Serial.begin(115200);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(13,OUTPUT);
}
void loop() {
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=duration*0.034/2;
if(distance<20)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
|
1f2beec19fe99ca5bca484fe6edfb250b9977210 | 9fa292d97ceb374068d355bd41097d0407d68bd3 | /src/rspf/imaging/rspfHsiRemapper.cpp | cfd8acbac5cb4e0b970e23bc2e0e1a75a0325dbf | [] | no_license | mfkiwl/rspf_v2.0 | 4d90153b92cc416663c798e05f87e348ad8792ef | f22d2707b775a4776fc8359a255f39c26ecc96a3 | refs/heads/master | 2021-05-27T04:36:34.132569 | 2013-07-16T04:04:12 | 2013-07-16T04:04:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 91,181 | cpp | rspfHsiRemapper.cpp | //*******************************************************************
// Copyright (C) 2002 ImageLinks Inc.
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description:
//
// Remapper to adjust hue, saturation and intensity.
//
//*************************************************************************
// $Id: rspfHsiRemapper.cpp 19714 2011-06-03 17:23:45Z gpotts $
#include <cstdlib>
#include <rspf/imaging/rspfHsiRemapper.h>
#include <rspf/base/rspfTrace.h>
#include <rspf/base/rspfNormRgbVector.h>
#include <rspf/base/rspfHsiVector.h>
#include <rspf/base/rspfNotifyContext.h>
#include <rspf/imaging/rspfImageDataFactory.h>
#include <rspf/base/rspfNumericProperty.h>
RTTI_DEF1(rspfHsiRemapper, "rspfHsiRemapper", rspfImageSourceFilter)
static rspfTrace traceDebug("rspfHsiRemapper:debug");
//***
// State keywords:
//***
static const char MASTER_HUE_OFFSET_KW[] = "hsi_master_hue_offset";
static const char MASTER_SATURATION_OFFSET_KW[] = "hsi_master_saturation_offset";
static const char MASTER_INTENSITY_OFFSET_KW[] = "hsi_master_intensity_offset";
static const char MASTER_INTENSITY_LOW_CLIP_KW[] = "hsi_master_intensity_low_clip";
static const char MASTER_INTENSITY_HIGH_CLIP_KW[] = "hsi_master_intensity_high_clip";
static const char RED_HUE_OFFSET_KW[] = "hsi_red_hue_offset";
static const char RED_HUE_LOW_RANGE_KW[] = "hsi_red_hue_low_range";
static const char RED_HUE_HIGH_RANGE_KW[] = "hsi_red_hue_high_range";
static const char RED_HUE_BLEND_RANGE_KW[] = "hsi_red_hue_blend_range";
static const char RED_SATURATION_OFFSET_KW[] = "hsi_red_saturation_offset";
static const char RED_INTENSITY_OFFSET_KW[] = "hsi_red_intensity_offset";
static const char YELLOW_HUE_OFFSET_KW[] = "hsi_yellow_hue_offset";
static const char YELLOW_HUE_LOW_RANGE_KW[] = "hsi_yellow_hue_low_range";
static const char YELLOW_HUE_HIGH_RANGE_KW[] = "hsi_yellow_hue_high_range";
static const char YELLOW_HUE_BLEND_RANGE_KW[] = "hsi_yellow_hue_blend_range";
static const char YELLOW_SATURATION_OFFSET_KW[] = "hsi_yellow_saturation_offset";
static const char YELLOW_INTENSITY_OFFSET_KW[] = "hsi_yellow_intensity_offset";
static const char GREEN_HUE_OFFSET_KW[] = "hsi_green_hue_offset";
static const char GREEN_HUE_LOW_RANGE_KW[] = "hsi_green_hue_low_range";
static const char GREEN_HUE_HIGH_RANGE_KW[] = "hsi_green_hue_high_range";
static const char GREEN_HUE_BLEND_RANGE_KW[] = "hsi_green_hue_blend_range";
static const char GREEN_SATURATION_OFFSET_KW[] = "hsi_green_saturation_offset";
static const char GREEN_INTENSITY_OFFSET_KW[] = "hsi_green_intensity_offset";
static const char CYAN_HUE_OFFSET_KW[] = "hsi_cyan_hue_offset";
static const char CYAN_HUE_LOW_RANGE_KW[] = "hsi_cyan_hue_low_range";
static const char CYAN_HUE_HIGH_RANGE_KW[] = "hsi_cyan_hue_high_range";
static const char CYAN_HUE_BLEND_RANGE_KW[] = "hsi_cyan_hue_blend_range";
static const char CYAN_SATURATION_OFFSET_KW[] = "hsi_cyan_saturation_offset";
static const char CYAN_INTENSITY_OFFSET_KW[] = "hsi_cyan_intensity_offset";
static const char BLUE_HUE_OFFSET_KW[] = "hsi_blue_hue_offset";
static const char BLUE_HUE_LOW_RANGE_KW[] = "hsi_blue_hue_low_range";
static const char BLUE_HUE_HIGH_RANGE_KW[] = "hsi_blue_hue_high_range";
static const char BLUE_HUE_BLEND_RANGE_KW[] = "hsi_blue_hue_blend_range";
static const char BLUE_SATURATION_OFFSET_KW[] = "hsi_blue_saturation_offset";
static const char BLUE_INTENSITY_OFFSET_KW[] = "hsi_blue_intensity_offset";
static const char MAGENTA_HUE_OFFSET_KW[] = "hsi_magenta_hue_offset";
static const char MAGENTA_HUE_LOW_RANGE_KW[] = "hsi_magenta_hue_low_range";
static const char MAGENTA_HUE_HIGH_RANGE_KW[] = "hsi_magenta_hue_high_range";
static const char MAGENTA_HUE_BLEND_RANGE_KW[] = "hsi_magenta_hue_blend_range";
static const char MAGENTA_SATURATION_OFFSET_KW[] = "hsi_magenta_saturation_offset";
static const char MAGENTA_INTENSITY_OFFSET_KW[] = "hsi_magenta_intensity_offset";
static const char WHITE_OBJECT_CLIP_KW[] = "hsi_white_object_clip";
static const double DEFAULT_BLEND = 15.0;
static const double MAX_BLEND = 30.0;
rspfHsiRemapper::rspfHsiRemapper()
:
rspfImageSourceFilter (), // base class
theTile (NULL),
theBuffer (NULL),
theNormalizedMinPix (0.0),
theMasterHueOffset (0.0),
theMasterSaturationOffset (0.0),
theMasterIntensityOffset (0.0),
theMasterIntensityLowClip (0.0),
theMasterIntensityHighClip (1.0),
theRedHueOffset (0.0),
theRedHueLowRange (-30.0),
theRedHueHighRange (30.0),
theRedHueBlendRange (DEFAULT_BLEND),
theRedSaturationOffset (0.0),
theRedIntensityOffset (0.0),
theYellowHueOffset (0.0),
theYellowHueLowRange (30.0),
theYellowHueHighRange (90.0),
theYellowHueBlendRange (DEFAULT_BLEND),
theYellowSaturationOffset (0.0),
theYellowIntensityOffset (0.0),
theGreenHueOffset (0.0),
theGreenHueLowRange (90.0),
theGreenHueHighRange (150.0),
theGreenHueBlendRange (DEFAULT_BLEND),
theGreenSaturationOffset (0.0),
theGreenIntensityOffset (0.0),
theCyanHueOffset (0.0),
theCyanHueLowRange (150.0),
theCyanHueHighRange (210.0),
theCyanHueBlendRange (DEFAULT_BLEND),
theCyanSaturationOffset (0.0),
theCyanIntensityOffset (0.0),
theBlueHueOffset (0.0),
theBlueHueLowRange (210.0),
theBlueHueHighRange (270.0),
theBlueHueBlendRange (DEFAULT_BLEND),
theBlueSaturationOffset (0.0),
theBlueIntensityOffset (0.0),
theMagentaHueOffset (0.0),
theMagentaHueLowRange (270.0),
theMagentaHueHighRange (330.0),
theMagentaHueBlendRange (DEFAULT_BLEND),
theMagentaSaturationOffset (0.0),
theMagentaIntensityOffset (0.0),
theWhiteObjectClip (1.0)
{
//***
// Set the base class "theEnableFlag" to off since no adjustments have been
// made yet.
//***
//disableSource();
theValidFlag = false;
// Construction not complete.
}
rspfHsiRemapper::~rspfHsiRemapper()
{
theTile = NULL;
if (theBuffer)
{
delete [] theBuffer;
theBuffer = NULL;
}
}
rspfRefPtr<rspfImageData> rspfHsiRemapper::getTile(
const rspfIrect& tile_rect,
rspf_uint32 resLevel)
{
if(!theInputConnection)
{
return rspfRefPtr<rspfImageData>();
}
// Fetch tile from pointer from the input source.
rspfRefPtr<rspfImageData> inputTile = theInputConnection->getTile(
tile_rect, resLevel);
// Check for remap bypass or a null tile return from input:
if (!isSourceEnabled() || !inputTile||!theValidFlag)
{
return inputTile;
}
// Check for first time through or size change.
if ( !theTile.valid() ||
tile_rect.height() != theTile->getHeight() ||
tile_rect.width() != theTile->getWidth() )
{
allocate(tile_rect);
}
//---
// Set the image rectangle of the tile.
// Note that this will resize the tiles buffers if
theTile->setImageRectangle(tile_rect);
// Get its status.
rspfDataObjectStatus tile_status = inputTile->getDataObjectStatus();
if ( (tile_status == RSPF_NULL) || (tile_status == RSPF_EMPTY) )
{
theTile->makeBlank();
return theTile;
}
double* rgbBuf[3];
const rspf_uint32 PPT = theTile->getSizePerBand(); // Pixels Per Tile
rgbBuf[0] = theBuffer;
rgbBuf[1] = &(theBuffer[PPT]);
rgbBuf[2] = &(rgbBuf[1][PPT]);
switch(inputTile->getNumberOfBands())
{
case 1:
case 2:
{
// Copy the first band only.
inputTile->copyTileBandToNormalizedBuffer(0, rgbBuf[0]);
memcpy(rgbBuf[1], rgbBuf[0], PPT*sizeof(double));
memcpy(rgbBuf[2], rgbBuf[0], PPT*sizeof(double));
break;
}
case 3:
{
inputTile->copyTileToNormalizedBuffer(theBuffer);
break;
}
default:
{
inputTile->copyTileBandToNormalizedBuffer(0, rgbBuf[0]);
inputTile->copyTileBandToNormalizedBuffer(1, rgbBuf[1]);
inputTile->copyTileBandToNormalizedBuffer(2, rgbBuf[2]);
break;
}
}
rspfNormRgbVector rgb;
rspfHsiVector hsi;
double r = 0.0;
double g = 0.0;
double b = 0.0;
double h = 0.0;
double s = 0.0;
double i = 0.0;
rspf_uint32 idx;
// Convert the rgb value to hsi and adjust values.
for (idx=0; idx<PPT; ++idx)
{
r = rgbBuf[0][idx];
g = rgbBuf[1][idx];
b = rgbBuf[2][idx];
rgb = rspfNormRgbVector(r,g,b);
hsi = rgb;
h = hsi.getH();
s = hsi.getS();
i = hsi.getI();
if(i > FLT_EPSILON)
{
double h_offset = theMasterHueOffset;
double s_offset = theMasterSaturationOffset;
double i_offset = theMasterIntensityOffset;
//***
// Note: For the purpose of checking to see if in the red range,
// make the hue negative if it's >= 315.0 and < 360.0.
// The red low and high ranges are stored in the same manner.
//***
double red_hue = h;
if (red_hue >= 315.0 && red_hue < 360.0) red_hue = red_hue - 360.0;
if ( red_hue >= theRedHueLowRange && red_hue <= theRedHueHighRange)
{
// Adjust the reds.
double bf = 1.0; // blend factor
if ( red_hue < (theRedHueLowRange + theRedHueBlendRange) )
{
bf = (red_hue - theRedHueLowRange) / theRedHueBlendRange;
}
else if ( red_hue > (theRedHueHighRange - theRedHueBlendRange) )
{
bf = (theRedHueHighRange - red_hue) / theRedHueBlendRange;
}
h_offset += (theRedHueOffset * bf);
s_offset += (theRedSaturationOffset * bf);
i_offset += (theRedIntensityOffset * bf);
}
if (h >= theYellowHueLowRange && h <= theYellowHueHighRange)
{
// Adjust the yellows.
double bf = 1.0; // blend factor
if ( h < (theYellowHueLowRange + theYellowHueBlendRange) )
{
bf = (h - theYellowHueLowRange) / theYellowHueBlendRange;
}
else if ( h > (theYellowHueHighRange - theYellowHueBlendRange) )
{
bf = (theYellowHueHighRange - h) / theYellowHueBlendRange;
}
h_offset += (theYellowHueOffset * bf);
s_offset += (theYellowSaturationOffset * bf);
i_offset += (theYellowIntensityOffset * bf);
}
if (h >= theGreenHueLowRange && h <= theGreenHueHighRange)
{
// Adjust the greens.
double bf = 1.0; // blend factor
if ( h < (theGreenHueLowRange + theGreenHueBlendRange) )
{
bf = (h - theGreenHueLowRange) / theGreenHueBlendRange;
}
else if ( h > (theGreenHueHighRange - theGreenHueBlendRange) )
{
bf = (theGreenHueHighRange - h) / theGreenHueBlendRange;
}
h_offset += (theGreenHueOffset * bf);
s_offset += (theGreenSaturationOffset * bf);
i_offset += (theGreenIntensityOffset * bf);
}
if (h >= theCyanHueLowRange && h <= theCyanHueHighRange)
{
// Adjust the cyans.
double bf = 1.0; // blend factor
if ( h < (theCyanHueLowRange + theCyanHueBlendRange) )
{
bf = (h - theCyanHueLowRange) / theCyanHueBlendRange;
}
else if ( h > (theCyanHueHighRange - theCyanHueBlendRange) )
{
bf = (theCyanHueHighRange - h) / theCyanHueBlendRange;
}
h_offset += (theCyanHueOffset * bf);
s_offset += (theCyanSaturationOffset * bf);
i_offset += (theCyanIntensityOffset * bf);
}
if (h >= theBlueHueLowRange && h <= theBlueHueHighRange)
{
// Adjust the blues.
double bf = 1.0; // blend factor
if ( h < (theBlueHueLowRange + theBlueHueBlendRange) )
{
bf = (h - theBlueHueLowRange) / theBlueHueBlendRange;
}
else if ( h > (theBlueHueHighRange - theBlueHueBlendRange) )
{
bf = (theBlueHueHighRange - h) / theBlueHueBlendRange;
}
h_offset += (theBlueHueOffset * bf);
s_offset += (theBlueSaturationOffset * bf);
i_offset += (theBlueIntensityOffset * bf);
}
if (h >= theMagentaHueLowRange && h <= theMagentaHueHighRange)
{
// Adjust the magentas.
double bf = 1.0; // blend factor
if ( h < (theMagentaHueLowRange + theMagentaHueBlendRange) )
{
bf = (h - theMagentaHueLowRange) / theMagentaHueBlendRange;
}
else if ( h > (theMagentaHueHighRange - theMagentaHueBlendRange) )
{
bf = (theMagentaHueHighRange - h) / theMagentaHueBlendRange;
}
h_offset += (theMagentaHueOffset * bf);
s_offset += (theMagentaSaturationOffset * bf);
i_offset += (theMagentaIntensityOffset * bf);
}
// Apply the hue offset.
h += h_offset;
// Make sure the hue is between 0 and 360...
if (h < 0.0) h += 360.0;
else if (h >= 360) h -= 360.0;
// Apply the saturation offset clamping/clipping to 0.0/1.0.
s += s_offset;
s = (s > 0.0 ? (s < 1.0 ? s : 1.0) : 0.0);
// Apply the intensity offset clamping/clipping to 0.0/1.0.
i += i_offset;
i = (i > 0.0 ? (i < 1.0 ? i : 1.0) : 0.0);
// Stretch the intensity channel.
// i = (i - theMasterIntensityLowClip) *
// ( 1.0 / (theMasterIntensityHighClip -
// theMasterIntensityLowClip) );
i = (i - theMasterIntensityLowClip)/(theMasterIntensityHighClip -
theMasterIntensityLowClip);
hsi.setH(h);
hsi.setS(s);
hsi.setI(i);
rgb = hsi;
r = rgb.getR();
g = rgb.getG();
b = rgb.getB();
if ( (theWhiteObjectClip < 1.0) &&
(r > theWhiteObjectClip) &&
(g > theWhiteObjectClip) &&
(b > theWhiteObjectClip) )
{
r = theWhiteObjectClip;
g = theWhiteObjectClip;
b = theWhiteObjectClip;
}
// Do min/max range check and assign back to buffer.
rgbBuf[0][idx] = r > theNormalizedMinPix ? (r < 1.0 ? r : 1.0) :
theNormalizedMinPix;
rgbBuf[1][idx] = g > theNormalizedMinPix ? (g < 1.0 ? g : 1.0) :
theNormalizedMinPix;
rgbBuf[2][idx] = b > theNormalizedMinPix ? (b < 1.0 ? b : 1.0) :
theNormalizedMinPix;
} // End of "if(i > FLT_EPSILON)"
else
{
rgbBuf[0][idx] = 0.0;
rgbBuf[1][idx] = 0.0;
rgbBuf[2][idx] = 0.0;
}
} // End of loop through pixels in a tile.
// Copy the buffer to the output tile.
theTile->copyNormalizedBufferToTile(theBuffer);
// Update the tile status.
theTile->validate();
return theTile;
}
void rspfHsiRemapper::initialize()
{
rspfImageSourceFilter::initialize();
if (theTile.valid())
{
theTile = NULL;
if(theBuffer)
{
delete []theBuffer;
theBuffer = NULL;
}
}
}
void rspfHsiRemapper::setProperty(rspfRefPtr<rspfProperty> property)
{
if(!property.valid()) return;
rspfString name = property->getName();
if(name == MASTER_HUE_OFFSET_KW)
{
setMasterHueOffset(property->valueToString().toDouble());
}
else if(name == MASTER_SATURATION_OFFSET_KW)
{
setMasterSaturationOffset(property->valueToString().toDouble());
}
else if(name == MASTER_INTENSITY_OFFSET_KW)
{
setMasterIntensityOffset(property->valueToString().toDouble());
}
else if(name == MASTER_INTENSITY_LOW_CLIP_KW)
{
setMasterIntensityLowClip(property->valueToString().toDouble());
}
else if(name == MASTER_INTENSITY_HIGH_CLIP_KW)
{
setMasterIntensityHighClip(property->valueToString().toDouble());
}
else if(name == RED_HUE_OFFSET_KW)
{
setRedHueOffset(property->valueToString().toDouble());
}
else if(name == RED_HUE_LOW_RANGE_KW)
{
setRedHueLowRange(property->valueToString().toDouble());
}
else if(name == RED_HUE_HIGH_RANGE_KW)
{
setRedHueHighRange(property->valueToString().toDouble());
}
else if(name == RED_HUE_BLEND_RANGE_KW)
{
setRedHueBlendRange(property->valueToString().toDouble());
}
else if(name == RED_SATURATION_OFFSET_KW)
{
setRedSaturationOffset(property->valueToString().toDouble());
}
else if(name == RED_INTENSITY_OFFSET_KW)
{
setRedIntensityOffset(property->valueToString().toDouble());
}
else if(name == YELLOW_HUE_OFFSET_KW)
{
setYellowHueOffset(property->valueToString().toDouble());
}
else if(name == YELLOW_HUE_LOW_RANGE_KW)
{
setYellowHueLowRange(property->valueToString().toDouble());
}
else if(name == YELLOW_HUE_HIGH_RANGE_KW)
{
setYellowHueHighRange(property->valueToString().toDouble());
}
else if(name == YELLOW_HUE_BLEND_RANGE_KW)
{
setYellowHueBlendRange(property->valueToString().toDouble());
}
else if(name == YELLOW_SATURATION_OFFSET_KW)
{
setYellowSaturationOffset(property->valueToString().toDouble());
}
else if(name == YELLOW_INTENSITY_OFFSET_KW)
{
setYellowIntensityOffset(property->valueToString().toDouble());
}
else if(name == GREEN_HUE_OFFSET_KW)
{
setGreenHueOffset(property->valueToString().toDouble());
}
else if(name == GREEN_HUE_LOW_RANGE_KW)
{
setGreenHueLowRange(property->valueToString().toDouble());
}
else if(name == GREEN_HUE_HIGH_RANGE_KW)
{
setGreenHueHighRange(property->valueToString().toDouble());
}
else if(name == GREEN_HUE_BLEND_RANGE_KW)
{
setGreenHueBlendRange(property->valueToString().toDouble());
}
else if(name == GREEN_SATURATION_OFFSET_KW)
{
setGreenSaturationOffset(property->valueToString().toDouble());
}
else if(name == GREEN_INTENSITY_OFFSET_KW)
{
setGreenIntensityOffset(property->valueToString().toDouble());
}
else if(name == CYAN_HUE_OFFSET_KW)
{
setCyanHueOffset(property->valueToString().toDouble());
}
else if(name == CYAN_HUE_LOW_RANGE_KW)
{
setCyanHueLowRange(property->valueToString().toDouble());
}
else if(name == CYAN_HUE_HIGH_RANGE_KW)
{
setCyanHueHighRange(property->valueToString().toDouble());
}
else if(name == CYAN_HUE_BLEND_RANGE_KW)
{
setCyanHueBlendRange(property->valueToString().toDouble());
}
else if(name == CYAN_SATURATION_OFFSET_KW)
{
setCyanSaturationOffset(property->valueToString().toDouble());
}
else if(name == CYAN_INTENSITY_OFFSET_KW)
{
setCyanIntensityOffset(property->valueToString().toDouble());
}
else if(name == BLUE_HUE_OFFSET_KW)
{
setBlueHueOffset(property->valueToString().toDouble());
}
else if(name == BLUE_HUE_LOW_RANGE_KW)
{
setBlueHueLowRange(property->valueToString().toDouble());
}
else if(name == BLUE_HUE_HIGH_RANGE_KW)
{
setBlueHueHighRange(property->valueToString().toDouble());
}
else if(name == BLUE_HUE_BLEND_RANGE_KW)
{
setBlueHueBlendRange(property->valueToString().toDouble());
}
else if(name == BLUE_SATURATION_OFFSET_KW)
{
setBlueSaturationOffset(property->valueToString().toDouble());
}
else if(name == BLUE_INTENSITY_OFFSET_KW)
{
setBlueIntensityOffset(property->valueToString().toDouble());
}
else if(name == MAGENTA_HUE_OFFSET_KW)
{
setMagentaHueOffset(property->valueToString().toDouble());
}
else if(name == MAGENTA_HUE_LOW_RANGE_KW)
{
setMagentaHueLowRange(property->valueToString().toDouble());
}
else if(name == MAGENTA_HUE_HIGH_RANGE_KW)
{
setMagentaHueHighRange(property->valueToString().toDouble());
}
else if(name == MAGENTA_HUE_BLEND_RANGE_KW)
{
setMagentaHueBlendRange(property->valueToString().toDouble());
}
else if(name == MAGENTA_SATURATION_OFFSET_KW)
{
setMagentaSaturationOffset(property->valueToString().toDouble());
}
else if(name == MAGENTA_INTENSITY_OFFSET_KW)
{
setMagentaIntensityOffset(property->valueToString().toDouble());
}
else if(name == WHITE_OBJECT_CLIP_KW)
{
setWhiteObjectClip(property->valueToString().toDouble());
}
else
{
rspfImageSourceFilter::setProperty(property);
}
}
rspfRefPtr<rspfProperty> rspfHsiRemapper::getProperty(const rspfString& name)const
{
rspfRefPtr<rspfProperty> result;
if(name == MASTER_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMasterHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == MASTER_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMasterSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == MASTER_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMasterIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == MASTER_INTENSITY_LOW_CLIP_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMasterIntensityLowClip), 0, 1);
result->setCacheRefreshBit();
}
else if(name == MASTER_INTENSITY_HIGH_CLIP_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMasterIntensityHighClip), 0, 1);
result->setCacheRefreshBit();
}
else if(name == RED_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == RED_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedHueLowRange), -30, 30);
result->setCacheRefreshBit();
}
else if(name == RED_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedHueHighRange), -30, 30);
result->setCacheRefreshBit();
}
else if(name == RED_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == RED_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == RED_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theRedIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == YELLOW_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == YELLOW_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowHueLowRange), 30, 90);
result->setCacheRefreshBit();
}
else if(name == YELLOW_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowHueHighRange), 30, 90);
result->setCacheRefreshBit();
}
else if(name == YELLOW_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == YELLOW_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == YELLOW_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theYellowIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == GREEN_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == GREEN_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenHueLowRange), 90, 150);
result->setCacheRefreshBit();
}
else if(name == GREEN_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenHueHighRange), 90, 150);
result->setCacheRefreshBit();
}
else if(name == GREEN_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == GREEN_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == GREEN_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theGreenIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == CYAN_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == CYAN_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanHueLowRange), 150, 210);
result->setCacheRefreshBit();
}
else if(name == CYAN_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanHueHighRange), 150, 210);
result->setCacheRefreshBit();
}
else if(name == CYAN_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == CYAN_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == CYAN_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theCyanIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == BLUE_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == BLUE_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueHueLowRange), 210, 270);
result->setCacheRefreshBit();
}
else if(name == BLUE_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueHueHighRange), 210, 270);
result->setCacheRefreshBit();
}
else if(name == BLUE_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == BLUE_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == BLUE_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theBlueIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_HUE_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaHueOffset), -180, 180);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_HUE_LOW_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaHueLowRange), 270, 330);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_HUE_HIGH_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaHueHighRange), 270, 330);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_HUE_BLEND_RANGE_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaHueBlendRange), 0, 30);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_SATURATION_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaSaturationOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == MAGENTA_INTENSITY_OFFSET_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theMagentaIntensityOffset), -1, 1);
result->setCacheRefreshBit();
}
else if(name == WHITE_OBJECT_CLIP_KW)
{
result = new rspfNumericProperty(name, rspfString::toString(theWhiteObjectClip), 0.8, 1.0);
result->setCacheRefreshBit();
}
else
{
result = rspfImageSourceFilter::getProperty(name);
}
return result;
}
void rspfHsiRemapper::getPropertyNames(std::vector<rspfString>& propertyNames)const
{
rspfImageSourceFilter::getPropertyNames(propertyNames);
propertyNames.push_back(MASTER_HUE_OFFSET_KW);
propertyNames.push_back(MASTER_SATURATION_OFFSET_KW);
propertyNames.push_back(MASTER_INTENSITY_OFFSET_KW);
propertyNames.push_back(MASTER_INTENSITY_LOW_CLIP_KW);
propertyNames.push_back(MASTER_INTENSITY_HIGH_CLIP_KW);
propertyNames.push_back(RED_HUE_OFFSET_KW);
propertyNames.push_back(RED_HUE_LOW_RANGE_KW);
propertyNames.push_back(RED_HUE_HIGH_RANGE_KW);
propertyNames.push_back(RED_HUE_BLEND_RANGE_KW);
propertyNames.push_back(RED_SATURATION_OFFSET_KW);
propertyNames.push_back(RED_INTENSITY_OFFSET_KW);
propertyNames.push_back(YELLOW_HUE_OFFSET_KW);
propertyNames.push_back(YELLOW_HUE_LOW_RANGE_KW);
propertyNames.push_back(YELLOW_HUE_HIGH_RANGE_KW);
propertyNames.push_back(YELLOW_HUE_BLEND_RANGE_KW);
propertyNames.push_back(YELLOW_SATURATION_OFFSET_KW);
propertyNames.push_back(YELLOW_INTENSITY_OFFSET_KW);
propertyNames.push_back(GREEN_HUE_OFFSET_KW);
propertyNames.push_back(GREEN_HUE_LOW_RANGE_KW);
propertyNames.push_back(GREEN_HUE_HIGH_RANGE_KW);
propertyNames.push_back(GREEN_HUE_BLEND_RANGE_KW);
propertyNames.push_back(GREEN_SATURATION_OFFSET_KW);
propertyNames.push_back(GREEN_INTENSITY_OFFSET_KW);
propertyNames.push_back(CYAN_HUE_OFFSET_KW);
propertyNames.push_back(CYAN_HUE_LOW_RANGE_KW);
propertyNames.push_back(CYAN_HUE_HIGH_RANGE_KW);
propertyNames.push_back(CYAN_HUE_BLEND_RANGE_KW);
propertyNames.push_back(CYAN_SATURATION_OFFSET_KW);
propertyNames.push_back(CYAN_INTENSITY_OFFSET_KW);
propertyNames.push_back(BLUE_HUE_OFFSET_KW);
propertyNames.push_back(BLUE_HUE_LOW_RANGE_KW);
propertyNames.push_back(BLUE_HUE_HIGH_RANGE_KW);
propertyNames.push_back(BLUE_HUE_BLEND_RANGE_KW);
propertyNames.push_back(BLUE_SATURATION_OFFSET_KW);
propertyNames.push_back(BLUE_INTENSITY_OFFSET_KW);
propertyNames.push_back(MAGENTA_HUE_OFFSET_KW);
propertyNames.push_back(MAGENTA_HUE_LOW_RANGE_KW);
propertyNames.push_back(MAGENTA_HUE_HIGH_RANGE_KW);
propertyNames.push_back(MAGENTA_HUE_BLEND_RANGE_KW);
propertyNames.push_back(MAGENTA_SATURATION_OFFSET_KW);
propertyNames.push_back(MAGENTA_INTENSITY_OFFSET_KW);
propertyNames.push_back(WHITE_OBJECT_CLIP_KW);
}
void rspfHsiRemapper::allocate(const rspfIrect& rect)
{
if(theInputConnection)
{
theTile = rspfImageDataFactory::instance()->create(this,this);
theTile->initialize();
rspf_uint32 width = rect.width();
rspf_uint32 height = rect.height();
if(theBuffer)
{
delete [] theBuffer;
theBuffer = 0;
}
rspf_uint32 size = width * height * 3; // Buffer always 3 bands.
theBuffer = new double[size];
memset(theBuffer, '\0', sizeof(double) * size);
// Get the minimum normalized pixel value.
theNormalizedMinPix = calculateMinNormValue();
}
}
bool rspfHsiRemapper::loadState(const rspfKeywordlist& kwl,
const char* prefix)
{
static const char MODULE[] = "rspfHsiRemapper::loadState()";
if (traceDebug())
{
rspfNotify(rspfNotifyLevel_DEBUG)
<< MODULE << " entering..." << endl;
}
// Make a prefix.
rspfString tmpPrefix;
if (prefix) tmpPrefix += prefix;
const char* lookupReturn;
lookupReturn = kwl.find(tmpPrefix.c_str(), MASTER_HUE_OFFSET_KW);
if(lookupReturn)
{
setMasterHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MASTER_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setMasterSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MASTER_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setMasterIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MASTER_INTENSITY_LOW_CLIP_KW);
if(lookupReturn)
{
setMasterIntensityLowClip(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MASTER_INTENSITY_HIGH_CLIP_KW);
if(lookupReturn)
{
setMasterIntensityHighClip(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_HUE_OFFSET_KW);
if(lookupReturn)
{
setRedHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setRedHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setRedHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setRedHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setRedSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), RED_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setRedIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_HUE_OFFSET_KW);
if(lookupReturn)
{
setYellowHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setYellowHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setYellowHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setYellowHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setYellowSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), YELLOW_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setYellowIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_HUE_OFFSET_KW);
if(lookupReturn)
{
setGreenHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setGreenHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setGreenHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setGreenHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setGreenSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), GREEN_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setGreenIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_HUE_OFFSET_KW);
if(lookupReturn)
{
setCyanHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setCyanHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setCyanHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setCyanHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setCyanSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), CYAN_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setCyanIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_HUE_OFFSET_KW);
if(lookupReturn)
{
setBlueHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setBlueHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setBlueHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setBlueHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setBlueSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), BLUE_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setBlueIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_HUE_OFFSET_KW);
if(lookupReturn)
{
setMagentaHueOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_HUE_LOW_RANGE_KW);
if(lookupReturn)
{
setMagentaHueLowRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_HUE_HIGH_RANGE_KW);
if(lookupReturn)
{
setMagentaHueHighRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_HUE_BLEND_RANGE_KW);
if(lookupReturn)
{
setMagentaHueBlendRange(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_SATURATION_OFFSET_KW);
if(lookupReturn)
{
setMagentaSaturationOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), MAGENTA_INTENSITY_OFFSET_KW);
if(lookupReturn)
{
setMagentaIntensityOffset(atof(lookupReturn));
}
lookupReturn = kwl.find(tmpPrefix.c_str(), WHITE_OBJECT_CLIP_KW);
if(lookupReturn)
{
setWhiteObjectClip(atof(lookupReturn));
}
//***
// Initialize the base class. Do this last so that the enable/disable
// doesn't get overridden by the "set*" methods.
//***
rspfImageSourceFilter::loadState(kwl, tmpPrefix.c_str());
if (traceDebug())
{
rspfNotify(rspfNotifyLevel_DEBUG)
<< ""
<< *this
<< "\nreturning..."
<< endl;
}
return true;
}
bool rspfHsiRemapper::saveState(rspfKeywordlist& kwl,
const char* prefix) const
{
static const char MODULE[] = "rspfHsiRemapper::saveStateTo()";
if (traceDebug())
{
rspfNotify(rspfNotifyLevel_DEBUG)
<< MODULE << "entering..." << endl;
}
// Call the base class getStateFrom.
rspfImageSourceFilter::saveState(kwl, prefix);
kwl.add(prefix, MASTER_HUE_OFFSET_KW, theMasterHueOffset);
kwl.add(prefix, MASTER_SATURATION_OFFSET_KW, theMasterSaturationOffset);
kwl.add(prefix, MASTER_INTENSITY_OFFSET_KW, theMasterIntensityOffset);
kwl.add(prefix, MASTER_INTENSITY_LOW_CLIP_KW, theMasterIntensityLowClip);
kwl.add(prefix, MASTER_INTENSITY_HIGH_CLIP_KW, theMasterIntensityHighClip);
kwl.add(prefix, RED_HUE_OFFSET_KW, theRedHueOffset);
kwl.add(prefix, RED_HUE_LOW_RANGE_KW, theRedHueLowRange);
kwl.add(prefix, RED_HUE_HIGH_RANGE_KW, theRedHueHighRange);
kwl.add(prefix, RED_HUE_BLEND_RANGE_KW, theRedHueBlendRange);
kwl.add(prefix, RED_SATURATION_OFFSET_KW, theRedSaturationOffset);
kwl.add(prefix, RED_INTENSITY_OFFSET_KW, theRedIntensityOffset);
kwl.add(prefix, YELLOW_HUE_OFFSET_KW, theYellowHueOffset);
kwl.add(prefix, YELLOW_HUE_LOW_RANGE_KW, theYellowHueLowRange);
kwl.add(prefix, YELLOW_HUE_HIGH_RANGE_KW, theYellowHueHighRange);
kwl.add(prefix, YELLOW_HUE_BLEND_RANGE_KW, theYellowHueBlendRange);
kwl.add(prefix, YELLOW_SATURATION_OFFSET_KW, theYellowSaturationOffset);
kwl.add(prefix, YELLOW_INTENSITY_OFFSET_KW, theYellowIntensityOffset);
kwl.add(prefix, GREEN_HUE_OFFSET_KW, theGreenHueOffset);
kwl.add(prefix, GREEN_HUE_LOW_RANGE_KW, theGreenHueLowRange);
kwl.add(prefix, GREEN_HUE_HIGH_RANGE_KW, theGreenHueHighRange);
kwl.add(prefix, GREEN_HUE_BLEND_RANGE_KW, theGreenHueBlendRange);
kwl.add(prefix, GREEN_SATURATION_OFFSET_KW, theGreenSaturationOffset);
kwl.add(prefix, GREEN_INTENSITY_OFFSET_KW, theGreenIntensityOffset);
kwl.add(prefix, CYAN_HUE_OFFSET_KW, theCyanHueOffset);
kwl.add(prefix, CYAN_HUE_LOW_RANGE_KW, theCyanHueLowRange);
kwl.add(prefix, CYAN_HUE_HIGH_RANGE_KW, theCyanHueHighRange);
kwl.add(prefix, CYAN_HUE_BLEND_RANGE_KW, theCyanHueBlendRange);
kwl.add(prefix, CYAN_SATURATION_OFFSET_KW, theCyanSaturationOffset);
kwl.add(prefix, CYAN_INTENSITY_OFFSET_KW, theCyanIntensityOffset);
kwl.add(prefix, BLUE_HUE_OFFSET_KW, theBlueHueOffset);
kwl.add(prefix, BLUE_HUE_LOW_RANGE_KW, theBlueHueLowRange);
kwl.add(prefix, BLUE_HUE_HIGH_RANGE_KW, theBlueHueHighRange);
kwl.add(prefix, BLUE_HUE_BLEND_RANGE_KW, theBlueHueBlendRange);
kwl.add(prefix, BLUE_SATURATION_OFFSET_KW, theBlueSaturationOffset);
kwl.add(prefix, BLUE_INTENSITY_OFFSET_KW, theBlueIntensityOffset);
kwl.add(prefix, MAGENTA_HUE_OFFSET_KW, theMagentaHueOffset);
kwl.add(prefix, MAGENTA_HUE_LOW_RANGE_KW, theMagentaHueLowRange);
kwl.add(prefix, MAGENTA_HUE_HIGH_RANGE_KW, theMagentaHueHighRange);
kwl.add(prefix, MAGENTA_HUE_BLEND_RANGE_KW, theMagentaHueBlendRange);
kwl.add(prefix, MAGENTA_SATURATION_OFFSET_KW, theMagentaSaturationOffset);
kwl.add(prefix, MAGENTA_INTENSITY_OFFSET_KW, theMagentaIntensityOffset);
kwl.add(prefix, WHITE_OBJECT_CLIP_KW, theWhiteObjectClip);
if (traceDebug())
{
rspfNotify(rspfNotifyLevel_DEBUG) << MODULE << "returning..." << endl;
}
return true;
}
void rspfHsiRemapper::resetGroup(int color_group)
{
switch (color_group)
{
case RED:
resetRed();
break;
case YELLOW:
resetYellow();
break;
case GREEN:
resetGreen();
break;
case CYAN:
resetCyan();
break;
case BLUE:
resetBlue();
break;
case MAGENTA:
resetMagenta();
break;
case ALL:
resetMaster();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setSaturationOffset NOTICE: Range error!"
<< endl;
break;
}
verifyEnabled();
}
void rspfHsiRemapper::resetAll()
{
theMasterHueOffset = 0.0;
theMasterSaturationOffset = 0.0;
theMasterIntensityOffset = 0.0;
theMasterIntensityLowClip = 0.0;
theMasterIntensityHighClip = 1.0;
theRedHueOffset = 0.0;
theRedHueLowRange = -30.0;
theRedHueHighRange = 30.0;
theRedHueBlendRange = DEFAULT_BLEND;
theRedSaturationOffset = 0.0;
theRedIntensityOffset = 0.0;
theYellowHueOffset = 0.0;
theYellowHueLowRange = 30.0;
theYellowHueHighRange = 90.0;
theYellowHueBlendRange = DEFAULT_BLEND;
theYellowSaturationOffset = 0.0;
theYellowIntensityOffset = 0.0;
theGreenHueOffset = 0.0;
theGreenHueLowRange = 90.0;
theGreenHueHighRange = 150.0;
theGreenHueBlendRange = DEFAULT_BLEND;
theGreenSaturationOffset = 0.0;
theGreenIntensityOffset = 0.0;
theCyanHueOffset = 0.0;
theCyanHueLowRange = 150.0;
theCyanHueHighRange = 210.0;
theCyanHueBlendRange = DEFAULT_BLEND;
theCyanSaturationOffset = 0.0;
theCyanIntensityOffset = 0.0;
theBlueHueOffset = 0.0;
theBlueHueLowRange = 210.0;
theBlueHueHighRange = 270.0;
theBlueHueBlendRange = DEFAULT_BLEND;
theBlueSaturationOffset = 0.0;
theBlueIntensityOffset = 0.0;
theMagentaHueOffset = 0.0;
theMagentaHueLowRange = 270.0;
theMagentaHueHighRange = 330.0;
theMagentaHueBlendRange = DEFAULT_BLEND;
theMagentaSaturationOffset = 0.0;
theMagentaIntensityOffset = 0.0;
theWhiteObjectClip = 1.0;
theValidFlag = false;
//disableSource();
}
void rspfHsiRemapper::resetMaster()
{
theMasterHueOffset = 0.0;
theMasterSaturationOffset = 0.0;
theMasterIntensityOffset = 0.0;
theMasterIntensityLowClip = 0.0;
theMasterIntensityHighClip = 1.0;
verifyEnabled();
}
void rspfHsiRemapper::resetRed()
{
theRedHueOffset = 0.0;
theRedHueLowRange = -30.0;
theRedHueHighRange = 30.0;
theRedHueBlendRange = DEFAULT_BLEND;
theRedSaturationOffset = 0.0;
theRedIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::resetYellow()
{
theYellowHueOffset = 0.0;
theYellowHueLowRange = 30.0;
theYellowHueHighRange = 90.0;
theYellowHueBlendRange = DEFAULT_BLEND;
theYellowSaturationOffset = 0.0;
theYellowIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::resetGreen()
{
theGreenHueOffset = 0.0;
theGreenHueLowRange = 90.0;
theGreenHueHighRange = 150.0;
theGreenHueBlendRange = DEFAULT_BLEND;
theGreenSaturationOffset = 0.0;
theGreenIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::resetCyan()
{
theCyanHueOffset = 0.0;
theCyanHueLowRange = 150.0;
theCyanHueHighRange = 210.0;
theCyanHueBlendRange = DEFAULT_BLEND;
theCyanSaturationOffset = 0.0;
theCyanIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::resetBlue()
{
theBlueHueOffset = 0.0;
theBlueHueLowRange = 210.0;
theBlueHueHighRange = 270.0;
theBlueHueBlendRange = DEFAULT_BLEND;
theBlueSaturationOffset = 0.0;
theBlueIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::resetMagenta()
{
theMagentaHueOffset = 0.0;
theMagentaHueLowRange = 270.0;
theMagentaHueHighRange = 330.0;
theMagentaHueBlendRange = DEFAULT_BLEND;
theMagentaSaturationOffset = 0.0;
theMagentaIntensityOffset = 0.0;
verifyEnabled();
}
void rspfHsiRemapper::verifyEnabled()
{
// Start off disabled...
//disableSource();
theValidFlag = false;
if (!theInputConnection)
{
//***
// Since this filter can be constructed with no input connection do not
// output and error, simply return.
//***
return;
}
//***
// Add all the offsets and the low clips.
// If greater than zero enable getTile method.
//***
double d = theMasterHueOffset +
theMasterSaturationOffset +
theMasterIntensityOffset +
theMasterIntensityLowClip +
theRedHueOffset +
theRedSaturationOffset +
theRedIntensityOffset +
theYellowHueOffset +
theYellowSaturationOffset +
theYellowIntensityOffset +
theGreenHueOffset +
theGreenSaturationOffset +
theGreenIntensityOffset +
theCyanHueOffset +
theCyanSaturationOffset +
theCyanIntensityOffset +
theBlueHueOffset +
theBlueSaturationOffset +
theBlueIntensityOffset +
theMagentaHueOffset +
theMagentaSaturationOffset +
theMagentaIntensityOffset;
if ( d != 0.0 ||
theMasterIntensityHighClip != 1.0 ||
theWhiteObjectClip != 1.0 )
{
theValidFlag = true;
// enableSource();
}
}
void rspfHsiRemapper::setMasterHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theMasterHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMasterHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setMasterSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theMasterSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMasterSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setMasterIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theMasterIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMasterIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setMasterIntensityLowClip(double clip)
{
if (clip >= 0.0 && clip < theMasterIntensityHighClip)
{
theMasterIntensityLowClip = clip;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMasterIntensityClip range error:"
<< "\nLow clip of " << clip << " is out of range!"
<< "\nMust be equal to or greater than 0.0 and less than"
<< "\nthe high clip of " << theMasterIntensityHighClip
<< endl;
}
}
void rspfHsiRemapper::setMasterIntensityHighClip(double clip)
{
if (clip <= 1.0 && clip > theMasterIntensityLowClip)
{
theMasterIntensityHighClip = clip;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMasterIntensityHighClip range error:"
<< "\nHigh clip of " << clip << " is out of range!"
<< "\nMust be greater than low clip of "
<< theMasterIntensityLowClip << " and less than 1.0"
<< endl;
}
}
void rspfHsiRemapper::setRedHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theRedHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setRedHueLowRange(double range)
{
//***
// Default red range: 330 - 30
// Allow 315 to 15 as long as it's less than the high range.
// Note: Store the range as a negative if it's between 315 and 360.
//***
double r = range;
double h = theRedHueHighRange;
if (r >= 315.0 && r < 360.0) r = r - 360.0;
if (h >= 315.0 && h < 360.0) h = h - 360.0;
if (r >= -45.0 && r <= 15.0 && r < h)
{
theRedHueLowRange = r;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedHueLow range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setRedHueHighRange(double range)
{
if (range == 360.0) range = 0.0;
//***
// Default red range: 330 - 30
// Allow 345 to 45 as long as it's greater than the low range.
// Note: Store the range as a negative if it's between 345 and 360.
//***
double r = range;
double l = theRedHueLowRange;
if (r >= 315.0 && r < 360.0) r = r - 360.0;
if (l >= 315.0 && l < 360.0) l = l - 360.0;
if (r >= -15.0 && r <= 45 && l < r)
{
theRedHueHighRange = r;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedHueHigh range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setRedHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theRedHueHighRange - theRedHueLowRange) / 2.0;
if (range <= half_range)
{
theRedHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theRedHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setRedSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theRedSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setRedIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theRedIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setRedIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setYellowHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theYellowHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setYellowHueLowRange(double range)
{
//***
// Default yellow range: 30 - 90
// Allow 15 to 75 as long as it's less than the high range.
//***
if ( range >= 15.0 &&
range <= 75.0 &&
range < theYellowHueHighRange )
{
theYellowHueLowRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowHueLowRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setYellowHueHighRange(double range)
{
//***
// Default yellow range: 30 - 90
// Allow 45 to 105 as long as it's greater than the low range.
//***
if ( range >= 45.0 &&
range <= 105.0 &&
range > theYellowHueLowRange )
{
theYellowHueHighRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowHueHighRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setYellowHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theYellowHueHighRange - theYellowHueLowRange) / 2.0;
if (range <= half_range)
{
theYellowHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theYellowHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setYellowSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theYellowSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setYellowIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theYellowIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setYellowIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setGreenHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theGreenHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setGreenHueLowRange(double range)
{
//***
// Default green range: 90 - 150
// Allow 75 to 135 as long as it's less than the high range.
//***
if ( range >= 75.0 &&
range <= 135.0 &&
range < theGreenHueHighRange )
{
theGreenHueLowRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenHueLowRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setGreenHueHighRange(double range)
{
//***
// Default green range: 90 - 150
// Allow 105 to 165 as long as it's greater than the low range.
//***
if ( range >= 105.0 &&
range <= 165.0 &&
range > theGreenHueLowRange )
{
theGreenHueHighRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenHueHighRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setGreenHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theGreenHueHighRange - theGreenHueLowRange) / 2.0;
if (range <= half_range)
{
theGreenHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theGreenHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setGreenSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theGreenSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setGreenIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theGreenIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setGreenIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setCyanHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theCyanHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setCyanHueLowRange(double range)
{
//***
// Default cyan range: 150 - 210
// Allow 135 to 195 as long as it's less than the high range.
//***
if ( range >= 135.0 &&
range <= 195.0 &&
range < theCyanHueHighRange )
{
theCyanHueLowRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanHueLowRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setCyanHueHighRange(double range)
{
//***
// Default cyan range: 150 - 210
// Allow 165 to 225 as long as it's greater than the low range.
//***
if ( range >= 165.0 &&
range <= 225.0 &&
range > theCyanHueLowRange )
{
theCyanHueHighRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanHueHighRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setCyanHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theCyanHueHighRange - theCyanHueLowRange) / 2.0;
if (range <= half_range)
{
theCyanHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theCyanHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setCyanSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theCyanSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setCyanIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theCyanIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setCyanIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setBlueHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theBlueHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setBlueHueLowRange(double range)
{
//***
// Default blue range: 210 - 270
// Allow 195 to 255 as long as it's less than the high range.
//***
if ( range >= 195.0 &&
range <= 255.0 &&
range < theBlueHueHighRange )
{
theBlueHueLowRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueHueLowRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setBlueHueHighRange(double range)
{
//***
// Default blue range: 210 - 270
// Allow 225 to 285 as long as it's greater than the low range.
//***
if ( range >= 225.0 &&
range <= 285.0 &&
range > theBlueHueLowRange )
{
theBlueHueHighRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueHueHighRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setBlueHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theBlueHueHighRange - theBlueHueLowRange) / 2.0;
if (range <= half_range)
{
theBlueHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theBlueHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setBlueSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theBlueSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setBlueIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theBlueIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setBlueIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setMagentaHueOffset(double offset)
{
if (offset >= -180.0 && offset <= 180.0)
{
theMagentaHueOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaHueOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -180.0 and less than"
<< "\nor equal to 180.0"
<< endl;
}
}
void rspfHsiRemapper::setMagentaHueLowRange(double range)
{
//***
// Default magenta range: 270 - 330
// Allow 255 to 315 as long as it's less than the high range.
//***
if ( range >= 255.0 &&
range <= 315.0 &&
range < theMagentaHueHighRange )
{
theMagentaHueLowRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaHueLowRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setMagentaHueHighRange(double range)
{
//***
// Default magenta range: 270 - 330
// Allow 285 to 345 as long as it's greater than the low range.
//***
if ( range >= 285.0 &&
range <= 345.0 &&
range > theMagentaHueLowRange )
{
theMagentaHueHighRange = range;
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaHueHighRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setMagentaHueBlendRange(double range)
{
//***
// Allowable range: 0.0 to 30.0 as long as it's not greater than the
// half range. If so snap it to half range.
//***
if ( range >= 0.0 &&
range <= MAX_BLEND )
{
double half_range = (theMagentaHueHighRange-theMagentaHueLowRange)/2.0;
if (range <= half_range)
{
theMagentaHueBlendRange = range;
}
else
{
// Put it in the middle of the range.
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaHueBlendRange range error:"
<< "\nRange of " << range << " is greater than the full range"
<< "\ndivided by 2!"
<< endl;
theMagentaHueBlendRange = half_range;
}
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaHueBlendRange range error:"
<< "\nRange of " << range << " is out of range!"
<< endl;
}
}
void rspfHsiRemapper::setMagentaSaturationOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theMagentaSaturationOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaSaturationOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
void rspfHsiRemapper::setMagentaIntensityOffset(double offset)
{
if (offset >= -1.0 && offset <= 1.0)
{
theMagentaIntensityOffset = offset;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "rspfHsiRemapper::setMagentaIntensityOffset range error:"
<< "\nOffset of " << offset << " is out of range!"
<< "\nMust be equal to or greater than -1.0 and less than"
<< "\nor equal to 1.0"
<< endl;
}
}
double rspfHsiRemapper::calculateMinNormValue()
{
static const char MODULE[] = "rspfHsiRemapper::calculateMinNormValue";
if (traceDebug())
{
rspfNotify(rspfNotifyLevel_DEBUG) << MODULE << " Entered..." << endl;
}
if (!theTile)
{
rspfNotify(rspfNotifyLevel_WARN)
<< MODULE << " ERROR:"
<< "\nClass not initialized!"
<< endl;
return 0.0;
}
double min_pix = theTile->getMinPix(0);
double max_pix = theTile->getMaxPix(0);
for (rspf_uint32 band=1; band<theTile->getNumberOfBands(); ++band)
{
if (min_pix != theTile->getMinPix(band))
{
rspfNotify(rspfNotifyLevel_WARN)
<< MODULE << " Warning:"
<< "\nMixed minimum values for bands..."
<< endl;
}
if (max_pix != theTile->getMaxPix(band))
{
rspfNotify(rspfNotifyLevel_WARN) << " Warning:"
<< "\nMixed maximum values for bands..."
<< endl;
}
}
if (min_pix < 0.0)
{
//
// Assigning some arbituary number for float data.
// This should really come from the normalizer (rspfImageData) of
// the data.
//
return RSPF_DEFAULT_MIN_PIX_NORM_DOUBLE;
}
return (min_pix / max_pix);
}
rspf_uint32 rspfHsiRemapper::getNumberOfOutputBands() const
{
if (isSourceEnabled()&&theValidFlag) // Always rgb tile out...
{
return 3;
}
// Filter bypassed so getTile will return input tile.
return rspfImageSourceFilter::getNumberOfInputBands();
}
double rspfHsiRemapper::getMasterHueOffset () const
{
return theMasterHueOffset;
}
double rspfHsiRemapper::getMasterSaturationOffset() const
{
return theMasterSaturationOffset;
}
double rspfHsiRemapper::getMasterIntensityOffset() const
{
return theMasterIntensityOffset;
}
double rspfHsiRemapper::getMasterIntensityLowClip() const
{
return theMasterIntensityLowClip;
}
double rspfHsiRemapper::getMasterIntensityHighClip() const
{
return theMasterIntensityHighClip;
}
double rspfHsiRemapper::getRedHueOffset() const
{
return theRedHueOffset;
}
double rspfHsiRemapper::getRedHueLowRange() const
{
return theRedHueLowRange;
}
double rspfHsiRemapper::getRedHueHighRange() const
{
return theRedHueHighRange;
}
double rspfHsiRemapper::getRedHueBlendRange() const
{
return theRedHueBlendRange;
}
double rspfHsiRemapper::getRedSaturationOffset() const
{
return theRedSaturationOffset;
}
double rspfHsiRemapper::getRedIntensityOffset() const
{
return theRedIntensityOffset;
}
double rspfHsiRemapper::getYellowHueOffset () const
{
return theYellowHueOffset;
}
double rspfHsiRemapper::getYellowHueLowRange() const
{
return theYellowHueLowRange;
}
double rspfHsiRemapper::getYellowHueHighRange() const
{
return theYellowHueHighRange;
}
double rspfHsiRemapper::getYellowHueBlendRange() const
{
return theYellowHueBlendRange;
}
double rspfHsiRemapper::getYellowSaturationOffset() const
{
return theYellowSaturationOffset;
}
double rspfHsiRemapper::getYellowIntensityOffset() const
{
return theYellowIntensityOffset;
}
double rspfHsiRemapper::getGreenHueOffset () const
{
return theGreenHueOffset;
}
double rspfHsiRemapper::getGreenHueLowRange() const
{
return theGreenHueLowRange;
}
double rspfHsiRemapper::getGreenHueHighRange() const
{
return theGreenHueHighRange;
}
double rspfHsiRemapper::getGreenHueBlendRange() const
{
return theGreenHueBlendRange;
}
double rspfHsiRemapper::getGreenSaturationOffset() const
{
return theGreenSaturationOffset;
}
double rspfHsiRemapper::getGreenIntensityOffset() const
{
return theGreenIntensityOffset;
}
double rspfHsiRemapper::getCyanHueOffset () const
{
return theCyanHueOffset;
}
double rspfHsiRemapper::getCyanHueLowRange() const
{
return theCyanHueLowRange;
}
double rspfHsiRemapper::getCyanHueHighRange() const
{
return theCyanHueHighRange;
}
double rspfHsiRemapper::getCyanHueBlendRange() const
{
return theCyanHueBlendRange;
}
double rspfHsiRemapper::getCyanSaturationOffset() const
{
return theCyanSaturationOffset;
}
double rspfHsiRemapper::getCyanIntensityOffset() const
{
return theCyanIntensityOffset;
}
double rspfHsiRemapper::getBlueHueOffset () const
{
return theBlueHueOffset;
}
double rspfHsiRemapper::getBlueHueLowRange() const
{
return theBlueHueLowRange;
}
double rspfHsiRemapper::getBlueHueHighRange() const
{
return theBlueHueHighRange;
}
double rspfHsiRemapper::getBlueHueBlendRange() const
{
return theBlueHueBlendRange;
}
double rspfHsiRemapper::getBlueSaturationOffset() const
{
return theBlueSaturationOffset;
}
double rspfHsiRemapper::getBlueIntensityOffset() const
{
return theBlueIntensityOffset;
}
double rspfHsiRemapper::getMagentaHueOffset () const
{
return theMagentaHueOffset;
}
double rspfHsiRemapper::getMagentaHueLowRange() const
{
return theMagentaHueLowRange;
}
double rspfHsiRemapper::getMagentaHueHighRange() const
{
return theMagentaHueHighRange;
}
double rspfHsiRemapper::getMagentaHueBlendRange() const
{
return theMagentaHueBlendRange;
}
double rspfHsiRemapper::getMagentaSaturationOffset() const
{
return theMagentaSaturationOffset;
}
double rspfHsiRemapper::getMagentaIntensityOffset() const
{
return theMagentaIntensityOffset;
}
void rspfHsiRemapper::setHueOffset(int color_group, double offset)
{
switch (color_group)
{
case RED:
setRedHueOffset(offset);
break;
case YELLOW:
setYellowHueOffset(offset);
break;
case GREEN:
setGreenHueOffset(offset);
break;
case CYAN:
setCyanHueOffset(offset);
break;
case BLUE:
setBlueHueOffset(offset);
break;
case MAGENTA:
setMagentaHueOffset(offset);
break;
case ALL:
setMasterHueOffset(offset);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setHueOffset NOTICE: Range error!" << endl;
}
}
void rspfHsiRemapper::setHueLowRange(int color_group, double range)
{
switch (color_group)
{
case RED:
setRedHueLowRange(range);
break;
case YELLOW:
setYellowHueLowRange(range);
break;
case GREEN:
setGreenHueLowRange(range);
break;
case CYAN:
setCyanHueLowRange(range);
break;
case BLUE:
setBlueHueLowRange(range);
break;
case MAGENTA:
setMagentaHueLowRange(range);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setHueLowRange NOTICE: Range error!"
<< endl;
}
}
void rspfHsiRemapper::setHueHighRange(int color_group, double range)
{
switch (color_group)
{
case RED:
setRedHueHighRange(range);
break;
case YELLOW:
setYellowHueHighRange(range);
break;
case GREEN:
setGreenHueHighRange(range);
break;
case CYAN:
setCyanHueHighRange(range);
break;
case BLUE:
setBlueHueHighRange(range);
break;
case MAGENTA:
setMagentaHueHighRange(range);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setHueHighRange NOTICE: Range error!"
<< endl;
}
}
void rspfHsiRemapper::setHueBlendRange(int color_group, double range)
{
switch (color_group)
{
case RED:
setRedHueBlendRange(range);
break;
case YELLOW:
setYellowHueBlendRange(range);
break;
case GREEN:
setGreenHueBlendRange(range);
break;
case CYAN:
setCyanHueBlendRange(range);
break;
case BLUE:
setBlueHueBlendRange(range);
break;
case MAGENTA:
setMagentaHueBlendRange(range);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setHueBlendRange NOTICE: Range error!"
<< endl;
}
}
void rspfHsiRemapper::setSaturationOffset(int color_group, double offset)
{
switch (color_group)
{
case RED:
setRedSaturationOffset(offset);
break;
case YELLOW:
setYellowSaturationOffset(offset);
break;
case GREEN:
setGreenSaturationOffset(offset);
break;
case CYAN:
setCyanSaturationOffset(offset);
break;
case BLUE:
setBlueSaturationOffset(offset);
break;
case MAGENTA:
setMagentaSaturationOffset(offset);
break;
case ALL:
setMasterSaturationOffset(offset);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setSaturationOffset NOTICE: Range error!"
<< endl;
break;
}
}
void rspfHsiRemapper::setIntensityOffset(int color_group, double offset)
{
switch (color_group)
{
case RED:
setRedIntensityOffset(offset);
break;
case YELLOW:
setYellowIntensityOffset(offset);
break;
case GREEN:
setGreenIntensityOffset(offset);
break;
case CYAN:
setCyanIntensityOffset(offset);
break;
case BLUE:
setBlueIntensityOffset(offset);
break;
case MAGENTA:
setMagentaIntensityOffset(offset);
break;
case ALL:
setMasterIntensityOffset(offset);
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::setIntensityOffset NOTICE: Range error!"
<< endl;
break;
}
}
double rspfHsiRemapper::getHueOffset(int color_group) const
{
switch (color_group)
{
case RED:
return getRedHueOffset();
break;
case YELLOW:
return getYellowHueOffset();
break;
case GREEN:
return getGreenHueOffset();
break;
case CYAN:
return getCyanHueOffset();
break;
case BLUE:
return getBlueHueOffset();
break;
case MAGENTA:
return getMagentaHueOffset();
break;
case ALL:
return getMasterHueOffset();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getHueOffset NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
double rspfHsiRemapper::getHueLowRange(int color_group) const
{
switch (color_group)
{
case RED:
return getRedHueLowRange();
break;
case YELLOW:
return getYellowHueLowRange();
break;
case GREEN:
return getGreenHueLowRange();
break;
case CYAN:
return getCyanHueLowRange();
break;
case BLUE:
return getBlueHueLowRange();
break;
case MAGENTA:
return getMagentaHueLowRange();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getHueLowRange NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
double rspfHsiRemapper::getHueHighRange(int color_group) const
{
switch (color_group)
{
case RED:
return getRedHueHighRange();
break;
case YELLOW:
return getYellowHueHighRange();
break;
case GREEN:
return getGreenHueHighRange();
break;
case CYAN:
return getCyanHueHighRange();
break;
case BLUE:
return getBlueHueHighRange();
break;
case MAGENTA:
return getMagentaHueHighRange();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getHueHighRange NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
double rspfHsiRemapper::getHueBlendRange(int color_group) const
{
switch (color_group)
{
case RED:
return getRedHueBlendRange();
break;
case YELLOW:
return getYellowHueBlendRange();
break;
case GREEN:
return getGreenHueBlendRange();
break;
case CYAN:
return getCyanHueBlendRange();
break;
case BLUE:
return getBlueHueBlendRange();
break;
case MAGENTA:
return getMagentaHueBlendRange();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getHueBlendRange NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
double rspfHsiRemapper::getSaturationOffset(int color_group) const
{
switch (color_group)
{
case RED:
return getRedSaturationOffset();
break;
case YELLOW:
return getYellowSaturationOffset();
break;
case GREEN:
return getGreenSaturationOffset();
break;
case CYAN:
return getCyanSaturationOffset();
break;
case BLUE:
return getBlueSaturationOffset();
break;
case MAGENTA:
return getMagentaSaturationOffset();
break;
case ALL:
return getMasterSaturationOffset();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getSaturationOffset NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
double rspfHsiRemapper::getIntensityOffset(int color_group) const
{
switch (color_group)
{
case RED:
return getRedIntensityOffset();
break;
case YELLOW:
return getYellowIntensityOffset();
break;
case GREEN:
return getGreenIntensityOffset();
break;
case CYAN:
return getCyanIntensityOffset();
break;
case BLUE:
return getBlueIntensityOffset();
break;
case MAGENTA:
return getMagentaIntensityOffset();
break;
case ALL:
return getMasterIntensityOffset();
break;
default:
rspfNotify(rspfNotifyLevel_NOTICE)
<< "rspfHsiRemapper::getIntensityOffset NOTICE: Range error!"
<< endl;
break;
}
return 0.0;
}
void rspfHsiRemapper::setWhiteObjectClip(double clip)
{
if ( (clip >= .8) && (clip <= 1.0) )
{
theWhiteObjectClip = clip;
verifyEnabled();
}
else
{
rspfNotify(rspfNotifyLevel_WARN)
<< "HsiRemapper::setWhiteObjectClip range error:"
<< "\nClip of " << clip << " is out of range!"
<< "\nMust be between .8 and 1.0"
<< endl;
}
}
double rspfHsiRemapper::getWhiteObjectClip() const
{
return theWhiteObjectClip;
}
void rspfHsiRemapper::resetWhiteObjectClip()
{
theWhiteObjectClip = 1.0;
verifyEnabled();
}
rspfString rspfHsiRemapper::getLongName()const
{
return rspfString("HSI Remapper, filter with controls for all HSI(Hue, Saturation, and Intensity) adjustments.");
}
rspfString rspfHsiRemapper::getShortName()const
{
return rspfString("HSI Remapper");
}
ostream& rspfHsiRemapper::print(ostream& os) const
{
os << setiosflags(ios::fixed) << setprecision(2)
<< "\nrspfHsiRemapper:"
<< "\ntheEnableFlag: " << theEnableFlag
<< "\ntheMasterHueOffset: " << theMasterHueOffset
<< "\ntheMasterSaturationOffset: " << theMasterSaturationOffset
<< "\ntheMasterIntensityOffset: " << theMasterIntensityOffset
<< "\ntheMasterIntensityLowClip: " << theMasterIntensityLowClip
<< "\ntheMasterIntensityHighClip: " << theMasterIntensityHighClip
<< "\ntheRedHueOffset: " << theRedHueOffset
<< "\ntheRedHueLowRange: " << theRedHueLowRange
<< "\ntheRedHueHighRange: " << theRedHueHighRange
<< "\ntheRedSaturationOffset: " << theRedSaturationOffset
<< "\ntheRedIntensityOffset: " << theRedIntensityOffset
<< "\ntheYellowHueOffset: " << theYellowHueOffset
<< "\ntheYellowHueLowRange: " << theYellowHueLowRange
<< "\ntheYellowHueHighRange: " << theYellowHueHighRange
<< "\ntheYellowSaturationOffset: " << theYellowSaturationOffset
<< "\ntheYellowIntensityOffset: " << theYellowIntensityOffset
<< "\ntheGreenHueOffset: " << theGreenHueOffset
<< "\ntheGreenHueLowRange: " << theGreenHueLowRange
<< "\ntheGreenHueHighRange: " << theGreenHueHighRange
<< "\ntheGreenSaturationOffset: " << theGreenSaturationOffset
<< "\ntheGreenIntensityOffset: " << theGreenIntensityOffset
<< "\ntheCyanHueOffset: " << theCyanHueOffset
<< "\ntheCyanHueLowRange: " << theCyanHueLowRange
<< "\ntheCyanHueHighRange: " << theCyanHueHighRange
<< "\ntheCyanSaturationOffset: " << theCyanSaturationOffset
<< "\ntheCyanIntensityOffset: " << theCyanIntensityOffset
<< "\ntheBlueHueOffset: " << theBlueHueOffset
<< "\ntheBlueHueLowRange: " << theBlueHueLowRange
<< "\ntheBlueHueHighRange: " << theBlueHueHighRange
<< "\ntheBlueSaturationOffset: " << theBlueSaturationOffset
<< "\ntheBlueIntensityOffset: " << theBlueIntensityOffset
<< "\ntheMagentaHueOffset: " << theMagentaHueOffset
<< "\ntheMagentaHueLowRange: " << theMagentaHueLowRange
<< "\ntheMagentaHueHighRange: " << theMagentaHueHighRange
<< "\ntheMagentaSaturationOffset: " << theMagentaSaturationOffset
<< "\ntheMagentaIntensityOffset: " << theMagentaIntensityOffset
<< "\ntheWhiteObjectClip: " << theWhiteObjectClip
<< endl;
return os;
}
ostream& operator<<(ostream& os, const rspfHsiRemapper& hr)
{
return hr.print(os);
}
|
c7c3c6b3ca9c32cf4b3fca3db8e046456b39b205 | 879fb3581f03b5c17dd90c68b45751712fbcd671 | /lib/semantics/Categorical_event.cpp | 394536231e07f02fd3d6a57810de163f82dd078b | [] | no_license | ivilab/kjb | 9f970e1ce16188f72f0edb34394e474ca83a9f2b | 238be8bc3c9018d4365741e56310067a52b715f9 | refs/heads/master | 2020-06-14T07:33:17.166805 | 2019-07-30T16:47:29 | 2019-07-30T16:47:29 | 194,946,614 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 320 | cpp | Categorical_event.cpp | /*!
* @file Categorical_event.cpp
*
* @author Colin Dawson
* $Id: Categorical_event.cpp 17097 2014-07-05 00:13:22Z cdawson $
*/
#include "semantics/Categorical_event.h"
namespace semantics
{
std::ostream& operator<<(std::ostream& os, const Categorical_event_base& e)
{
e.print_to(os);
return os;
}
};
|
bd77137ed4d347fb6cb099baac206d4caf331073 | 2b00f77cbb9f93a8ee77a0375a3f160e55c5b8cb | /05-SceneManager/Animation.h | 6642bc235c5e480cbcbfa01bb1e58afda6667619 | [] | no_license | dungdna2000/gamedev-intro-tutorials | 562a9279e9cb9b4eeef7d53f08427a45ed061bf2 | a51d470a30619a32a597d8a6e54112ccfbf12802 | refs/heads/master | 2023-06-07T21:29:56.704076 | 2023-05-25T10:10:53 | 2023-05-25T10:10:53 | 148,815,341 | 54 | 66 | null | 2023-05-25T14:20:10 | 2018-09-14T16:32:20 | C++ | UTF-8 | C++ | false | false | 478 | h | Animation.h | #pragma once
#include <Windows.h>
#include <unordered_map>
#include "Sprites.h"
#include "AnimationFrame.h"
using namespace std;
class CAnimation
{
ULONGLONG lastFrameTime;
int defaultTime;
int currentFrame;
vector<LPANIMATION_FRAME> frames;
public:
CAnimation(int defaultTime = 100) { this->defaultTime = defaultTime; lastFrameTime = -1; currentFrame = -1; }
void Add(int spriteId, DWORD time = 0);
void Render(float x, float y);
};
typedef CAnimation* LPANIMATION; |
cb2d2b28aa878acab908fd936c54ca8d44e55ed6 | aee5e113d4739740fa5dbe2acf62218f824ff13c | /latest/lib/bitmap.cc | e227832f4c4eefbb50b97a6bad7b82083216db50 | [
"BSD-3-Clause"
] | permissive | hlitz/stamp_libitm_excitevm | 0ea8d2655678f4ca6299d38c95b9ab04ee4a2b05 | cda1a76c01e18ae7e51650d6921630fdee499de9 | refs/heads/master | 2020-05-17T01:23:04.717961 | 2015-06-29T20:18:35 | 2015-06-29T20:18:35 | 32,036,335 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,515 | cc | bitmap.cc | /* =============================================================================
*
* bitmap.c
*
* =============================================================================
*
* Copyright (C) Stanford University, 2006. All Rights Reserved.
* Author: Chi Cao Minh
*
* =============================================================================
*
* For the license of bayes/sort.h and bayes/sort.c, please see the header
* of the files.
*
* ------------------------------------------------------------------------
*
* For the license of kmeans, please see kmeans/LICENSE.kmeans
*
* ------------------------------------------------------------------------
*
* For the license of ssca2, please see ssca2/COPYRIGHT
*
* ------------------------------------------------------------------------
*
* For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
* header of the files.
*
* ------------------------------------------------------------------------
*
* For the license of lib/rbtree.h and lib/rbtree.c, please see
* lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
*
* ------------------------------------------------------------------------
*
* Unless otherwise noted, the following license applies to STAMP files:
*
* Copyright (c) 2007, Stanford University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Stanford University 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 STANFORD UNIVERSITY ``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 STANFORD UNIVERSITY 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.
*
* =============================================================================
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "bitmap.h"
#include "tm.h"
#include "utility.h"
#include "tm_transition.h"
#define NUM_BIT_PER_BYTE (8L)
#define NUM_BIT_PER_WORD (sizeof(unsigned long) * NUM_BIT_PER_BYTE)
/* =============================================================================
* bitmap_alloc
* -- Returns NULL on failure
* =============================================================================
*/
TM_SAFE
bitmap_t*
bitmap_alloc (long numBit)
{
bitmap_t* bitmapPtr;
bitmapPtr = (bitmap_t*)malloc(sizeof(bitmap_t));
if (bitmapPtr == NULL) {
return NULL;
}
bitmapPtr->numBit = numBit;
long numWord = DIVIDE_AND_ROUND_UP(numBit, NUM_BIT_PER_WORD);
bitmapPtr->numWord = numWord;
bitmapPtr->bits = (unsigned long*)malloc(numWord * sizeof(unsigned long));
if (bitmapPtr->bits == NULL) {
free(bitmapPtr);
return NULL;
}
//memset(bitmapPtr->bits, 0, (numWord * sizeof(ulong_t)));
int i;
for (i = 0; i < bitmapPtr->numWord; i++) {
bitmapPtr->bits[i] = 0;
}
return bitmapPtr;
}
/* =============================================================================
* bitmap_free
* =============================================================================
*/
TM_SAFE
void
bitmap_free (bitmap_t* bitmapPtr)
{
free(bitmapPtr->bits);
free(bitmapPtr);
}
/* =============================================================================
* bitmap_set
* -- Sets ith bit to 1
* -- Returns true on success, else false
* =============================================================================
*/
TM_SAFE
bool
bitmap_set (bitmap_t* bitmapPtr, long i)
{
if ((i < 0) || (i >= bitmapPtr->numBit))
return false;
bitmapPtr->bits[i/NUM_BIT_PER_WORD] |= (1UL << (i % NUM_BIT_PER_WORD));
return true;
}
/* =============================================================================
* bitmap_clear
* -- Clears ith bit to 0
* -- Returns true on success, else false
* =============================================================================
*/
TM_SAFE
bool
bitmap_clear (bitmap_t* bitmapPtr, long i)
{
if ((i < 0) || (i >= bitmapPtr->numBit))
return false;
bitmapPtr->bits[i/NUM_BIT_PER_WORD] &= ~(1UL << (i % NUM_BIT_PER_WORD));
return true;
}
/* =============================================================================
* bitmap_clearAll
* -- Clears all bit to 0
* =============================================================================
*/
TM_SAFE
void
bitmap_clearAll (bitmap_t* bitmapPtr)
{
//memset(bitmapPtr->bits, 0, (bitmapPtr->numWord * sizeof(ulong_t)));
int i;
for (i = 0; i < bitmapPtr->numWord; i++) {
bitmapPtr->bits[i] = 0;
}
}
/* =============================================================================
* bitmap_isClear
* -- Returns true if ith bit is clear, else false
* =============================================================================
*/
TM_SAFE
bool
bitmap_isClear (bitmap_t* bitmapPtr, long i)
{
if ((i >= 0) && (i < bitmapPtr->numBit) &&
!(bitmapPtr->bits[i/NUM_BIT_PER_WORD] & (1UL << (i % NUM_BIT_PER_WORD)))) {
return true;
}
return false;
}
/* =============================================================================
* bitmap_isSet
* -- Returns true if ith bit is set, else false
* =============================================================================
*/
TM_SAFE
bool
bitmap_isSet (bitmap_t* bitmapPtr, long i)
{
if ((i >= 0) && (i < bitmapPtr->numBit) &&
(bitmapPtr->bits[i/NUM_BIT_PER_WORD] & (1UL << (i % NUM_BIT_PER_WORD)))) {
return true;
}
return false;
}
/* =============================================================================
* bitmap_findClear
* -- Returns index of first clear bit
* -- If start index is negative, will start from beginning
* -- If all bits are set, returns -1
* =============================================================================
*/
TM_SAFE
long
bitmap_findClear (bitmap_t* bitmapPtr, long startIndex)
{
long i;
long numBit = bitmapPtr->numBit;
unsigned long* bits = bitmapPtr->bits;
for (i = MAX(startIndex, 0); i < numBit; i++) {
if (!(bits[i/NUM_BIT_PER_WORD] & (1UL << (i % NUM_BIT_PER_WORD)))) {
return i;
}
}
return -1;
}
/* =============================================================================
* bitmap_findSet
* -- Returns index of first set bit
* -- If start index is negative, will start from beginning
* -- If all bits are clear, returns -1
* =============================================================================
*/
TM_SAFE
long
bitmap_findSet (bitmap_t* bitmapPtr, long startIndex)
{
long i;
long numBit = bitmapPtr->numBit;
unsigned long* bits = bitmapPtr->bits;
for (i = MAX(startIndex, 0); i < numBit; i++) {
if (bits[i/NUM_BIT_PER_WORD] & (1UL << (i % NUM_BIT_PER_WORD))) {
return i;
}
}
return -1;
}
/* =============================================================================
* bitmap_getNumClear
* =============================================================================
*/
TM_SAFE
long
bitmap_getNumClear (bitmap_t* bitmapPtr)
{
long numBit = bitmapPtr->numBit;
return (numBit - bitmap_getNumSet(bitmapPtr));
}
/* =============================================================================
* bitmap_getNumSet
* =============================================================================
*/
TM_SAFE
long
bitmap_getNumSet (bitmap_t* bitmapPtr)
{
long i;
long numBit = bitmapPtr->numBit;
unsigned long* bits = bitmapPtr->bits;
long count = 0;
for (i = 0; i < numBit; i++) {
if (bits[i/NUM_BIT_PER_WORD] & (1UL << (i % NUM_BIT_PER_WORD))) {
count++;
}
}
return count;
}
/* =============================================================================
* bitmap_copy
* =============================================================================
*/
TM_SAFE
void
bitmap_copy (bitmap_t* dstPtr, bitmap_t* srcPtr)
{
assert(dstPtr->numBit == srcPtr->numBit);
memcpy(dstPtr->bits, srcPtr->bits, (dstPtr->numWord * sizeof(unsigned long)));
}
/* =============================================================================
* bitmap_toggleAll
* =============================================================================
*/
TM_SAFE
void
bitmap_toggleAll (bitmap_t* bitmapPtr)
{
unsigned long* bits = bitmapPtr->bits;
long numWord = bitmapPtr->numWord;
long w;
for (w = 0; w < numWord; w++) {
bits[w] ^= (unsigned long)(-1L);
}
}
/* =============================================================================
* TEST_BITMAP
* =============================================================================
*/
#ifdef TEST_BITMAP
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
bitmap_t* bitmapPtr;
long numBit = 320;
long i;
long j;
srand(0);
puts("Starting...");
bitmapPtr = bitmap_alloc(numBit);
assert(bitmapPtr->numBit == numBit);
assert(bitmapPtr->numWord == (DIVIDE_AND_ROUND_UP(numBit, NUM_BIT_PER_WORD)));
/* Check that initial is all clear */
for (i = 0; i < numBit; i++) {
assert(bitmap_isClear(bitmapPtr, i));
assert(!bitmap_isSet(bitmapPtr, i));
}
assert(bitmap_getNumClear(bitmapPtr) == numBit);
assert(bitmap_getNumSet(bitmapPtr) == 0);
/* Check bounds */
assert(!bitmap_clear(bitmapPtr, -1));
assert(!bitmap_set(bitmapPtr, -1));
assert(!bitmap_clear(bitmapPtr, numBit+1));
assert(!bitmap_set(bitmapPtr, numBit+1));
/* Set random bits */
for (i = 0, j = 0; i < numBit; i+=(rand() % 5 + 1)) {
assert(bitmap_set(bitmapPtr, i));
assert(bitmap_set(bitmapPtr, i));
assert(bitmap_clear(bitmapPtr, i));
assert(bitmap_set(bitmapPtr, i));
assert(bitmap_set(bitmapPtr, i));
assert(bitmap_isSet(bitmapPtr, i));
j++;
}
assert(bitmap_getNumClear(bitmapPtr) == (numBit - j));
assert(bitmap_getNumSet(bitmapPtr) == j);
/* Clear set bits */
while ((i = bitmap_findSet(bitmapPtr, -1)) >= 0) {
assert(bitmap_clear(bitmapPtr, i));
i++;
}
assert(bitmap_getNumClear(bitmapPtr) == numBit);
assert(bitmap_getNumSet(bitmapPtr) == 0);
assert(bitmap_findSet(bitmapPtr, -1) == -1);
/* Set all bits */
i = -1;
while ((i = bitmap_findClear(bitmapPtr, i)) >= 0) {
assert(bitmap_set(bitmapPtr, i));
i++;
}
assert(bitmap_getNumClear(bitmapPtr) == 0);
assert(bitmap_getNumSet(bitmapPtr) == numBit);
assert(bitmap_findClear(bitmapPtr, -1) == -1);
/* Clear random bits */
for (i = 0, j = 0; i < numBit; i+=(rand() % 5 + 1)) {
assert(bitmap_clear(bitmapPtr, i));
assert(bitmap_clear(bitmapPtr, i));
assert(bitmap_set(bitmapPtr, i));
assert(bitmap_clear(bitmapPtr, i));
assert(bitmap_clear(bitmapPtr, i));
assert(bitmap_isClear(bitmapPtr, i));
j++;
}
assert(bitmap_getNumClear(bitmapPtr) == j);
assert(bitmap_getNumSet(bitmapPtr) == (numBit - j));
bitmap_free(bitmapPtr);
puts("All tests passed.");
return 0;
}
#endif /* TEST_BITMAP */
/* =============================================================================
*
* End of bitmap.c
*
* =============================================================================
*/
|
a598dcfe41d066dabe26265d06d0f7f814afca94 | 88ec20832536c735a5fea270691973b4d1049327 | /salestax.cpp | 43adb7b38b78004553987298d5692cdccc716ca0 | [] | no_license | lwelshchapman/int2020-assign2 | e3d501b7cccfc49a7362ddf3fbe5329a75453845 | 44ebc95c28051faf9c2f91fe561dce9923656556 | refs/heads/master | 2020-12-19T13:34:38.749602 | 2020-01-24T21:13:36 | 2020-01-24T21:13:36 | 235,747,823 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,035 | cpp | salestax.cpp | /*
* Logan Welsh
* lwelsh@chapman.edu
* CPSC-298-07
* int2020-assign2
* salestax.cpp
*/
/*
* Problem 4 (salestax.cpp):
* Implement a function called addTax.
* The function addTax has two formal parameters:
* taxRate, which is the amount of sales tax expressed as a percent;
* and cost, which is the cost of an item before tax.
* The function returns the value (float) of cost so that it includes sales tax.
*/
#include <iostream>
using namespace std;
float addTax(float cost, float taxRate) {
return cost * (1 + (taxRate / 100)); // Multiplies the cost by 1.taxRate Example: taxRate = 5; return cost * 1.05
}
int main(int argc, char **argv) {
// DECLARE VARIABLES
float demoSubtotal = 19.99;
float demoTaxRate = 7.25;
float demoTotal = 0;
// TEST THE FUNCTION
cout << "Price before tax:\t" << demoSubtotal << endl; // Output initial price
demoTotal = addTax(demoSubtotal, demoTaxRate); // Calculate total price
cout << "Price after tax:\t" << demoTotal << endl; // Output total price
return 0;
} |
3e5dcbcc5adfdfe543608044a03cd2a90c67df8d | 94514e6b023d1f042108c4d474c2f0198408ca88 | /华为上机/选取礼仪.cpp | 81e9be86bc4ba45d81be0769f39f9e0bbfad7496 | [] | no_license | Saunak626/HUAWEI-CODE | 3495542d8d938ac4a429c7ff6db3e140590c024d | b6d4ecd4cf7d9f2b1b90289075cd42b5c96ad78f | refs/heads/master | 2021-05-29T05:28:04.524924 | 2015-06-01T06:43:17 | 2015-06-01T06:43:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 426 | cpp | 选取礼仪.cpp | #include <stdio.h>
#include <stdlib.h>
int compare(const void *p,const void *q){
return *(int *)p-*(int *)q;
}
int main()
{
int n,i=0,a[100];
scanf("%d",&n);
while(getchar()!='\n'){
a[i++]=n;
scanf("%d",&n);
}
a[i++]=n;
qsort(a,i,sizeof(int),compare);
int ans=a[1]-a[0],k;
for(int j=1;j<i-1;j++)
{
if(ans>=a[j+1]-a[j])
{
ans=a[j+1]-a[j];
k=j;
}
}
printf("%d %d\n",a[k],a[k+1]);
return 0;
} |
3942302ac53e6dfaf62d99d046f4dd8f3b5d8254 | a3c25f35626392cd1dd490e5ace63b2c81e70bdd | /Model/lab5_inform/inform-center/computer.cpp | 9c20678d4ece65ef45396af7b06ebcee544b6cdb | [] | no_license | reijo1337/7sem | 64aa6a48286e232a3e2ce9a216855e7fecf10b4b | 410067bb0a1348c4e4ddecd31771784d4f36ac1d | refs/heads/master | 2021-09-01T19:08:16.002316 | 2017-12-28T10:37:13 | 2017-12-28T10:37:13 | 104,502,702 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 533 | cpp | computer.cpp | #include "computer.h"
#include "base.h"
void Computer::recvRequest()
{
m_queue++;
}
Computer::Computer(double time)
{
m_serveTime = time;
m_currentTime = 0;
m_queue = 0;
}
void Computer::proc()
{
if (m_currentTime > 0) {
m_currentTime -= 0.01;
}
if (m_currentTime <= 0 && m_queue > 0) {
m_currentTime = m_serveTime;
m_queue--;
}
}
bool Computer::done()
{
return (m_queue == 0) && (m_currentTime <= 0);
}
void Computer::setTime(double time)
{
m_serveTime = time;
}
|
419d702895ac15970069899373bc582d82067461 | d9ede3cde24323d19fcc3eb729b75b4da3b286c4 | /DoubleCheck/SoundOption.h | 1fa0d46fdd7978e410763a1330c1db8adce1cd1d | [] | no_license | minseoksung/BODYSEX | 1e8ca86f81e5629a300c91ed0a8a1e44bc3bf0bb | 2bf6d40bbf01c0fc148478a44fdfb98da2ababa9 | refs/heads/master | 2021-03-01T11:46:29.964371 | 2020-03-07T18:54:42 | 2020-03-07T18:54:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,337 | h | SoundOption.h | #pragma once
/*
* Author :Chulseung Lee
* File :SoundOption.h
* Term :2020 Winter
* Class :GAM250
* Project :GAM250 Project
* Date :2020/02/11
* Description :Header file of SoundOption.cpp
* copyright All content ?2019 DigiPen (USA) Corporation, all rights reserved
*/
#pragma once
#include "State.h"
#include "vector2.hpp"
class Object;
class SoundOption : public State
{
enum class BUTTON
{
MASTER,
MUSIC,
SFX,
BACK
};
public:
SoundOption()
{
current_state = GameState::Sound;
}
virtual void Load();
virtual void Update(float dt);
virtual void Clear();
virtual void UnLoad()
{
is_next = false;
next_level = {};
}
void SetMusicIcon();
void SetMusicVolumeBox();
void SetMuteButton();
void MusicVolume();
void Mute();
void SetInfoText();
void SetBackButton();
void ButtonSelector();
void SetSoundVolume(float value, bool BGM = true);
private:
Object* music_icon[3];
Object* volume_box[3];
Object* volume_box_hover[3];
Object* music_volume_text;
Object* mute_button[3];
Object* unmute_button[3];
Object* back_button;
Object* back_button_hover;
Object* info_text[3];
BitmapFont font{};
float mute_timer = 0;
float button_timer = 0;
int pointer = 0;
}; |
744a03f5064c2aae77622c6952bfc80d9b6ae183 | cb5ee802d85e40428ed556fafb31b951ff517557 | /ED/practica1/Punto2D.hpp | 809a67f753ef7e4ed1037650092e09c55270b1ab | [] | no_license | i22safed/AsignaturasIngenier | 04bbe62d23f166e65d039f7cd400b30663d9c0c4 | 331638f1d766e7ac8dea45643a1a7e50a62c14f2 | refs/heads/master | 2021-01-18T02:34:20.010445 | 2015-04-20T15:41:18 | 2015-04-20T15:41:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,056 | hpp | Punto2D.hpp | /**
*@brief Clase Punto que usaremos para trabajar con rectas, y listar los puntos de contorno y aproximacion, para calcular el error
@param _coordenadaX como primera coordenada
@param _coordenadaY como segunda coordenada
*/
#ifndef PUNTOS2D_HPP
#define PUNTOS2D_HPP
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
namespace ed
{
class Punto2D
{
private:
double _coordenadaX;
double _coordenadaY;
public:
Punto2D(double coordenadaX, double coordenadaY)
{
_coordenadaX=coordenadaX;
_coordenadaY=coordenadaY;
}
Punto2D(Punto2D const &p)
{
_coordenadaX=p._coordenadaX;
_coordenadaY=p._coordenadaY;
};
double getCoordenadaX() const{return _coordenadaX;};
double getCoordenadaY() const{return _coordenadaY;};
void setCoordenadaX(double coordenadaX){_coordenadaX=coordenadaX;};
void setCoordenadaY(double coordenadaY){_coordenadaY=coordenadaY;};
bool sonIguales(const Punto2D &punto);
};
}
#endif
|
314eed99aea4f748d222ba341e72207ad2d345bd | ec6d82eec01de000a919f9a3b7741cd953d3aef7 | /TKOM-proj/statement/Procedure.h | e6cf89d49317a94cd1ae881b1ff363acc3da9af8 | [] | no_license | Kasia4/SmartHouseLang | 4bd80c2f41b868ac4266eaa1243baf9feac2bbef | c9e0d01605fb65019353c7468330f49ea791d97f | refs/heads/master | 2020-03-12T18:47:31.381142 | 2018-05-19T16:22:12 | 2018-05-19T16:22:12 | 130,769,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 444 | h | Procedure.h | #pragma once
#include <memory>
#include "Statement.h"
using StatementPtr = std::unique_ptr<Statement>;
class Procedure
{
public:
Procedure() = default;
//TODO: add name of procedure
Procedure(std::string proc_name, StatementPtr block_statement) : proc_name(proc_name), block_statement(std::move(block_statement)) {};
~Procedure() = default;
std::string toString() const;
private:
std::string proc_name;
StatementPtr block_statement;
};
|
14de8f6219e12d3d0272e7bbec69fe83a9487603 | 62199d3d54f3dd133cf1b7f759d8ca0fa01d550a | /stix/Source/audio/Voice.h | 3f4034ee500503d2b0d0d3c38e35e1abd87ae54c | [] | no_license | mhavryliv/blue_sky | 3116ab64f962f671dd414636791e5e9c242d8a62 | 8f2b23eb733fc99f2ca5240b36cff45666afdad7 | refs/heads/master | 2023-01-08T23:54:51.284401 | 2020-10-14T01:17:05 | 2020-10-14T01:17:05 | 235,459,929 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,590 | h | Voice.h | /*
==============================================================================
Voice.h
Created: 23 Jan 2020 12:49:29pm
Author: Mark Havryliv
==============================================================================
*/
#pragma once
#include <JuceHeader.h>
#include "Utils.h"
using namespace juce;
class Voice : public Component{
public:
Voice();
~Voice() {}
void loadFileIntoPosition(const String &fname, int position, const String &stemName);
void changePlayState(TransportState newState);
void setStemVol(int stem, float vol, bool zeroOthers);
void setAllStems(const Array<float> &vols) {
jassert(vols.size() == 4);
stemVols_ = vols;
}
// Audio player helpers
void prepareToPlay(int sampsPerBlock, double srate);
void releaseResources();
void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill, const float amp = 1.f);
const int MAX_LAYERS = 4;
void setFormatManager(AudioFormatManager *fman) {
formatManager_ = fman;
for(Audio *audio : files_) {
audio->formatManager_ = fman;
}
}
void setName(const String &name) {
name_ = name;
}
String name() const {
return name_;
}
String stemNames(int index) const {
return stemNames_[index];
}
private:
AudioFormatManager *formatManager_;
TransportState playState_;
float prevAmp_ = 0.f;
struct Audio {
Audio() {
playState_ = Stopped;
}
void loadFileFromInputStream(InputStream *is) {
auto* reader = formatManager_->createReaderFor (std::unique_ptr<InputStream> (is));
if(reader != nullptr) {
std::unique_ptr<AudioFormatReaderSource> newSource
(new AudioFormatReaderSource (reader, true));
transportSource_.setSource (newSource.get(), 0, nullptr, reader->sampleRate);
readerSource_.reset (newSource.release());
readerSource_->setLooping(true);
}
}
void changePlayState(TransportState newState) {
if(playState_ != newState) {
playState_ = newState;
switch (playState_)
{
case Stopped:
transportSource_.setPosition (0.0);
break;
case Starting:
transportSource_.setPosition (0.0);
transportSource_.start();
break;
case Playing:
break;
case Stopping:
transportSource_.stop();
break;
}
}
}
void prepareToPlay(int sampsPerBlock, double srate) {
transportSource_.prepareToPlay(sampsPerBlock, srate);
// And re-init our buffer
audioBuffer_.setSize(2, sampsPerBlock);
info_.buffer = &audioBuffer_;
info_.numSamples = sampsPerBlock;
info_.startSample = 0;
}
void releaseResources() {
transportSource_.releaseResources();
}
void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill) {
// Write to my own buffer
if(audioBuffer_.getNumSamples() != bufferToFill.numSamples) {
Logger::writeToLog("[Voice::Audio] Had to resize local buffer");
audioBuffer_.setSize(2, bufferToFill.numSamples, false, false, true);
}
// Clear out audio buffer
audioBuffer_.clear();
// Copy settings from the input buffer
info_.numSamples = bufferToFill.numSamples;
info_.startSample = bufferToFill.startSample;
transportSource_.getNextAudioBlock(info_);
// for(int i = 0; i < audioBuffer_.getNumSamples(); ++i) {
// float leftVal = audioBuffer_.getReadPointer(0)[i];
// float rightVal = audioBuffer_.getReadPointer(1)[i];
// }
}
void copyFromLocalToDst(AudioBuffer<float> &dst,
float startGain = 1.f, float endGain = 1.f) {
int numToCopy = jmin(audioBuffer_.getNumSamples(), dst.getNumSamples());
float stepGain = (endGain - startGain) / (float)numToCopy;
const float *readLeft = audioBuffer_.getReadPointer(0);
const float *readRight = audioBuffer_.getReadPointer(1);
float *writeLeft = dst.getWritePointer(0);
float *writeRight = dst.getWritePointer(1);
for(int i = 0; i < numToCopy; ++i) {
float gain = startGain + (stepGain * (float)i);
*(writeLeft + i) += (*(readLeft + i)) * gain;
*(writeRight + i) += (*(readRight + i)) * gain;
}
}
std::unique_ptr<AudioFormatReaderSource> readerSource_;
AudioTransportSource transportSource_;
String fname_;
AudioFormatManager *formatManager_;
TransportState playState_;
AudioSourceChannelInfo info_;
AudioBuffer<float> audioBuffer_;
};
String name_;
juce::OwnedArray<Audio> files_;
StringArray stemNames_;
AudioBuffer<float> summingBuffer_;
Array<float> stemVols_;
Array<float> prevStemVols_;
};
|
cb3965ab19b798c6d8a3fc5f7a5e4ad1ab97d766 | 8d1a5b13e34925bf847b78b54c9163c36ecc9988 | /18120258/ConsoleApplication1/Source.cpp | 72294a2e1dea7e3a89e8b9a05ad74b2736783c20 | [] | no_license | tungrg/Binary-Search-Tree | 9d07ef63265008ff5c6c2447152e03135a034147 | 110b1ae604954ce4ff2f829fb8984a259b19dada | refs/heads/master | 2020-09-12T16:35:10.039015 | 2019-11-18T15:26:48 | 2019-11-18T15:26:48 | 222,480,939 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,070 | cpp | Source.cpp | #include "Source.h"
void inMenu()
{
cout << "1. Nhap du lieu vao cay nhi phan" << endl;
cout << "2. In cay nhi phan" << endl;
cout << "3. Xoa 1 node" << endl;
cout << "4.Tim 1 node " << endl;
cout << "5. Tim tat ca ca node" << endl;
cout << "6.Thoat" << endl;
cout << "Nhap lenh can thuc hien: ";
}
int inMenu1()
{
cout << "Nhap gia tri can them: ";
int n;
cin >> n;
return n;
}
int inMenu3()
{
cout << "Nhap gia tri node can xoa: ";
int n;
cin >> n;
return n;
}
int inMenu4()
{
cout << "Nhap gia tri node can tim: ";
int n;
cin >> n;
return n;
}
void fHandle(int lenh, BST* root)
{
if (lenh == 1)
{
int temp1 = inMenu1();
root = root->insertNode(root, temp1);
}
else if (lenh == 2)
{
root->LNR(root);
system("pause");
}
else if (lenh == 3)
{
int temp3 = inMenu3();
root->deleteNode(root, temp3);
}
else if (lenh == 4)
{
int temp4 = inMenu4();
root->searchNode1(root, temp4);
}
else if (lenh == 5)
{
int temp5 = inMenu4();
root->searchNode(root, temp5);
}
} |
053a580aee008ee4383669bc772700432e0f6f55 | 23553b6bcf0a278776f0a651b24a3c6a22a702f9 | /ALibrary/ABase/AFilename.cpp | 459461cbc1f52bd627cda32f1ba7cffcf182d26d | [] | no_license | achacha/AOS | 24ace04a4228de4d0295379d84cb936c2a33511b | bea07af94f23982d4fceb10a9cf70a7e5467355f | refs/heads/master | 2020-05-17T12:20:35.667655 | 2016-02-10T13:33:43 | 2016-02-10T13:33:43 | 3,578,772 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,520 | cpp | AFilename.cpp | /*
Written by Alex Chachanashvili
$Id$
*/
#include "pchABase.hpp"
#include "AFilename.hpp"
#include "AXmlElement.hpp"
const AString AFilename::RESERVED("|\\?*<\":>/");
const AString AFilename::FILE_PREFIX("file:///");
void AFilename::debugDump(std::ostream& os, int indent) const
{
ADebugDumpable::indent(os, indent) << "(" << typeid(*this).name() << " @ " << std::hex << this << std::dec << ") {" << std::endl;
ADebugDumpable::indent(os, indent+1) << "m_Type=" << m_Type;
ADebugDumpable::indent(os, indent+1) << " m_RelativePath=" << m_RelativePath << std::endl;
ADebugDumpable::indent(os, indent+1) << "m_Drive=" << m_Drive << std::endl;
ADebugDumpable::indent(os, indent+1) << "m_PathNames={" << std::endl;
LIST_AString::const_iterator cit = m_PathNames.begin();
while (cit != m_PathNames.end())
{
ADebugDumpable::indent(os, indent+2) << *cit << std::endl;
++cit;
}
ADebugDumpable::indent(os, indent+1) << "}" << std::endl;
ADebugDumpable::indent(os, indent+1) << "m_Filename=" << m_Filename << std::endl;
ADebugDumpable::indent(os, indent) << "}" << std::endl;
}
AFilename::AFilename() :
m_Type(FTYPE_DEFAULT),
m_Drive('\x0'),
m_RelativePath(false)
{
}
AFilename::AFilename(const AFilename& filepath) :
m_Type(filepath.m_Type),
m_Drive(filepath.m_Drive),
m_RelativePath(filepath.m_RelativePath),
m_Filename(filepath.m_Filename)
{
for (LIST_AString::const_iterator cit = filepath.m_PathNames.begin(); cit != filepath.m_PathNames.end(); ++cit)
{
m_PathNames.push_back(*cit);
}
}
AFilename::AFilename(
const AEmittable& filepath,
bool forceDirectory // = false
) :
m_Type(FTYPE_DEFAULT),
m_Drive('\x0'),
m_RelativePath(false)
{
set(filepath, forceDirectory);
}
AFilename::AFilename(
const AEmittable& filepath0,
const AEmittable& filepath1,
bool forceDirectory
)
{
set(filepath0, true);
join(filepath1, forceDirectory);
}
AFilename::AFilename(
const AEmittable& filepath0,
const AEmittable& filepath1,
const AEmittable& filepath2,
bool forceDirectory
)
{
set(filepath0, true);
join(filepath1, forceDirectory);
join(filepath2, forceDirectory);
}
AFilename::AFilename(
const AFilename& filepath0,
const AFilename& filepath1
)
{
set(filepath0);
join(filepath1);
}
AFilename::AFilename(
const AFilename& filepath0,
const AFilename& filepath1,
const AFilename& filepath2
)
{
set(filepath0);
join(filepath1);
join(filepath2);
}
void AFilename::set(const AFilename& filepath)
{
m_Drive = filepath.m_Drive;
m_Type = filepath.m_Type;
m_RelativePath = filepath.m_RelativePath;
m_Filename = filepath.m_Filename;
m_PathNames.clear();
for (LIST_AString::const_iterator cit = filepath.m_PathNames.begin(); cit != filepath.m_PathNames.end(); ++cit)
m_PathNames.push_back(*cit);
}
void AFilename::set(
const AEmittable& filepath,
bool forceDirectory
)
{
m_PathNames.clear();
m_Filename.clear();
AString temp(filepath);
temp.replace('\\', '/');
temp.split(m_PathNames, '/', AConstant::ASTRING_EMPTY, true);
if (m_PathNames.empty())
{
//a_No path
return;
}
//a_Check if drive letter is included
AString& first = m_PathNames.front();
if (first.getSize() > 1 && ':' == first.at(1))
{
m_Drive = (char)tolower(m_PathNames.front().at(0));
first.remove(2);
if (first.isEmpty())
m_PathNames.pop_front();
}
else
m_Drive = '\x0';
if (m_PathNames.empty())
{
//a_Only drive letter found
m_RelativePath = false;
return;
}
//a_Check if relative or absolute (path starts with /)
if (m_PathNames.front().isEmpty() || m_Drive != '\x0')
{
m_RelativePath = false;
if (m_Drive == '\x0')
m_PathNames.pop_front(); //a_Pop front in list since it is empty
}
else
m_RelativePath = true;
if (m_PathNames.empty())
{
//a_No filename
return;
}
//a_Now check if last entry is a filename.ext or a path/
if (!forceDirectory && '/' != temp.last())
{
m_Filename.assign(m_PathNames.back());
m_PathNames.pop_back();
}
//a_Cleanup
LIST_AString::iterator itKill, it = m_PathNames.begin();
while (it != m_PathNames.end())
{
if ((*it).isEmpty())
{
itKill = it;
++it;
m_PathNames.erase(itKill);
}
else
{
++it;
}
}
}
void AFilename::emit(AOutputBuffer& target) const
{
emit(target, m_Type);
}
AString AFilename::toAString() const
{
AString str(MAX_PATH, 256);
emit(str, m_Type);
return str;
}
void AFilename::emit(
AOutputBuffer& target,
AFilename::FTYPE ftype,
bool noTrailingSlash // = false
) const
{
//a_Filename
if (!m_Filename.isEmpty())
{
//a_Path
emitPath(target, ftype);
//a_Append filename
target.append(m_Filename);
}
else
{
//a_Check if trailing slash is not needed
emitPath(target, ftype, noTrailingSlash);
}
}
void AFilename::emitFileUrl(AOutputBuffer& target) const
{
target.append(FILE_PREFIX);
emit(target, AFilename::FTYPE_DEFAULT);
}
AXmlElement& AFilename::emitXml(AXmlElement& thisRoot) const
{
thisRoot.addAttribute(ASW("os", 2), AString::fromInt(m_Type));
//a_Drive
if (m_Drive)
thisRoot.addElement(ASW("drive",5)).addData(m_Drive);
//a_Path
AXmlElement& basePath = thisRoot.addElement(ASW("path",4));
for (LIST_AString::const_iterator cit = m_PathNames.begin(); cit != m_PathNames.end(); ++cit)
{
basePath.addElement(ASW("dir",3)).addData(*cit);
}
//a_Filename
if (!m_Filename.isEmpty())
thisRoot.addElement(ASW("name",4)).addData(m_Filename);
thisRoot.addElement(ASW("full",4)).addData(*this);
return thisRoot;
}
void AFilename::emitPath(AOutputBuffer& target) const
{
emitPath(target, m_Type, false);
}
void AFilename::emitPath(AOutputBuffer& target, AFilename::FTYPE ftype, bool noTrailingSlash) const
{
char sep = '/';
if (FTYPE_MSDOS == ftype)
sep = '\\';
//a_Drive
if (m_Drive)
{
switch (ftype)
{
case FTYPE_UNIX:
break;
case FTYPE_CYGWIN:
target.append(ASW("/cygdrive/",10));
target.append(m_Drive);
break;
default:
if (!m_RelativePath)
{
target.append(m_Drive);
target.append(':');
}
}
}
//a_Add slash is not a relative path
if (!m_RelativePath)
target.append(sep);
else if (0 == m_PathNames.size())
{
//a_Special case, relative and no path, default to . or ./ (depends on noTailingSlash flag)
target.append(AConstant::ASTRING_PERIOD);
if (!noTrailingSlash)
target.append(sep);
return;
}
//a_Path
LIST_AString::const_iterator cit = m_PathNames.begin();
while (cit != m_PathNames.end())
{
target.append(*cit);
++cit;
if (cit != m_PathNames.end() || !noTrailingSlash)
target.append(sep);
}
}
void AFilename::emitNoExt(AOutputBuffer& target) const
{
emitNoExt(target, m_Type);
}
void AFilename::emitNoExt(AOutputBuffer& target, AFilename::FTYPE ftype) const
{
emitPath(target, ftype);
size_t pos = m_Filename.rfind('.');
if (AConstant::npos != pos)
m_Filename.peek(target, 0, pos);
else
target.append(m_Filename);
}
void AFilename::setType(AFilename::FTYPE t)
{
m_Type = t;
}
AFilename::FTYPE AFilename::getType() const
{
return m_Type;
}
void AFilename::clear()
{
m_Drive = '\x0';
m_Type = FTYPE_DEFAULT;
m_PathNames.clear();
m_Filename.clear();
}
void AFilename::clearFilename()
{
m_Filename.clear();
}
void AFilename::clearPathNames()
{
m_PathNames.clear();
}
void AFilename::clearDrive()
{
m_Drive = '\x0';
}
void AFilename::clearExtension()
{
setExtension(AConstant::ASTRING_EMPTY);
}
void AFilename::join(
const AEmittable& that,
bool forceDirectory
)
{
AFilename fThat(that, forceDirectory);
join(fThat);
}
void AFilename::join(const AFilename& that)
{
if (that.m_Drive && !that.m_RelativePath)
m_Drive = that.m_Drive;
LIST_AString::const_iterator cit = that.m_PathNames.begin();
while (cit != that.m_PathNames.end())
{
m_PathNames.push_back(*cit);
++cit;
}
if (!that.m_Filename.isEmpty())
m_Filename.assign(that.m_Filename);
}
void AFilename::emitDrive(AOutputBuffer& target) const
{
target.append(m_Drive);
}
const LIST_AString& AFilename::getPathNames() const
{
return m_PathNames;
}
const AString& AFilename::getFilename() const
{
return m_Filename;
}
void AFilename::emitPathAndFilename(AOutputBuffer& target) const
{
emitPath(target);
target.append(m_Filename);
}
void AFilename::emitPathAndFilenameNoExt(AOutputBuffer& target) const
{
emitPath(target);
emitFilenameNoExt(target);
}
void AFilename::emitFilenameNoExt(AOutputBuffer& target) const
{
size_t pos = m_Filename.rfind('.');
if (AConstant::npos == pos)
m_Filename.emit(target);
else
m_Filename.peek(target, 0, pos);
}
void AFilename::emitExtension(AOutputBuffer& ext) const
{
size_t pos = m_Filename.rfind('.');
if (AConstant::npos != pos)
(m_Filename.peek(ext, pos+1) > 0);
}
bool AFilename::isDirectory() const
{
return m_Filename.isEmpty();
}
bool AFilename::isRelativePath() const
{
return m_RelativePath;
}
bool AFilename::hasExtension() const
{
return (AConstant::npos != m_Filename.rfind('.'));
}
bool AFilename::equalsExtension(const AString& ext) const
{
if (AConstant::npos != m_Filename.rfind('.'))
{
AString str(16,16);
emitExtension(str);
return (str.equalsNoCase(ext));
}
else
return false;
}
bool AFilename::equalsExtension(const AString& ext1, const AString& ext2) const
{
//a_Check for filename.ext1.ext2
AString str(64,16);
str.assign('.');
str.append(ext1);
str.append('.');
str.append(ext2);
size_t pos = getFilename().rfind(str);
if (AConstant::npos != pos && pos == getFilename().getSize() - str.getSize())
return true;
else
return false;
}
char& AFilename::useDrive()
{
return m_Drive;
}
LIST_AString& AFilename::usePathNames()
{
return m_PathNames;
}
AString& AFilename::useFilename()
{
return m_Filename;
}
void AFilename::setExtension(const AString& ext)
{
size_t pos = m_Filename.rfind('.');
if (AConstant::npos != pos)
{
m_Filename.setSize(pos);
}
//a_Set extension if any, else clear extension
if (!ext.isEmpty())
{
m_Filename.append('.');
m_Filename.append(ext);
}
}
bool AFilename::operator <(const AFilename& that) const
{
if (m_Drive < that.m_Drive)
{
return true;
}
if (m_PathNames.size() > 0)
{
//a_Equal @ of path name entries, do compare
LIST_AString::const_iterator citThis = m_PathNames.begin();
LIST_AString::const_iterator citThat = that.m_PathNames.begin();
while(citThis != m_PathNames.end())
{
if (citThat == that.m_PathNames.end())
{
//a_That is shorter
return false;
}
if (*citThis != *citThat)
{
bool ret = (*citThis < *citThat);
return ret;
}
++citThis;
++citThat;
}
if (citThat != that.m_PathNames.end())
{
//a_This is shorter
return true;
}
}
else if (that.m_PathNames.size() > 0)
return true;
//a_Equal paths at this point leaves it to the filename
bool ret = (m_Filename < that.m_Filename);
return ret;
}
bool AFilename::operator ==(const AFilename& that) const
{
if (m_Drive != that.m_Drive)
return false;
if (m_PathNames.size() != that.m_PathNames.size())
return false;
LIST_AString::const_iterator citThis = m_PathNames.begin();
LIST_AString::const_iterator citThat = that.m_PathNames.begin();
while(citThis != m_PathNames.end())
{
if (*citThis != *citThat)
return false;
++citThis;
++citThat;
}
//a_Equal paths at this point leaves it to the filename
return (m_Filename == that.m_Filename);
}
bool AFilename::isValid() const
{
if (AConstant::npos != m_Filename.findOneOf(RESERVED))
return false;
if ('\x0' != m_Drive && !isalnum((const u1)m_Drive))
return false;
LIST_AString::const_iterator cit = m_PathNames.begin();
while(cit != m_PathNames.end())
{
if (AConstant::npos != (*cit).findOneOf(RESERVED))
return false;
++cit;
}
return true;
}
void AFilename::removeBasePath(
const AFilename& base,
bool makeResultAbsolute // = false
)
{
//a_Verify that base is actually in this
LIST_AString::iterator it = m_PathNames.begin();
for (LIST_AString::const_iterator cit = base.m_PathNames.begin(); cit != base.m_PathNames.end(); ++cit, ++it)
{
if (it == m_PathNames.end() || !(*it).equals(*cit))
ATHROW_EX(this, AException::InvalidData, *cit);
}
for (size_t i = base.m_PathNames.size(); i > 0; --i)
m_PathNames.pop_front();
m_RelativePath = !makeResultAbsolute;
}
void AFilename::removeExtension(int count)
{
for (int i=0; i<count; ++i)
{
m_Filename.rremoveUntil('.');
}
}
bool AFilename::compactPath()
{
LIST_AString pathNames(m_PathNames.begin(), m_PathNames.end());
m_PathNames.clear();
LIST_AString::iterator it = pathNames.begin();
if (it != pathNames.end())
{
//a_Iterate and compact as needed
while(it != pathNames.end())
{
if (it->equals(AConstant::ASTRING_PERIOD))
{
++it;
continue;
}
else if (it->equals(AConstant::ASTRING_DOUBLEPERIOD))
{
if (
(
m_PathNames.size() == 1
&& !m_PathNames.back().equals(AConstant::ASTRING_DOUBLEPERIOD)
)
||
(
m_PathNames.size() > 1
&& !m_PathNames.back().equals(AConstant::ASTRING_PERIOD)
&& !m_PathNames.back().equals(AConstant::ASTRING_DOUBLEPERIOD)
)
)
{
if (m_PathNames.back().equals(AConstant::ASTRING_PERIOD))
m_PathNames.back().assign(AConstant::ASTRING_DOUBLEPERIOD);
else
m_PathNames.pop_back();
}
else
m_PathNames.push_back(*it);
}
else
m_PathNames.push_back(*it);
++it;
}
}
if (m_PathNames.size() > 0)
return (!m_PathNames.front().equals(AConstant::ASTRING_DOUBLEPERIOD));
else
return true; // No path means its not relative
}
void AFilename::makeAbsolute()
{
// Remove leading . or ..
if (
m_PathNames.size() > 0
&&
(
m_PathNames.front().equals(AConstant::ASTRING_DOUBLEPERIOD)
|| m_PathNames.front().equals(AConstant::ASTRING_PERIOD)
)
)
{
m_PathNames.pop_front();
}
m_RelativePath = false;
}
void AFilename::makeRelative()
{
if (
m_PathNames.size() > 0
&& !m_PathNames.front().equals(AConstant::ASTRING_DOUBLEPERIOD)
&& !m_PathNames.front().equals(AConstant::ASTRING_PERIOD)
)
{
m_PathNames.push_front(AConstant::ASTRING_PERIOD);
}
m_RelativePath = true;
}
|
29c742936111260acabcde6121064d0e6944484f | 28ea54a68b4bd8f4225a33484db0dddabbe91a2c | /source/Classes/Client/Items/.svn/text-base/GemStonesFromLua.h.svn-base | 5d277be3b95dc7f017aa2288ac1c2ba519ecfb9c | [] | no_license | cash2one/hellopetclient | fad7374899a1c0bb04581caa517586ae8fb124ab | f87e47cd946858f8fe5bae6ea2bbc13b43d912d4 | refs/heads/master | 2020-12-24T11:52:38.157993 | 2015-12-26T17:07:23 | 2015-12-26T17:07:23 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 920 | GemStonesFromLua.h.svn-base | #ifndef GEM_STONES_FROM_LUA_H
#define GEM_STONES_FROM_LUA_H
#include "cocos2d.h"
class GemStonesFromLua
{
public:
GemStonesFromLua();
virtual ~GemStonesFromLua();
static GemStonesFromLua* getInstance(void);
static void Destroy();
void init();
//宝石镶嵌请求
void EquipInlayGemReq(unsigned int equip,unsigned int hole,unsigned int gemId);
//宝石镶嵌回包
void EquipInlayGemRsp(unsigned int error);
void GemRecastReq(unsigned int equipPos,unsigned int hole1,unsigned int hole2,unsigned int hole3,unsigned int hole4,unsigned int currencyKey);
void GemRecastRsp(unsigned int error);
void GemAnimaExchangeReq(unsigned int gemId,unsigned int multi);
void GemAnimaExchangeRsp(unsigned int error);
void GemHoleUnlockReq(unsigned int exchangeId,unsigned int equipPos);
void GemHoleUnlockRsp(bool success);
private:
bool checkEnchaseUILayer();
private:
lua_State *m_configLuaState;
};
#endif | |
bbe1c9aabe2268b7992e79674eca408cb71d74f9 | 3f3095dbf94522e37fe897381d9c76ceb67c8e4f | /Current/BP_LargeLongRootLoop_3.hpp | 7f5311d0022db3a82fbbff3ba01292889df17d11 | [] | no_license | DRG-Modding/Header-Dumps | 763c7195b9fb24a108d7d933193838d736f9f494 | 84932dc1491811e9872b1de4f92759616f9fa565 | refs/heads/main | 2023-06-25T11:11:10.298500 | 2023-06-20T13:52:18 | 2023-06-20T13:52:18 | 399,652,576 | 8 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 166 | hpp | BP_LargeLongRootLoop_3.hpp | #ifndef UE4SS_SDK_BP_LargeLongRootLoop_3_HPP
#define UE4SS_SDK_BP_LargeLongRootLoop_3_HPP
class ABP_LargeLongRootLoop_3_C : public ABP_HugeRoots_Base_C
{
};
#endif
|
ad7d851558599583238876b95ba44eefe07a601f | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/collectd/gumtree/collectd_repos_function_1415_collectd-4.8.0.cpp | 22d22da6e62f5340814ed1a471d203984f6404d9 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 755 | cpp | collectd_repos_function_1415_collectd-4.8.0.cpp | static int ts_config_add_string (char **dest, /* {{{ */
const oconfig_item_t *ci, int may_be_empty)
{
char *temp;
if (dest == NULL)
return (-EINVAL);
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
ERROR ("Target `set': The `%s' option requires exactly one string "
"argument.", ci->key);
return (-1);
}
if ((!may_be_empty) && (ci->values[0].value.string[0] == 0))
{
ERROR ("Target `set': The `%s' option does not accept empty strings.",
ci->key);
return (-1);
}
temp = ts_strdup (ci->values[0].value.string);
if (temp == NULL)
{
ERROR ("ts_config_add_string: ts_strdup failed.");
return (-1);
}
free (*dest);
*dest = temp;
return (0);
} |
04eadd8f5a718fd46dd146020f7a29e2f536bbc9 | c593e95683bdd81be3f1e006755cbea2368a2719 | /sources/contained.cpp | c0ae112da2318149680d55d420b978b88acaf431 | [
"BSD-2-Clause"
] | permissive | gcross/HDF | 163ea7f299f4de3e691186932669505cd67b2a4a | 074ca9e35799325b0c0716c3e5d488b9990d24fb | refs/heads/master | 2016-09-03T07:08:11.578938 | 2013-12-20T09:58:03 | 2013-12-20T09:59:49 | 1,789,412 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 715 | cpp | contained.cpp | // Includes {{{
#include "contained.hpp"
#include <boost/make_shared.hpp>
// Includes }}}
// Usings {{{
using boost::make_shared;
// Usings }}}
namespace HDF {
// class Contained {{{
// Constructors {{{
Contained::Contained() {}
Contained::Contained(File const& file, hid_t id, Identity::Closer const& closer)
: Identified(make_shared<Identity>(id,closer))
, file(file)
{}
Contained::Contained(File const& file, Identity::Ptr const& identity)
: Identified(identity)
, file(file)
{}
// Constructors }}}
// Fields {{{
File const& Contained::getFile() const { return file; }
Identity::Ptr const& Contained::getIdentity() const { return identity; }
// Fields }}}
// class Contained }}}
}
|
4b37a686c994f067df298b247259a581f7cd1536 | 0bc37ee7f7b94bb6ffc06b8afeced5bdda60a065 | /include/test_tracing_data.hpp | 82e918d78572071b179cd40ad4e0965beae71a1a | [
"BSL-1.0"
] | permissive | CppPhil/caf_shiviz_trial | 97baac89bdb1eb97ee78d88d07b79f73292d1e1b | 90ebd1329ec664896ca7a6eb216ff04439fa0f90 | refs/heads/master | 2022-04-23T20:05:54.366241 | 2020-04-23T14:14:26 | 2020-04-23T14:14:26 | 242,571,660 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 387 | hpp | test_tracing_data.hpp | #pragma once
#include "caf/all.hpp"
namespace cst {
class test_tracing_data : public caf::tracing_data {
public:
std::string value;
test_tracing_data(std::string value); // NOLINT(google-explicit-constructor)
caf::error serialize(caf::serializer& sink) const override;
caf::error_code<caf::sec>
serialize(caf::binary_serializer& sink) const override;
};
} // namespace cst
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.