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
5080b553b219a3de4182605347a05bb65b879de5
a74a23ec493c789d0362e9327b3c5283ba3cdd7f
/src/Etat/Etat17.cpp
71095a6e7591e920af5627edcfb4ecc92ac02c31
[]
no_license
Hexanameless/Grammaires-Languages
71bdfe079fc2934f6d82e4e3f6b64cc96b3890c3
4f43021492d832414c1b06e1f2952f1a10c8192b
refs/heads/master
2016-08-12T21:36:06.104995
2016-03-30T17:12:06
2016-03-30T17:12:06
52,772,047
1
0
null
2016-03-28T21:05:18
2016-02-29T07:20:41
C++
UTF-8
C++
false
false
2,299
cpp
Etat17.cpp
/************************************************************************* Etat17 - description ------------------- début : 7 mars 2016 copyright : (C) 2016 par E.Bai *************************************************************************/ //---------- Réalisation de la classe <Etat17> (fichier Etat17.cpp) -- //---------------------------------------------------------------- INCLUDE //-------------------------------------------------------- Include système using namespace std; #include <iostream> //------------------------------------------------------ Include personnel #include "Etat17.h" #include "Etat18.h" //------------------------------------------------------------- CONSTantes //---------------------------------------------------- VARiables de classe //----------------------------------------------------------- Types privés //----------------------------------------------------------------- PUBLIC //-------------------------------------------------------- Fonctions amies //----------------------------------------------------- Méthodes publiques void Etat17::transition(Automate* const automate, Symbole* symbole) { switch (symbole->getId()) { case EG : automate->pushEtat(new Etat18()); automate->decalage(); automate->transitionLecture(); break; default : automate->rejette(); } } //------------------------------------------------- Surcharge d'opérateurs //-------------------------------------------- CONSTructeurs - destructeur Etat17::Etat17 ( const Etat17 & unEtat17 ) // Algorithme : // { #ifdef MAP cout << "Appel au constructeur de copie de <Etat17>" << endl; #endif } //----- Fin de Etat17 (constructeur de copie) Etat17::Etat17 ( ) // Algorithme : // { #ifdef MAP cout << "Appel au constructeur de <Etat17>" << endl; #endif } //----- Fin de Etat17 Etat17::~Etat17 ( ) // Algorithme : // { #ifdef MAP cout << "Appel au destructeur de <Etat17>" << endl; #endif } //----- Fin de ~Etat17 //------------------------------------------------------------------ PRIVE //----------------------------------------------------- Méthodes protégées //------------------------------------------------------- Méthodes privées
cfbdd3589185540df53c292c1f4120610904056e
7fe9c825a46e0ce6250e05183cd065c258f777f4
/Code/graph_ques/nearestCloneColorNode.cpp
7515776a5ed114f35ae4d9cae9a98b24827f6652
[]
no_license
100sarthak100/DataStructures-Algorithms
5a550275c9da99e94ea303acac30db6b307af880
b1193665b417a2654767141c7a55ab6d04edd582
refs/heads/master
2023-03-04T17:41:48.381379
2021-02-20T12:57:52
2021-02-20T12:57:52
266,804,252
2
5
null
2020-10-25T03:09:09
2020-05-25T14:43:47
C++
UTF-8
C++
false
false
1,283
cpp
nearestCloneColorNode.cpp
// Input - // 4 3 // 1 2 // 1 3 // 4 2 // 1 2 1 1 // 1 // Output - // 1 #include <bits/stdc++.h> #define MAX 1000003 using namespace std; vector<int> adj[MAX]; bool visited[MAX]; int arr[MAX], c, id; void bfs(int i) { memset(visited, false, sizeof(visited)); queue<pair<int, int>> q; pair<int, int> p; q.push({i, 0}); visited[i] = true; while (!q.empty()) { p = q.front(); q.pop(); for (auto x : adj[p.first]) { if (!visited[x]) { if (arr[x] == id) { c = p.second + 1; return; } visited[x] = true; q.push({x, p.second + 1}); } } } } int main() { int n, m, x, y; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> x >> y; --x; --y; adj[x].push_back(y); adj[y].push_back(x); } for (int i = 0; i < n; i++) cin >> arr[i]; cin >> id; int ans = 1e9; for (int i = 0; i < n; i++) { if (arr[i] == id) { c = 1e9; bfs(i); ans = min(ans, c); } } if (ans == 1e9) ans = -1; cout << ans << endl; }
46b98fe378272f25df88d1a9c8a26839cbfa4492
ac39c71425ad819afb8d5dffbd6a48e92a7b9723
/packager/hls/base/media_playlist_unittest.cc
11ede8390a88ca63f114859db299097433d7260e
[ "BSD-3-Clause" ]
permissive
kongqx/shaka-packager
c4b18d6de55be546102a88b238d52e6b7ba479bc
3bad4ca70014b0b0ba5648aa2cab63df15348468
refs/heads/master
2020-12-02T23:00:49.574240
2017-06-29T22:23:53
2017-06-30T18:35:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
22,125
cc
media_playlist_unittest.cc
// Copyright 2016 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #include <gmock/gmock.h> #include <gtest/gtest.h> #include "packager/hls/base/media_playlist.h" #include "packager/media/file/file_test_util.h" #include "packager/version/version.h" namespace shaka { namespace hls { using ::testing::_; using ::testing::ReturnArg; namespace { const char kDefaultPlaylistFileName[] = "default_playlist.m3u8"; const double kTimeShiftBufferDepth = 20; const uint64_t kTimeScale = 90000; const uint64_t kMBytes = 1000000; MATCHER_P(MatchesString, expected_string, "") { const std::string arg_string(static_cast<const char*>(arg)); *result_listener << "which is " << arg_string.size() << " long and the content is " << arg_string; return expected_string == std::string(static_cast<const char*>(arg)); } } // namespace class MediaPlaylistTest : public ::testing::Test { protected: MediaPlaylistTest() : MediaPlaylistTest(MediaPlaylist::MediaPlaylistType::kVod) {} MediaPlaylistTest(MediaPlaylist::MediaPlaylistType type) : default_file_name_(kDefaultPlaylistFileName), default_name_("default_name"), default_group_id_("default_group_id"), media_playlist_(type, kTimeShiftBufferDepth, default_file_name_, default_name_, default_group_id_) {} void SetUp() override { SetPackagerVersionForTesting("test"); MediaInfo::VideoInfo* video_info = valid_video_media_info_.mutable_video_info(); video_info->set_codec("avc1"); video_info->set_time_scale(kTimeScale); video_info->set_frame_duration(3000); video_info->set_width(1280); video_info->set_height(720); video_info->set_pixel_width(1); video_info->set_pixel_height(1); valid_video_media_info_.set_reference_time_scale(kTimeScale); } const std::string default_file_name_; const std::string default_name_; const std::string default_group_id_; MediaPlaylist media_playlist_; MediaInfo valid_video_media_info_; }; // Verify that SetMediaInfo() fails if timescale is not present. TEST_F(MediaPlaylistTest, NoTimeScale) { MediaInfo media_info; EXPECT_FALSE(media_playlist_.SetMediaInfo(media_info)); } // The current implementation only handles video and audio. TEST_F(MediaPlaylistTest, NoAudioOrVideo) { MediaInfo media_info; media_info.set_reference_time_scale(kTimeScale); MediaInfo::TextInfo* text_info = media_info.mutable_text_info(); text_info->set_format("vtt"); EXPECT_FALSE(media_playlist_.SetMediaInfo(media_info)); } TEST_F(MediaPlaylistTest, SetMediaInfo) { MediaInfo media_info; media_info.set_reference_time_scale(kTimeScale); MediaInfo::VideoInfo* video_info = media_info.mutable_video_info(); video_info->set_width(1280); video_info->set_height(720); EXPECT_TRUE(media_playlist_.SetMediaInfo(media_info)); } // Verify that AddSegment works (not crash). TEST_F(MediaPlaylistTest, AddSegment) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); } // Verify that AddEncryptionInfo works (not crash). TEST_F(MediaPlaylistTest, AddEncryptionInfo) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0xabcedf", "", ""); } TEST_F(MediaPlaylistTest, WriteToFile) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:0\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } // If bitrate (bandwidth) is not set in the MediaInfo, use it. TEST_F(MediaPlaylistTest, UseBitrateInMediaInfo) { valid_video_media_info_.set_bandwidth(8191); ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); EXPECT_EQ(8191u, media_playlist_.Bitrate()); } // If bitrate (bandwidth) is not set in the MediaInfo, then calculate from the // segments. TEST_F(MediaPlaylistTest, GetBitrateFromSegments) { valid_video_media_info_.clear_bandwidth(); ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 5 * kMBytes); // Max bitrate is 2000Kb/s. EXPECT_EQ(2000000u, media_playlist_.Bitrate()); } TEST_F(MediaPlaylistTest, GetLongestSegmentDuration) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); media_playlist_.AddSegment("file3.ts", 40 * kTimeScale, 14 * kTimeScale, 3 * kMBytes); EXPECT_NEAR(30.0, media_playlist_.GetLongestSegmentDuration(), 0.01); } TEST_F(MediaPlaylistTest, WriteToFileWithSegments) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(MediaPlaylistTest, WriteToFileWithEncryptionInfo) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x12345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(MediaPlaylistTest, WriteToFileWithEncryptionInfoEmptyIv) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "", "com.widevine", ""); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",KEYFORMAT=\"com.widevine\"\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } // Verify that EXT-X-DISCONTINUITY is inserted before EXT-X-KEY. TEST_F(MediaPlaylistTest, WriteToFileWithClearLead) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXT-X-DISCONTINUITY\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x12345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(MediaPlaylistTest, GetLanguage) { MediaInfo media_info; media_info.set_reference_time_scale(kTimeScale); // Check conversions from long to short form. media_info.mutable_audio_info()->set_language("eng"); ASSERT_TRUE(media_playlist_.SetMediaInfo(media_info)); EXPECT_EQ("en", media_playlist_.GetLanguage()); // short form media_info.mutable_audio_info()->set_language("eng-US"); ASSERT_TRUE(media_playlist_.SetMediaInfo(media_info)); EXPECT_EQ("en-US", media_playlist_.GetLanguage()); // region preserved media_info.mutable_audio_info()->set_language("apa"); ASSERT_TRUE(media_playlist_.SetMediaInfo(media_info)); EXPECT_EQ("apa", media_playlist_.GetLanguage()); // no short form exists } TEST_F(MediaPlaylistTest, InitSegment) { valid_video_media_info_.set_init_segment_name("init_segment.mp4"); ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.mp4", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.mp4", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-MAP:URI=\"init_segment.mp4\"\n" "#EXTINF:10.000,\n" "file1.mp4\n" "#EXTINF:30.000,\n" "file2.mp4\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } // Verify that kSampleAesCenc is handled correctly. TEST_F(MediaPlaylistTest, SampleAesCenc) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAesCenc, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES-CENC," "URI=\"http://example.com\",IV=0x12345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } // Verify that multiple encryption info can be set. TEST_F(MediaPlaylistTest, MultipleEncryptionInfo) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAes, "http://mydomain.com", "0xfedc", "0x12345678", "com.widevine.someother", "1"); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 30 * kTimeScale, 5 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x12345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://mydomain.com\",KEYID=0xfedc,IV=0x12345678," "KEYFORMATVERSIONS=\"1\"," "KEYFORMAT=\"com.widevine.someother\"\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:30.000,\n" "file2.ts\n" "#EXT-X-ENDLIST\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } class LiveMediaPlaylistTest : public MediaPlaylistTest { protected: LiveMediaPlaylistTest() : MediaPlaylistTest(MediaPlaylist::MediaPlaylistType::kLive) {} }; TEST_F(LiveMediaPlaylistTest, Basic) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:20\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:20.000,\n" "file2.ts\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(LiveMediaPlaylistTest, TimeShifted) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); media_playlist_.AddSegment("file3.ts", 30 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:20\n" "#EXT-X-MEDIA-SEQUENCE:1\n" "#EXTINF:20.000,\n" "file2.ts\n" "#EXTINF:20.000,\n" "file3.ts\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(LiveMediaPlaylistTest, TimeShiftedWithEncryptionInfo) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAes, "http://mydomain.com", "0xfedc", "0x12345678", "com.widevine.someother", "1"); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); media_playlist_.AddSegment("file3.ts", 30 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:20\n" "#EXT-X-MEDIA-SEQUENCE:1\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x12345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://mydomain.com\",KEYID=0xfedc,IV=0x12345678," "KEYFORMATVERSIONS=\"1\"," "KEYFORMAT=\"com.widevine.someother\"\n" "#EXTINF:20.000,\n" "file2.ts\n" "#EXTINF:20.000,\n" "file3.ts\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } TEST_F(LiveMediaPlaylistTest, TimeShiftedWithEncryptionInfoShifted) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x12345678", "com.widevine", "1/2/4"); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAes, "http://mydomain.com", "0xfedc", "0x12345678", "com.widevine.someother", "1"); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x22345678", "com.widevine", "1/2/4"); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAes, "http://mydomain.com", "0xfedd", "0x22345678", "com.widevine.someother", "1"); media_playlist_.AddSegment("file3.ts", 30 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); media_playlist_.AddEncryptionInfo(MediaPlaylist::EncryptionMethod::kSampleAes, "http://example.com", "", "0x32345678", "com.widevine", "1/2/4"); media_playlist_.AddEncryptionInfo( MediaPlaylist::EncryptionMethod::kSampleAes, "http://mydomain.com", "0xfede", "0x32345678", "com.widevine.someother", "1"); media_playlist_.AddSegment("file4.ts", 50 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:20\n" "#EXT-X-MEDIA-SEQUENCE:2\n" "#EXT-X-DISCONTINUITY-SEQUENCE:1\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x22345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://mydomain.com\",KEYID=0xfedd,IV=0x22345678," "KEYFORMATVERSIONS=\"1\"," "KEYFORMAT=\"com.widevine.someother\"\n" "#EXTINF:20.000,\n" "file3.ts\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://example.com\",IV=0x32345678,KEYFORMATVERSIONS=\"1/2/4\"," "KEYFORMAT=\"com.widevine\"\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," "URI=\"http://mydomain.com\",KEYID=0xfede,IV=0x32345678," "KEYFORMATVERSIONS=\"1\"," "KEYFORMAT=\"com.widevine.someother\"\n" "#EXTINF:20.000,\n" "file4.ts\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } class EventMediaPlaylistTest : public MediaPlaylistTest { protected: EventMediaPlaylistTest() : MediaPlaylistTest(MediaPlaylist::MediaPlaylistType::kEvent) {} }; TEST_F(EventMediaPlaylistTest, Basic) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); media_playlist_.AddSegment("file1.ts", 0, 10 * kTimeScale, kMBytes); media_playlist_.AddSegment("file2.ts", 10 * kTimeScale, 20 * kTimeScale, 2 * kMBytes); const char kExpectedOutput[] = "#EXTM3U\n" "#EXT-X-VERSION:6\n" "## Generated with https://github.com/google/shaka-packager version " "test\n" "#EXT-X-TARGETDURATION:20\n" "#EXT-X-PLAYLIST-TYPE:EVENT\n" "#EXTINF:10.000,\n" "file1.ts\n" "#EXTINF:20.000,\n" "file2.ts\n"; const char kMemoryFilePath[] = "memory://media.m3u8"; EXPECT_TRUE(media_playlist_.WriteToFile(kMemoryFilePath)); ASSERT_FILE_STREQ(kMemoryFilePath, kExpectedOutput); } } // namespace hls } // namespace shaka
c713e2df6690cca73c2c77cbd37bd028574b13d4
21fdd28b765b286204d709b3385031b0a438e510
/38-RatonesEnUnLaberinto.cpp
cf7ac83000d042276f66dfc490e9d6393d24e1d7
[]
no_license
BNeku/TAIS
4f39ee2c7b0ba9e89d4ea417f4302e51f618c4da
ba7fdb248aa681406909dddf4558637e6c3bb779
refs/heads/master
2021-07-01T13:45:25.480060
2021-01-17T17:42:43
2021-01-17T17:42:43
207,549,771
8
1
null
null
null
null
WINDOWS-1250
C++
false
false
2,196
cpp
38-RatonesEnUnLaberinto.cpp
//Nerea Jiménez González #include <iostream> #include <fstream> #include "GrafoDirigidoValorado.h" #include "IndexPQ.h" using namespace std; const int INFINITO = 1000000000; /* int llegan(const GrafoDirigidoValorado<int> &g, int S, int T, vector<bool> &marked){ int ratones = 0; for (int i = 0; i < g.ady(S).size() && T>0; i++){ AristaDirigida<int> a = g.ady(S)[i]; if (T - a.valor() >= 0 && !marked[a.to()]){ ratones++; marked[a.to()] = true; ratones += llegan(g, a.to(), T - a.valor(), marked); } } return ratones; }*/ void relajar(AristaDirigida<int>& a, vector<AristaDirigida<int>>& aristas, IndexPQ<int>& pq, vector<int>&dist) { int v = a.from(), w = a.to(); if (dist[w] > dist[v] + a.valor()) { dist[w] = dist[v] + a.valor(); aristas[w] = a; pq.update(w, dist[w]); } } int llegan(const GrafoDirigidoValorado<int> &g, int& S, int& T){ vector<int> distancias(g.V(), INFINITO); vector<AristaDirigida<int>> aristas(g.V()); IndexPQ<int> pq(g.V()); int ratones = 0; distancias[S-1] = 0; pq.push(S-1, 0); while(!pq.empty()){ int v = pq.top().elem; pq.pop(); for (AristaDirigida<int> a : g.ady(v)){ relajar(a, aristas, pq, distancias); } } for (int i = 0; i < distancias.size(); i++){ if (i != S-1 && distancias[i] <= T) ratones++; } return ratones; } bool resuelveCaso() { int Nceldas, SnumCelda,Tseg,Pasadizos; cin >> Nceldas; if (!std::cin) // fin de la entrada return false; cin >> SnumCelda >> Tseg >> Pasadizos; int o, d, v; GrafoDirigidoValorado<int> grafo(Nceldas); vector<bool> marked(Nceldas); for (int i = 0 ; i < Pasadizos; i++){ cin >> o >> d >> v; AristaDirigida<int> arista(d-1,o-1,v); grafo.ponArista(arista); } //cout << llegan(grafo, SnumCelda-1, Tseg, marked) << endl; cout << llegan(grafo, SnumCelda, Tseg) << endl;; return true; } int main() { // ajustes para que cin extraiga directamente de un fichero #ifndef DOMJUDGE std::ifstream in("casos38.txt"); auto cinbuf = std::cin.rdbuf(in.rdbuf()); #endif while (resuelveCaso()); // para dejar todo como estaba al principio #ifndef DOMJUDGE std::cin.rdbuf(cinbuf); system("PAUSE"); #endif return 0; }
28518cf73f18c790338f007c4a6275c48b577212
50c74d83357e921a523e8d9b2a8e37522e180f94
/siglinux/unions/main.cpp
7d5ff2e50d2c2e36a48fd3f8eaf2a0d24578749c
[ "Unlicense" ]
permissive
JoeyCluett/supreme-chainsaw
6e74bec0caf463442e941477187ae01060a2dada
99e24a7d0cedd9a6943db5a9e58f990b86a07fed
refs/heads/master
2020-04-29T00:39:28.438351
2019-04-17T21:57:12
2019-04-17T21:57:12
175,702,367
1
0
null
null
null
null
UTF-8
C++
false
false
433
cpp
main.cpp
#include <iostream> using namespace std; void print_binary_format(int i32) { for(int i = 31; i >= 0; i--) cout << (((i32>>i) & 0x01) ? '1':'0'); cout << endl; } void print_binary_format(float f32) { union { int i32; float f_32; }; f_32 = f32; for(int i = 31; i >= 0; i--) cout << (((i32>>i) & 0x01) ? '1':'0'); cout << endl; } int main() { return 0; }
20659f2bc037a26e0a676c4a95212ff2d46d2ea7
7fa81ad3432c68f1b08bcabb4cacfb8c3baf3546
/Mod3_b/RP1-a_QRE/RP1-a_QRE.ino
3d4ec92ac0414ca025597e58fe3a2e776fd2e9c9
[]
no_license
asantospt/EI_FApl_Labs
3c4aed220b5108b4df8d0b7c59ed0dd6d59c7c73
f380cb592a8a1b5b4c72ce6c85d15a0514b8c6bf
refs/heads/master
2021-09-04T19:47:08.670814
2018-01-21T21:13:37
2018-01-21T21:13:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
678
ino
RP1-a_QRE.ino
/** * @ex - Mod.3b - RP1-a * @brief - ler V_out do QRE * @date - 06/12 * @author - Afonso & Natanael * @state - OK */ /** * LIGAÇÕES: @Arduino 'Mega 2560' * 5V -> USB * GND -> breadboard * A0 -> sensor QRE1113 * * @Sensor de reflexão/proximidade 'QRE1113' * 1 -> 5V + R1 (130 kOhm) * 2 -> GND * 3 -> V_out + R2 (10 kOhm) * 4 -> GND */ const int PIN_QRE = A0; void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(PIN_QRE); float voltage = sensorValue * (5.0 / 1023.0); Serial.println(voltage); delay(500); /** Valores Lidos: * min: 0.19 (com deteção em cima) * max: 5.00 (sem deteção) */ }
3a03ce87de7554d94edb0afd2d3e44920a3314ba
67ca177b2d3cbef19c2cf196a509d87a46b0d646
/core/server/server.h
2b5bb9f23712c900548f7b8c877716e5c3be258a
[]
no_license
stopfaner/BelyashDB
0b9cdd262cf942692bcb6295cdc12d48371b7b4a
c143e301409bd0c9d71c44e9f3f66099d0dba573
refs/heads/master
2021-04-15T13:53:47.439934
2018-04-18T21:25:54
2018-04-18T21:25:54
126,597,268
0
0
null
null
null
null
UTF-8
C++
false
false
1,630
h
server.h
#pragma once #include <stdio.h> #include <string.h> //strlen #include <stdlib.h> #include <errno.h> #include <unistd.h> //close #include <arpa/inet.h> //close #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/time.h> //FD_SET, FD_ISSET, FD_ZERO macros #include <iostream> #include "../utils/logwrapper.h" #include "session_manager.h" #define TRUE 1 #define FALSE 0 #define PORT 8888 #define MAX_CLIENTS_DEFAULT 30 #define MAX_CLIENTS 100 namespace server { class Server { private: int opt = TRUE; int master_socket; int address_len; int new_socket; int *client_socket; int max_clients; int activity; int valread; int sd; int max_sd; struct sockaddr_in server_address; // Session manager define SessionManager* session_manager; char buffer[1025]; //data buffer of 1K //set of socket descriptors fd_set readfds; bool err_flag = false; char *err = NULL; bool _set_up_socket(); void _incomming_connection(); void _io_accept(); public: Server(int max_clients); void start_accepting(); }; }
3153cc63263e1715319610fd0a301906d8103464
22a451347cf2938efecc97500dd5e699eeeb066a
/courseSchedule.cpp
6b9cfb9e38a2a7ea4a195a3d8c43800bc9b1a294
[]
no_license
galok8749/Graph_CSES
f5e382fc88eb53b3e423892d4a2157278356cf2a
0dd159576cee509a2217aba30af8cee7252ad14b
refs/heads/main
2023-06-17T02:17:04.731483
2021-07-17T05:31:36
2021-07-17T05:31:36
386,506,610
0
0
null
null
null
null
UTF-8
C++
false
false
858
cpp
courseSchedule.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y; cin >> n >> m; vector<int> g[n+1]; vector<int> inDegree(n+1, 0); for(int i = 1; i <= m; i++) { cin >> x >> y; g[x].push_back(y); inDegree[y] +=1; } queue<int> qu; for(int i = 1; i <= n; i++) { if(inDegree[i] == 0) qu.push(i); } vector<int> ans; while(!qu.empty()) { x = qu.front(); qu.pop(); ans.push_back(x); for(int i = 0; i < g[x].size(); i++) { int y = g[x][i]; if(--inDegree[y] == 0) qu.push(y); } } if(ans.size() == n) { for(int i = 0; i < n; i++) cout << ans[i] << " "; cout << endl; } else { cout << "IMPOSSIBLE\n"; } return 0; }
8828b4b68852a6d277976e7e99b8f3c2107e85a2
4a0182f33147034ee4ff2b6ed6b1b2563aa046ad
/r/r/pc/cpp/ser/inc/CatheterSerialSender.h
7d698d64f24ac88dc93cc20723f29958d51b9ca4
[]
no_license
thibugio/obor
0b9227124b317df3068c6ea473ebf9ce93fdece1
078c4f477d2cb9cd5a52caae86abb60d85bf6a13
refs/heads/master
2020-12-31T00:17:46.228156
2015-11-01T20:29:22
2015-11-01T20:29:22
45,356,114
0
0
null
null
null
null
UTF-8
C++
false
false
766
h
CatheterSerialSender.h
/* CatheterSerialSender.h */ #ifndef CATHETER_SERIAL_SENDER_H #define CATHETER_SERIAL_SENDER_H #include <cstdint> #include <string> #include <stdint.h> #include "common_utils.h" #include "posix_serial_utils.h" class CatheterSerialSender { public: CatheterSerialSender(); ~CatheterSerialSender(); bool init(); std::string showSerialPath(); int sendByteVectors(std::vector<std::vector<uint8_t>> bytes, std::vector<int> delays); std::vector<std::vector<uint8_t>> sendByteVectorsAndRead( std::vector<std::vector<uint8_t>> pbytes, std::vector<int> pdelays); private: const std::string& serial_path; serial_port sp; }; #endif
86a0f23f16d2f67a2f19c7ae0ae9fc3c0e9db209
346c17a1b3feba55e3c8a0513ae97a4282399c05
/CodeGenere/photogram/cEqAppui_GL__TerFix_M2CPolyn0.cpp
1fb6dbe872cd56315177c3b7e33f4071976b4f93
[ "LicenseRef-scancode-cecill-b-en" ]
permissive
micmacIGN/micmac
af4ab545c3e1d9c04b4c83ac7e926a3ff7707df6
6e5721ddc65cb9b480e53b5914e2e2391d5ae722
refs/heads/master
2023-09-01T15:06:30.805394
2023-07-25T09:18:43
2023-08-30T11:35:30
74,707,998
603
156
NOASSERTION
2023-06-19T12:53:13
2016-11-24T22:09:54
C++
UTF-8
C++
false
false
16,102
cpp
cEqAppui_GL__TerFix_M2CPolyn0.cpp
// File Automatically generated by eLiSe #include "StdAfx.h" #include "cEqAppui_GL__TerFix_M2CPolyn0.h" cEqAppui_GL__TerFix_M2CPolyn0::cEqAppui_GL__TerFix_M2CPolyn0(): cElCompiledFonc(2) { AddIntRef (cIncIntervale("Intr",0,3)); AddIntRef (cIncIntervale("Orient",3,9)); Close(false); } void cEqAppui_GL__TerFix_M2CPolyn0::ComputeVal() { double tmp0_ = mCompCoord[3]; double tmp1_ = mCompCoord[4]; double tmp2_ = cos(tmp1_); double tmp3_ = cos(tmp0_); double tmp4_ = tmp3_ * tmp2_; double tmp5_ = sin(tmp0_); double tmp6_ = tmp5_ * tmp2_; double tmp7_ = sin(tmp1_); double tmp8_ = mCompCoord[5]; double tmp9_ = sin(tmp8_); double tmp10_ = -(tmp9_); double tmp11_ = -(tmp7_); double tmp12_ = cos(tmp8_); double tmp13_ = mCompCoord[6]; double tmp14_ = mLocXTer - tmp13_; double tmp15_ = -(tmp5_); double tmp16_ = tmp15_ * tmp10_; double tmp17_ = tmp3_ * tmp11_; double tmp18_ = tmp17_ * tmp12_; double tmp19_ = tmp16_ + tmp18_; double tmp20_ = tmp3_ * tmp10_; double tmp21_ = tmp5_ * tmp11_; double tmp22_ = tmp21_ * tmp12_; double tmp23_ = tmp20_ + tmp22_; double tmp24_ = tmp2_ * tmp12_; double tmp25_ = mCompCoord[7]; double tmp26_ = mLocYTer - tmp25_; double tmp27_ = mCompCoord[8]; double tmp28_ = mLocZTer - tmp27_; double tmp29_ = tmp15_ * tmp12_; double tmp30_ = tmp17_ * tmp9_; double tmp31_ = tmp29_ + tmp30_; double tmp32_ = tmp3_ * tmp12_; double tmp33_ = tmp21_ * tmp9_; double tmp34_ = tmp32_ + tmp33_; double tmp35_ = tmp2_ * tmp9_; double tmp36_ = mCompCoord[0]; double tmp37_ = (tmp19_) * mLocGL_0_0; double tmp38_ = (tmp23_) * mLocGL_1_0; double tmp39_ = tmp37_ + tmp38_; double tmp40_ = tmp24_ * mLocGL_2_0; double tmp41_ = tmp39_ + tmp40_; double tmp42_ = (tmp41_) * (tmp14_); double tmp43_ = (tmp19_) * mLocGL_0_1; double tmp44_ = (tmp23_) * mLocGL_1_1; double tmp45_ = tmp43_ + tmp44_; double tmp46_ = tmp24_ * mLocGL_2_1; double tmp47_ = tmp45_ + tmp46_; double tmp48_ = (tmp47_) * (tmp26_); double tmp49_ = tmp42_ + tmp48_; double tmp50_ = (tmp19_) * mLocGL_0_2; double tmp51_ = (tmp23_) * mLocGL_1_2; double tmp52_ = tmp50_ + tmp51_; double tmp53_ = tmp24_ * mLocGL_2_2; double tmp54_ = tmp52_ + tmp53_; double tmp55_ = (tmp54_) * (tmp28_); double tmp56_ = tmp49_ + tmp55_; double tmp57_ = tmp36_ / (tmp56_); mVal[0] = ((((tmp4_ * mLocGL_0_0 + tmp6_ * mLocGL_1_0 + tmp7_ * mLocGL_2_0) * (tmp14_) + (tmp4_ * mLocGL_0_1 + tmp6_ * mLocGL_1_1 + tmp7_ * mLocGL_2_1) * (tmp26_) + (tmp4_ * mLocGL_0_2 + tmp6_ * mLocGL_1_2 + tmp7_ * mLocGL_2_2) * (tmp28_)) * (tmp57_) + mCompCoord[1]) - mLocXIm) * mLocScNorm; mVal[1] = (((((tmp31_) * mLocGL_0_0 + (tmp34_) * mLocGL_1_0 + tmp35_ * mLocGL_2_0) * (tmp14_) + ((tmp31_) * mLocGL_0_1 + (tmp34_) * mLocGL_1_1 + tmp35_ * mLocGL_2_1) * (tmp26_) + ((tmp31_) * mLocGL_0_2 + (tmp34_) * mLocGL_1_2 + tmp35_ * mLocGL_2_2) * (tmp28_)) * (tmp57_) + mCompCoord[2]) - mLocYIm) * mLocScNorm; } void cEqAppui_GL__TerFix_M2CPolyn0::ComputeValDeriv() { double tmp0_ = mCompCoord[3]; double tmp1_ = mCompCoord[4]; double tmp2_ = cos(tmp1_); double tmp3_ = cos(tmp0_); double tmp4_ = tmp3_ * tmp2_; double tmp5_ = sin(tmp0_); double tmp6_ = tmp5_ * tmp2_; double tmp7_ = sin(tmp1_); double tmp8_ = mCompCoord[5]; double tmp9_ = sin(tmp8_); double tmp10_ = -(tmp9_); double tmp11_ = -(tmp7_); double tmp12_ = cos(tmp8_); double tmp13_ = mCompCoord[6]; double tmp14_ = mLocXTer - tmp13_; double tmp15_ = -(tmp5_); double tmp16_ = tmp15_ * tmp10_; double tmp17_ = tmp3_ * tmp11_; double tmp18_ = tmp17_ * tmp12_; double tmp19_ = tmp16_ + tmp18_; double tmp20_ = tmp3_ * tmp10_; double tmp21_ = tmp5_ * tmp11_; double tmp22_ = tmp21_ * tmp12_; double tmp23_ = tmp20_ + tmp22_; double tmp24_ = tmp2_ * tmp12_; double tmp25_ = mCompCoord[7]; double tmp26_ = mLocYTer - tmp25_; double tmp27_ = mCompCoord[8]; double tmp28_ = mLocZTer - tmp27_; double tmp29_ = (tmp19_) * mLocGL_0_0; double tmp30_ = (tmp23_) * mLocGL_1_0; double tmp31_ = tmp29_ + tmp30_; double tmp32_ = tmp24_ * mLocGL_2_0; double tmp33_ = tmp31_ + tmp32_; double tmp34_ = (tmp33_) * (tmp14_); double tmp35_ = (tmp19_) * mLocGL_0_1; double tmp36_ = (tmp23_) * mLocGL_1_1; double tmp37_ = tmp35_ + tmp36_; double tmp38_ = tmp24_ * mLocGL_2_1; double tmp39_ = tmp37_ + tmp38_; double tmp40_ = (tmp39_) * (tmp26_); double tmp41_ = tmp34_ + tmp40_; double tmp42_ = (tmp19_) * mLocGL_0_2; double tmp43_ = (tmp23_) * mLocGL_1_2; double tmp44_ = tmp42_ + tmp43_; double tmp45_ = tmp24_ * mLocGL_2_2; double tmp46_ = tmp44_ + tmp45_; double tmp47_ = (tmp46_) * (tmp28_); double tmp48_ = tmp41_ + tmp47_; double tmp49_ = tmp4_ * mLocGL_0_0; double tmp50_ = tmp6_ * mLocGL_1_0; double tmp51_ = tmp49_ + tmp50_; double tmp52_ = tmp7_ * mLocGL_2_0; double tmp53_ = tmp51_ + tmp52_; double tmp54_ = (tmp53_) * (tmp14_); double tmp55_ = tmp4_ * mLocGL_0_1; double tmp56_ = tmp6_ * mLocGL_1_1; double tmp57_ = tmp55_ + tmp56_; double tmp58_ = tmp7_ * mLocGL_2_1; double tmp59_ = tmp57_ + tmp58_; double tmp60_ = (tmp59_) * (tmp26_); double tmp61_ = tmp54_ + tmp60_; double tmp62_ = tmp4_ * mLocGL_0_2; double tmp63_ = tmp6_ * mLocGL_1_2; double tmp64_ = tmp62_ + tmp63_; double tmp65_ = tmp7_ * mLocGL_2_2; double tmp66_ = tmp64_ + tmp65_; double tmp67_ = (tmp66_) * (tmp28_); double tmp68_ = tmp61_ + tmp67_; double tmp69_ = -(1); double tmp70_ = tmp69_ * tmp5_; double tmp71_ = tmp70_ * tmp2_; double tmp72_ = mCompCoord[0]; double tmp73_ = tmp72_ / (tmp48_); double tmp74_ = -(tmp3_); double tmp75_ = tmp74_ * tmp10_; double tmp76_ = tmp70_ * tmp11_; double tmp77_ = tmp76_ * tmp12_; double tmp78_ = tmp75_ + tmp77_; double tmp79_ = tmp70_ * tmp10_; double tmp80_ = tmp79_ + tmp18_; double tmp81_ = ElSquare(tmp48_); double tmp82_ = tmp69_ * tmp7_; double tmp83_ = tmp82_ * tmp3_; double tmp84_ = tmp82_ * tmp5_; double tmp85_ = -(tmp2_); double tmp86_ = tmp85_ * tmp3_; double tmp87_ = tmp86_ * tmp12_; double tmp88_ = tmp85_ * tmp5_; double tmp89_ = tmp88_ * tmp12_; double tmp90_ = tmp82_ * tmp12_; double tmp91_ = -(tmp12_); double tmp92_ = tmp69_ * tmp9_; double tmp93_ = tmp91_ * tmp15_; double tmp94_ = tmp92_ * tmp17_; double tmp95_ = tmp93_ + tmp94_; double tmp96_ = tmp91_ * tmp3_; double tmp97_ = tmp92_ * tmp21_; double tmp98_ = tmp96_ + tmp97_; double tmp99_ = tmp92_ * tmp2_; double tmp100_ = tmp15_ * tmp12_; double tmp101_ = tmp17_ * tmp9_; double tmp102_ = tmp100_ + tmp101_; double tmp103_ = tmp3_ * tmp12_; double tmp104_ = tmp21_ * tmp9_; double tmp105_ = tmp103_ + tmp104_; double tmp106_ = tmp2_ * tmp9_; double tmp107_ = (tmp48_) / tmp81_; double tmp108_ = (tmp102_) * mLocGL_0_0; double tmp109_ = (tmp105_) * mLocGL_1_0; double tmp110_ = tmp108_ + tmp109_; double tmp111_ = tmp106_ * mLocGL_2_0; double tmp112_ = tmp110_ + tmp111_; double tmp113_ = (tmp112_) * (tmp14_); double tmp114_ = (tmp102_) * mLocGL_0_1; double tmp115_ = (tmp105_) * mLocGL_1_1; double tmp116_ = tmp114_ + tmp115_; double tmp117_ = tmp106_ * mLocGL_2_1; double tmp118_ = tmp116_ + tmp117_; double tmp119_ = (tmp118_) * (tmp26_); double tmp120_ = tmp113_ + tmp119_; double tmp121_ = (tmp102_) * mLocGL_0_2; double tmp122_ = (tmp105_) * mLocGL_1_2; double tmp123_ = tmp121_ + tmp122_; double tmp124_ = tmp106_ * mLocGL_2_2; double tmp125_ = tmp123_ + tmp124_; double tmp126_ = (tmp125_) * (tmp28_); double tmp127_ = tmp120_ + tmp126_; double tmp128_ = tmp74_ * tmp12_; double tmp129_ = tmp76_ * tmp9_; double tmp130_ = tmp128_ + tmp129_; double tmp131_ = tmp70_ * tmp12_; double tmp132_ = tmp131_ + tmp101_; double tmp133_ = (tmp78_) * mLocGL_0_0; double tmp134_ = (tmp80_) * mLocGL_1_0; double tmp135_ = tmp133_ + tmp134_; double tmp136_ = (tmp135_) * (tmp14_); double tmp137_ = (tmp78_) * mLocGL_0_1; double tmp138_ = (tmp80_) * mLocGL_1_1; double tmp139_ = tmp137_ + tmp138_; double tmp140_ = (tmp139_) * (tmp26_); double tmp141_ = tmp136_ + tmp140_; double tmp142_ = (tmp78_) * mLocGL_0_2; double tmp143_ = (tmp80_) * mLocGL_1_2; double tmp144_ = tmp142_ + tmp143_; double tmp145_ = (tmp144_) * (tmp28_); double tmp146_ = tmp141_ + tmp145_; double tmp147_ = tmp72_ * (tmp146_); double tmp148_ = -(tmp147_); double tmp149_ = tmp148_ / tmp81_; double tmp150_ = tmp86_ * tmp9_; double tmp151_ = tmp88_ * tmp9_; double tmp152_ = tmp82_ * tmp9_; double tmp153_ = tmp87_ * mLocGL_0_0; double tmp154_ = tmp89_ * mLocGL_1_0; double tmp155_ = tmp153_ + tmp154_; double tmp156_ = tmp90_ * mLocGL_2_0; double tmp157_ = tmp155_ + tmp156_; double tmp158_ = (tmp157_) * (tmp14_); double tmp159_ = tmp87_ * mLocGL_0_1; double tmp160_ = tmp89_ * mLocGL_1_1; double tmp161_ = tmp159_ + tmp160_; double tmp162_ = tmp90_ * mLocGL_2_1; double tmp163_ = tmp161_ + tmp162_; double tmp164_ = (tmp163_) * (tmp26_); double tmp165_ = tmp158_ + tmp164_; double tmp166_ = tmp87_ * mLocGL_0_2; double tmp167_ = tmp89_ * mLocGL_1_2; double tmp168_ = tmp166_ + tmp167_; double tmp169_ = tmp90_ * mLocGL_2_2; double tmp170_ = tmp168_ + tmp169_; double tmp171_ = (tmp170_) * (tmp28_); double tmp172_ = tmp165_ + tmp171_; double tmp173_ = tmp72_ * (tmp172_); double tmp174_ = -(tmp173_); double tmp175_ = tmp174_ / tmp81_; double tmp176_ = tmp92_ * tmp15_; double tmp177_ = tmp12_ * tmp17_; double tmp178_ = tmp176_ + tmp177_; double tmp179_ = tmp92_ * tmp3_; double tmp180_ = tmp12_ * tmp21_; double tmp181_ = tmp179_ + tmp180_; double tmp182_ = tmp12_ * tmp2_; double tmp183_ = (tmp95_) * mLocGL_0_0; double tmp184_ = (tmp98_) * mLocGL_1_0; double tmp185_ = tmp183_ + tmp184_; double tmp186_ = tmp99_ * mLocGL_2_0; double tmp187_ = tmp185_ + tmp186_; double tmp188_ = (tmp187_) * (tmp14_); double tmp189_ = (tmp95_) * mLocGL_0_1; double tmp190_ = (tmp98_) * mLocGL_1_1; double tmp191_ = tmp189_ + tmp190_; double tmp192_ = tmp99_ * mLocGL_2_1; double tmp193_ = tmp191_ + tmp192_; double tmp194_ = (tmp193_) * (tmp26_); double tmp195_ = tmp188_ + tmp194_; double tmp196_ = (tmp95_) * mLocGL_0_2; double tmp197_ = (tmp98_) * mLocGL_1_2; double tmp198_ = tmp196_ + tmp197_; double tmp199_ = tmp99_ * mLocGL_2_2; double tmp200_ = tmp198_ + tmp199_; double tmp201_ = (tmp200_) * (tmp28_); double tmp202_ = tmp195_ + tmp201_; double tmp203_ = tmp72_ * (tmp202_); double tmp204_ = -(tmp203_); double tmp205_ = tmp204_ / tmp81_; double tmp206_ = tmp69_ * (tmp33_); double tmp207_ = tmp72_ * tmp206_; double tmp208_ = -(tmp207_); double tmp209_ = tmp208_ / tmp81_; double tmp210_ = tmp69_ * (tmp39_); double tmp211_ = tmp72_ * tmp210_; double tmp212_ = -(tmp211_); double tmp213_ = tmp212_ / tmp81_; double tmp214_ = tmp69_ * (tmp46_); double tmp215_ = tmp72_ * tmp214_; double tmp216_ = -(tmp215_); double tmp217_ = tmp216_ / tmp81_; mVal[0] = (((tmp68_) * (tmp73_) + mCompCoord[1]) - mLocXIm) * mLocScNorm; mCompDer[0][0] = (tmp107_) * (tmp68_) * mLocScNorm; mCompDer[0][1] = mLocScNorm; mCompDer[0][2] = 0; mCompDer[0][3] = (((tmp71_ * mLocGL_0_0 + tmp4_ * mLocGL_1_0) * (tmp14_) + (tmp71_ * mLocGL_0_1 + tmp4_ * mLocGL_1_1) * (tmp26_) + (tmp71_ * mLocGL_0_2 + tmp4_ * mLocGL_1_2) * (tmp28_)) * (tmp73_) + (tmp149_) * (tmp68_)) * mLocScNorm; mCompDer[0][4] = (((tmp83_ * mLocGL_0_0 + tmp84_ * mLocGL_1_0 + tmp2_ * mLocGL_2_0) * (tmp14_) + (tmp83_ * mLocGL_0_1 + tmp84_ * mLocGL_1_1 + tmp2_ * mLocGL_2_1) * (tmp26_) + (tmp83_ * mLocGL_0_2 + tmp84_ * mLocGL_1_2 + tmp2_ * mLocGL_2_2) * (tmp28_)) * (tmp73_) + (tmp175_) * (tmp68_)) * mLocScNorm; mCompDer[0][5] = (tmp205_) * (tmp68_) * mLocScNorm; mCompDer[0][6] = (tmp69_ * (tmp53_) * (tmp73_) + (tmp209_) * (tmp68_)) * mLocScNorm; mCompDer[0][7] = (tmp69_ * (tmp59_) * (tmp73_) + (tmp213_) * (tmp68_)) * mLocScNorm; mCompDer[0][8] = (tmp69_ * (tmp66_) * (tmp73_) + (tmp217_) * (tmp68_)) * mLocScNorm; mVal[1] = (((tmp127_) * (tmp73_) + mCompCoord[2]) - mLocYIm) * mLocScNorm; mCompDer[1][0] = (tmp107_) * (tmp127_) * mLocScNorm; mCompDer[1][1] = 0; mCompDer[1][2] = mLocScNorm; mCompDer[1][3] = ((((tmp130_) * mLocGL_0_0 + (tmp132_) * mLocGL_1_0) * (tmp14_) + ((tmp130_) * mLocGL_0_1 + (tmp132_) * mLocGL_1_1) * (tmp26_) + ((tmp130_) * mLocGL_0_2 + (tmp132_) * mLocGL_1_2) * (tmp28_)) * (tmp73_) + (tmp149_) * (tmp127_)) * mLocScNorm; mCompDer[1][4] = (((tmp150_ * mLocGL_0_0 + tmp151_ * mLocGL_1_0 + tmp152_ * mLocGL_2_0) * (tmp14_) + (tmp150_ * mLocGL_0_1 + tmp151_ * mLocGL_1_1 + tmp152_ * mLocGL_2_1) * (tmp26_) + (tmp150_ * mLocGL_0_2 + tmp151_ * mLocGL_1_2 + tmp152_ * mLocGL_2_2) * (tmp28_)) * (tmp73_) + (tmp175_) * (tmp127_)) * mLocScNorm; mCompDer[1][5] = ((((tmp178_) * mLocGL_0_0 + (tmp181_) * mLocGL_1_0 + tmp182_ * mLocGL_2_0) * (tmp14_) + ((tmp178_) * mLocGL_0_1 + (tmp181_) * mLocGL_1_1 + tmp182_ * mLocGL_2_1) * (tmp26_) + ((tmp178_) * mLocGL_0_2 + (tmp181_) * mLocGL_1_2 + tmp182_ * mLocGL_2_2) * (tmp28_)) * (tmp73_) + (tmp205_) * (tmp127_)) * mLocScNorm; mCompDer[1][6] = (tmp69_ * (tmp112_) * (tmp73_) + (tmp209_) * (tmp127_)) * mLocScNorm; mCompDer[1][7] = (tmp69_ * (tmp118_) * (tmp73_) + (tmp213_) * (tmp127_)) * mLocScNorm; mCompDer[1][8] = (tmp69_ * (tmp125_) * (tmp73_) + (tmp217_) * (tmp127_)) * mLocScNorm; } void cEqAppui_GL__TerFix_M2CPolyn0::ComputeValDerivHessian() { ELISE_ASSERT(false,"Foncteur cEqAppui_GL__TerFix_M2CPolyn0 Has no Der Sec"); } void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_0_0(double aVal){ mLocGL_0_0 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_0_1(double aVal){ mLocGL_0_1 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_0_2(double aVal){ mLocGL_0_2 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_1_0(double aVal){ mLocGL_1_0 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_1_1(double aVal){ mLocGL_1_1 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_1_2(double aVal){ mLocGL_1_2 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_2_0(double aVal){ mLocGL_2_0 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_2_1(double aVal){ mLocGL_2_1 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetGL_2_2(double aVal){ mLocGL_2_2 = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetScNorm(double aVal){ mLocScNorm = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetXIm(double aVal){ mLocXIm = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetXTer(double aVal){ mLocXTer = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetYIm(double aVal){ mLocYIm = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetYTer(double aVal){ mLocYTer = aVal;} void cEqAppui_GL__TerFix_M2CPolyn0::SetZTer(double aVal){ mLocZTer = aVal;} double * cEqAppui_GL__TerFix_M2CPolyn0::AdrVarLocFromString(const std::string & aName) { if (aName == "GL_0_0") return & mLocGL_0_0; if (aName == "GL_0_1") return & mLocGL_0_1; if (aName == "GL_0_2") return & mLocGL_0_2; if (aName == "GL_1_0") return & mLocGL_1_0; if (aName == "GL_1_1") return & mLocGL_1_1; if (aName == "GL_1_2") return & mLocGL_1_2; if (aName == "GL_2_0") return & mLocGL_2_0; if (aName == "GL_2_1") return & mLocGL_2_1; if (aName == "GL_2_2") return & mLocGL_2_2; if (aName == "ScNorm") return & mLocScNorm; if (aName == "XIm") return & mLocXIm; if (aName == "XTer") return & mLocXTer; if (aName == "YIm") return & mLocYIm; if (aName == "YTer") return & mLocYTer; if (aName == "ZTer") return & mLocZTer; return 0; } cElCompiledFonc::cAutoAddEntry cEqAppui_GL__TerFix_M2CPolyn0::mTheAuto("cEqAppui_GL__TerFix_M2CPolyn0",cEqAppui_GL__TerFix_M2CPolyn0::Alloc); cElCompiledFonc * cEqAppui_GL__TerFix_M2CPolyn0::Alloc() { return new cEqAppui_GL__TerFix_M2CPolyn0(); }
d4129949a8f534dc4db4aa2f1774f1c045c37098
d31aed88f751ec8f9dd0a51ea215dba4577b5a9b
/framework/core/plugins_manager/sources/plugins_manager/pm_plugins_manager.hpp
6cc8b84c0f7b55a80b27c09beb1c3464ceb63bbb
[]
no_license
valeriyr/Hedgehog
56a4f186286608140f0e4ce5ef962e9a10b123a8
c045f262ca036570416c793f589ba1650223edd9
refs/heads/master
2016-09-05T20:00:51.747169
2015-09-04T05:21:38
2015-09-04T05:21:38
3,336,071
0
0
null
null
null
null
UTF-8
C++
false
false
2,787
hpp
pm_plugins_manager.hpp
#ifndef __PM_PLUGINS_MANAGER_HPP__ #define __PM_PLUGINS_MANAGER_HPP__ /*---------------------------------------------------------------------------*/ #include "plugins_manager/sources/plugins_manager/pm_iplugins_manager_internal.hpp" /*---------------------------------------------------------------------------*/ namespace Framework { namespace Core { namespace PluginsManager { /*---------------------------------------------------------------------------*/ struct ISystemInformation; /*---------------------------------------------------------------------------*/ class PluginsManager : public Tools::Core::BaseWrapper< IPluginsManagerInternal > { /*---------------------------------------------------------------------------*/ public: /*---------------------------------------------------------------------------*/ PluginsManager( boost::intrusive_ptr< ISystemInformation > _systemInformation ); virtual ~PluginsManager(); /*---------------------------------------------------------------------------*/ /*virtual*/ boost::intrusive_ptr< IBase > getPluginInterface( const QString& _pluginName, const quint32 _interfaceId ); /*virtual*/ bool isPluginLoaded( const QString& _pluginName ) const; /*---------------------------------------------------------------------------*/ /*virtual*/ void registerPlugin( boost::shared_ptr< PluginData > _pluginData ); /*virtual*/ void loadPlugins(); /*virtual*/ void closePlugins(); /*---------------------------------------------------------------------------*/ private: /*---------------------------------------------------------------------------*/ void loadPluginIfNeeded( boost::shared_ptr< PluginData > _pluginData ); /*---------------------------------------------------------------------------*/ typedef std::map< QString, boost::shared_ptr< PluginData > > PluginsCollectionType; typedef PluginsCollectionType::const_iterator PluginsCollectionTypeIterator; typedef std::vector< boost::shared_ptr< PluginData > > PluginsInLoadingOrderCollectionType; typedef PluginsInLoadingOrderCollectionType::reverse_iterator PluginsInLoadingOrderCollectionTypeIterator; /*---------------------------------------------------------------------------*/ PluginsCollectionType m_pluginsCollection; PluginsInLoadingOrderCollectionType m_pluginsInLoadingOrderCollection; boost::intrusive_ptr< ISystemInformation > m_systemInformation; /*---------------------------------------------------------------------------*/ }; /*---------------------------------------------------------------------------*/ } // namespace PluginsManager } // namespace Core } // namespace Framework /*---------------------------------------------------------------------------*/ #endif // __PM_PLUGINS_MANAGER_HPP__
c1b8a1734da4c6638b3c361fd119e844d3cf6f9e
1a90ec74dc103a89c6696e4985cc5821ed9fbbca
/thrift/gen-cpp/adserver_types.cpp
d42dd269605d2db452a1fe5b9b88bc2e9a39d63c
[]
no_license
baodier/advertise_lab
24801590535be49ad2b92089cbec42bb820f2f50
e4aa5aaefde8a0d7a820af8a0db4999331498908
refs/heads/master
2016-09-06T09:18:45.419273
2015-01-18T16:04:30
2015-01-18T16:04:30
28,140,628
0
1
null
null
null
null
UTF-8
C++
false
true
4,875
cpp
adserver_types.cpp
/** * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #include "adserver_types.h" #include <algorithm> #include <ostream> #include <thrift/TToString.h> ad_info::~ad_info() throw() { } void ad_info::__set_os(const std::string& val) { this->os = val; } void ad_info::__set_browser(const std::string& val) { this->browser = val; } void ad_info::__set_region(const std::string& val) { this->region = val; } void ad_info::__set_hour(const int32_t val) { this->hour = val; } void ad_info::__set_searchWord(const std::string& val) { this->searchWord = val; } const char* ad_info::ascii_fingerprint = "C18AD26BF3FFAD5198DC3D25D5D7A521"; const uint8_t ad_info::binary_fingerprint[16] = {0xC1,0x8A,0xD2,0x6B,0xF3,0xFF,0xAD,0x51,0x98,0xDC,0x3D,0x25,0xD5,0xD7,0xA5,0x21}; uint32_t ad_info::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->os); this->__isset.os = true; } else { xfer += iprot->skip(ftype); } break; case 2: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->browser); this->__isset.browser = true; } else { xfer += iprot->skip(ftype); } break; case 3: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->region); this->__isset.region = true; } else { xfer += iprot->skip(ftype); } break; case 4: if (ftype == ::apache::thrift::protocol::T_I32) { xfer += iprot->readI32(this->hour); this->__isset.hour = true; } else { xfer += iprot->skip(ftype); } break; case 5: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->searchWord); this->__isset.searchWord = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t ad_info::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; oprot->incrementRecursionDepth(); xfer += oprot->writeStructBegin("ad_info"); xfer += oprot->writeFieldBegin("os", ::apache::thrift::protocol::T_STRING, 1); xfer += oprot->writeString(this->os); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("browser", ::apache::thrift::protocol::T_STRING, 2); xfer += oprot->writeString(this->browser); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("region", ::apache::thrift::protocol::T_STRING, 3); xfer += oprot->writeString(this->region); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("hour", ::apache::thrift::protocol::T_I32, 4); xfer += oprot->writeI32(this->hour); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("searchWord", ::apache::thrift::protocol::T_STRING, 5); xfer += oprot->writeString(this->searchWord); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); oprot->decrementRecursionDepth(); return xfer; } void swap(ad_info &a, ad_info &b) { using ::std::swap; swap(a.os, b.os); swap(a.browser, b.browser); swap(a.region, b.region); swap(a.hour, b.hour); swap(a.searchWord, b.searchWord); swap(a.__isset, b.__isset); } ad_info::ad_info(const ad_info& other0) { os = other0.os; browser = other0.browser; region = other0.region; hour = other0.hour; searchWord = other0.searchWord; __isset = other0.__isset; } ad_info& ad_info::operator=(const ad_info& other1) { os = other1.os; browser = other1.browser; region = other1.region; hour = other1.hour; searchWord = other1.searchWord; __isset = other1.__isset; return *this; } std::ostream& operator<<(std::ostream& out, const ad_info& obj) { using apache::thrift::to_string; out << "ad_info("; out << "os=" << to_string(obj.os); out << ", " << "browser=" << to_string(obj.browser); out << ", " << "region=" << to_string(obj.region); out << ", " << "hour=" << to_string(obj.hour); out << ", " << "searchWord=" << to_string(obj.searchWord); out << ")"; return out; }
63471007421294b5ad5c6e9905b2f11ffa6da92c
75316e9fb0f582cafc932aa0aadab653fb4435e3
/src/EQjson.cpp
e989f76557f7e2484454c903062928745c927e05
[ "MIT" ]
permissive
Spationaute/FullEarth
942618ce1887b2286a86047d57088772774f755e
6b135154abbeda57303e772afd8a7b5b8ad03f89
refs/heads/master
2022-12-24T13:14:48.630070
2022-12-19T17:49:27
2022-12-19T17:49:27
201,925,457
6
4
null
null
null
null
UTF-8
C++
false
false
4,310
cpp
EQjson.cpp
// // Created by gabriel on 18/07/19. // #include "EQjson.h" using json = nlohmann::json; EQjson::~EQjson() { clearEq(); } bool EQjson::parse() { bool res = Geojson::parse(); std::vector<Owner*> ownerList = this->getOwners(); std::vector<Pts> pointsList = this->getPoints(); clearEq(); float max_mag = -1; float min_mag = 100; time_t max_time = INT_MIN; time_t min_time = INT_MAX; if(res){ long int n = ownerList.size(); for(int ii=0;ii<n;++ii){ Owner* temp = ownerList.at(ii); if(temp->ptsIds.size()>0){ json* properties = temp->properties; auto eq = new EarthQuake(); eq->owner = temp; eq->label = properties->find("title").value().get<std::string>(); eq->lon = pointsList.at(temp->ptsIds.at(0)-1).at(0); eq->lat = pointsList.at(temp->ptsIds.at(0)-1).at(1); eq->magnitude = properties->find("mag").value().get<float>(); eq->event_time = properties->find("time").value().get<long int>()/1000; eq->depth = pointsList.at(temp->ptsIds.at(0)-1).at(2); eq->place = properties->find("place").value().get<std::string>(); eq->url = properties->find("url").value().get<std::string>(); eq->selected = false; eq->shown = true; eq->index = equake.size(); eq->vindex = equake.size(); equake.push_back(eq); if(eq->magnitude>max_mag){ max_mag = eq->magnitude; largest = eq; } if(eq->magnitude<min_mag){ min_mag = eq->magnitude; smallest = eq; } if(eq->event_time>max_time){ max_time = eq->event_time; latest = eq; } if(eq->event_time<min_time){ min_time = eq->event_time; oldest = eq; } } } sortedLatest.clear(); sortedLargest.clear(); sortedLargest = equake; sortedLatest = equake; std::sort(sortedLargest.begin(),sortedLargest.end(),EQjson::isLarger); std::sort(sortedLatest.begin(),sortedLatest.end(),EQjson::isLatest); return true; } return false; } void EQjson::clearEq() { for(auto ii=equake.begin();ii!=equake.end();++ii){ delete((*ii)); } equake.clear(); } std::vector<EarthQuake*> EQjson::getEarthQuakes() { return equake; } time_t EQjson::latestTime() { return latest->event_time; } time_t EQjson::oldestTime() { return oldest->event_time; } EarthQuake *EQjson::largestEq() { return largest; } EarthQuake *EQjson::smallestEq() { return smallest; } EarthQuake *EQjson::latestEq() { return latest; } void EQjson::unselect() { for(auto ii=equake.begin();ii!=equake.end();++ii){ EarthQuake* eq = (*ii); eq->selected = false; } } long int EQjson::size() { return n; } EarthQuake *EQjson::at(long int pos) { return equake.at(pos); } void EQjson::sortMagnitude() { std::sort(equake.begin(),equake.end(),EQjson::isLarger); } bool EQjson::isLarger(EarthQuake* a,EarthQuake* b) { if(a->magnitude > b->magnitude){ return true; } return false; } void EQjson::sortTime() { std::sort(equake.begin(),equake.end(),EQjson::isLatest); } bool EQjson::isLatest(EarthQuake *a, EarthQuake *b) { if(a->event_time > b->event_time){ return true; } return false; } std::vector<EarthQuake *> EQjson::getSortedLargest() { return this->sortedLargest; } std::vector<EarthQuake *> EQjson::getSortedLatest() { return this->sortedLatest; } void EQjson::filter(Parametres *param) { n=0; for(auto ii:equake){ ii->shown = testFilter(ii,param); if(ii->shown) n++; } } bool EQjson::testFilter(EarthQuake *eq, Parametres *param) { if( time(nullptr)-eq->event_time > param->minDeltaTime*3600){ return false; } if(eq->magnitude <param->minMag || eq->magnitude > param->maxMag) { return false; } return true; }
2513d9590f9d4bff5b88f3438b670fb7199e0f86
f3a9174535cd7e76d1c1e0f0fa1a3929751fb48d
/SDK/PVR_Gun_Sawedoff_functions.cpp
f7541486733227bec9047a1b2f3672a775766ae7
[]
no_license
hinnie123/PavlovVRSDK
9fcdf97e7ed2ad6c5cb485af16652a4c83266a2b
503f8d9a6770046cc23f935f2df1f1dede4022a8
refs/heads/master
2020-03-31T05:30:40.125042
2020-01-28T20:16:11
2020-01-28T20:16:11
151,949,019
5
2
null
null
null
null
UTF-8
C++
false
false
4,397
cpp
PVR_Gun_Sawedoff_functions.cpp
// PavlovVR (Dumped by Hinnie) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function Gun_Sawedoff.Gun_Sawedoff_C.UserConstructionScript // (Event, Public, BlueprintCallable, BlueprintEvent) void AGun_Sawedoff_C::UserConstructionScript() { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.UserConstructionScript"); AGun_Sawedoff_C_UserConstructionScript_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.ReceiveBeginPlay // (Event, Protected, BlueprintEvent) void AGun_Sawedoff_C::ReceiveBeginPlay() { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.ReceiveBeginPlay"); AGun_Sawedoff_C_ReceiveBeginPlay_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.OnMagBoltRelease_Event_1 // (BlueprintCallable, BlueprintEvent) void AGun_Sawedoff_C::OnMagBoltRelease_Event_1() { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.OnMagBoltRelease_Event_1"); AGun_Sawedoff_C_OnMagBoltRelease_Event_1_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.OnBarrelChanged_Event_1 // (BlueprintCallable, BlueprintEvent) // Parameters: // bool bOpen (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void AGun_Sawedoff_C::OnBarrelChanged_Event_1(bool bOpen) { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.OnBarrelChanged_Event_1"); AGun_Sawedoff_C_OnBarrelChanged_Event_1_Params params; params.bOpen = bOpen; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.CustomEvent_2 // (BlueprintCallable, BlueprintEvent) // Parameters: // struct FName Name (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void AGun_Sawedoff_C::CustomEvent_2(const struct FName& Name) { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.CustomEvent_2"); AGun_Sawedoff_C_CustomEvent_2_Params params; params.Name = Name; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.SetupRemoval // (BlueprintCallable, BlueprintEvent) void AGun_Sawedoff_C::SetupRemoval() { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.SetupRemoval"); AGun_Sawedoff_C_SetupRemoval_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.SetupClose // (BlueprintCallable, BlueprintEvent) void AGun_Sawedoff_C::SetupClose() { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.SetupClose"); AGun_Sawedoff_C_SetupClose_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Gun_Sawedoff.Gun_Sawedoff_C.ExecuteUbergraph_Gun_Sawedoff // (Final, HasDefaults) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void AGun_Sawedoff_C::ExecuteUbergraph_Gun_Sawedoff(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function Gun_Sawedoff.Gun_Sawedoff_C.ExecuteUbergraph_Gun_Sawedoff"); AGun_Sawedoff_C_ExecuteUbergraph_Gun_Sawedoff_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
e37752bd4b34c1b686dceb05b3cc5725e31e7c24
bcf52cb7a224906ce72cd30f4cbacd82ae78099e
/Arduino/LockUnlock/lockunlock_Valahia.ino
1f14ebf010712413f20cdc36475266367ee0df82
[]
no_license
Dinoo02/Bike-Asistant
2f2853ff586a619b1e8ee5cd1cefb490712b14a2
eb9784c0188b7f69e192ee33780000c6c95e3746
refs/heads/master
2020-05-23T18:10:22.753306
2019-05-18T14:12:50
2019-05-18T14:12:50
186,883,316
0
0
null
null
null
null
UTF-8
C++
false
false
3,890
ino
lockunlock_Valahia.ino
#include <SoftwareSerial.h> #include <Servo.h> SoftwareSerial Serial1(2, 3); Servo lockServo; int motorPin1 = 8; int motorPin2 = 9; int motorPin3 = 10; int motorPin4 = 11; int delayTime = 10; const int lockSensor = 4; long timeout; boolean connectedToServer = false; boolean locked = false; void printCommand(String comm) { Serial.print("--- "); Serial.println(comm); Serial1.println(comm); while(Serial1.available()) { Serial.write(Serial1.read()); } delay(1000); } void connectToServer() { printCommand("AT+CIPSTART=\"TCP\",\"207.154.213.12\",\"443\""); } void disconnectFromServer() { printCommand("AT+CIPCLOSE"); } void sendToServer(String message) { printCommand("AT+CIPSEND"); Serial1.print(message); Serial1.write(0x1A); } bool Locked = false; void lock(){ Serial.println("Locking"); while(!digitalRead(lockSensor)){ lockServo.write(120); digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); delay(delayTime); } lockServo.write(60); } void unlock(){ Serial.println("Unlocking"); if(digitalRead(lockSensor)){ lockServo.write(120); for(int i=0;i<600;i++){ digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); delay(delayTime); digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); delay(delayTime); } } } void setup() { // pinMode(solenoid, OUTPUT); pinMode(lockSensor, OUTPUT); Serial.begin(9600); Serial1.begin(9600); while(!Serial.available()); Serial.println(Serial.read()); // printCommand("AT+CPIN=\"0000\""); delay(5000); printCommand("AT+CIPSHUT"); printCommand("AT+CIPMUX=0"); printCommand("AT+CGPSPWR=1"); printCommand("AT+CGATT=1"); printCommand("AT+CSTT=\"net\",\"\",\"\""); printCommand("AT+CIICR"); printCommand("AT+CIFSR"); timeout = millis(); lockServo.attach(5); lockServo.write(120); } void loop() { if(Serial.available()) { auto message = Serial.readStringUntil(0x7E); if(message == "CONNECT") { connectToServer(); connectedToServer = true; } else if(message == "DISCONNECT") { disconnectFromServer(); connectedToServer = false; } else if(connectedToServer == true) { sendToServer(message); } } if(millis() - timeout > 30000 && connectedToServer == true) { timeout = millis(); Serial1.println("AT+CGPSINF=0"); while(!Serial1.available()); auto loc = Serial1.readString(); // Serial.print(loc); // Serial.println("{\"loc\": \"" + loc + "\"}"); sendToServer(loc); } if(digitalRead(lockSensor) == HIGH) { if(locked == true) { sendToServer("LOCKBRK"); unlock(); locked = false; } } if(Serial1.available()) { auto message = Serial1.readStringUntil(0x40); if(message == "lock") { locked = true; lock(); } else if(message == "unlock") { locked = false; unlock(); } Serial.println(message); } }
4476c6c5cc40f4991322889d40be386e79204aaf
46fa5b8389dfc7ceede15ad893ee71e9525a6f86
/FFMPEG/Myffmpeg.h
202e4b625ec85fd585bff2e27f39dcc2e6f9ba5a
[]
no_license
mehome/Game-Sharing-Platform-Client
532fabda02875917307e2751e16315e1d7b0659f
5e120fb69b94156fcf1c3c812b8de2e0b44ae9f3
refs/heads/master
2022-01-21T10:07:31.873179
2019-07-14T04:00:32
2019-07-14T04:00:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
555
h
Myffmpeg.h
#pragma once #include "MyCollectDesktop.h" #include "CollectAudio.h" #include "CollectCamera.h" class Myffmpeg { public: Myffmpeg(void); ~Myffmpeg(void); public: void Unitffmpeg(); void Factory(bool desk =true,bool camera=true,bool audio=true,bool microphone=false); void SetStart(bool desk =true,bool camera =true,bool audio =true,bool microphone =false); void SetStop(bool desk =true,bool camera =true,bool audio =true,bool microphone =false); public: MyCollectDesktop *m_pDesktop; CCollectAudio *m_pAudio; CCollectCamera *m_pCamera; };
39138f010cb92c1978d1a49d9f1c75568c989b70
ee84c51e7c376c4ace5d3b60f1372bcb0d39054a
/INTERVIEW/GEEGKSFORGEEKS/GRAPH2/dijkastrafor_adjMAtT.cpp
bce92dd304946d55d7144f52ac2e869a0ebe9437
[]
no_license
mritunjay583/Programs
a8b98d1da63de0485fc7eb371bd9d1699a5aa630
106bc59b741993941774b841aaa7aac71d383096
refs/heads/master
2023-04-08T00:05:47.034647
2021-04-20T12:54:16
2021-04-20T12:54:16
359,804,970
0
0
null
null
null
null
UTF-8
C++
false
false
1,866
cpp
dijkastrafor_adjMAtT.cpp
#include<bits/stdc++.h> using namespace std; struct cmp{ bool operator()(pair<int,int> x,pair<int,int> y){ return x.second>y.second; } }; vector <int> dijkstra(vector<vector<int>> g, int src, int V) { vector<int> dis(V,INT_MAX); dis[src]=0; //first initialize distance of source node is 0 priority_queue<pair<int,int>,vector<pair<int,int> >,cmp> q; // node distance q.push(make_pair(src,0)); //push src in queue while(q.empty()==false){ pair<int,int> t=q.top();q.pop(); for(int i=0;i<V;i++){ // for each vertex from source relax all vertex if(g[t.first][i]!=0){ //to tacle self loop if(t.second+g[t.first][i]<dis[i]){ //main conditiion of relaxation dis[i]=t.second+g[t.first][i]; q.push(make_pair(i,dis[i])); } } } } return dis; } int main() { int V=9; vector<vector<int>> g{ { 0, 4, 0, 0, 0, 0, 0, 8, 0 }, { 4, 0, 8, 0, 0, 0, 0, 11, 0 }, { 0, 8, 0, 7, 0, 4, 0, 0, 2 }, { 0, 0, 7, 0, 9, 14, 0, 0, 0 }, { 0, 0, 0, 9, 0, 10, 0, 0, 0 }, { 0, 0, 4, 14, 10, 0, 2, 0, 0 }, { 0, 0, 0, 0, 0, 2, 0, 1, 6 }, { 8, 11, 0, 0, 0, 0, 1, 0, 7 }, { 0, 0, 2, 0, 0, 0, 6, 7, 0 } }; int src=0; vector <int> res = dijkstra(g, src, V); for(auto x:res) cout<<x<<" "; cout<<endl; return 0; }// } Driver Code Ends /* Function to implement Dijkstra * g: vector of vectors which represents the graph * src: source vertex to start traversing graph with * V: number of vertices */
e56bc15b3ec07f7188abfd048a9225ff38f1ad9a
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_2645486_0/C++/SQLNinja/2.cpp
4c623eef8851d388ee8314db782082d09005ad0b
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
1,425
cpp
2.cpp
#include<iostream> #include<cstdio> #define ll long long #define ull unsigned long long #define mp make_pair #define ld long double using namespace std; int dp[11][11]; int e,r,n,maxi; int v[100]; void doit(int pos,int en,int gnn); int main() { freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int t; cin>>t; for(int tt=1;tt<=t;tt++) { cin>>e>>r>>n; for(int i=0;i<n;i++) cin>>v[i]; maxi=0; doit(0,e,0); cout<<"Case #"<<tt<<": "<<maxi<<"\n"; } scanf("\n"); return 0; } void doit(int pos,int en,int gnn) { if(pos==n) { maxi=max(maxi,gnn); return ; } for(int i=0;i<=en;i++) { if((en-i+r)<=e) doit(pos+1,(en-i)+r,gnn+v[pos]*i); else doit(pos+1,e,gnn+v[pos]*i); } return ; }
740f969a5817f9d021a2574cd2359bd2f4be9dc8
5e10ffe26cc333a77d78bd2ddb998c2213478883
/KozlovaVI/kursach/kursach.cpp
fc43e4503cc5c9f106fca2ce5bdf65b1c6195fe5
[]
no_license
Toxa-man/labWorks-2021-0372
2a1297fb426786a0375455919b57cd47781fb877
73132f7022ee227807c522451237074373ab973e
refs/heads/master
2023-05-10T05:29:26.447533
2021-06-09T12:55:52
2021-06-09T12:55:52
357,349,271
1
23
null
2022-10-13T21:20:38
2021-04-12T21:54:01
C++
UTF-8
C++
false
false
9,499
cpp
kursach.cpp
#include <iostream> #include <cmath> using namespace std; int const size = 16; int const sq = sqrt(size); class Sudoku{ private: int Diff; int Pole [size][size]; bool InviseablePoleMAsk[size][size]; //true -> скрыто int put=0; public: Sudoku(int Diff=5){ this->Diff = Diff; int Base[size*2]; for (int i = 0; i < 2; i++) { for (int j = 1; j <=size; j++) Base[j - 1 + size * i] = j; } for (int i = 0; i < sq ; i++) { for (int j = 0; j < size; j++) { int kol = 0; while (kol<sq){ Pole[kol + i * sq][j] = Base[i + j + sq*kol]; kol++; } } } int random; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { random = rand()%Diff+1; InviseablePoleMAsk[i][j] = (random == Diff); if (InviseablePoleMAsk[i][j]){ put++; } } } cout << "Количество пробелов: " << put << endl; } void Transpose (){ int Clone [size][size]; for (int i=0; i<size; i++){ for (int j=0; j<size; j++){ Clone [i][j] = Pole [i][j]; } } for (int i=0; i<size; i++){ for (int j=0; j<size; j++){ Pole [i][j] = Clone [j][i]; } } } void ChangeLine (int iA, int iB){ for (int j=0; j<size; j++){ int Zam = Pole [iA][j]; Pole [iA][j] = Pole [iB][j]; Pole [iB][j] = Zam; } } void ChangeColumn (int jA, int jB){ for (int i=0; i<size; i++){ int Zam = Pole [i][jA]; Pole [i][jA] = Pole [i][jB]; Pole [i][jB] = Zam; } } void ChangeBlockLine (int a, int b){ for (int n = 0; n < sq; n++){ for (int j = 0; j < size; j++){ int Zam = Pole [(a-1)*sq+n][j]; Pole [(a-1)*sq+n][j] = Pole [(b-1)*sq+n][j]; Pole [(b-1)*sq+n][j] = Zam; } } } void ChangeBlockColumn (int a, int b){ for (int n = 0; n < sq; n++){ for (int i = 0; i < size; i++){ int Zam = Pole [i][(a-1)*sq+n]; Pole [i][(a-1)*sq+n] = Pole [i][(b-1)*sq+n]; Pole [i][(b-1)*sq+n] = Zam; } } } // void PrintField(){ // cout << " " << "\t"; // for (int i = 0; i < size; i++){ // cout << i << "\t"; // } // cout << "\n"; // for (int i = 0; i < size; i++) { // cout << i << "\t"; // for (int j = 0; j < size; j++) // cout << Pole[i][j] << "\t"; // cout << '\n'; // } // cout << '\n'; // } void PrintFieldWithMask(){ cout << " "; for (int i = 0; i < size; i++){ if (i%sq==0) cout << " " << "\t"; cout << i+1 << "\t"; } cout << "\n"; for (int i = 0; i < size; i++) { if(i%sq == 0){ cout <<"____\n"; } cout << i+1 << "\t"; for (int j = 0; j < size; j++) { if (j%sq == 0){ cout << "|" << "\t"; } if (InviseablePoleMAsk[i][j]) { cout << "*" << "\t"; } else { cout << Pole[i][j] << "\t"; } } cout << '\n'; } cout << '\n'; } void GetAnswer (){ int i, j, answer; cin >> i >> j >> answer; if (Pole[i-1][j-1]==answer){ InviseablePoleMAsk[i-1][j-1]= false; PrintFieldWithMask(); cout << "Yep" << endl; } else { cout << "No" << endl; } if (getNull()==0){ cout << "U are win" << endl; } } int getNull(){ int null =0; for (int i=0; i<size; i++){ for (int j=0; j<size; j++){ if (InviseablePoleMAsk[i][j]){ null++; }}} return null; } void Change (){ for (int i=0; i<10; i++){ int random = rand()%9+1; switch (random) { case 1: Transpose(); break; case 2: ChangeLine(rand()%sq, rand()%sq); break; case 3: ChangeLine(rand()%sq+sq, rand()%sq+sq); break; case 4: ChangeLine(rand()%sq+sq*2, rand()%sq+sq*2); break; case 5: ChangeColumn(rand()%sq, rand()%sq); break; case 6: ChangeColumn(rand()%sq+sq, rand()%sq+sq); break; case 7: ChangeColumn(rand()%sq+sq*2, rand()%sq+sq*2); break; case 8: ChangeBlockLine(rand()%sq+1, rand()%sq+1); break; case 9: ChangeBlockColumn(rand()%sq+1, rand()%sq+1); break; } } } }; class Decision{ private: int Pole [size][size]; int kolNul; //Тут будет храниться количество нулей в судоку int I [40]; //Массив координат i для нулей int J [40]; //Массив координат j для нулей public: Decision() { kolNul = 0; for (int i = 0; i < size; i++) { //Тут у нас заполнение судоку. Причем места, где нет цифр надо проставить нулями for (int j = 0; j < size; j++) { cin >> Pole[i][j]; if (Pole[i][j] == 0) { //Сразу, как найдется нуль, координаты заносятся в массив, а количество нулей подсчитывается I[kolNul] = i; J[kolNul] = j; kolNul++; } } } if (!check ()){ cout << "Судоку не имеет решения" << endl; } } bool check (){ for (int i = 0; i < size; i++){ //По идее это проверка на реальность судоку for (int j = 0; j < size-1; j++){ for (int k = j+1; k < size; k++) { if ((Pole[i][j] == Pole[i][k] && Pole[i][j] != 0) || Pole [i][j] > size || Pole [i][k] > size){ return false; } if ((Pole[j][i] == Pole[k][i] && Pole[j][i] != 0) || Pole[j][i] > size || Pole [k][i] > size){ return false; } } } } for (int m = 0; m < sq; m++){ for (int n = 0; n < sq; n++){ for (int a = 0; a < size-1; a++){ int i = a/sq; int j = a%sq; for (int k = a+1; k < size; k++){ for (int l = a+1; l < sq; l++){ if ((Pole[i+(m*sq)][j+(n*sq)] == Pole [(k/sq)+(m*sq)][(l%sq)+(n*sq)])&& Pole[i+(m*sq)][j+(n*sq)]!=0) { return false; } } } } } } return true; } void decide(){ int i = I[kolNul-1]; int j = J[kolNul-1]; if ( Pole[i][j]==0){ Pole [i][j] = 1; } while (!check() && Pole[i][j] < size) { Pole[i][j] = Pole[i][j]+1; } if (check()){ kolNul--; } else { Pole[i][j]=0; kolNul++; decide(); } if (kolNul==0 && check()){ cout << "Судоку решено" << endl; for (int a = 0; a < size; a++){ for (int b = 0; b < size; b++){ cout << Pole [a][b] << " "; } cout << endl; } } else { if (check()) decide(); } } }; int main () { cout << "Выберите режим:" << endl; cout << "1. Решить судоку" << endl << "2. Ввести судоку для решения программы" <<endl; int koef; cin >> koef; if (koef==1){ auto Playground = new Sudoku(5); Playground->Change(); Playground->PrintFieldWithMask(); while (Playground->getNull()!=0){ cout << "Вам осталось угадать чисел: " << Playground->getNull() << endl; Playground->GetAnswer(); }} else { cout << " Введите таблицу судоку, проставив в пустые поля 0. Учтите, что должно быть не более 40 нулей для единственного решения." << endl; auto Polenko = new Decision; Polenko->check(); Polenko->decide(); } return 0; }
ffa3d3ac71c13d4fb1649e1c7d448c8c3ec0306f
f6442d0de3a95e553b44430862c1dcd6b3a5e1ef
/course_exercises/File IO/fileOutputIntro.cpp
089ce9c56897d57a7c76e3732073b0e52fc1c3d9
[]
no_license
john-s-li/complete_cpp_developer_course
10c3af1bff38a3e249e9a09278c4133f45861ab9
eac81dc5047214201d5a35b495eb357452cec869
refs/heads/main
2023-08-14T06:24:08.532190
2021-09-30T22:22:51
2021-09-30T22:22:51
410,625,682
0
0
null
null
null
null
UTF-8
C++
false
false
676
cpp
fileOutputIntro.cpp
#include <iostream> #include <fstream> #include <iomanip> using namespace std; void printFormatted(ofstream& outFile, int numVals) { outFile.open("fileOutputIntro.txt"); outFile << fixed << showpoint; for(int i = 0; i < numVals; i++) { outFile << setw(12) << setprecision(2) << (i * 3.14159) << setw(12) << setprecision(4) << (i * 9.161996) << endl; } outFile.close(); cout << "Done. Look for .txt file in directory." << endl; } int main() { int userVal; cout << "Please enter how many numbers you'd like.\n"; cin >> userVal; ofstream outFile; printFormatted(outFile, userVal); return 0; }
f2173d89ff2cb2da918089937fd41a7d1a06a568
12fdc6acde406ca67183a737b2678852802490b0
/test/paged_pool_test.cc
9f820dc85bbbda57c9e8c0a12012343dbf125ab9
[ "MIT" ]
permissive
tabokie/portal-db
8b3eda76329ee167721a0bbff33e9099f899f29e
af6eeb97e99ea7a8314d114df5c52a2ad2626e26
refs/heads/master
2020-04-29T15:28:14.213492
2019-05-17T12:00:56
2019-05-17T12:00:56
176,229,099
11
1
null
null
null
null
UTF-8
C++
false
false
1,503
cc
paged_pool_test.cc
#include <gtest/gtest.h> #include "db/paged_pool.h" #include <cstring> #include <iostream> using namespace portal_db; TEST(PagedPoolTest, RAII) { PagedPool<256> pool("unique"); for(int i = 0; i < pool.capacity() / 4; i++) { size_t token = pool.New(); char* tmp = pool.Get(token); EXPECT_TRUE(tmp != NULL); memset(tmp, 0, sizeof(char) * 256); EXPECT_EQ(pool.size(), i + 1); } } TEST(PagedPoolTest, Retrieval) { PagedPool<32> pool("unique"); for(size_t i = 0; i < pool.capacity() / 4; i++) { size_t token = pool.New(); char* tmp = pool.Get(token); EXPECT_TRUE(tmp != NULL); memcpy(tmp, reinterpret_cast<char*>(&i), sizeof(char) * 4); } for(size_t i = 0; i < pool.capacity() / 4; i++) { char* tmp = pool.Get(i); size_t retrieve = *reinterpret_cast<size_t*>(tmp); EXPECT_EQ(retrieve, i); } } TEST(PagedPoolTest, Snapshot) { PagedPool<32> pool("unique"); for(size_t i = 0; i < pool.capacity() / 4; i++) { size_t token = pool.New(); char* tmp = pool.Get(token); EXPECT_TRUE(tmp != NULL); memcpy(tmp, reinterpret_cast<char*>(&i), sizeof(char) * 4); } EXPECT_TRUE(pool.MakeSnapshot().inspect()); pool.Close(); PagedPool<32> shadow("unique"); EXPECT_TRUE(shadow.ReadSnapshot().inspect()); for(size_t i = 0; i < shadow.capacity() / 4; i++) { char* tmp = shadow.Get(i); size_t retrieve = *reinterpret_cast<size_t*>(tmp); EXPECT_EQ(retrieve, i); } EXPECT_TRUE(shadow.DeleteSnapshot().inspect()); }
48ff141d50fd6bcb03f3b05d5d0c510f6d4c3538
f053144cf3e211b5de9ffb68bee344c1906591a6
/nodo.cpp
f4ec7f98a3813033c2436a6ff2d598e71996935f
[]
no_license
LauraParravicini/tp2algo2
7901e8926a4aaae6e9947eac7d6bdc3b2bca30e8
b11632ec3930d8015eafb1c7dfad3dcef381674b
refs/heads/master
2020-05-22T10:09:03.211649
2019-05-13T17:07:50
2019-05-13T17:07:50
186,305,198
0
0
null
null
null
null
UTF-8
C++
false
false
455
cpp
nodo.cpp
#include "nodo.h" Nodo::Nodo(Trabajador* trabajador){ this->trabajador = trabajador; siguiente = NULL; } Nodo::~Nodo(){ cout<<"hola"<<endl; } void Nodo::asignar_trabajador(Trabajador* trabajador){ this->trabajador = trabajador; } Trabajador* Nodo::obtener_trabajador(){ return trabajador; } void Nodo::setear_siguiente(Nodo* siguiente){ this->siguiente = siguiente; } Nodo* Nodo::obtener_siguiente(){ return siguiente; }
202db25de85234cdaaa72aad14e7fc5050218646
e71de35fc53c18b07cd990c6549d8228d05733e6
/src/Visualizer.cpp
c174f0f395fcedcb5a7c6d48422b9626b037f838
[]
no_license
tapgar/iLQG
60d4faf84739beab97d35b53a1f58fff559cec22
256fe9e0f527a238fad5d704e94cd670fd3a3bf7
refs/heads/master
2021-09-03T11:37:59.677851
2018-01-08T20:05:07
2018-01-08T20:05:07
116,722,289
1
0
null
null
null
null
UTF-8
C++
false
false
9,330
cpp
Visualizer.cpp
/* * Visualizer.cpp * * Created on: Jul 3, 2017 * Author: tapgar */ #include "Visualizer.h" using namespace std; using namespace Eigen; Visualizer::Visualizer(mjModel *m, bool save_vid, const char* win_title) { mj_Model = m; m_Width = 1200; m_Height = 900; m_bTrajInit = false; Vector3d temp = Vector3d::Zero(); for (int i = 0; i < N; i++) { traj_pts.push_back(temp); } Init(save_vid, win_title); bWaitForUserFeedback = PAUSE_VIS; bOKtoComplete = false; } Visualizer::~Visualizer() { // TODO Auto-generated destructor stub } static void window_close_callback(GLFWwindow* window) { ((Visualizer*)(glfwGetWindowUserPointer(window)))->Close(); } static void scroll(GLFWwindow* window, double xoffset, double yoffset) { ((Visualizer*)(glfwGetWindowUserPointer(window)))->Scroll(xoffset, yoffset); } static void mouse_move(GLFWwindow* window, double xpos, double ypos) { ((Visualizer*)(glfwGetWindowUserPointer(window)))->Mouse_Move(xpos, ypos); } static void mouse_button(GLFWwindow* window, int button, int act, int mods) { ((Visualizer*)(glfwGetWindowUserPointer(window)))->Mouse_Button(button, act, mods); } static void keyboard(GLFWwindow* window, int key, int scancode, int act, int mods) { ((Visualizer*)(glfwGetWindowUserPointer(window)))->Keyboard(key, scancode, act, mods); } int Visualizer::Init(bool save_video, const char* win_title) { if (!glfwInit()) { mju_error("Could not initialize GLFW"); return 1; } // Create window m_Window = glfwCreateWindow(m_Width, m_Height, win_title, NULL, NULL); glfwMakeContextCurrent(m_Window); glfwSwapInterval(1); // // Set up mujoco visualization objects // mj_Cam.lookat[0] = mj_Model->stat.center[0]; // mj_Cam.lookat[1] = mj_Model->stat.center[1]; // mj_Cam.lookat[2] = 1.0 + mj_Model->stat.center[2]; //// //// mj_Cam.distance = 0.5 * mj_Model->stat.extent; //// mjv_moveCamera(mj_Model, mjMOUSE_ROTATE_H, 0.5, 0.0, &mj_Scn, &mj_Cam); // mj_Cam.type = mjCAMERA_FREE; // //// mj_Cam.type = mjCAMERA_TRACKING; //// mj_Cam.trackbodyid = 1; // mj_Cam.distance = 0.3 * mj_Model->stat.extent; // mjv_moveCamera(mj_Model, mjMOUSE_ROTATE_H, 0.75, 0.0, &mj_Scn, &mj_Cam); mj_Cam.type = mjCAMERA_FIXED; mj_Cam.fixedcamid = 0; mjv_defaultOption(&mj_Opt); mj_Opt.flags[10] = 1; mj_Opt.flags[11] = 1; mj_Opt.flags[8] = 1; // mj_Opt.flags[15] = 1; // mj_Opt.flags[2] = 1; // mj_Opt.flags[3] = 1; //int present = glfwJoystickPresent(GLFW_JOYSTICK_1); //printf("Joystick present %d\n", present); mjr_defaultContext(&mj_Con); mjv_makeScene(&mj_Scn, 1E5); mjr_makeContext(mj_Model, &mj_Con, mjFONTSCALE_100); // Set callback for user-initiated window close events glfwSetWindowUserPointer(m_Window, this); glfwSetWindowCloseCallback(m_Window, window_close_callback); glfwSetCursorPosCallback(m_Window, mouse_move); glfwSetMouseButtonCallback(m_Window, mouse_button); glfwSetScrollCallback(m_Window, scroll); glfwSetKeyCallback(m_Window, keyboard); if (save_video) { m_image_rgb = (unsigned char*)malloc(3*m_Width*m_Height); m_image_depth = (float*)malloc(sizeof(float)*m_Width*m_Height); // create output rgb file fp = fopen("out/temp.out", "wb"); if( !fp ) mju_error("Could not open rgbfile for writing"); } m_bSaveVideo = save_video; return 0; } void Visualizer::GetDisturbanceForce(double* Fx, double* Fy, double* Fz) { int count; const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &count); (*Fx) = -axes[2]*200.0; (*Fy) = -axes[0]*200.0; (*Fz) = -axes[3]*200.0; } void Visualizer::DrawWithPoints(mjData* data, vector<Vector3d> pts) { // Return early if window is closed if (!m_Window) return; // Set up for rendering glfwMakeContextCurrent(m_Window); mjrRect viewport = {0, 0, 0, 0}; glfwGetFramebufferSize(m_Window, &viewport.width, &viewport.height); // Render scene mjv_updateScene(mj_Model, data, &mj_Opt, NULL, &mj_Cam, mjCAT_ALL, &mj_Scn); for (int i = 0; i < pts.size(); i++) { mjtNum pos[3]; for (int j = 0; j < 3; j++) pos[j] = pts[i](j); mjtNum size[3] = {0.05,0.05,0.05}; mjv_initGeom(&(mj_Scn.geoms[mj_Scn.ngeom]), mjGEOM_SPHERE, size, pos, NULL, NULL ); mj_Scn.ngeom++; } mjv_addGeoms(mj_Model, data, &mj_Opt, NULL, mjCAT_DECOR, &mj_Scn); mjr_render(viewport, &mj_Scn, &mj_Con); // Show updated scene glfwSwapBuffers(m_Window); glfwPollEvents(); if (m_bSaveVideo) { mjr_readPixels(m_image_rgb, m_image_depth, viewport, &mj_Con); // insert subsampled depth image in lower-left corner of rgb image const int NS = 3; // depth image sub-sampling for( int r=0; r<m_Height; r+=NS ) for( int c=0; c<m_Width; c+=NS ) { int adr = (r/NS)*m_Width + c/NS; m_image_rgb[3*adr] = m_image_rgb[3*adr+1] = m_image_rgb[3*adr+2] = (unsigned char)((1.0f-m_image_depth[r*m_Width+c])*255.0f); } // write rgb image to file fwrite(m_image_rgb, 3, m_Width*m_Height, fp); } if (bWaitForUserFeedback) { while (!bOKtoComplete) glfwPollEvents(); bOKtoComplete = false; } } void Visualizer::Draw(mjData* data) { // Return early if window is closed if (!m_Window) return; // Set up for rendering glfwMakeContextCurrent(m_Window); mjrRect viewport = {0, 0, 0, 0}; glfwGetFramebufferSize(m_Window, &viewport.width, &viewport.height); // Render scene // printf("Before Update Geoms: %d\n", mj_Scn.ngeom); mjv_updateScene(mj_Model, data, &mj_Opt, NULL, &mj_Cam, mjCAT_ALL, &mj_Scn); // printf("After Update Geoms: %d\n", mj_Scn.ngeom); if (m_bTrajInit) { for (int i = 0; i < N; i++) { // traj_pts.push_back(&(mj_Scn.geoms[mj_Scn.ngeom+i])); //printf("Vis: %f, %f\n", (traj_pts[i])[0], (traj_pts[i])[2]); mjtNum pos[3]; for (int j = 0; j < 3; j++) pos[j] = traj_pts[i](j); mjtNum size[3] = {0.05,0.05,0.05}; mjv_initGeom(&(mj_Scn.geoms[mj_Scn.ngeom]), mjGEOM_SPHERE, size, pos, NULL, NULL ); mj_Scn.ngeom++; } // printf("After Init Geoms: %d\n", mj_Scn.ngeom); mjv_addGeoms(mj_Model, data, &mj_Opt, NULL, mjCAT_DECOR, &mj_Scn); // printf("After Add Geoms: %d\n", mj_Scn.ngeom); } // mjtNum pos[3]; // for (int j = 0; j < 3; j++) // pos[j] = data->xipos[4*3 + j]; // // mjtNum size[3] = {0.1,0.05,0.05}; // mjv_initGeom(&(mj_Scn.geoms[mj_Scn.ngeom]), mjGEOM_SPHERE, size, pos, NULL, NULL ); // mj_Scn.ngeom++; // mjv_addGeoms(mj_Model, data, &mj_Opt, NULL, mjCAT_DECOR, &mj_Scn); mjr_render(viewport, &mj_Scn, &mj_Con); // Show updated scene glfwSwapBuffers(m_Window); glfwPollEvents(); // for (int i = 0; i < count; i++) // printf("Axis: %d\t%f\n", i, axes[i]); if (m_bSaveVideo) { mjr_readPixels(m_image_rgb, m_image_depth, viewport, &mj_Con); // insert subsampled depth image in lower-left corner of rgb image const int NS = 3; // depth image sub-sampling for( int r=0; r<m_Height; r+=NS ) for( int c=0; c<m_Width; c+=NS ) { int adr = (r/NS)*m_Width + c/NS; m_image_rgb[3*adr] = m_image_rgb[3*adr+1] = m_image_rgb[3*adr+2] = (unsigned char)((1.0f-m_image_depth[r*m_Width+c])*255.0f); } // write rgb image to file fwrite(m_image_rgb, 3, m_Width*m_Height, fp); } if (bWaitForUserFeedback) { while (!bOKtoComplete) glfwPollEvents(); bOKtoComplete = false; } } // mouse button void Visualizer::Mouse_Button(int button, int act, int mods) { // update button state button_left = (glfwGetMouseButton(m_Window, GLFW_MOUSE_BUTTON_LEFT)==GLFW_PRESS); button_middle = (glfwGetMouseButton(m_Window, GLFW_MOUSE_BUTTON_MIDDLE)==GLFW_PRESS); button_right = (glfwGetMouseButton(m_Window, GLFW_MOUSE_BUTTON_RIGHT)==GLFW_PRESS); // update mouse position glfwGetCursorPos(m_Window, &cursor_lastx, &cursor_lasty); } // mouse move void Visualizer::Mouse_Move(double xpos, double ypos) { // no buttons down: nothing to do if( !button_left && !button_middle && !button_right ) return; // compute mouse displacement, save double dx = xpos - cursor_lastx; double dy = ypos - cursor_lasty; cursor_lastx = xpos; cursor_lasty = ypos; // get current window size int width, height; glfwGetWindowSize(m_Window, &width, &height); // get shift key state bool mod_shift = (glfwGetKey(m_Window, GLFW_KEY_LEFT_SHIFT)==GLFW_PRESS || glfwGetKey(m_Window, GLFW_KEY_RIGHT_SHIFT)==GLFW_PRESS); // determine action based on mouse button mjtMouse action; if( button_right ) action = mod_shift ? mjMOUSE_MOVE_H : mjMOUSE_MOVE_V; else if( button_left ) action = mod_shift ? mjMOUSE_ROTATE_H : mjMOUSE_ROTATE_V; else action = mjMOUSE_ZOOM; mjv_moveCamera(mj_Model, action, dx/height, dy/height, &mj_Scn, &mj_Cam); } void Visualizer::Scroll(double xoffset, double yoffset) { // scroll: emulate vertical mouse motion = 5% of window height mjv_moveCamera(mj_Model, mjMOUSE_ZOOM, 0, -0.05*yoffset, &mj_Scn, &mj_Cam); printf("scroll callback %f, %f\n", xoffset, yoffset); } // keyboard void Visualizer::Keyboard(int key, int scancode, int act, int mods) { // do not act on release if( act==GLFW_RELEASE ) return; bOKtoComplete = true; } void Visualizer::Close() { // Free mujoco objects mjv_freeScene(&mj_Scn); mjr_freeContext(&mj_Con); // Close window glfwDestroyWindow(m_Window); m_Window = NULL; }
674a3f40f1e158f887be4f3d22f0a2fb233289b5
c2dce5941201390ee01abc300f62fd4e4d3281e0
/cetty-shiro/src/cetty/shiro/authc/AuthenticationToken.cpp
bd05c53f9b2a89b1af9f49edb155f10ee37d72dc
[ "Apache-2.0" ]
permissive
justding/cetty2
1cf2b7b5808fe0ca9dd5221679ba44fcbba2b8dc
62ac0cd1438275097e47a9ba471e72efd2746ded
refs/heads/master
2020-12-14T09:01:47.987777
2015-11-08T10:38:59
2015-11-08T10:38:59
66,538,583
1
0
null
2016-08-25T08:11:20
2016-08-25T08:11:20
null
UTF-8
C++
false
false
660
cpp
AuthenticationToken.cpp
/* * AuthenticationToken.cpp * * Created on: 2012-8-17 * Author: chenhl */ #include <cetty/shiro/authc/AuthenticationToken.h> #include <cetty/util/StringUtil.h> #include <cstdio> namespace cetty { namespace shiro { namespace authc { using namespace cetty::util; const std::string& AuthenticationToken::getCredentials() const { return credentials; } std::string AuthenticationToken::toString() { return StringUtil::printf("principal: %s host: %s rememberMe: %s", principal.c_str(), host.c_str(), rememberMe ? "true" : "false"); } } } }
be1638e071abe4558c1403052032d5321d1e0a86
a0b61494de6b4ffcc0c67f6469703154d392eb17
/StrongComponents/EdgeWeightedGraph.h
ceca822f6f69e5fa811df4946244426134fbb509
[]
no_license
sreejithsreekantan/Algorithms
d496b82ec8f118ad6b1fbeb56c710376ebb233ae
76580634d317b74ebbd160de3b0951d8e49a6196
refs/heads/master
2020-05-29T23:46:17.101978
2014-12-05T05:42:51
2014-12-05T05:42:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
867
h
EdgeWeightedGraph.h
/* Author : Sreejith Sreekantan */ #ifndef __EDGEWEIGHTEDGRAPH_H__ #define __EDGEWEIGHTEDGRAPH_H__ #include "Edge.h" #include <memory> namespace graph { class EdgeWeightedGraph { public: EdgeWeightedGraph(int v):v_(v), e_(0), edges_(v_) {} bool addEdge(int u, int v, double weight); int V() const { return v_; } int E() const { return e_; } const std::vector< std::shared_ptr<Edge> >& edgesOf(int u) const { return edges_[u]; } private: int v_; int e_; std::vector<std::vector< std::shared_ptr<Edge> > > edges_; }; bool EdgeWeightedGraph::addEdge(int u, int v, double weight) { std::shared_ptr<Edge> edge(new Edge(u, v, weight)); // since its undirected graph, add this edges to both vertices' list edges_[u].push_back(edge); edges_[v].push_back(edge); ++e_; return true; } } // namespace graph #endif // __EDGEWEIGHTEDGRAPH_H__
36de6fd15dff94b82f66ab55057793e27663ca72
c2a7688012c783d014f131edbc10856027f492d4
/mcdatacreator/Exceptions/NotImplementedException.h
e51a0b735f1f0afbf0e0830d9b6c8ed5dbf0b89e
[]
no_license
Crashaholic/mcdatacreator
e301919ff4e8fd2829a9ad15b7c01ac1854b7b4b
7feb4898f16c498e1a7d425a0ba99fcd4d111e00
refs/heads/master
2023-06-08T17:16:22.024807
2021-06-23T05:16:42
2021-06-23T05:16:42
283,416,649
0
0
null
null
null
null
UTF-8
C++
false
false
189
h
NotImplementedException.h
#pragma once #include <exception> class NotImplementedException : public std::exception { public: const char* what() { return "Thing is defined but there's no implementation!"; } };
9a99e547d54645f8c39d76664f996016435dd25e
c0a0712fe086e87d2798d8c9a63a1cb3678d335e
/LsiConsulter/ParserQuery.cpp
034cec5f3264ff66e44141b0075a6e503e98c94f
[]
no_license
ae77em/datos-2-2012-isl
4061ae9fa2629ddcbee0b1b90576bb63e7772869
f2428a6b1005da15462e0a35cc0e21113521b420
refs/heads/master
2021-01-20T03:34:07.294444
2012-11-29T16:15:55
2012-11-29T16:15:55
40,095,634
0
0
null
null
null
null
UTF-8
C++
false
false
3,096
cpp
ParserQuery.cpp
#include "ParserQuery.h" ParserQuery::ParserQuery(std::string pathDiccionario, std::string pathOffsetDiccionario) { diccionario.open(pathDiccionario.c_str(), std::fstream::in); offsetDiccionario.open(pathOffsetDiccionario.c_str(),std::fstream::in); if(!diccionario.good() || !offsetDiccionario.good()){ std::cout<<"no se pudiento abrir diccionarios"<<std::endl; } stemmer = new Stemmer(); palabras = new std::list<std::string>; palabrasStemezadas = new std::list<std::string>; contenedorOffsetDiccionario = new std::vector<unsigned int>; cargarOffsetDiccionario(); } void ParserQuery::cargarOffsetDiccionario(){ unsigned int offset; while(!offsetDiccionario.eof() && (offsetDiccionario>>offset) ){ contenedorOffsetDiccionario->push_back(offset); } } ParserQuery::~ParserQuery() { // TODO Auto-generated destructor stub } std::vector<int>* ParserQuery::parsearConsulta(std::list<std::string>* terminosConsulta) { palabras = terminosConsulta; stemezarPalabras(); return recuperarIds(); } void ParserQuery::stemezarPalabras(){ std::list<std::string>::iterator b = palabras->begin(); std::list<std::string>::iterator e = palabras->end(); while(b!=e){ palabrasStemezadas->push_back(stemmer->stemPalabra( *(b) ) ); b++; } } std::vector<int>* ParserQuery::recuperarIds() { std::vector<int>* ids = new std::vector<int>; std::list<std::string>::iterator b = palabrasStemezadas->begin(); std::list<std::string>::iterator e = palabrasStemezadas->end(); while (b != e) { int id = buscarIdTermino(*b); if (id != -1) { ids->push_back(id); } b++; } if(ids->size() > 0){ return ids; }else{ return NULL; } } int ParserQuery::buscarIdTermino(std::string termino) { int ini=0; int fin=contenedorOffsetDiccionario->size()-1; int medio = fin / 2; return buscarIdTerminoRec(termino,ini,fin,medio); } int ParserQuery::buscarIdTerminoRec(std::string termino,int ini,int fin,int medio) { std::string terminoEnArchivo; int id=0; //condicion de corte if(ini==fin){ diccionario.seekg(contenedorOffsetDiccionario->at(ini)); diccionario>>terminoEnArchivo; diccionario>>id; if (terminoEnArchivo.compare(termino)==0){ return id; }else{ return -1; } } diccionario.seekg(contenedorOffsetDiccionario->at(medio)); diccionario>>terminoEnArchivo; diccionario>>id; if( terminoEnArchivo.compare(termino)==0){ return id; }else{ if (termino.compare(terminoEnArchivo) < 0) { fin = medio - 1; }else { ini = medio + 1; } medio = (ini + fin) / 2; return buscarIdTerminoRec(termino,ini,fin,medio); } } void ParserQuery::obtenerOffsetDiccionario() { unsigned int nro=0; while(!offsetDiccionario.eof()){ offsetDiccionario>>nro; this->contenedorOffsetDiccionario->push_back(nro); } }
bea01625964a295d84401a64f46f50222d2fac61
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/c++/godot/2017/12/soft_body_bullet.cpp
ef5c8cac6fd9b2b8a3218a02dd90e55c6c80f932
[ "MIT" ]
permissive
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
C++
false
false
9,994
cpp
soft_body_bullet.cpp
/*************************************************************************/ /* soft_body_bullet.cpp */ /* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "soft_body_bullet.h" #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "space_bullet.h" #include "scene/3d/immediate_geometry.h" SoftBodyBullet::SoftBodyBullet() : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), mass(1), simulation_precision(5), stiffness(0.5f), pressure_coefficient(50), damping_coefficient(0.005), drag_coefficient(0.005), bt_soft_body(NULL), soft_shape_type(SOFT_SHAPETYPE_NONE), isScratched(false), soft_body_shape_data(NULL) { test_geometry = memnew(ImmediateGeometry); red_mat = Ref<SpatialMaterial>(memnew(SpatialMaterial)); red_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); red_mat->set_line_width(20.0); red_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); red_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); red_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); red_mat->set_albedo(Color(1, 0, 0, 1)); test_geometry->set_material_override(red_mat); test_is_in_scene = false; } SoftBodyBullet::~SoftBodyBullet() { bulletdelete(soft_body_shape_data); } void SoftBodyBullet::reload_body() { if (space) { space->remove_soft_body(this); space->add_soft_body(this); } } void SoftBodyBullet::set_space(SpaceBullet *p_space) { if (space) { isScratched = false; // Remove this object from the physics world space->remove_soft_body(this); } space = p_space; if (space) { space->add_soft_body(this); } reload_soft_body(); } void SoftBodyBullet::dispatch_callbacks() { if (!bt_soft_body) { return; } if (!test_is_in_scene) { test_is_in_scene = true; SceneTree::get_singleton()->get_current_scene()->add_child(test_geometry); } test_geometry->clear(); test_geometry->begin(Mesh::PRIMITIVE_LINES, NULL); bool first = true; Vector3 pos; for (int i = 0; i < bt_soft_body->m_nodes.size(); ++i) { const btSoftBody::Node &n = bt_soft_body->m_nodes[i]; B_TO_G(n.m_x, pos); test_geometry->add_vertex(pos); if (!first) { test_geometry->add_vertex(pos); } else { first = false; } } test_geometry->end(); } void SoftBodyBullet::on_collision_filters_change() { } void SoftBodyBullet::on_collision_checker_start() { } void SoftBodyBullet::on_enter_area(AreaBullet *p_area) { } void SoftBodyBullet::on_exit_area(AreaBullet *p_area) { } void SoftBodyBullet::set_trimesh_body_shape(PoolVector<int> p_indices, PoolVector<Vector3> p_vertices, int p_triangles_num) { TrimeshSoftShapeData *shape_data = bulletnew(TrimeshSoftShapeData); shape_data->m_triangles_indices = p_indices; shape_data->m_vertices = p_vertices; shape_data->m_triangles_num = p_triangles_num; set_body_shape_data(shape_data, SOFT_SHAPE_TYPE_TRIMESH); reload_soft_body(); } void SoftBodyBullet::set_body_shape_data(SoftShapeData *p_soft_shape_data, SoftShapeType p_type) { bulletdelete(soft_body_shape_data); soft_body_shape_data = p_soft_shape_data; soft_shape_type = p_type; } void SoftBodyBullet::set_transform(const Transform &p_transform) { transform = p_transform; if (bt_soft_body) { // TODO the softbody set new transform considering the current transform as center of world // like if it's local transform, so I must fix this by setting nwe transform considering the old btTransform bt_trans; G_TO_B(transform, bt_trans); //bt_soft_body->transform(bt_trans); } } const Transform &SoftBodyBullet::get_transform() const { return transform; } void SoftBodyBullet::get_first_node_origin(btVector3 &p_out_origin) const { if (bt_soft_body && bt_soft_body->m_nodes.size()) { p_out_origin = bt_soft_body->m_nodes[0].m_x; } else { p_out_origin.setZero(); } } void SoftBodyBullet::set_activation_state(bool p_active) { if (p_active) { bt_soft_body->setActivationState(ACTIVE_TAG); } else { bt_soft_body->setActivationState(WANTS_DEACTIVATION); } } void SoftBodyBullet::set_mass(real_t p_val) { if (0 >= p_val) { p_val = 1; } mass = p_val; if (bt_soft_body) { bt_soft_body->setTotalMass(mass); } } void SoftBodyBullet::set_stiffness(real_t p_val) { stiffness = p_val; if (bt_soft_body) { mat0->m_kAST = stiffness; mat0->m_kLST = stiffness; mat0->m_kVST = stiffness; } } void SoftBodyBullet::set_simulation_precision(int p_val) { simulation_precision = p_val; if (bt_soft_body) { bt_soft_body->m_cfg.piterations = simulation_precision; } } void SoftBodyBullet::set_pressure_coefficient(real_t p_val) { pressure_coefficient = p_val; if (bt_soft_body) { bt_soft_body->m_cfg.kPR = pressure_coefficient; } } void SoftBodyBullet::set_damping_coefficient(real_t p_val) { damping_coefficient = p_val; if (bt_soft_body) { bt_soft_body->m_cfg.kDP = damping_coefficient; } } void SoftBodyBullet::set_drag_coefficient(real_t p_val) { drag_coefficient = p_val; if (bt_soft_body) { bt_soft_body->m_cfg.kDG = drag_coefficient; } } void SoftBodyBullet::reload_soft_body() { destroy_soft_body(); create_soft_body(); if (bt_soft_body) { // TODO the softbody set new transform considering the current transform as center of world // like if it's local transform, so I must fix this by setting nwe transform considering the old btTransform bt_trans; G_TO_B(transform, bt_trans); bt_soft_body->transform(bt_trans); bt_soft_body->generateBendingConstraints(2, mat0); mat0->m_kAST = stiffness; mat0->m_kLST = stiffness; mat0->m_kVST = stiffness; bt_soft_body->m_cfg.piterations = simulation_precision; bt_soft_body->m_cfg.kDP = damping_coefficient; bt_soft_body->m_cfg.kDG = drag_coefficient; bt_soft_body->m_cfg.kPR = pressure_coefficient; bt_soft_body->setTotalMass(mass); } if (space) { // TODO remove this please space->add_soft_body(this); } } void SoftBodyBullet::create_soft_body() { if (!space || !soft_body_shape_data) { return; } ERR_FAIL_COND(!space->is_using_soft_world()); switch (soft_shape_type) { case SOFT_SHAPE_TYPE_TRIMESH: { TrimeshSoftShapeData *trimesh_data = static_cast<TrimeshSoftShapeData *>(soft_body_shape_data); Vector<int> indices; Vector<btScalar> vertices; int i; const int indices_size = trimesh_data->m_triangles_indices.size(); const int vertices_size = trimesh_data->m_vertices.size(); indices.resize(indices_size); vertices.resize(vertices_size * 3); PoolVector<int>::Read i_r = trimesh_data->m_triangles_indices.read(); for (i = 0; i < indices_size; ++i) { indices[i] = i_r[i]; } i_r = PoolVector<int>::Read(); PoolVector<Vector3>::Read f_r = trimesh_data->m_vertices.read(); for (int j = i = 0; i < vertices_size; ++i, j += 3) { vertices[j + 0] = f_r[i][0]; vertices[j + 1] = f_r[i][1]; vertices[j + 2] = f_r[i][2]; } f_r = PoolVector<Vector3>::Read(); bt_soft_body = btSoftBodyHelpers::CreateFromTriMesh(*space->get_soft_body_world_info(), vertices.ptr(), indices.ptr(), trimesh_data->m_triangles_num); } break; default: ERR_PRINT("Shape type not supported"); return; } setupBulletCollisionObject(bt_soft_body); bt_soft_body->getCollisionShape()->setMargin(0.001f); bt_soft_body->setCollisionFlags(bt_soft_body->getCollisionFlags() & (~(btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT))); mat0 = bt_soft_body->appendMaterial(); } void SoftBodyBullet::destroy_soft_body() { if (space) { /// This step is required to assert that the body is not into the world during deletion /// This step is required since to change the body shape the body must be re-created. /// Here is handled the case when the body is assigned into a world and the body /// shape is changed. space->remove_soft_body(this); } destroyBulletCollisionObject(); bt_soft_body = NULL; }
fa5076638d5682bd6feff21c1a50b7131bdd145c
1ca911bbd4d6fa5b676784607769b1ba8be2f07b
/qbleservice.cpp
bfb4b35dcfc997b2553f2868730c3904daaffd7a
[]
no_license
piggz/qble
d1351b74fe1b44d763302a1f4e0375f972001c1d
3631992ff3bf71a4680f18487e05486c134a1805
refs/heads/master
2022-05-03T08:59:19.241669
2022-04-05T21:11:28
2022-04-05T21:11:28
134,163,326
3
3
null
null
null
null
UTF-8
C++
false
false
4,769
cpp
qbleservice.cpp
#include "qbleservice.h" #include <QtXml/QtXml> #include <utility> QBLEService::QBLEService(const QString &uuid,const QString &path, QObject *parent) : QObject(parent), m_serviceUUID(uuid), m_servicePath(path) { m_serviceInterface = new QDBusInterface("org.bluez", m_servicePath, "org.bluez.GattService1", QDBusConnection::systemBus()); introspect(); } void QBLEService::characteristicChangedInt(const QString &characteristic, const QByteArray &value) { //qDebug() << "characteristicChangedInt:" << characteristic << value.size() << value.toHex(); emit characteristicChanged(characteristic, value); } void QBLEService::characteristicReadInt(const QString &characteristic, const QByteArray &value) { //qDebug() << "characteristicReadInt:" << characteristic << value.size() << value.toHex(); emit characteristicRead(characteristic, value); } void QBLEService::characteristicWrittenInt(const QString &characteristic, const QByteArray &value) { //qDebug() << "characteristicWrittenInt:" << characteristic << value.size() << value.toHex(); emit characteristicRead(characteristic, value); } void QBLEService::descriptorWrittenInt(const QString &descriptor, const QByteArray &value) { //qDebug() << "descriptorWrittenInt:" << descriptor << value.size() << value.toHex(); emit descriptorWritten(descriptor, value); } void QBLEService::enableNotification(const QString &c) { qDebug() << "Starting notify for " << c; QBLECharacteristic *ch = characteristic(c); if (ch) { ch->startNotify(); } else { qDebug() << "Unable to get characteristic"; } } void QBLEService::disableNotification(const QString &c) { qDebug() << "Stopping notify for " << c; QBLECharacteristic *ch = characteristic(c); if (ch) { ch->stopNotify(); } else { qDebug() << "Unable to get characteristic"; } } QString QBLEService::serviceUUID() const { return m_serviceUUID; } void QBLEService::writeValue(const QString &c, const QByteArray &value) { qDebug() << "Writing to " << c << ":" << value.toHex(); QBLECharacteristic *ch = characteristic(c); if (ch) { ch->writeValue(value); } else { qDebug() << "Unable to get characteristic"; } } void QBLEService::writeAsync(const QString &c, const QByteArray &value) { qDebug() << "Async Writing to " << c << ":" << value.toHex(); QBLECharacteristic *ch = characteristic(c); if (ch) { ch->writeAsync(value); } else { qDebug() << "Unable to get characteristic"; } } QByteArray QBLEService::readValue(const QString &c) { qDebug() << "Reading from " << c; QBLECharacteristic *ch = characteristic(c); if (ch) { return ch->readValue(); } else { qDebug() << "Unable to get characteristic"; } return QByteArray(); } void QBLEService::introspect() { QDBusInterface miIntro("org.bluez", m_servicePath, "org.freedesktop.DBus.Introspectable", QDBusConnection::systemBus(), 0); QDBusReply<QString> xml = miIntro.call("Introspect"); QDomDocument doc; doc.setContent(xml.value()); QDomNodeList nodes = doc.elementsByTagName("node"); qDebug() << nodes.count() << "nodes"; for (int x = 0; x < nodes.count(); x++) { QDomElement node = nodes.at(x).toElement(); QString nodeName = node.attribute("name"); if (nodeName.startsWith("char")) { QString path = m_servicePath + "/" + nodeName; QDBusInterface charInterface("org.bluez", path, "org.bluez.GattCharacteristic1", QDBusConnection::systemBus(), 0); m_characteristicMap[charInterface.property("UUID").toString()] = new QBLECharacteristic(path, this); } } for (const auto &c: static_cast<const QMap<QString, QBLECharacteristic* >>(m_characteristicMap)) { connect(c, &QBLECharacteristic::characteristicChanged, this, &QBLEService::characteristicChangedInt); connect(c, &QBLECharacteristic::characteristicRead, this, &QBLEService::characteristicReadInt); } qDebug() << "Introspect:characteristics:" << m_characteristicMap.keys(); } void QBLEService::onPropertiesChanged(const QString &interface, const QVariantMap &map, const QStringList &list) { emit propertiesChanged(interface, map, list); } QBLECharacteristic *QBLEService::characteristic(const QString &c) const { return m_characteristicMap.value(c, nullptr); } void QBLEService::readAsync(const QString &c) const { qDebug() << "Async reading from " << c; QBLECharacteristic *ch = characteristic(c); if (ch) { ch->readAsync(); } else { qDebug() << "Unable to get characteristic"; } } bool QBLEService::operationRunning() { return false; }
7e4bbd8414305a4119b81fd6b3379f01b8fedd89
e2df9dfe5051f7bc427778ab68b43cee3911a7bf
/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp
c520ede1bb9e4eb0cc0d47b471d281cedd0991b5
[ "Apache-2.0" ]
permissive
pwisbey/dali-toolkit
3a0d3358f0a07505786b0c97f83c48e9481e9791
aeb2a95e6cb48788c99d0338dd9788c402ebde07
refs/heads/master
2021-01-12T15:50:06.874102
2016-10-25T12:48:13
2016-10-25T12:48:13
71,880,217
0
0
null
null
null
null
UTF-8
C++
false
false
29,073
cpp
flex-container-impl.cpp
/* * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ // CLASS HEADER #include <dali-toolkit/internal/controls/flex-container/flex-container-impl.h> // EXTERNAL INCLUDES #include <sstream> #include <dali/public-api/object/ref-object.h> #include <dali/public-api/object/type-registry.h> #include <dali/public-api/object/type-registry-helper.h> #include <dali/devel-api/scripting/scripting.h> #include <dali/public-api/size-negotiation/relayout-container.h> #include <dali/integration-api/debug.h> using namespace Dali; namespace { #if defined(DEBUG_ENABLED) // debugging support, very useful when new features are added or bugs are hunted down // currently not called from code so compiler will optimize these away, kept here for future debugging #define FLEX_CONTAINER_TAG "DALI Toolkit::FlexContainer " #define FC_LOG(fmt, args...) Debug::LogMessage(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ## args) //#define FLEX_CONTAINER_DEBUG 1 #if defined(FLEX_CONTAINER_DEBUG) void PrintNode( Toolkit::Internal::FlexContainer::FlexItemNodeContainer itemNodes ) { // Print the style property and layout of all the children for( unsigned int i = 0; i < itemNodes.size(); ++i ) { FC_LOG( "Item %d style: \n", i ); print_css_node( itemNodes[i].node, (css_print_options_t)( CSS_PRINT_STYLE | CSS_PRINT_CHILDREN ) ); FC_LOG( "Item %d layout: \n", i ); print_css_node( itemNodes[i].node, (css_print_options_t)( CSS_PRINT_LAYOUT | CSS_PRINT_CHILDREN ) ); FC_LOG( "\n" ); } } #endif // defined(FLEX_CONTAINER_DEBUG) #endif // defined(DEBUG_ENABLED) } // namespace namespace Dali { namespace Toolkit { namespace Internal { namespace { // Type registration BaseHandle Create() { return Toolkit::FlexContainer::New(); } // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::FlexContainer, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "contentDirection", INTEGER, CONTENT_DIRECTION ) DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexDirection", INTEGER, FLEX_DIRECTION ) DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexWrap", INTEGER, FLEX_WRAP ) DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "justifyContent", INTEGER, JUSTIFY_CONTENT ) DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignItems", INTEGER, ALIGN_ITEMS ) DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignContent", INTEGER, ALIGN_CONTENT ) DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flex", FLOAT, FLEX ) DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignSelf", INTEGER, ALIGN_SELF ) DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexMargin", VECTOR4, FLEX_MARGIN ) DALI_TYPE_REGISTRATION_END() const Scripting::StringEnum ALIGN_SELF_STRING_TABLE[] = { { "auto", Toolkit::FlexContainer::ALIGN_AUTO }, { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, { "center", Toolkit::FlexContainer::ALIGN_CENTER }, { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } }; const unsigned int ALIGN_SELF_STRING_TABLE_COUNT = sizeof( ALIGN_SELF_STRING_TABLE ) / sizeof( ALIGN_SELF_STRING_TABLE[0] ); const Scripting::StringEnum CONTENT_DIRECTION_STRING_TABLE[] = { { "inherit", Toolkit::FlexContainer::INHERIT }, { "LTR", Toolkit::FlexContainer::LTR }, { "RTL", Toolkit::FlexContainer::RTL } }; const unsigned int CONTENT_DIRECTION_STRING_TABLE_COUNT = sizeof( CONTENT_DIRECTION_STRING_TABLE ) / sizeof( CONTENT_DIRECTION_STRING_TABLE[0] ); const Scripting::StringEnum FLEX_DIRECTION_STRING_TABLE[] = { { "column", Toolkit::FlexContainer::COLUMN }, { "columnReverse", Toolkit::FlexContainer::COLUMN_REVERSE }, { "row", Toolkit::FlexContainer::ROW }, { "rowReverse", Toolkit::FlexContainer::ROW_REVERSE } }; const unsigned int FLEX_DIRECTION_STRING_TABLE_COUNT = sizeof( FLEX_DIRECTION_STRING_TABLE ) / sizeof( FLEX_DIRECTION_STRING_TABLE[0] ); const Scripting::StringEnum FLEX_WRAP_STRING_TABLE[] = { { "noWrap", Toolkit::FlexContainer::NO_WRAP }, { "wrap", Toolkit::FlexContainer::WRAP } }; const unsigned int FLEX_WRAP_STRING_TABLE_COUNT = sizeof( FLEX_WRAP_STRING_TABLE ) / sizeof( FLEX_WRAP_STRING_TABLE[0] ); const Scripting::StringEnum JUSTIFY_CONTENT_STRING_TABLE[] = { { "flexStart", Toolkit::FlexContainer::JUSTIFY_FLEX_START }, { "center", Toolkit::FlexContainer::JUSTIFY_CENTER }, { "flexEnd", Toolkit::FlexContainer::JUSTIFY_FLEX_END }, { "spaceBetween", Toolkit::FlexContainer::JUSTIFY_SPACE_BETWEEN }, { "spaceAround", Toolkit::FlexContainer::JUSTIFY_SPACE_AROUND } }; const unsigned int JUSTIFY_CONTENT_STRING_TABLE_COUNT = sizeof( JUSTIFY_CONTENT_STRING_TABLE ) / sizeof( JUSTIFY_CONTENT_STRING_TABLE[0] ); const Scripting::StringEnum ALIGN_ITEMS_STRING_TABLE[] = { { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, { "center", Toolkit::FlexContainer::ALIGN_CENTER }, { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } }; const unsigned int ALIGN_ITEMS_STRING_TABLE_COUNT = sizeof( ALIGN_ITEMS_STRING_TABLE ) / sizeof( ALIGN_ITEMS_STRING_TABLE[0] ); const Scripting::StringEnum ALIGN_CONTENT_STRING_TABLE[] = { { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, { "center", Toolkit::FlexContainer::ALIGN_CENTER }, { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } }; const unsigned int ALIGN_CONTENT_STRING_TABLE_COUNT = sizeof( ALIGN_CONTENT_STRING_TABLE ) / sizeof( ALIGN_CONTENT_STRING_TABLE[0] ); /** * The function used by the layout algorithm to be get the style properties * and layout information of the child at the given index. */ css_node_t* GetChildNodeAtIndex( void *childrenNodes, int i ) { FlexContainer::FlexItemNodeContainer childrenNodeContainer = *( static_cast<FlexContainer::FlexItemNodeContainer*>( childrenNodes ) ); return childrenNodeContainer[i].node; } /** * The function used by the layout algorithm to check whether the node is dirty * for relayout. */ bool IsNodeDirty( void *itemNodes ) { // We only calculate the layout when the child is added or removed, or when // style properties are changed. So should always return true here. return true; } } // Unnamed namespace Toolkit::FlexContainer FlexContainer::New() { // Create the implementation, temporarily owned by this handle on stack IntrusivePtr< FlexContainer > impl = new FlexContainer(); // Pass ownership to CustomActor handle Toolkit::FlexContainer handle( *impl ); // Second-phase init of the implementation // This can only be done after the CustomActor connection has been made... impl->Initialize(); return handle; } FlexContainer::~FlexContainer() { free_css_node( mRootNode.node ); for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { free_css_node( mChildrenNodes[i].node ); } mChildrenNodes.clear(); } void FlexContainer::SetContentDirection( Toolkit::FlexContainer::ContentDirection contentDirection ) { if( mContentDirection != contentDirection ) { mContentDirection = contentDirection; mRootNode.node->style.direction = static_cast<css_direction_t>( mContentDirection ); RelayoutRequest(); } } Toolkit::FlexContainer::ContentDirection FlexContainer::GetContentDirection() { return mContentDirection; } void FlexContainer::SetFlexDirection( Toolkit::FlexContainer::FlexDirection flexDirection ) { if( mFlexDirection != flexDirection ) { mFlexDirection = flexDirection; mRootNode.node->style.flex_direction = static_cast<css_flex_direction_t>( mFlexDirection ); RelayoutRequest(); } } Toolkit::FlexContainer::FlexDirection FlexContainer::GetFlexDirection() { return mFlexDirection; } void FlexContainer::SetFlexWrap( Toolkit::FlexContainer::WrapType flexWrap ) { if( mFlexWrap != flexWrap ) { mFlexWrap = flexWrap; mRootNode.node->style.flex_wrap = static_cast<css_wrap_type_t>( mFlexWrap ); RelayoutRequest(); } } Toolkit::FlexContainer::WrapType FlexContainer::GetFlexWrap() { return mFlexWrap; } void FlexContainer::SetJustifyContent( Toolkit::FlexContainer::Justification justifyContent ) { if( mJustifyContent != justifyContent ) { mJustifyContent = justifyContent; mRootNode.node->style.justify_content = static_cast<css_justify_t>( mJustifyContent ); RelayoutRequest(); } } Toolkit::FlexContainer::Justification FlexContainer::GetJustifyContent() { return mJustifyContent; } void FlexContainer::SetAlignItems( Toolkit::FlexContainer::Alignment alignItems ) { if( mAlignItems != alignItems ) { mAlignItems = alignItems; mRootNode.node->style.align_items = static_cast<css_align_t>( mAlignItems ); RelayoutRequest(); } } Toolkit::FlexContainer::Alignment FlexContainer::GetAlignItems() { return mAlignItems; } void FlexContainer::SetAlignContent( Toolkit::FlexContainer::Alignment alignContent ) { if( mAlignContent != alignContent ) { mAlignContent = alignContent; mRootNode.node->style.align_content = static_cast<css_align_t>( mAlignContent ); RelayoutRequest(); } } Toolkit::FlexContainer::Alignment FlexContainer::GetAlignContent() { return mAlignContent; } void FlexContainer::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) { Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast( Dali::BaseHandle( object ) ); if( flexContainer ) { FlexContainer& flexContainerImpl( GetImpl( flexContainer ) ); switch( index ) { case Toolkit::FlexContainer::Property::CONTENT_DIRECTION: { Toolkit::FlexContainer::ContentDirection contentDirection( Toolkit::FlexContainer::INHERIT ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetContentDirection( static_cast<Toolkit::FlexContainer::ContentDirection>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::ContentDirection >( value.Get< std::string >().c_str(), CONTENT_DIRECTION_STRING_TABLE, CONTENT_DIRECTION_STRING_TABLE_COUNT, contentDirection ) ) { flexContainerImpl.SetContentDirection(contentDirection); } break; } case Toolkit::FlexContainer::Property::FLEX_DIRECTION: { Toolkit::FlexContainer::FlexDirection flexDirection( Toolkit::FlexContainer::COLUMN ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetFlexDirection( static_cast<Toolkit::FlexContainer::FlexDirection>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::FlexDirection >( value.Get< std::string >().c_str(), FLEX_DIRECTION_STRING_TABLE, FLEX_DIRECTION_STRING_TABLE_COUNT, flexDirection ) ) { flexContainerImpl.SetFlexDirection(flexDirection); } break; } case Toolkit::FlexContainer::Property::FLEX_WRAP: { Toolkit::FlexContainer::WrapType flexWrap( Toolkit::FlexContainer::NO_WRAP ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetFlexWrap( static_cast<Toolkit::FlexContainer::WrapType>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::WrapType >( value.Get< std::string >().c_str(), FLEX_WRAP_STRING_TABLE, FLEX_WRAP_STRING_TABLE_COUNT, flexWrap ) ) { flexContainerImpl.SetFlexWrap(flexWrap); } break; } case Toolkit::FlexContainer::Property::JUSTIFY_CONTENT: { Toolkit::FlexContainer::Justification justifyContent( Toolkit::FlexContainer::JUSTIFY_FLEX_START ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetJustifyContent( static_cast<Toolkit::FlexContainer::Justification>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Justification >( value.Get< std::string >().c_str(), JUSTIFY_CONTENT_STRING_TABLE, JUSTIFY_CONTENT_STRING_TABLE_COUNT, justifyContent ) ) { flexContainerImpl.SetJustifyContent(justifyContent); } break; } case Toolkit::FlexContainer::Property::ALIGN_ITEMS: { Toolkit::FlexContainer::Alignment alignItems( Toolkit::FlexContainer::ALIGN_STRETCH ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetAlignItems( static_cast<Toolkit::FlexContainer::Alignment>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.Get< std::string >().c_str(), ALIGN_ITEMS_STRING_TABLE, ALIGN_ITEMS_STRING_TABLE_COUNT, alignItems ) ) { flexContainerImpl.SetAlignItems(alignItems); } break; } case Toolkit::FlexContainer::Property::ALIGN_CONTENT: { Toolkit::FlexContainer::Alignment alignContent( Toolkit::FlexContainer::ALIGN_FLEX_START ); if( value.GetType() == Property::INTEGER ) { flexContainerImpl.SetAlignContent( static_cast<Toolkit::FlexContainer::Alignment>( value.Get< int >() ) ); } else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.Get< std::string >().c_str(), ALIGN_CONTENT_STRING_TABLE, ALIGN_CONTENT_STRING_TABLE_COUNT, alignContent ) ) { flexContainerImpl.SetAlignContent(alignContent); } break; } } } } Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index index ) { Property::Value value; Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast( Dali::BaseHandle( object ) ); if( flexContainer ) { FlexContainer& flexContainerImpl( GetImpl( flexContainer ) ); switch( index ) { case Toolkit::FlexContainer::Property::CONTENT_DIRECTION: { value = flexContainerImpl.GetContentDirection(); break; } case Toolkit::FlexContainer::Property::FLEX_DIRECTION: { value = flexContainerImpl.GetFlexDirection(); break; } case Toolkit::FlexContainer::Property::FLEX_WRAP: { value = flexContainerImpl.GetFlexWrap(); break; } case Toolkit::FlexContainer::Property::JUSTIFY_CONTENT: { value = flexContainerImpl.GetJustifyContent(); break; } case Toolkit::FlexContainer::Property::ALIGN_ITEMS: { value = flexContainerImpl.GetAlignItems(); break; } case Toolkit::FlexContainer::Property::ALIGN_CONTENT: { value = flexContainerImpl.GetAlignContent(); break; } } } return value; } void FlexContainer::OnChildAdd( Actor& child ) { Control::OnChildAdd( child ); // Anchor actor to top left of the container child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); child.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Create a new node for the child. FlexItemNode childNode; childNode.actor = child; childNode.node = new_css_node(); childNode.node->get_child = GetChildNodeAtIndex; childNode.node->is_dirty = IsNodeDirty; mChildrenNodes.push_back(childNode); } void FlexContainer::OnChildRemove( Actor& child ) { for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { if( mChildrenNodes[i].actor.GetHandle() == child ) { free_css_node( mChildrenNodes[i].node ); mChildrenNodes.erase( mChildrenNodes.begin() + i ); // Relayout the container only if instances were found RelayoutRequest(); break; } } Control::OnChildRemove( child ); } void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& container ) { for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH); float negotiatedHeight = child.GetRelayoutSize(Dimension::HEIGHT); if( negotiatedWidth > 0 ) { mChildrenNodes[i].node->style.dimensions[CSS_WIDTH] = negotiatedWidth; } if( negotiatedHeight > 0 ) { mChildrenNodes[i].node->style.dimensions[CSS_HEIGHT] = negotiatedHeight; } } } // Relayout the container RelayoutChildren(); for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE ) { child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH ); } if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE ) { child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT ); } container.Add( child, Vector2(mChildrenNodes[i].node->layout.dimensions[CSS_WIDTH], mChildrenNodes[i].node->layout.dimensions[CSS_HEIGHT] ) ); } } } bool FlexContainer::RelayoutDependentOnChildren( Dimension::Type dimension ) { return true; } void FlexContainer::OnSizeSet( const Vector3& size ) { if( mRootNode.node ) { Actor self = Self(); mRootNode.node->style.dimensions[CSS_WIDTH] = size.x; mRootNode.node->style.dimensions[CSS_HEIGHT] = size.y; RelayoutRequest(); } } void FlexContainer::OnSizeAnimation( Animation& animation, const Vector3& targetSize ) { // @todo Animate the children to their target size and position } void FlexContainer::ComputeLayout() { if( mRootNode.node ) { mRootNode.node->children_count = mChildrenNodes.size(); // Intialize the layout. mRootNode.node->layout.position[CSS_LEFT] = 0; mRootNode.node->layout.position[CSS_TOP] = 0; mRootNode.node->layout.position[CSS_BOTTOM] = 0; mRootNode.node->layout.position[CSS_RIGHT] = 0; mRootNode.node->layout.dimensions[CSS_WIDTH] = CSS_UNDEFINED; mRootNode.node->layout.dimensions[CSS_HEIGHT] = CSS_UNDEFINED; for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { css_node_t* childNode = mChildrenNodes[i].node; Actor childActor = mChildrenNodes[i].actor.GetHandle(); childNode->layout.position[CSS_LEFT] = 0; childNode->layout.position[CSS_TOP] = 0; childNode->layout.position[CSS_BOTTOM] = 0; childNode->layout.position[CSS_RIGHT] = 0; childNode->layout.dimensions[CSS_WIDTH] = CSS_UNDEFINED; childNode->layout.dimensions[CSS_HEIGHT] = CSS_UNDEFINED; // Intialize the style of the child. childNode->style.minDimensions[CSS_WIDTH] = childActor.GetMinimumSize().x; childNode->style.minDimensions[CSS_HEIGHT] = childActor.GetMinimumSize().y; childNode->style.maxDimensions[CSS_WIDTH] = childActor.GetMaximumSize().x; childNode->style.maxDimensions[CSS_HEIGHT] = childActor.GetMaximumSize().y; // Check child properties on the child for how to layout it. // These properties should be dynamically registered to the child which // would be added to FlexContainer. if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE ) { childNode->style.flex = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX ).Get<float>(); } Toolkit::FlexContainer::Alignment alignSelf( Toolkit::FlexContainer::ALIGN_AUTO ); if( childActor.GetPropertyType( Toolkit::FlexContainer::FlexContainer::ChildProperty::ALIGN_SELF ) != Property::NONE ) { Property::Value alignSelfPropertyValue = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::ALIGN_SELF ); if( alignSelfPropertyValue.GetType() == Property::INTEGER ) { alignSelf = static_cast<Toolkit::FlexContainer::Alignment>( alignSelfPropertyValue.Get< int >() ); } else if( alignSelfPropertyValue.GetType() == Property::STRING ) { std::string value = alignSelfPropertyValue.Get<std::string>(); Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.c_str(), ALIGN_SELF_STRING_TABLE, ALIGN_SELF_STRING_TABLE_COUNT, alignSelf ); } } childNode->style.align_self = static_cast<css_align_t>(alignSelf); if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ) != Property::NONE ) { Vector4 flexMargin = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ).Get<Vector4>(); childNode->style.margin[CSS_LEFT] = flexMargin.x; childNode->style.margin[CSS_TOP] = flexMargin.y; childNode->style.margin[CSS_RIGHT] = flexMargin.z; childNode->style.margin[CSS_BOTTOM] = flexMargin.w; } } // Calculate the layout layoutNode( mRootNode.node, Self().GetMaximumSize().x, Self().GetMaximumSize().y, mRootNode.node->style.direction ); } } void FlexContainer::RelayoutChildren() { ComputeLayout(); // Set size and position of children according to the layout calculation for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) { Dali::Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { child.SetX( mChildrenNodes[i].node->layout.position[CSS_LEFT] ); child.SetY( mChildrenNodes[i].node->layout.position[CSS_TOP] ); } } } Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) { Actor nextFocusableActor; // First check whether there is any items in the container if( mChildrenNodes.size() > 0 ) { if ( !currentFocusedActor || currentFocusedActor == Self() ) { // Nothing is currently focused, so the first child in the container should be focused. nextFocusableActor = mChildrenNodes[0].actor.GetHandle(); } else { // Check whether the current focused actor is within flex container int currentFocusedActorIndex = -1; for( unsigned int index = 0; index < mChildrenNodes.size(); index++ ) { if( currentFocusedActor == mChildrenNodes[index].actor.GetHandle() ) { currentFocusedActorIndex = index; break; } } if( currentFocusedActorIndex > -1 ) { int previousCheckedActorIndex = -1; int nextFocusedActorIndex = currentFocusedActorIndex; switch ( direction ) { case Toolkit::Control::KeyboardFocus::LEFT: case Toolkit::Control::KeyboardFocus::UP: { // Search the next focusable actor in the backward direction do { nextFocusedActorIndex--; if( nextFocusedActorIndex < 0 ) { nextFocusedActorIndex = loopEnabled ? mChildrenNodes.size() - 1 : 0; } if( nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex ) { previousCheckedActorIndex = nextFocusedActorIndex; } else { break; } } while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().IsKeyboardFocusable() ); break; } case Toolkit::Control::KeyboardFocus::RIGHT: case Toolkit::Control::KeyboardFocus::DOWN: { // Search the next focusable actor in the forward direction do { nextFocusedActorIndex++; if( nextFocusedActorIndex > static_cast<int>(mChildrenNodes.size() - 1) ) { nextFocusedActorIndex = loopEnabled ? 0 : mChildrenNodes.size() - 1; } if( nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex ) { previousCheckedActorIndex = nextFocusedActorIndex; } else { break; } } while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().IsKeyboardFocusable() ); break; } } if( nextFocusedActorIndex != currentFocusedActorIndex ) { nextFocusableActor = mChildrenNodes[nextFocusedActorIndex].actor.GetHandle(); } else { // No focusble child in the container nextFocusableActor = Actor(); } } else { // The current focused actor is not within flex container, so the first child in the container should be focused. nextFocusableActor = mChildrenNodes[0].actor.GetHandle(); } } } return nextFocusableActor; } FlexContainer::FlexContainer() : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mContentDirection( Toolkit::FlexContainer::INHERIT ), mFlexDirection( Toolkit::FlexContainer::COLUMN ), mFlexWrap( Toolkit::FlexContainer::NO_WRAP ), mJustifyContent( Toolkit::FlexContainer::JUSTIFY_FLEX_START ), mAlignItems( Toolkit::FlexContainer::ALIGN_STRETCH ), mAlignContent( Toolkit::FlexContainer::ALIGN_FLEX_START ) { SetKeyboardNavigationSupport( true ); } void FlexContainer::OnInitialize() { // Initialize the node for the flex container itself Dali::Actor self = Self(); mRootNode.actor = self; mRootNode.node = new_css_node(); mRootNode.node->context = &mChildrenNodes; // Set default style mRootNode.node->style.direction = static_cast<css_direction_t>( mContentDirection ); mRootNode.node->style.flex_direction = static_cast<css_flex_direction_t>( mFlexDirection ); mRootNode.node->style.flex_wrap = static_cast<css_wrap_type_t>( mFlexWrap ); mRootNode.node->style.justify_content = static_cast<css_justify_t>( mJustifyContent ); mRootNode.node->style.align_items = static_cast<css_align_t>( mAlignItems ); mRootNode.node->style.align_content = static_cast<css_align_t>( mAlignContent ); // Set callbacks. mRootNode.node->get_child = GetChildNodeAtIndex; mRootNode.node->is_dirty = IsNodeDirty; // Make self as keyboard focusable and focus group self.SetKeyboardFocusable( true ); SetAsKeyboardFocusGroup( true ); } } // namespace Internal } // namespace Toolkit } // namespace Dali
cfa66eb339f3c50bbf6482f8986615ba2729d937
3f093bc3895a349479181f8fce0e291985aa0849
/src/DatLink.cpp
73fa3cb9be356a74a0b55af21b0d2931846fedb7
[]
no_license
mkovrizhnykh/mp2-lab7-tables
8e09f65a95af979ecd4e5de8f6a1b48f9bdbfc65
3514b4a415a8c3e4468499f08c199a574255e725
refs/heads/master
2020-05-28T04:31:43.950623
2019-06-02T14:58:45
2019-06-02T14:58:45
188,880,242
0
0
null
2019-05-27T16:55:32
2019-05-27T16:55:32
null
UTF-8
C++
false
false
207
cpp
DatLink.cpp
#include "DatLink.h" void TDatLink::SetDatValue(PTDatValue pVal) { pValue=pVal; } PTDatValue TDatLink::GetDatValue() { return pValue; } PTDatLink TDatLink::GetNextDatLink() { return (PTDatLink)pNext; }
2673c74b256e428398fb9848dc1e6ba3585ca372
eabe92ff958be0e5894ed7501780d8eb608b6ae9
/content/browser/renderer_host/resource_dispatcher_host.h
e3ff805b69a6e709a77295d552039a9fa6c4a647
[ "BSD-3-Clause" ]
permissive
meego-tablet-ux/meego-app-browser
51bf8a8b8f15d702151a3f32a2598d4621b6926d
0f4ef17bd4b399c9c990a2f6ca939099495c2b9c
refs/heads/master
2021-01-10T21:33:19.677680
2011-07-20T01:19:53
2011-08-01T07:18:37
32,045,345
1
1
null
null
null
null
UTF-8
C++
false
false
22,028
h
resource_dispatcher_host.h
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This is the browser side of the resource dispatcher, it receives requests // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and // dispatches them to URLRequests. It then forwards the messages from the // URLRequests back to the correct process for handling. // // See http://dev.chromium.org/developers/design-documents/multi-process-resource-loading #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ #pragma once #include <map> #include <string> #include <vector> #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/timer.h" #include "content/browser/renderer_host/resource_queue.h" #include "content/common/child_process_info.h" #include "content/common/notification_type.h" #include "ipc/ipc_message.h" #include "net/url_request/url_request.h" #include "webkit/glue/resource_type.h" class CrossSiteResourceHandler; class DownloadFileManager; class DownloadRequestLimiter; class LoginHandler; class NotificationDetails; class PluginService; class ResourceDispatcherHostRequestInfo; class ResourceHandler; class ResourceMessageFilter; class SafeBrowsingService; class SaveFileManager; class SSLClientAuthHandler; class WebKitThread; struct DownloadSaveInfo; struct GlobalRequestID; struct ResourceHostMsg_Request; struct ViewMsg_ClosePage_Params; namespace net { class URLRequestContext; } // namespace net namespace webkit_blob { class DeletableFileReference; } class ResourceDispatcherHost : public net::URLRequest::Delegate { public: class Observer { public: virtual ~Observer() {} virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher, net::URLRequest* request) = 0; virtual void OnResponseCompleted( ResourceDispatcherHost* resource_dispatcher, net::URLRequest* request) = 0; virtual void OnReceivedRedirect(ResourceDispatcherHost* resource_dispatcher, net::URLRequest* request, const GURL& new_url) = 0; }; explicit ResourceDispatcherHost( const ResourceQueue::DelegateSet& resource_queue_delegates); ~ResourceDispatcherHost(); void Initialize(); // Puts the resource dispatcher host in an inactive state (unable to begin // new requests). Cancels all pending requests. void Shutdown(); // Returns true if the message was a resource message that was processed. // If it was, message_was_ok will be false iff the message was corrupt. bool OnMessageReceived(const IPC::Message& message, ResourceMessageFilter* filter, bool* message_was_ok); // Initiates a download from the browser process (as opposed to a resource // request from the renderer or another child process). void BeginDownload(const GURL& url, const GURL& referrer, const DownloadSaveInfo& save_info, bool prompt_for_save_location, int process_unique_id, int route_id, net::URLRequestContext* request_context); // Initiates a save file from the browser process (as opposed to a resource // request from the renderer or another child process). void BeginSaveFile(const GURL& url, const GURL& referrer, int process_unique_id, int route_id, net::URLRequestContext* request_context); // Cancels the given request if it still exists. We ignore cancels from the // renderer in the event of a download. void CancelRequest(int process_unique_id, int request_id, bool from_renderer); // Follows a deferred redirect for the given request. // new_first_party_for_cookies, if non-empty, is the new cookie policy URL // for the redirected URL. If the cookie policy URL needs changing, pass // true as has_new_first_party_for_cookies and the new cookie policy URL as // new_first_party_for_cookies. Otherwise, pass false as // has_new_first_party_for_cookies, and new_first_party_for_cookies will not // be used. void FollowDeferredRedirect(int process_unique_id, int request_id, bool has_new_first_party_for_cookies, const GURL& new_first_party_for_cookies); // Starts a request that was deferred during ResourceHandler::OnWillStart(). void StartDeferredRequest(int process_unique_id, int request_id); // Returns true if it's ok to send the data. If there are already too many // data messages pending, it pauses the request and returns false. In this // case the caller should not send the data. bool WillSendData(int process_unique_id, int request_id); // Pauses or resumes network activity for a particular request. void PauseRequest(int process_unique_id, int request_id, bool pause); // Returns the number of pending requests. This is designed for the unittests int pending_requests() const { return static_cast<int>(pending_requests_.size()); } // Intended for unit-tests only. Returns the memory cost of all the // outstanding requests (pending and blocked) for |process_unique_id|. int GetOutstandingRequestsMemoryCost(int process_unique_id) const; // Intended for unit-tests only. Overrides the outstanding requests bound. void set_max_outstanding_requests_cost_per_process(int limit) { max_outstanding_requests_cost_per_process_ = limit; } // The average private bytes increase of the browser for each new pending // request. Experimentally obtained. static const int kAvgBytesPerOutstandingRequest = 4400; DownloadFileManager* download_file_manager() const { return download_file_manager_; } DownloadRequestLimiter* download_request_limiter() const { return download_request_limiter_.get(); } SaveFileManager* save_file_manager() const { return save_file_manager_; } SafeBrowsingService* safe_browsing_service() const { return safe_browsing_; } WebKitThread* webkit_thread() const { return webkit_thread_.get(); } // Called when the onunload handler for a cross-site request has finished. void OnClosePageACK(const ViewMsg_ClosePage_Params& params); // Force cancels any pending requests for the given process. void CancelRequestsForProcess(int process_unique_id); // Force cancels any pending requests for the given route id. This method // acts like CancelRequestsForProcess when route_id is -1. void CancelRequestsForRoute(int process_unique_id, int route_id); // net::URLRequest::Delegate virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect); virtual void OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo* auth_info); virtual void OnCertificateRequested( net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info); virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, net::X509Certificate* cert); virtual void OnGetCookies(net::URLRequest* request, bool blocked_by_policy); virtual void OnSetCookie(net::URLRequest* request, const std::string& cookie_line, const net::CookieOptions& options, bool blocked_by_policy); virtual void OnResponseStarted(net::URLRequest* request); virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); void OnResponseCompleted(net::URLRequest* request); // Helper functions to get our extra data out of a request. The given request // must have been one we created so that it has the proper extra data pointer. static ResourceDispatcherHostRequestInfo* InfoForRequest( net::URLRequest* request); static const ResourceDispatcherHostRequestInfo* InfoForRequest( const net::URLRequest* request); // Extracts the render view/process host's identifiers from the given request // and places them in the given out params (both required). If there are no // such IDs associated with the request (such as non-page-related requests), // this function will return false and both out params will be -1. static bool RenderViewForRequest(const net::URLRequest* request, int* render_process_host_id, int* render_view_host_id); // Adds an observer. The observer will be called on the IO thread. To // observe resource events on the UI thread, subscribe to the // NOTIFY_RESOURCE_* notifications of the notification service. void AddObserver(Observer* obs); // Removes an observer. void RemoveObserver(Observer* obs); // Retrieves a net::URLRequest. Must be called from the IO thread. net::URLRequest* GetURLRequest(const GlobalRequestID& request_id) const; // Notifies our observers that a request has been cancelled. void NotifyResponseCompleted(net::URLRequest* request, int process_unique_id); void RemovePendingRequest(int process_unique_id, int request_id); // Causes all new requests for the route identified by // |process_unique_id| and |route_id| to be blocked (not being // started) until ResumeBlockedRequestsForRoute or // CancelBlockedRequestsForRoute is called. void BlockRequestsForRoute(int process_unique_id, int route_id); // Resumes any blocked request for the specified route id. void ResumeBlockedRequestsForRoute(int process_unique_id, int route_id); // Cancels any blocked request for the specified route id. void CancelBlockedRequestsForRoute(int process_unique_id, int route_id); // Decrements the pending_data_count for the request and resumes // the request if it was paused due to too many pending data // messages sent. void DataReceivedACK(int process_unique_id, int request_id); // Maintains a collection of temp files created in support of // the download_to_file capability. Used to grant access to the // child process and to defer deletion of the file until it's // no longer needed. void RegisterDownloadedTempFile( int child_id, int request_id, webkit_blob::DeletableFileReference* reference); void UnregisterDownloadedTempFile(int child_id, int request_id); // Needed for the sync IPC message dispatcher macros. bool Send(IPC::Message* message); // Controls if we launch or squash prefetch requests as they arrive // from renderers. static bool is_prefetch_enabled(); static void set_is_prefetch_enabled(bool value); void AddPrerenderChildRoutePair(int child_id, int route_id); void RemovePrerenderChildRoutePair(int child_id, int route_id); typedef std::set<std::pair<int, int> > PrerenderChildRouteIdPairs; const PrerenderChildRouteIdPairs& prerender_child_route_id_pairs() const { return prerender_child_route_pairs_; } private: FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies); FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, IncrementOutstandingRequestsMemoryCost); FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, CalculateApproximateMemoryCost); class ShutdownTask; friend class ShutdownTask; // Associates the given info with the given request. The info will then be // owned by the request. void SetRequestInfo(net::URLRequest* request, ResourceDispatcherHostRequestInfo* info); // A shutdown helper that runs on the IO thread. void OnShutdown(); // Returns true if the request is paused. bool PauseRequestIfNeeded(ResourceDispatcherHostRequestInfo* info); // Resumes the given request by calling OnResponseStarted or OnReadCompleted. void ResumeRequest(const GlobalRequestID& request_id); // Internal function to start reading for the first time. void StartReading(net::URLRequest* request); // Reads data from the response using our internal buffer as async IO. // Returns true if data is available immediately, false otherwise. If the // return value is false, we will receive a OnReadComplete() callback later. bool Read(net::URLRequest* request, int* bytes_read); // Internal function to finish an async IO which has completed. Returns // true if there is more data to read (e.g. we haven't read EOF yet and // no errors have occurred). bool CompleteRead(net::URLRequest*, int* bytes_read); // Internal function to finish handling the ResponseStarted message. Returns // true on success. bool CompleteResponseStarted(net::URLRequest* request); // Helper function for regular and download requests. void BeginRequestInternal(net::URLRequest* request); // Helper function that cancels |request|. Returns whether the // request was actually cancelled. If a renderer cancels a request // for a download, we ignore the cancellation. bool CancelRequestInternal(net::URLRequest* request, bool from_renderer); // Helper function that inserts |request| into the resource queue. void InsertIntoResourceQueue( net::URLRequest* request, const ResourceDispatcherHostRequestInfo& request_info); // Updates the "cost" of outstanding requests for |process_unique_id|. // The "cost" approximates how many bytes are consumed by all the in-memory // data structures supporting this request (net::URLRequest object, // HttpNetworkTransaction, etc...). // The value of |cost| is added to the running total, and the resulting // sum is returned. int IncrementOutstandingRequestsMemoryCost(int cost, int process_unique_id); // Estimate how much heap space |request| will consume to run. static int CalculateApproximateMemoryCost(net::URLRequest* request); // The list of all requests that we have pending. This list is not really // optimized, and assumes that we have relatively few requests pending at once // since some operations require brute-force searching of the list. // // It may be enhanced in the future to provide some kind of prioritization // mechanism. We should also consider a hashtable or binary tree if it turns // out we have a lot of things here. typedef std::map<GlobalRequestID, net::URLRequest*> PendingRequestList; // Deletes the pending request identified by the iterator passed in. // This function will invalidate the iterator passed in. Callers should // not rely on this iterator being valid on return. void RemovePendingRequest(const PendingRequestList::iterator& iter); // Notify our observers that we started receiving a response for a request. void NotifyResponseStarted(net::URLRequest* request, int process_unique_id); // Notify our observers that a request has been redirected. void NotifyReceivedRedirect(net::URLRequest* request, int process_unique_id, const GURL& new_url); // Tries to handle the url with an external protocol. If the request is // handled, the function returns true. False otherwise. bool HandleExternalProtocol(int request_id, int process_unique_id, int route_id, const GURL& url, ResourceType::Type resource_type, ResourceHandler* handler); // Checks all pending requests and updates the load states and upload // progress if necessary. void UpdateLoadStates(); // Checks the upload state and sends an update if one is necessary. bool MaybeUpdateUploadProgress(ResourceDispatcherHostRequestInfo *info, net::URLRequest *request); // Resumes or cancels (if |cancel_requests| is true) any blocked requests. void ProcessBlockedRequestsForRoute(int process_unique_id, int route_id, bool cancel_requests); void OnRequestResource(const IPC::Message& msg, int request_id, const ResourceHostMsg_Request& request_data); void OnSyncLoad(int request_id, const ResourceHostMsg_Request& request_data, IPC::Message* sync_result); void BeginRequest(int request_id, const ResourceHostMsg_Request& request_data, IPC::Message* sync_result, // only valid for sync int route_id); // only valid for async void OnDataReceivedACK(int request_id); void OnDataDownloadedACK(int request_id); void OnUploadProgressACK(int request_id); void OnCancelRequest(int request_id); void OnFollowRedirect(int request_id, bool has_new_first_party_for_cookies, const GURL& new_first_party_for_cookies); void OnReleaseDownloadedFile(int request_id); bool IsPrerenderingChildRoutePair(int child_id, int route_id) const; ResourceHandler* CreateSafeBrowsingResourceHandler( ResourceHandler* handler, int child_id, int route_id, ResourceType::Type resource_type); // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request // (a download or a page save). |download| should be true if the request // is a file download. ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( ResourceHandler* handler, int child_id, int route_id, bool download); // Returns true if |request| is in |pending_requests_|. bool IsValidRequest(net::URLRequest* request); // Determine request priority based on how critical this resource typically // is to user-perceived page load performance. static net::RequestPriority DetermineRequestPriority(ResourceType::Type type); // Sends the given notification on the UI thread. The RenderViewHost's // controller is used as the source. template <class T> static void NotifyOnUI(NotificationType type, int render_process_id, int render_view_id, T* detail); PendingRequestList pending_requests_; // Collection of temp files downloaded for child processes via // the download_to_file mechanism. We avoid deleting them until // the client no longer needs them. typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> > DeletableFilesMap; // key is request id typedef std::map<int, DeletableFilesMap> RegisteredTempFiles; // key is child process id RegisteredTempFiles registered_temp_files_; // A timer that periodically calls UpdateLoadStates while pending_requests_ // is not empty. base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_; // Handles the resource requests from the moment we want to start them. ResourceQueue resource_queue_; // We own the download file writing thread and manager scoped_refptr<DownloadFileManager> download_file_manager_; // Determines whether a download is allowed. scoped_refptr<DownloadRequestLimiter> download_request_limiter_; // We own the save file manager. scoped_refptr<SaveFileManager> save_file_manager_; scoped_refptr<SafeBrowsingService> safe_browsing_; // We own the WebKit thread and see to its destruction. scoped_ptr<WebKitThread> webkit_thread_; // Request ID for browser initiated requests. request_ids generated by // child processes are counted up from 0, while browser created requests // start at -2 and go down from there. (We need to start at -2 because -1 is // used as a special value all over the resource_dispatcher_host for // uninitialized variables.) This way, we no longer have the unlikely (but // observed in the real world!) event where we have two requests with the same // request_id_. int request_id_; // List of objects observing resource dispatching. ObserverList<Observer> observer_list_; // For running tasks. ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; // True if the resource dispatcher host has been shut down. bool is_shutdown_; typedef std::vector<net::URLRequest*> BlockedRequestsList; typedef std::pair<int, int> ProcessRouteIDs; typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; BlockedRequestMap blocked_requests_map_; // Maps the process_unique_ids to the approximate number of bytes // being used to service its resource requests. No entry implies 0 cost. typedef std::map<int, int> OutstandingRequestsMemoryCostMap; OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_; // |max_outstanding_requests_cost_per_process_| is the upper bound on how // many outstanding requests can be issued per child process host. // The constraint is expressed in terms of bytes (where the cost of // individual requests is given by CalculateApproximateMemoryCost). // The total number of outstanding requests is roughly: // (max_outstanding_requests_cost_per_process_ / // kAvgBytesPerOutstandingRequest) int max_outstanding_requests_cost_per_process_; // Used during IPC message dispatching so that the handlers can get a pointer // to the source of the message. ResourceMessageFilter* filter_; static bool is_prefetch_enabled_; PrerenderChildRouteIdPairs prerender_child_route_pairs_; DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); }; #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_
55c0797583e1e28f59c2be172ff9e3bfa01dac22
c9b02ab1612c8b436c1de94069b139137657899b
/rpg/app/battle/OnlineRewardManager.h
ea4c80558a9632529c9f7243342f35ec5fbd51ce
[]
no_license
colinblack/game_server
a7ee95ec4e1def0220ab71f5f4501c9a26ab61ab
a7724f93e0be5c43e323972da30e738e5fbef54f
refs/heads/master
2020-03-21T19:25:02.879552
2020-03-01T08:57:07
2020-03-01T08:57:07
138,948,382
1
1
null
null
null
null
UTF-8
C++
false
false
587
h
OnlineRewardManager.h
/* * OnlineReward.h * * Created on: 2019年7月25日 * Author: memory */ #ifndef ONLINEREWARD_H_ #define ONLINEREWARD_H_ #include "BattleBaseInc.h" class OnlineRewardManager: public CSingleton<OnlineRewardManager> { private: friend class CSingleton<OnlineRewardManager>; OnlineRewardManager(); ~OnlineRewardManager(); public: bool DailyReset(UserCache &cache); public: int Process(uint32_t uid, logins::COnlineRewardReq *req); public: int Sync(const UserCache &cache, uint32_t cmd, msgs::SPlayerOnlineReward *resp);// 4072 - 1568 }; #endif /* ONLINEREWARD_H_ */
c8b8192ad681050da920dd1ca896647acd65232f
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
/Engine/Source/Runtime/Slate/Public/Widgets/Input/NumericUnitTypeInterface.inl
030dd4f22a1b5ab58d2bc05fbd6c9e14451fed65
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
windystrife/UnrealEngine_NVIDIAGameWorks
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
b50e6338a7c5b26374d66306ebc7807541ff815e
refs/heads/4.18-GameWorks
2023-03-11T02:50:08.471040
2022-01-13T20:50:29
2022-01-13T20:50:29
124,100,479
262
179
MIT
2022-12-16T05:36:38
2018-03-06T15:44:09
C++
UTF-8
C++
false
false
2,774
inl
NumericUnitTypeInterface.inl
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/UnrealString.h" #include "Misc/Optional.h" #include "Internationalization/Text.h" #include "Templates/ValueOrError.h" #include "Math/UnitConversion.h" template<typename NumericType> struct TDefaultNumericTypeInterface; template<typename NumericType> struct TNumericUnitTypeInterface; template<typename NumericType> TNumericUnitTypeInterface<NumericType>::TNumericUnitTypeInterface(EUnit InUnits) : UnderlyingUnits(InUnits) {} template<typename NumericType> FString TNumericUnitTypeInterface<NumericType>::ToString(const NumericType& Value) const { if (UnderlyingUnits == EUnit::Unspecified) { return TDefaultNumericTypeInterface<NumericType>::ToString(Value); } using namespace Lex; FNumericUnit<NumericType> FinalValue(Value, UnderlyingUnits); if (FixedDisplayUnits.IsSet()) { auto Converted = FinalValue.ConvertTo(FixedDisplayUnits.GetValue()); if (Converted.IsSet()) { return ToSanitizedString(Converted.GetValue()); } } return ToSanitizedString(FinalValue); } template<typename NumericType> TOptional<NumericType> TNumericUnitTypeInterface<NumericType>::FromString(const FString& InString, const NumericType& InExistingValue) { if (UnderlyingUnits == EUnit::Unspecified) { return TDefaultNumericTypeInterface<NumericType>::FromString(InString, InExistingValue); } using namespace Lex; EUnit DefaultUnits = FixedDisplayUnits.IsSet() ? FixedDisplayUnits.GetValue() : UnderlyingUnits; // Always parse in as a double, to allow for input of higher-order units with decimal numerals into integral types (eg, inputting 0.5km as 500m) TValueOrError<FNumericUnit<double>, FText> NewValue = FNumericUnit<double>::TryParseExpression( *InString, DefaultUnits, InExistingValue ); if (NewValue.IsValid()) { // Convert the number into the correct units EUnit SourceUnits = NewValue.GetValue().Units; if (SourceUnits == EUnit::Unspecified && FixedDisplayUnits.IsSet()) { // Use the default supplied input units SourceUnits = FixedDisplayUnits.GetValue(); } return FUnitConversion::Convert(NewValue.GetValue().Value, SourceUnits, UnderlyingUnits); } return TOptional<NumericType>(); } template<typename NumericType> bool TNumericUnitTypeInterface<NumericType>::IsCharacterValid(TCHAR InChar) const { return (UnderlyingUnits == EUnit::Unspecified) ? TDefaultNumericTypeInterface<NumericType>::IsCharacterValid(InChar) : true; } template<typename NumericType> void TNumericUnitTypeInterface<NumericType>::SetupFixedDisplay(const NumericType& InValue) { EUnit DisplayUnit = FUnitConversion::CalculateDisplayUnit(InValue, UnderlyingUnits); if (DisplayUnit != EUnit::Unspecified) { FixedDisplayUnits = DisplayUnit; } }
10dc097fe806cd5d27aa61a2f3f8924981d0fe5b
c444a5d126ea215b13648ce0f46cd16dfaa1fa6a
/Source/UserDialog.cpp
e906cd10d006a12d5177c9cdbe7842d9968e598f
[]
no_license
IntelOrca/Columns
a2665fbf70531308caab282bd8b518bb45d89e4a
f12fc411aaa2ae3f5c8e5bf6186d3c22efadd2b0
refs/heads/master
2021-01-21T05:20:02.522041
2017-02-25T23:47:26
2017-02-25T23:47:26
83,170,988
4
2
null
null
null
null
UTF-8
C++
false
false
11,486
cpp
UserDialog.cpp
/**************************** * Columns * * Copyright Ted John 2008 * * http://tedtycoon.co.uk * ****************************/ #include "Strings.h" #include "GameApp.h" #include "Game.h" #include "MessageDialog.h" #include "UserDialog.h" #include "UserNameDialog.h" #include "User.h" #include "Res.h" #include "GameApp.h" #include "SexyAppFramework/SexyAppBase.h" #include "SexyAppFramework/WidgetManager.h" #include "SexyAppFramework/Font.h" #include "SexyAppFramework/DialogButton.h" #include "SexyAppFramework/ListWidget.h" #include "SexyAppFramework/EditWidget.h" #include "SexyAppFramework/ScrollbarWidget.h" #include "SexyAppFramework/ScrollbuttonWidget.h" using namespace Sexy; UserDialog::UserDialog(std::string theHeader, std::string theBody) : Dialog(IMAGE_DIALOG, IMAGE_DIALOG_BTN, UserDialog::DIALOG_ID, true, StringToSexyStringFast(theHeader), StringToSexyStringFast(theBody), "", Dialog::BUTTONS_NONE) { usercount = 0; userlist = NULL; mContentInsets = Insets(40, 10, 45, 40); mSpaceAfterHeader = 10; SetHeaderFont(FONT_NORMAL); SetLinesFont(FONT_NORMAL); SetButtonFont(FONT_NORMAL); SetColor(COLOR_HEADER, Color::Black); SetColor(COLOR_LINES, Color::Black); mListScrollbuttonU = new ScrollbuttonWidget(USERSCROLLU_SCROLLBUTTON_ID, this, 1); mListScrollbuttonD = new ScrollbuttonWidget(USERSCROLLD_SCROLLBUTTON_ID, this, 0); mListScroll = new ScrollbarWidget(USERSCROLL_SCROLLBAR_ID, this); mListScroll->mUpButton = mListScrollbuttonU; mListScroll->mDownButton = mListScrollbuttonD; mUserList = new ListWidget(USER_LIST_ID, FONT_NORMAL, this); mUserList->mScrollbar = mListScroll; mUserList->mJustify = ListWidget::JUSTIFY_CENTER; mUserList->mItemHeight = FONT_NORMAL->GetHeight() - 10; mUserList->mColors[ListWidget::COLOR_BKG] = Color(115, 0, 0); mUserList->mColors[ListWidget::COLOR_OUTLINE] = Color::Black; mUserList->mColors[ListWidget::COLOR_TEXT] = Color(255, 255, 0); mUserList->mColors[ListWidget::COLOR_HILITE] = Color(255, 255, 255); mUserList->mColors[ListWidget::COLOR_SELECT] = Color(255, 0, 255); mUserList->mColors[ListWidget::COLOR_SELECT_TEXT] = Color(255, 255, 0); mUserList->AddLine(SZ_CREATE_NEW_USER, false); RefreshList(); mRenameButton = new DialogButton(IMAGE_DIALOG_BTN, RENAME_BUTTON_ID, this); mRenameButton->mLabel = SZ_RENAME; mRenameButton->SetFont(FONT_NORMAL); mRenameButton->SetColor(DialogButton::COLOR_LABEL, Color::Black); mRenameButton->SetColor(DialogButton::COLOR_LABEL_HILITE, Color::Black); mDeleteButton = new DialogButton(IMAGE_DIALOG_BTN, DELETE_BUTTON_ID, this); mDeleteButton->mLabel = SZ_DELETE; mDeleteButton->SetFont(FONT_NORMAL); mDeleteButton->SetColor(DialogButton::COLOR_LABEL, Color::Black); mDeleteButton->SetColor(DialogButton::COLOR_LABEL_HILITE, Color::Black); mCancelButton = new DialogButton(IMAGE_DIALOG_BTN, CANCEL_BUTTON_ID, this); mCancelButton->mLabel = SZ_CANCEL; mCancelButton->SetFont(FONT_NORMAL); mCancelButton->SetColor(DialogButton::COLOR_LABEL, Color::Black); mCancelButton->SetColor(DialogButton::COLOR_LABEL_HILITE, Color::Black); mOKButton = new DialogButton(IMAGE_DIALOG_BTN, OK_BUTTON_ID, this); mOKButton->mLabel = SZ_OK; mOKButton->SetFont(FONT_NORMAL); mOKButton->SetColor(DialogButton::COLOR_LABEL, Color::Black); mOKButton->SetColor(DialogButton::COLOR_LABEL_HILITE, Color::Black); } UserDialog::~UserDialog() { delete[] userlist; delete mListScroll; delete mUserList; delete mRenameButton; delete mDeleteButton; delete mCancelButton; delete mOKButton; } User *UserDialog::SelectedUser() { if (mUserList->mLines.size() > 1) return &userlist[mUserList->mSelectIdx - 1]; else return NULL; } void UserDialog::AddUser(SexyString sname) { //Convert string to c-string char *name = new char[sname.length()]; strcpy(name, sname.c_str()); //Check if name is unique for (int i = 0; i < usercount; i++) { if (strcmp(userlist[i].mName, name) == 0) { //Name already in use } } //Create the new user User *u = new User(mApp, name, true); for (int i = 1; i < 255; i++) { if (i == 255) { //Too many users } else { char filename[MAX_PATH]; sprintf(filename, PATH_USER_FILE, i); if (GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES) { u->Save(filename); break; } } } } void UserDialog::RemoveUser(int id) { //Check if a user is selected if (SelectedUser() == NULL) return; if (!DeleteFile(userlist[id].mFilename)) { //Can't remove user } } void UserDialog::SelectUser(SexyString sname) { //Convert string to c-string char *name = new char[sname.length()]; strcpy(name, sname.c_str()); for (int i = 0; i < usercount; i++) { if (strcmp(name, userlist[i].mName) == 0) { mUserList->SetSelect(i + 1); break; } } } void UserDialog::RenameSelectedUser(SexyString sname) { //Convert string to c-string char *name = new char[sname.length()]; strcpy(name, sname.c_str()); User *usr = SelectedUser(); usr->mName = name; usr->Save(); } void UserDialog::GetUsersFromDirectory() { char szFiles[400]; WIN32_FIND_DATA ffd; TCHAR szDir[MAX_PATH] = PATH_USER_FILES; HANDLE hFind = INVALID_HANDLE_VALUE; DWORD dwError=0; usercount = 0; //Count number of users hFind = FindFirstFile(szDir, &ffd); if (hFind != INVALID_HANDLE_VALUE) { usercount++; while (FindNextFile(hFind, &ffd) != 0) { usercount++; } } userlist = new User[usercount]; //Load users int i = 0; hFind = FindFirstFile(szDir, &ffd); if (hFind != INVALID_HANDLE_VALUE) { char filename[MAX_PATH]; sprintf(filename, "%s%s", PATH_USERS, ffd.cFileName); userlist[i].Load(filename); i++; for (i = i; i < usercount; i++) { if (FindNextFile(hFind, &ffd) != 0) { char filename[MAX_PATH]; sprintf(filename, "%s%s", PATH_USERS, ffd.cFileName); if (!userlist[i].Load(filename)) { i--; usercount--; } } } } FindClose(hFind); } void UserDialog::RefreshList() { GetUsersFromDirectory(); mUserList->RemoveAll(); mUserList->AddLine(SZ_CLICK_TO_ADD_NEW_USER, false); for (int i = 0; i < usercount; i++) { if (userlist[i].mSuccessfulLoad) { mUserList->AddLine(userlist[i].mName, false); } } mUserList->SetSelect(1); } void UserDialog::NewUserDialog() { UserNameDialog *dlg; int result; //Create the dialog and show it dlg = new UserNameDialog(SZ_NULL); dlg->mApp = mApp; //Disallowed names dlg->mDisallowedNamesCount = usercount; dlg->mDisallowedNames = new SexyString[usercount]; for (int i = 0; i < usercount; i++) { dlg->mDisallowedNames[i] = userlist[i].mName; } dlg->Resize((mApp->mWidth / 2) - (350 / 2), mApp->mHeight / 5, 350, 200); mApp->AddDialog(UserNameDialog::DIALOG_ID, dlg); //When dialog finishes, check result result = dlg->WaitForResult(true); if (result == UserNameDialog::OK_BUTTON_ID) { //Add the new user AddUser(dlg->mUserName); RefreshList(); SelectUser(dlg->mUserName); } } void UserDialog::RenameUserDialog() { UserNameDialog *dlg; int result; //Check if a user is selected if (SelectedUser() == NULL) return; //Create the dialog and show it dlg = new UserNameDialog(SelectedUser()->mName); dlg->Resize((mApp->mWidth / 2) - (350 / 2), mApp->mHeight / 5, 350, 200); mApp->AddDialog(UserNameDialog::DIALOG_ID, dlg); //When dialog finishes, check result result = dlg->WaitForResult(true); if (result == UserNameDialog::OK_BUTTON_ID) { //Rename the selected user RenameSelectedUser(dlg->mUserName); RefreshList(); SelectUser(dlg->mUserName); } } void UserDialog::Resize(int theX, int theY, int theWidth, int theHeight) { Dialog::Resize(theX, theY, theWidth, theHeight); int x = theX + mContentInsets.mLeft; int w = mWidth - mContentInsets.mLeft - mContentInsets.mRight; int y = theY + mContentInsets.mTop + mSpaceAfterHeader + FONT_NORMAL->GetHeight(); mOKButton->Resize(x, theY + mHeight - mContentInsets.mBottom - IMAGE_DIALOG_BTN->GetHeight(), w / 2 - 10, IMAGE_DIALOG_BTN->GetHeight()); mCancelButton->Layout(LAY_Right | LAY_SameTop | LAY_SameSize, mOKButton, 20, 0, 0, 0); mRenameButton->Layout(LAY_Above | LAY_SameLeft | LAY_SameSize, mOKButton, 0, -10, 0, 0); mDeleteButton->Layout(LAY_Above | LAY_SameLeft | LAY_SameSize, mCancelButton, 0, -10, 0, 0); int h = mRenameButton->mY -theY - 10 - mContentInsets.mTop - mSpaceAfterHeader - FONT_NORMAL->GetHeight(); mUserList->Resize(x, y, w - 16, h); mListScroll->Layout(LAY_SameTop | LAY_Right | LAY_SameHeight | LAY_SetWidth, mUserList, 0, 0, 16, 0); mListScrollbuttonU->Layout(LAY_SameTop | LAY_SameLeft | LAY_SameWidth | LAY_SetHeight, mListScroll, 0, 0, 0, 16); mListScrollbuttonD->Layout(LAY_SameTop | LAY_SameLeft | LAY_SameWidth | LAY_SetHeight, mListScroll, 0, mListScroll->mHeight - 16, 0, 16); } void UserDialog::AddedToManager(WidgetManager* theWidgetManager) { Dialog::AddedToManager(theWidgetManager); theWidgetManager->AddWidget(mUserList); theWidgetManager->AddWidget(mListScroll); theWidgetManager->AddWidget(mListScrollbuttonU); theWidgetManager->AddWidget(mListScrollbuttonD); theWidgetManager->AddWidget(mRenameButton); theWidgetManager->AddWidget(mDeleteButton); theWidgetManager->AddWidget(mCancelButton); theWidgetManager->AddWidget(mOKButton); //Select current user if (mApp->mCurrentUser != NULL) SelectUser(mApp->mCurrentUser->mName); } void UserDialog::RemovedFromManager(WidgetManager* theWidgetManager) { Dialog::RemovedFromManager(theWidgetManager); theWidgetManager->RemoveWidget(mListScrollbuttonU); theWidgetManager->RemoveWidget(mListScrollbuttonD); theWidgetManager->RemoveWidget(mListScroll); theWidgetManager->RemoveWidget(mUserList); theWidgetManager->RemoveWidget(mRenameButton); theWidgetManager->RemoveWidget(mDeleteButton); theWidgetManager->RemoveWidget(mCancelButton); theWidgetManager->RemoveWidget(mOKButton); } void UserDialog::ListClicked(int theId, int theIdx, int theClickCount) { if (theIdx > 0) { mUserList->SetSelect(theIdx); } else { //New User NewUserDialog(); } } void UserDialog::ButtonDepress(int theId) { Dialog::ButtonDepress(theId); switch (theId) { case RENAME_BUTTON_ID: RenameUserDialog(); break; case DELETE_BUTTON_ID: RemoveUser(mUserList->mSelectIdx - 1); RefreshList(); break; case CANCEL_BUTTON_ID: if (SelectedUser() == NULL || mApp->mCurrentUser == NULL) { MessageDialog *msgbox = new MessageDialog(60, SZ_WHO_ARE_YOU, SZ_MUST_SELECT_USER, SZ_OK, SZ_NULL, MessageDialog::MSGBOX_SINGLE); msgbox->Resize(mApp); mApp->AddDialog(msgbox); msgbox->WaitForResult(true); } else { gSexyAppBase->KillDialog(this); } break; case OK_BUTTON_ID: if (SelectedUser() == NULL) { MessageDialog *msgbox = new MessageDialog(60, SZ_WHO_ARE_YOU, SZ_MUST_SELECT_USER, SZ_OK, SZ_NULL, MessageDialog::MSGBOX_SINGLE); msgbox->Resize(mApp); mApp->AddDialog(msgbox); msgbox->WaitForResult(true); } else { mApp->SetCurrentUser(new User(mApp, SelectedUser()->mFilename, false)); gSexyAppBase->KillDialog(this); } break; } } void UserDialog::ButtonDownTick(int theId) { Dialog::ButtonDownTick(theId); switch (theId) { case USERSCROLLU_SCROLLBUTTON_ID: mListScroll->SetThumbPosition(mListScroll->GetThumbPosition() - 1); break; case USERSCROLLD_SCROLLBUTTON_ID: mListScroll->SetThumbPosition(mListScroll->GetThumbPosition() + 1); break; } } void UserDialog::ScrollPosition(int theId, double thePosition) { mUserList->ScrollPosition(theId, thePosition); }
476dc2af047847f7ae7af18a34430d3d1dbb7c3e
dd656493066344e70123776c2cc31dd13f31c1d8
/MITK/Core/Code/Algorithms/mitkBaseDataSource.cpp
6e7a4ab5eead61f08a09b7b22e2eb4a135755ced
[]
no_license
david-guerrero/MITK
e9832b830cbcdd94030d2969aaed45da841ffc8c
e5fbc9993f7a7032fc936f29bc59ca296b4945ce
refs/heads/master
2020-04-24T19:08:37.405353
2011-11-13T22:25:21
2011-11-13T22:25:21
2,372,730
0
1
null
null
null
null
UTF-8
C++
false
false
1,725
cpp
mitkBaseDataSource.cpp
/*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkBaseDataSource.h" mitk::BaseDataSource::BaseDataSource() { // Pure virtual functions may not be called in the constructor... // see ( see Bjarne Stroustrup's C++ PL 3rd ed section 15.4.3 ) //OutputType::Pointer output = static_cast<OutputType*> ( this->MakeOutput( 0 ).GetPointer() ); //Superclass::SetNumberOfRequiredOutputs( 1 ); //Superclass::SetNthOutput( 0, output.GetPointer() ); } mitk::BaseDataSource::~BaseDataSource() { } void mitk::BaseDataSource::SetOutput( OutputType* output ) { this->SetNthOutput( 0, output ); } void mitk::BaseDataSource::SetOutput( unsigned int idx, OutputType* output ) { this->SetNthOutput(idx, output); } mitk::BaseDataSource::OutputType* mitk::BaseDataSource::GetOutput() { if ( this->GetNumberOfOutputs() < 1 ) { return 0; } return static_cast<OutputType*> ( Superclass::GetOutput( 0 ) ); } mitk::BaseDataSource::OutputType* mitk::BaseDataSource::GetOutput ( unsigned int idx ) { return static_cast<OutputType*> ( Superclass::GetOutput( idx ) ); }
86ad513faf9a646b0a8cca32669ac131b036e4aa
d91cfc8c8cf27fabe957ec2c4b6307baa3fa6444
/Atcoder/ABC/ABC079/ABC079(B).c++
0faaf2c1d93b478703ea208ca0413fd24fd5a088
[]
no_license
Yuya-Nakata/Competitive-programming
87d5e030a1f2e346a02dea91eaabbfef7f285995
9e75ae74f08d27b25ec463200795cc64cab00e48
refs/heads/master
2020-03-24T21:22:58.085248
2018-09-04T07:05:08
2018-09-04T07:05:08
143,029,134
0
0
null
null
null
null
UTF-8
C++
false
false
373
ABC079(B).c++
//2017.11.18 //コンテスト中AC #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector <long long int> a(100); //ここの大きさを最初intでWA a[0]=2; a[1]=1; int i=2; while(i<=n){ a[i]=a[i-1]+a[i-2]; i++; } cout <<a[i-1] << endl; return 0; }
0cfa320d88e46605045c330012d2fdb355f2c00a
35d7642a52e0e966e2d78163eb78e8c29b01a0b5
/Model/Etc/Look.h
935c371be588997bdf02bce839ba8bd8cf90ada5
[]
no_license
tkdals1049/Project_N
e66e100482f38b56690a1308c027b75457e902dc
508265fb046a9eaa9ab35bf49f800f4f54f86ad6
refs/heads/master
2020-03-11T15:27:55.752875
2020-01-03T21:21:50
2020-01-03T21:21:50
126,276,621
0
0
null
null
null
null
UHC
C++
false
false
1,448
h
Look.h
#pragma once class LookBuffer : public ShaderBuffer { public: LookBuffer() : ShaderBuffer(&Data, sizeof(Struct)) { Data.color = D3DXCOLOR(0, 0, 0, 1); } void SetColor(D3DXCOLOR& color) { Data.color = color; } struct Struct { D3DXCOLOR color; }; Struct Data; }; #define PLANE_EPSILON 5.0f class Look { public: Look(); ~Look(); /// 카메라(view) * 프로젝션(projection)행렬을 입력받아 6개의 평면을 만든다. BOOL Make(); /// 한점 v가 프러스텀안에 있으면 TRUE를 반환, 아니면 FALSE를 반환한다. BOOL IsIn(const D3DXVECTOR3* pv); /** 중심(v)와 반지름(radius)를 갖는 경계구(bounding sphere)가 프러스텀안에 있으면 * TRUE를 반환, 아니면 FALSE를 반환한다. */ BOOL IsInSphere(const D3DXVECTOR3* pv, float radius); void PreUpdate(); void Update(); void Render();; void CreateBuffer(); void ChangeColor(); void SetWorld(D3DXMATRIX world); private: //무기 이펙트 쉐이더 typedef Vertex VertexType; Shader* shader; VertexType* vertex; UINT* index; ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; UINT vertexCount; UINT indexCount; LookBuffer* lookbuffer; WorldBuffer* worldBuffer; D3DXMATRIX world,view,proj,scale; D3DXVECTOR3 m_vtx[8]; /// 프러스텀을 구성할 정점 8개 D3DXVECTOR3 m_vPos; /// 현재 카메라의 월드좌표 D3DXPLANE m_plane[6]; /// 프러스텀을 구성하는 6개의 평면 };
e611ae3576a9fba75cecc8a6e58106f42395635d
d01f5d894602293f0b224c100e988e9c255b145c
/TLX/Courses/Pemrograman Kompetitif Dasar/Brute Force/H.cpp
56b347ad4769da492c397fa1501b4cf479fdf62d
[]
no_license
adityarev/online-judge
708e98599cdf461aef671ae1bc8806456eca29f2
4b92da74b71aa9ecdb13e662df323d5acc08c29f
refs/heads/master
2021-04-05T13:13:01.335277
2020-07-29T13:45:52
2020-07-29T13:45:52
248,560,399
0
0
null
null
null
null
UTF-8
C++
false
false
2,056
cpp
H.cpp
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; void set_arr(vector<int>& arr) { for (int& x: arr) cin >> x; sort(arr.begin(), arr.end()); } vector<int> create_borders( vector<bool>& flags, int& max_size ) { int n = (int)flags.size(); int curr = 0; vector<int> borders; for (int i = 0; i < n; i++) { curr += max_size; if (!flags[i]) curr--; borders.push_back(curr); } return borders; } bool is_valid_borders( vector<int>& borders, vector<int>& arr ) { for (int& border: borders) { if (border > 0 && arr[border] == arr[border - 1]) return false; } return true; } vector<int> get_filtered_arr( vector<int>& arr, vector<int>& indices ) { vector<int> filtered_arr; for (int& index: indices) filtered_arr.push_back(arr[index]); return filtered_arr; } vector<int> get_ans( vector<int>& arr, int& k ) { int n = (int)arr.size(); int max_size = (int)ceil((double)n / (double)k); int big_count = (n % k == 0 ? k : (n % k)); int small_count = k - big_count; vector<bool> flags; bool found = false; vector<int> ans; function<void(int)> _dfs = [&](int len) -> void { if (!found && len == k - 1) { vector<int> borders = create_borders(flags, max_size); if (is_valid_borders(borders, arr)) { ans = get_filtered_arr(arr, borders); found = true; } return; } function<void(bool,int&)> _trace = [&](bool value, int& counter) -> void { flags.push_back(value); counter--; _dfs(len + 1); counter++; flags.pop_back(); }; if (!found) { if (big_count > 0) _trace(true, big_count); if (small_count > 0) _trace(false, small_count); } }; _dfs(0); return ans; } void show_arr(vector<int>& arr) { int n = (int)arr.size(); for (int i = 0; i < n; i++) cout << arr[i] << (i == n - 1 ? "\n" : " "); } int main() { int n; cin >> n; vector<int> arr(n); set_arr(arr); int k; cin >> k; vector<int> ans = get_ans(arr, k); show_arr(ans); return 0; }
38ef6452bdcb818f31b2813c3d7b7642cc6a3529
74c657cc46874b9aef78bdb921f61f6d26cf48bf
/ColorBoxes/ColorBoxesEngine.cpp
dff2ae8c1e8ede5a1febcf18537343a607175e25
[]
no_license
jbromley/ColorBoxes
2d620bdbec912aafd7395716b6e0546440ad2e77
55364d515ca1de1bf38c4e67b48fd0bb90301ba6
refs/heads/master
2021-06-02T05:53:04.046033
2020-11-20T22:55:15
2020-11-20T22:55:15
7,352,648
0
0
null
null
null
null
UTF-8
C++
false
false
17,170
cpp
ColorBoxesEngine.cpp
// // ColorBoxesEngine.cpp // ColorBoxes // // Created by Jay Bromley on 12/27/12. // Copyright (c) 2012 Jay Bromley. All rights reserved. // #include <algorithm> #include <functional> #include <sstream> #include <AntTweakBar.h> #include "ColorBoxesEngine.h" #include "OpenGLDraw.h" #include "Utilities.h" #include "Wall.h" #include "Circle.h" #include "Polygon.h" #include "Box.h" #include "Edge.h" #include "Bomb.h" #include "Cursors.h" // AntTweakBar helpers static void TW_CALL getObjectCount(void* value, void* clientData) { *static_cast<unsigned long*>(value) = static_cast<const ColorBoxesEngine*>(clientData)->objectCount(); } static void TW_CALL getFps(void* value, void* clientData) { *static_cast<int*>(value) = static_cast<const ColorBoxesEngine*>(clientData)->fps(); } static void TW_CALL getGravityStrength(void* value, void* clientData) { b2Vec2 gravity = static_cast<ColorBoxesEngine*>(clientData)->world()->GetGravity(); *static_cast<float*>(value) = gravity.Length(); } static void TW_CALL setGravityStrength(const void* value, void* clientData) { float strength = *static_cast<const float*>(value); b2Vec2 gravity = static_cast<ColorBoxesEngine*>(clientData)->world()->GetGravity(); float length = gravity.Normalize(); if (length == 0.0f) { gravity = b2Vec2(0, -1.0f); } gravity *= strength; static_cast<ColorBoxesEngine*>(clientData)->world()->SetGravity(gravity); } static void TW_CALL getGravityDirection(void* value, void* clientData) { b2Vec2 gravity = static_cast<ColorBoxesEngine*>(clientData)->world()->GetGravity(); *static_cast<float*>(value) = atan2f(gravity.y, gravity.x) * 180.0f / M_PI; } static void TW_CALL setGravityDirection(const void* value, void* clientData) { float angle = *static_cast<const float*>(value) * M_PI / 180.0f; b2Vec2 gravity = static_cast<ColorBoxesEngine*>(clientData)->world()->GetGravity(); float strength = gravity.Length(); gravity = b2Vec2(cosf(angle), sinf(angle)); gravity *= strength; static_cast<ColorBoxesEngine*>(clientData)->world()->SetGravity(gravity); } static void TW_CALL resetWorldObjects(void* clientData) { static_cast<ColorBoxesEngine*>(clientData)->resetWorld(); } // Functional delete helpers void deleteDoneShapes(PhysicsEntity*& object) { if (object->done()) { delete object; object = 0; } } template <class T> void deleteAll(T*& object) { delete object; object = 0; } template void deleteAll<Edge>(Edge*&); template void deleteAll<PhysicsEntity>(PhysicsEntity*&); // Static variables const float ColorBoxesEngine::SELECTION_THRESHOLD = 10.0f; const GLColor ColorBoxesEngine::SELECTION_COLOR = GLColor(1.0f, 0.0f, 0.0f, 1.0f); const GLColor ColorBoxesEngine::EDGE_COLOR = GLColor::magenta().lighten(0.75f); ColorBoxesEngine* ColorBoxesEngine::self = NULL; ColorBoxesEngine* ColorBoxesEngine::instance() { return ColorBoxesEngine::self; } ColorBoxesEngine::ColorBoxesEngine(int w, int h, const char* resourcePath) : GameEngine(w, h, resourcePath), state_(NORMAL), currentShape_(TRIANGLE), newEdge_(NULL), selectedEdge_(NULL), renderStats_(false), gravity_(b2Vec2(0, -10.0f)), scaleFactor_(10.0f), yFlip_(-1.0f), textColor_(GLColor::white()), defaultCursor_(defaultCursor()) { // Set the cursor. SDL_SetCursor(defaultCursor_); // Set up Box2D world. bool doSleep = true; world_ = new b2World(gravity_); world_->SetAllowSleeping(doSleep); world_->SetWarmStarting(true); world_->SetContinuousPhysics(true); // Set up SDL TTF. if (TTF_Init() == -1) { std::cerr << "SDL_ttf error: " << TTF_GetError() << std::endl; } std::string fontPath = std::string(resourcePath) + "/Arial.ttf"; font_ = TTF_OpenFont(fontPath.c_str(), 12); if (font_ == NULL) { std::cerr << "SDL_ttf error: " << TTF_GetError() << std::endl; } else { TTF_SetFontStyle(font_, TTF_STYLE_BOLD); } // Set up AntTweakBar configureTweakBar(); ColorBoxesEngine::self = this; } ColorBoxesEngine::~ColorBoxesEngine() { delete world_; SDL_FreeCursor(defaultCursor_); TwTerminate(); TTF_CloseFont(font_); TTF_Quit(); SDL_Quit(); } void ColorBoxesEngine::configureTweakBar() { TwInit(TW_OPENGL, NULL); TwWindowSize(width(), height()); TwBar* tweakBar = TwNewBar("Color Boxes"); TwDefine("GLOBAL help='Adjust Color Boxes parameters and perform commands.'"); TwAddVarCB(tweakBar, "Objects", TW_TYPE_UINT32, NULL, getObjectCount, this, ""); TwAddVarCB(tweakBar, "FPS", TW_TYPE_INT32, NULL, getFps, this, ""); TwAddSeparator(tweakBar, "gravitySeparator", ""); TwAddButton(tweakBar, "Gravity", NULL, NULL, ""); TwAddVarCB(tweakBar, "Strength", TW_TYPE_FLOAT, setGravityStrength, getGravityStrength, this, "min=0 max=100 step=1.0"); TwAddVarCB(tweakBar, "Direction", TW_TYPE_FLOAT, setGravityDirection, getGravityDirection, this, "min=-180 max=180 step=1.0"); TwAddSeparator(tweakBar, "paramSeparator", ""); // TwAddVarRW(tweakBar, "Scale", TW_TYPE_FLOAT, &scaleFactor_, "min=1.0 max=20.0 step=1.0"); TwEnumVal modeEnumValues[] = { {NORMAL, "Normal"}, {CREATE_OBJECT, "Create objects"}, {CREATE_EDGE, "Create wall"}, {DELETE_EDGE, "Delete wall"}, {CREATE_BOMB, "Create bomb"} }; TwType modeType = TwDefineEnum("ModeType", modeEnumValues, NUMBER_STATES); TwAddVarRW(tweakBar, "Mode", modeType, &state_, NULL); TwEnumVal shapeEnumValues[] = { {TRIANGLE, "Triangle"}, {QUADRILATERAL, "Quadrilateral"}, {PENTAGON, "Pentagon"}, {HEXAGON, "Hexagon"}, {HEPTAGON, "Heptagon"}, {OCTAGON, "Octagon"}, {CIRCLE, "Circle"}, {BOX, "Box"} }; TwType shapeType = TwDefineEnum("ShapeType", shapeEnumValues, NUMBER_OBJECT_SHAPES); TwAddVarRW(tweakBar, "Shape", shapeType, &currentShape_, NULL); TwAddButton(tweakBar, "Reset", resetWorldObjects, this, ""); } void ColorBoxesEngine::initializeData() { setTitle("Box Fall"); walls_.push_back(new Wall(0.0f, 1.0f, 5.0f, height() - 20.0f, this)); walls_.push_back(new Wall(width() - 6.0f, 1.0f, 5.0f, height() - 20.0f, this)); walls_.push_back(new Wall(width() / 16.0f, height() - 15.0f, 6.0f * width() / 16.0f, 5.0, this)); walls_.push_back(new Wall(9.0f * width() / 16.0f, height() - 15.0f, 6.0f * width() / 16.0f, 5.0, this)); } void ColorBoxesEngine::update(long elapsedTime) { const int32 velocityIterations = 8; const int32 positionIterations = 2; float32 timeStep = elapsedTime / 1000.0f; int x; int y; SDL_GetMouseState(&x, &y); // Create an object if we are in create mode. if (state_ == CREATE_OBJECT) { PhysicsEntity* object = NULL; switch (currentShape_) { case TRIANGLE: case QUADRILATERAL: case PENTAGON: case HEXAGON: case HEPTAGON: case OCTAGON: object = new Polygon(x, y, currentShape_ + 3, this); break; case CIRCLE: object = new Circle(x, y, this); break; case BOX: object = new Box(x, y, this); break; default: // Do nothing. break; } objects_.push_back(object); } else if (state_ == DELETE_EDGE) { // Calculate the closest edge within a threshold radius. if (selectedEdge_) { selectedEdge_->setColor(EDGE_COLOR); selectedEdge_ = NULL; } b2Vec2 p(x, y); float minDistance = std::numeric_limits<float>::max(); for (int i = 0; i < edges_.size(); ++i) { float distance = pointToEdgeDistance(p, edges_[i]); if (distance < SELECTION_THRESHOLD && distance < minDistance) { minDistance = distance; selectedEdge_ = edges_[i]; } } if (selectedEdge_ != NULL) { selectedEdge_->setColor(SELECTION_COLOR); } } // Update the new edge if we are in edge drawing mode. if (newEdge_ != NULL) { newEdge_->setEndPoint(b2Vec2(x, y)); } // Clear out any objects that are off the screen. for_each(objects_.begin(), objects_.end(), deleteDoneShapes); objects_.erase(std::remove(objects_.begin(), objects_.end(), static_cast<PhysicsEntity*>(0)), objects_.end()); // Update the state of all objects and physics. for_each(objects_.begin(), objects_.end(), std::bind2nd(std::mem_fun(&PhysicsEntity::update), elapsedTime)); world_->Step(timeStep, velocityIterations, positionIterations); } void ColorBoxesEngine::render() { TwDraw(); for_each(walls_.begin(), walls_.end(), std::mem_fun(&Wall::render)); for_each(objects_.begin(), objects_.end(), std::mem_fun(&PhysicsEntity::render)); for_each(edges_.begin(), edges_.end(), std::mem_fun(&Edge::render)); if (newEdge_ != NULL) { newEdge_->render(); } if (renderStats_) { renderStatistics(); } } void ColorBoxesEngine::renderStatistics() { std::ostringstream msg; msg << objects_.size() << " objects, " << fps() << " fps"; renderText(msg.str(), 8.0f, 2.0f); // ogl::drawString(8.0f, 16.0f, msg.str(), textColor_); } void ColorBoxesEngine::renderText(const std::string &text, float x, float y) { // Use SDL_TTF to render the text onto an initial surface. SDL_Surface* textSurface = TTF_RenderText_Blended(font_, text.c_str(), textColor_.toSDLColor()); // Convert the rendered text to a known format. int w = nextPowerOfTwo(textSurface->w); int h = nextPowerOfTwo(textSurface->h); SDL_Surface* intermediary = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCALPHA, w, h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); SDL_SetAlpha(textSurface, 0, 0); SDL_BlitSurface(textSurface, NULL, intermediary, NULL); // Tell GL about our new texture. GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, intermediary->pixels ); // GL_NEAREST looks horrible if scaled. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Prepare to render our texture. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glColor4f(textColor_.r, textColor_.g, textColor_.b, textColor_.a); // Draw a quad at location. glBegin(GL_QUADS); // Recall that the origin is in the lower-left corner. That is why the // TexCoords specify different corners than the Vertex coors seem to. glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); glTexCoord2f(1.0f, 0.0f); glVertex2f(x + w, y); glTexCoord2f(1.0f, 1.0f); glVertex2f(x + w, y + h); glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y + h); glEnd(); // Bad things happen if we delete the texture before it finishes. glFinish(); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); // Clean up. SDL_FreeSurface(intermediary); SDL_FreeSurface(textSurface); glDeleteTextures(1, &texture); } void ColorBoxesEngine::end() { } void ColorBoxesEngine::keyDown(int keyCode) { switch (keyCode) { case SDLK_a: currentShape_ = static_cast<ObjectShape>(static_cast<int>(currentShape_) + 1); if (currentShape_ == NUMBER_OBJECT_SHAPES) { currentShape_ = TRIANGLE; } std::cout << "Current shape: " << currentShape_ << std::endl; break; case SDLK_b: if (state_ == NORMAL) { state_ = CREATE_BOMB; } break; case SDLK_c: if (backgroundColor() == GLColor::black()) { setBackgroundColor(GLColor::white()); textColor_ = GLColor::black(); } else { setBackgroundColor(GLColor::black()); textColor_ = GLColor::white(); } break; case SDLK_d: if (state_ == NORMAL) { selectedEdge_ = NULL; state_ = DELETE_EDGE; } break; case SDLK_e: if (state_ == NORMAL) { state_ = CREATE_EDGE; selectedEdge_ = NULL; } break; case SDLK_r: // Reset the world: clear boxes and edges. resetWorld(); break; case SDLK_s: renderStats_ = !renderStats_; break; case SDLK_SPACE: if (newEdge_ != NULL) { delete newEdge_; newEdge_ = NULL; } if (selectedEdge_ != NULL) { selectedEdge_->setColor(EDGE_COLOR); selectedEdge_ = NULL; } state_ = NORMAL; break; default: // Do nothing. break; } } //void //ColorBoxesEngine::keyUp(int keyCode) //{ // //} void ColorBoxesEngine::mouseButtonDown(int button, int x, int y, int dx, int dy) { if (button == SDL_BUTTON_LEFT) { switch (state_) { case NORMAL: state_ = CREATE_OBJECT; break; case CREATE_EDGE: if (newEdge_ == NULL) { // Turn on draw edge mode and record the starting point. b2Vec2 pt(x, y); newEdge_ = new Edge(pt, pt, GLColor::cyan(), this); } else { // End draw edge mode and finalize the edge. b2Vec2 endPt(x, y); newEdge_->setEndPoint(endPt); newEdge_->setColor(EDGE_COLOR); edges_.push_back(newEdge_); newEdge_ = NULL; state_ = NORMAL; } break; case DELETE_EDGE: delete selectedEdge_; edges_.erase(remove(edges_.begin(), edges_.end(), selectedEdge_), edges_.end()); selectedEdge_ = NULL; state_ = NORMAL; break; case CREATE_BOMB: objects_.push_back(new Bomb(x, y, 20.0f, 1000.0f, 3.0f, this)); state_ = NORMAL; break; default: // Don't do anything. break; } } } void ColorBoxesEngine::mouseButtonUp(int button, int x, int y, int dx, int dy) { if (state_ == CREATE_OBJECT && button == SDL_BUTTON_LEFT) { state_ = NORMAL; } } unsigned long ColorBoxesEngine::objectCount() const { return objects_.size(); } b2World* ColorBoxesEngine::world() { return world_; } void ColorBoxesEngine::resetWorld() { for_each(objects_.begin(), objects_.end(), deleteAll<PhysicsEntity>); objects_.erase(std::remove(objects_.begin(), objects_.end(), static_cast<PhysicsEntity*>(0)), objects_.end()); for_each(edges_.begin(), edges_.end(), deleteAll<Edge>); edges_.erase(std::remove(edges_.begin(), edges_.end(), static_cast<Edge*>(0)), edges_.end()); } b2Vec2 ColorBoxesEngine::coordWorldToPixels(float worldX, float worldY) { float pixelX = worldX * scaleFactor_; float pixelY = worldY * scaleFactor_; if (yFlip_ == -1.0f) { pixelY = map(pixelY, 0.0f, static_cast<float>(height()), static_cast<float>(height()), 0.0f); } return b2Vec2(pixelX, pixelY); } b2Vec2 ColorBoxesEngine::coordWorldToPixels(const b2Vec2& v) { return coordWorldToPixels(v.x, v.y); } b2Vec2 ColorBoxesEngine::coordPixelsToWorld(float pixelX, float pixelY) { float worldX = pixelX / scaleFactor_; float worldY = pixelY; if (yFlip_ == -1.0f) { worldY = map(pixelY, static_cast<float>(height()), 0.0f, 0.0f, static_cast<float>(height())); } worldY /= scaleFactor_; return b2Vec2(worldX, worldY); } b2Vec2 ColorBoxesEngine::coordPixelsToWorld(const b2Vec2& v) { return coordPixelsToWorld(v.x, v.y); } float ColorBoxesEngine::scalarWorldToPixels(float val) { return val * scaleFactor_; } float ColorBoxesEngine::scalarPixelsToWorld(float val) { return val / scaleFactor_; } float ColorBoxesEngine::scaleFactor() const { return scaleFactor_; } TTF_Font* ColorBoxesEngine::font() const { return font_; }
69436fd2bf4b3569840b22dfdaadf929ecb21ced
a9ace49a2e2aac04415b273a79293c018faf3898
/C++_project_001/BM_Project_by_A_P_J/WrinklePizza.h
c857a4278c5b0ce94aa9705d89f47a6443e950e2
[]
no_license
ggznzn007/Cpp_Lecture
b7d0bd038cbe247ffdcae87c517df3b3740d5f29
b99017430d2c22b45b1e8d208569b513f52f5f05
refs/heads/master
2023-01-03T17:34:48.758900
2020-10-29T07:16:03
2020-10-29T07:16:03
308,246,879
1
0
null
null
null
null
UTF-8
C++
false
false
175
h
WrinklePizza.h
#pragma once #include "Pizza.h" class WrinklePizza : public Pizza { public: WrinklePizza(); virtual void showWelcom(); virtual void cooking(); virtual void delivery(); };
c097fa78bc084fa9941210e23d0e88f77eecdc59
31452b8ff42ce7fdf57cff82ac1a5b7d67df4987
/PCAssistant/PCAssistant/ProcessDlg.cpp
b5c3d6be419ce892bd60de74ff0f3c416c2e1df5
[]
no_license
wgwjifeng/PCAssistant
a3b5477b7bb954fa369389a1ed244cf2bee9ba0f
78da06224173ad1184e60d4b6fd4786ed4a77938
refs/heads/master
2020-04-06T18:40:59.657942
2017-03-08T05:00:40
2017-03-08T05:00:40
null
0
0
null
null
null
null
GB18030
C++
false
false
12,098
cpp
ProcessDlg.cpp
// ProcessDlg.cpp : 实现文件 // #include "stdafx.h" #include "PCAssistant.h" #include "ProcessDlg.h" #include "afxdialogex.h" #include "ProcessFunc.h" #include "Common.h" #include "ProcessViewDlg.h" // CProcessDlg 对话框 int ResizeX; int ResizeY; IMPLEMENT_DYNAMIC(CProcessDlg, CDialogEx) extern BOOL bIsChecking; extern CWnd* g_wParent; CWnd* g_process = NULL; COLUMN_STRUCT g_Column_Process[] = { { L"映像名称", 160 }, { L"进程ID", 65 }, { L"父进程ID", 65 }, { L"映像路径", 230 }, { L"EPROCESS", 125 }, { L"应用层访问", 75 }, { L"文件厂商", 122 } }; UINT g_Column_Process_Count = 7; //进程列表列数 CProcessDlg::CProcessDlg(CWnd* pParent /*=NULL*/) : CDialogEx(IDD_DIALOG_PROCESS, pParent) { } CProcessDlg::~CProcessDlg() { } void CProcessDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST_PROCESS, m_ListCtrl); } BEGIN_MESSAGE_MAP(CProcessDlg, CDialogEx) ON_WM_SHOWWINDOW() ON_MESSAGE(PROCESSDIG_SEND_INSERT, ProcessDlgSendInsert) ON_COMMAND(ID_MENU_PROCESS_FILELOCATION, &CProcessDlg::OnMenuProcessFilelocation) ON_NOTIFY(NM_RCLICK, IDC_LIST_PROCESS, &CProcessDlg::OnNMRClickListProcess) ON_COMMAND(ID_MENU_PROCESS_REFRESH, &CProcessDlg::OnMenuProcessRefresh) ON_COMMAND(ID_MENU_PROCESS_KILL, &CProcessDlg::OnMenuProcessKill) ON_COMMAND(ID_MENU_PROCESS_KILLMUST, &CProcessDlg::OnMenuProcessKillmust) ON_COMMAND(ID_MENU_PROCESS_COPYINFO, &CProcessDlg::OnMenuProcessCopyinfo) ON_COMMAND(ID_MENU_NEW_RUN, &CProcessDlg::OnMenuNewRun) ON_COMMAND(ID_MENU_PROCESS_ATTRIBUTE, &CProcessDlg::OnMenuProcessAttribute) ON_COMMAND(ID_MENU_PROCESS_DETAIL, &CProcessDlg::OnMenuProcessDetail) ON_COMMAND(ID_MENU_PROCESS_THREAD, &CProcessDlg::OnMenuProcessThread) ON_COMMAND(ID_MENU_PROCESS_PRIVILEGE, &CProcessDlg::OnMenuProcessPrivilege) ON_COMMAND(ID_MENU_PROCESS_HANDLE, &CProcessDlg::OnMenuProcessHandle) ON_COMMAND(ID_MENU_PROCESS_WINDOW, &CProcessDlg::OnMenuProcessWindow) ON_COMMAND(ID_MENU_PROCESS_MODULE, &CProcessDlg::OnMenuProcessModule) ON_COMMAND(ID_MENU_PROCESS_MEMORY, &CProcessDlg::OnMenuProcessMemory) ON_WM_SIZE() END_MESSAGE_MAP() // CProcessDlg 消息处理程序 BOOL CProcessDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 g_process = this; InitList(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } VOID CProcessDlg::InitList() { CRect Rect; this->GetClientRect(&Rect); m_ListCtrl.MoveWindow(Rect); m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP); UINT i; for (i = 0; i<g_Column_Process_Count; i++) { m_ListCtrl.InsertColumn(i, g_Column_Process[i].szTitle, LVCFMT_LEFT, g_Column_Process[i].nWidth); } } void CProcessDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CDialogEx::OnShowWindow(bShow, nStatus); if (bShow == TRUE) { m_ListCtrl.MoveWindow(0, 0, ResizeX, ResizeY); LoadProcessList(); SendStatusTip(L"进程"); } } VOID CProcessDlg::LoadProcessList() { if (bIsChecking == FALSE) { bIsChecking = TRUE; m_ListCtrl.DeleteAllItems(); m_ListCtrl.SetSelectedColumn(-1); SendStatusDetail(L"进程列表正在加载。"); CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)QueryProcessFunction, this, 0, NULL); } } LRESULT CProcessDlg::ProcessDlgSendInsert(WPARAM wParam, LPARAM lParam) { PPROCESSINFO* hsProcItem = (PPROCESSINFO*)lParam; CString Name = NULL; CString Pid = NULL; CString PPid = NULL; CString Path = NULL; CString EProcess = NULL; CString UserAccess = NULL; CString CompanyName = NULL; ULONG ulItem = m_ListCtrl.GetItemCount(); WCHAR tempdir[100]; GetEnvironmentVariableW(L"windir", tempdir, 100); Name = (*hsProcItem)->Name; Pid.Format(L"%d", (*hsProcItem)->Pid); if ((*hsProcItem)->PPid == 0xffffffff) { PPid = L"-"; } else { PPid.Format(L"%d", (*hsProcItem)->PPid); } Path = (*hsProcItem)->Path; EProcess.Format(L"0x%p", (*hsProcItem)->Eprocess); if ((*hsProcItem)->UserAccess == TRUE) { UserAccess = L"允许"; } else { UserAccess = L"拒绝"; } CompanyName = (*hsProcItem)->CompanyName; //AddProcessFileIcon(Path.GetBuffer()); m_ListCtrl.InsertItem(ulItem, Name, ulItem); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_PID, Pid); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_PPID, PPid); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_PATH, Path); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_EPROCESS, EProcess); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_USERACCESS, UserAccess); m_ListCtrl.SetItemText(ulItem, PROCESS_COLUMN_COMPANY, CompanyName); /* CToolTipCtrl ToolTipCtrl; ToolTipCtrl.Create(this); m_ListCtrl.SetToolTips(&ToolTipCtrl); */ return TRUE; } void CProcessDlg::OnMenuProcessFilelocation() { POSITION pos = m_ListCtrl.GetFirstSelectedItemPosition(); while (pos) { int iItem = m_ListCtrl.GetNextSelectedItem(pos); CString csFilePath = m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_PATH); LocationExplorer(csFilePath); } } void CProcessDlg::OnNMRClickListProcess(NMHDR *pNMHDR, LRESULT *pResult) { LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); // TODO: 在此添加控件通知处理程序代码 CMenu popup; popup.LoadMenu(IDR_MENU_PROCESS); //加载菜单资源 CMenu* pM = popup.GetSubMenu(0); //获得菜单的子项 CPoint p; GetCursorPos(&p); int count = pM->GetMenuItemCount(); if (m_ListCtrl.GetSelectedCount() == 0) //如果没有选中 { for (int i = 0; i<count; i++) { pM->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰 } pM->EnableMenuItem(ID_MENU_PROCESS_REFRESH, MF_BYCOMMAND | MF_ENABLED); } //pM->SetDefaultItem(ID_MENU_PROCESS_DETAIL, FALSE); pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this); *pResult = 0; } void CProcessDlg::OnMenuProcessRefresh() { LoadProcessList(); } void CProcessDlg::OnMenuProcessKill() { BOOL bIsOK = MessageBox(L"确定要结束该进程吗?", L"天影卫士", MB_YESNO); if (bIsOK == IDYES) { POSITION pos = m_ListCtrl.GetFirstSelectedItemPosition(); while (pos) { int nItem = m_ListCtrl.GetNextSelectedItem(pos); DWORD_PTR ulPid = _ttoi(m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_PID).GetBuffer()); if (ulPid == 0 || ulPid == 4) { MessageBox(L"进程关闭失败。", L"天影卫士", 0); return; } DebugPrivilege(SE_DEBUG_NAME, TRUE); HANDLE hProcess = OpenProcess(PROCESS_TERMINATE | PROCESS_VM_OPERATION, TRUE, (DWORD)ulPid); BOOL bIsSuccess = TerminateProcess(hProcess, 0); DebugPrivilege(SE_DEBUG_NAME, FALSE); if (bIsSuccess == FALSE) { MessageBox(L"关闭进程失败。", L"天影卫士", 0); } else { m_ListCtrl.DeleteItem(nItem); } CloseHandle(hProcess); } } } void CProcessDlg::OnMenuProcessKillmust() { if (bIsChecking) { return; } if (MessageBox(L"强制关闭进程的操作有风险,请谨慎操作。\r\n确定要结束该进程吗?", L"PCAssistant", MB_YESNO) == IDNO) { return; } // CreateThread(NULL,0, // (LPTHREAD_START_ROUTINE)HsKillProcessByForce,(CMyList*)&m_ProcessList, 0,NULL); bIsChecking = TRUE; KillProcessByForce((CListCtrl*)&m_ListCtrl); bIsChecking = FALSE; } void CProcessDlg::OnMenuProcessCopyinfo() { POSITION pos = m_ListCtrl.GetFirstSelectedItemPosition(); while (pos) { int iItem = m_ListCtrl.GetNextSelectedItem(pos); CStringA(csProcInfo); csProcInfo = "映像名称: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_NAME); csProcInfo += " 进程ID: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_PID); csProcInfo += " 父进程ID: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_PPID); csProcInfo += " 映像路径: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_PATH); csProcInfo += " EPROCESS: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_EPROCESS); csProcInfo += " 应用层访问: "; csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_USERACCESS); csProcInfo += " 文件厂商: "; if (m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_COMPANY).GetLength()>0) { csProcInfo += m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_COMPANY); } if (::OpenClipboard(NULL)) { HGLOBAL hmem = GlobalAlloc(GHND, csProcInfo.GetLength() + 1); char *pmem = (char*)GlobalLock(hmem); EmptyClipboard(); memcpy(pmem, csProcInfo.GetBuffer(), csProcInfo.GetLength() + 1); SetClipboardData(CF_TEXT, hmem); CloseClipboard(); GlobalFree(hmem); } } } void CProcessDlg::OnMenuNewRun() { WCHAR wzFileFilter[] = L"应用程序 (*.exe)\0*.exe\0"; WCHAR wzFileChoose[] = L"打开文件"; CFileDialog FileDlg(TRUE); FileDlg.m_ofn.lpstrTitle = wzFileChoose; FileDlg.m_ofn.lpstrFilter = wzFileFilter; if (IDOK != FileDlg.DoModal()) { return; } CString ExePath = FileDlg.GetPathName(); ShellExecuteW(NULL, L"open", ExePath, L"", L"", SW_SHOW); } void CProcessDlg::OnMenuProcessAttribute() { POSITION pos = m_ListCtrl.GetFirstSelectedItemPosition(); while (pos) { int iItem = m_ListCtrl.GetNextSelectedItem(pos); CString csFilePath = m_ListCtrl.GetItemText(iItem, PROCESS_COLUMN_PATH); CheckAttribute(csFilePath); } } void CProcessDlg::OnMenuProcessDetail() { OpenProcessViewDlg(PROCVIEW_TYPE_DETAIL); } void CProcessDlg::OnMenuProcessThread() { OpenProcessViewDlg(PROCVIEW_TYPE_THREAD); } void CProcessDlg::OnMenuProcessPrivilege() { OpenProcessViewDlg(PROCVIEW_TYPE_PRIVILEGE); } void CProcessDlg::OnMenuProcessHandle() { OpenProcessViewDlg(PROCVIEW_TYPE_HANDLE); } void CProcessDlg::OnMenuProcessWindow() { OpenProcessViewDlg(PROCVIEW_TYPE_HANDLE); } void CProcessDlg::OnMenuProcessModule() { OpenProcessViewDlg(PROCVIEW_TYPE_MODULE); } void CProcessDlg::OnMenuProcessMemory() { OpenProcessViewDlg(PROCVIEW_TYPE_MEMORY); } void CProcessDlg::OpenProcessViewDlg(int nViewType) { POSITION pos = m_ListCtrl.GetFirstSelectedItemPosition(); while (pos) { int nItem = m_ListCtrl.GetNextSelectedItem(pos); ULONG_PTR ulPid = _ttoi(m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_PID).GetBuffer()); ULONG_PTR ulPPid = _ttoi(m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_PPID).GetBuffer()); CString ProcessEProcess = m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_EPROCESS); ProcessEProcess = ProcessEProcess.GetBuffer() + 2; ULONG_PTR ulEProcess = 0; //MessageBox(ProcessEProcess, NULL, 0); //swscanf_s(ProcessEProcess.GetBuffer(), L"%P", &ulEProcess); PROCESSINFO hsProcInfo = { 0 }; hsProcInfo.Pid = ulPid; hsProcInfo.PPid = ulPPid; hsProcInfo.Eprocess = ulEProcess; if (_wcsnicmp(m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_COMPANY).GetBuffer(), L"拒绝", wcslen(L"拒绝")) == 0) { hsProcInfo.UserAccess = FALSE; } else { hsProcInfo.UserAccess = TRUE; } StringCchCopyW(hsProcInfo.CompanyName, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_COMPANY).GetLength() + 1, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_COMPANY).GetBuffer()); StringCchCopyW(hsProcInfo.Name, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_NAME).GetLength() + 1, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_NAME).GetBuffer()); StringCchCopyW(hsProcInfo.Path, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_PATH).GetLength() + 1, m_ListCtrl.GetItemText(nItem, PROCESS_COLUMN_PATH).GetBuffer()); CProcessViewDlg* dlg = new CProcessViewDlg(nViewType, &hsProcInfo, this); dlg->DoModal(); } } void CProcessDlg::OnSize(UINT nType, int cx, int cy) { CDialogEx::OnSize(nType, cx, cy); ResizeX = cx; ResizeY = cy; }
c9b2691ef4f103c582f65d79fad345a1e697aaa5
65deabfadbc675929f17e280156597f92cf2480d
/laughing-pancake/Classes/Charactor.h
7e541dd1d51a87c3298459881bfb2e067d54a344
[ "MIT" ]
permissive
Frogp/laughing-pancake
ab4121bd3ce59d96ebbb81d62d4b040ed3838938
bf102cf2ddfdfbdf1e9e7b5af586882924ca4213
refs/heads/master
2021-05-04T02:41:05.858104
2016-07-21T17:52:22
2016-07-21T17:52:22
55,394,402
0
0
null
null
null
null
UTF-8
C++
false
false
375
h
Charactor.h
#ifndef __CHARACTOR_H__ #define __CHARACTOR_H__ #include "cocos2d.h" #include "cocostudio/CocoStudio.h" #include "ui/CocosGUI.h" USING_NS_CC; using namespace cocos2d; using namespace ui; class Charactor { public: Charactor(); ~Charactor(); int attack; int defence; int move; int hp; int CharNum; int type; int ArdaID; private: }; #endif // __CHARACTOR_H__
da65cae898ce360d4554fe9409f9d5a6c04c7571
3c7189febcb2b9e0778b44c38b3d3c3793dc052b
/resources/resource_list.hpp
75d458c5a984ada9e88447a9352f0e256bd64937
[ "BSD-3-Clause" ]
permissive
hyper1423/SomeFPS
f706d82280f84d574835b23c78dea7c79181fecc
dcd353124d58e2696be7eaf44cddec17d6259629
refs/heads/master
2021-05-20T02:38:34.724076
2020-09-23T12:48:08
2020-09-23T12:48:08
252,150,828
0
0
null
null
null
null
UTF-8
C++
false
false
1,077
hpp
resource_list.hpp
#ifndef RESOURCES_LIST_HPP #define RESOURCES_LIST_HPP #include "../renderer/vertex_array/vertex_array.hpp" #include "../renderer/model/model.hpp" #include <glm/glm.hpp> #include <string> #include <vector> namespace resourceTypes { class Resource { public: virtual ~Resource() = default; std::string getPath(); private: const std::string path; }; // std::string wrapper for resource loader class ResourceString: public Resource { public: ResourceString() = default; ResourceString(const std::string& str); std::string& get(); private: std::string string; }; class ResourceModel: public Resource { public: ResourceModel() = default; ResourceModel(const Model& model); Model& get(); private: Model model; }; class Image2D: public Resource { public: std::vector<std::vector<glm::vec4>>& data(); glm::vec4& pixelAt(glm::uvec2 pos); glm::uvec2 getSize(); operator std::vector<std::vector<glm::vec4>>(); std::vector<glm::vec4>& operator[](unsigned int index); private: std::vector<std::vector<glm::vec4>> imageData; glm::uvec2 imageSize; }; } #endif
d06d4af2ca90e2b159797b1edd5e5917285fb0d8
23deb6fab3c77325811d20f40d3e103005e25a85
/include/typedefs.h
8ceebff11d7a4c94798a9050ebcace987ef310ba
[]
no_license
DigiArt-project/3D-DPM
d4788fdf87ff20e03cce293d5009d84431db0fa9
3383776b28206832157926ba6928fcf048f923ed
refs/heads/master
2020-04-08T23:33:57.717726
2018-11-30T13:56:35
2018-11-30T13:56:35
159,808,129
0
0
null
null
null
null
UTF-8
C++
false
false
2,826
h
typedefs.h
#ifndef typedefs_h #define typedefs_h using namespace std; /* Define some custom types to make the rest of our code easier to read */ typedef pcl::ReferenceFrame RFType; typedef pcl::PointCloud<RFType> PointCloudRF; typedef pcl::PointCloud<RFType>::Ptr PointCloudRFPtr; // Define "PointCloud" to be a pcl::PointCloud of pcl::PointXYZRGB points typedef pcl::PointXYZRGB PointType; typedef pcl::PointXYZRGBNormal PointAll; typedef pcl::PointCloud<PointType> PointCloudT; typedef pcl::PointCloud<PointAll> PointCloudA; typedef pcl::PointCloud<PointType>::Ptr PointCloudPtr; typedef pcl::PointCloud<PointAll>::Ptr PointCloudAPtr; typedef pcl::PointCloud<PointType>::ConstPtr PointCloudConstPtr; //Vector of point cloud typedef std::vector<PointCloudPtr> cloudVectorT; // Define "SurfaceNormals" to be a pcl::PointCloud of pcl::Normal points typedef pcl::Normal NormalType; typedef pcl::PointCloud<NormalType> SurfaceNormals; typedef pcl::PointCloud<NormalType>::Ptr SurfaceNormalsPtr; typedef pcl::PointCloud<NormalType>::ConstPtr SurfaceNormalsConstPtr; // Define "Descriptors" to be a pcl::PointCloud of SHOT points. Can change //typedef pcl::SHOT352 LocalDescriptor; typedef pcl::SHOT352 DescriptorType; typedef pcl::PointCloud<DescriptorType> Descriptors; typedef pcl::PointCloud<DescriptorType>::Ptr DescriptorsPtr; typedef pcl::PointCloud<DescriptorType>::ConstPtr DescriptorsConstPtr; struct PointTypeIsInferior{ bool operator()( const PointType& pl, const PointType& pr) const{ return pl.x < pr.x || ( pl.x == pr.x && pl.y < pr.y) || ( pl.x == pr.x && pl.y == pr.y && pl.z < pr.z); } }; static bool pointTypeIsEqual( PointType pl, PointType pr, float epsilon = 0.01){ return abs( pl.x - pr.x) < epsilon && abs( pl.y - pr.y) < epsilon && abs( pl.z - pr.z) < epsilon; } //namespace FFLD //{ // //Read point cloud from a path // static int readPointCloud(std::string object_path, PointCloudPtr point_cloud){ // std::string extension = boost::filesystem::extension(object_path); // if (extension == ".pcd" || extension == ".PCD") // { // if (pcl::io::loadPCDFile(object_path.c_str() , *point_cloud) == -1) // { // std::cout << "\n Cloud reading failed." << std::endl; // return (-1); // } // } // else if (extension == ".ply" || extension == ".PLY") // { // if (pcl::io::loadPLYFile(object_path.c_str() , *point_cloud) == -1) // { // std::cout << "\n Cloud reading failed." << std::endl; // return (-1); // } // } // else // { // std::cout << "\n file extension is not correct." << std::endl; // return -1; // } // return 1; // } //} #endif /* typedefs_h */
a390c3a68622bff7b4b87d96e68df9a9d0a8eb9a
b98e52550f838e5b0051ab1513cc725b973070af
/NRF24L01_Receiver_Test_Joystick_and_T200_IncludedV3.ino
494699f9ea619de631dbd6529732c2cc7de097f0
[ "Apache-2.0" ]
permissive
Project-Pisces/Rover_Controls
8d036dac6d37bb8c1816d0d322b0abffbd3cdbca
61f6870c1d0bd79a917bcd2de221e03c68c45ce3
refs/heads/master
2020-05-03T00:07:14.420562
2019-05-12T02:49:40
2019-05-12T02:49:40
178,301,145
0
0
null
null
null
null
UTF-8
C++
false
false
13,494
ino
NRF24L01_Receiver_Test_Joystick_and_T200_IncludedV3.ino
#include <Servo.h> #include <SPI.h> #include <RF24.h> #include <nRF24L01.h> //READ REFERENCE PAGE ATTACHED TO GOOGLE DRIVE FOR UROV3 AND MOTOR CONTROL INSTRUCTIONS AND CODE DETAILS //Motor Setup byte Thruster1 = 3; //Front Right Thruster byte Thruster2 = 4; //Front Left Thruster byte Thruster3 = 5; //Back Right Thruster byte Thruster4 = 6; //Back Left Thruster Servo Front_Right_Thruster; Servo Front_Left_Thruster; Servo Back_Right_Thruster; Servo Back_Left_Thruster; int max_thrust_signal = 1600; //Signal for ESC for maximum forward thrust NOTE:MAX SIGNAL = 1900, MIN = 1100 int min_thrust_signal = 1400; //Signal for ESC for maximum reverse thrust int stop_thrust_signal = 1500; //Signal for ESC to stop the thrusters //Variables to store various signals for each thruster. int FRT_Signal; //Front Right Thruster Signal int FLT_Signal; //Front Left Thruster Signal int BRT_Signal; //Back Right Thruster Signal int BLT_Signal; //Back Left Thruster Signal //Radio Frequency Receiver Initialization Setup float Input_ReceivedMessage[6] = {000}; //Used to store value received by NRF24L01 for X and Y input, Element 0 = X Input, Element 1 = Y Input float Output_SentMessage[2] = {000}; //Used to send water sensor data back to transmitter/controller RF24 radio(7,8); //Setup of the RF24 radio on SPI pin 9 and 10 on the Arduino Uno const byte addresses[][6] = {"00001","00002"}; //Radio Channel that is used for communicating the 2 NRF24L01 Transmitter and Receiver //Variable Initialization int Yaverage; //Y position from analog stick input int Xaverage; //X position from analog stick input int Current_Angle; //Angle used to determine which movement control should be used. int X_Signal; //ESC Signal from average X joystick value int Y_Signal; //ESC Signal from average Y joystick value ////Movement Intervals used for controlling the 8 different actions and motions of the ROV. REFERENCED ON REFERENCE PAGE. //The Angles are used to figure out the X and Y positional values for each specific direction movement regions. int AngleBound1 = 23; int AngleBound2 = 68; int AngleBound3 = 113; int AngleBound4 = 158; int AngleBound5 = -157; int AngleBound6 = -112; int AngleBound7 = -67; int AngleBound8 = -22; int Mid_Point_Angle = 180; // Water Sensor Initialization and Setup int H2O_Sensor = A0; // the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: //pinMode(led, OUTPUT); Serial.begin(19200); //H20 Sensor Setup pinMode(H2O_Sensor,INPUT); //Attaching Various Servos to Pin Signal Assignments Front_Right_Thruster.attach(Thruster1); Front_Left_Thruster.attach(Thruster2); Back_Right_Thruster.attach(Thruster3); Back_Left_Thruster.attach(Thruster4); //Set all motor speeds to zero during start up Front_Right_Thruster.writeMicroseconds(stop_thrust_signal); Front_Left_Thruster.writeMicroseconds(stop_thrust_signal); Back_Right_Thruster.writeMicroseconds(stop_thrust_signal); Back_Left_Thruster.writeMicroseconds(stop_thrust_signal); delay(7000); //Delay Required to allow the ESC to recognize the stop signal //Radio Setup radio.begin(); // Start up the NRF24L01 radio.openWritingPipe(addresses[0]); // 00002 Allows NRF24L01 to send data via Pipe 2 radio.openReadingPipe(1, addresses[1]); // 00001 Allows the NRF24L01 ready to receive data via Pipe 1 radio.setPALevel(RF24_PA_MIN); // Lowest Possible Power Level,for low power consumption radio.setDataRate(RF24_1MBPS); //Set to the middle transmission speed radio.setChannel(124); //Sets RF Channel pick one that is not similar to Wi-Fi and Microwave Ovens //radio.startListening(); // Start the NRF24L01 to begin listening for any data being transmitted from the Transmitting NRF24L01 } // the loop routine runs over and over again forever: void loop() { radio.startListening(); //Start the NRF24L01 to listen for any data from the transmitter radio.read(&Input_ReceivedMessage,sizeof(Input_ReceivedMessage)); // "&" sign takes in the all of the data being transferred, sizeof makes sure to capture the whole data and not just specific parts Xaverage = Input_ReceivedMessage[0]; //Assigns input received value as the x position which should relay from transmitter code. Yaverage = Input_ReceivedMessage[1]; //Assigns input received value as the y position which should relay from transmitter code. Current_Angle = Input_ReceivedMessage[2]; //Assigns input received value as the y position which should relay from transmitter code. X_Signal = Input_ReceivedMessage[3]; //Assigns input received value as the y position which should relay from transmitter code. Y_Signal = Input_ReceivedMessage[4]; //Assigns input received value as the y position which should relay from transmitter code. X_Signal = Limit_Motor_Signal(X_Signal); Y_Signal = Limit_Motor_Signal(Y_Signal); // int x_signal = map(x_pos, 0, 1023,min_thrust_signal,max_thrust_signal); //Maps the value of the analog signal to the correct ESC desired powered Signal for the X-direction // int y_signal = map(y_pos, 0, 1023,min_thrust_signal,max_thrust_signal); //Maps the value of the analog signal to the correct ESC desired powered Signal for the Y-direction // Limit_Motor_Signal(x_signal); //Limits the motor signals to make sure that the ESC doesn't run the motor at an unexpected PWM rate // Limit_Motor_Signal(y_signal); if(Current_Angle > AngleBound8 && Current_Angle <=AngleBound1 && Xaverage > 250){ // Clockwise (CW) Movement Quadrant, Joystick is moved to the right // Front_Right_Thruster.writeMicroseconds(map(X_Signal,min_thrust_signal,max_thrust_signal,max_thrust_signal,min_thrust_signal));//Needs to go opposite direction at same magnitude // Front_Left_Thruster.writeMicroseconds(X_Signal); // Back_Right_Thruster.writeMicroseconds(map(X_Signal,min_thrust_signal,max_thrust_signal,max_thrust_signal,min_thrust_signal));//Needs to go opposite direction at same magnitude // Back_Left_Thruster.writeMicroseconds(X_Signal); //Map Function Used to Flip the signal for thruster to "push" in the opposite direction int FRT_Signal = min_thrust_signal; //Front Right Thruster Signal int FLT_Signal = max_thrust_signal; //Front Left Thruster Signal int BRT_Signal = min_thrust_signal; //Back Right Thruster Signal int BLT_Signal = max_thrust_signal; //Back Left Thruster Signal Serial.println("Moving Right"); Serial.println(BLT_Signal); Front_Right_Thruster.writeMicroseconds(FRT_Signal); Front_Left_Thruster.writeMicroseconds(FLT_Signal); Back_Right_Thruster.writeMicroseconds(BLT_Signal); Back_Left_Thruster.writeMicroseconds(BRT_Signal); } //// else if(Current_Angle > AngleBound1 && Current_Angle <=AngleBound2){ // Drift Right (DR) Movement Quadrant (CURRENTLY NOT USED) //// //TBD //// } else if(Current_Angle > AngleBound2 && Current_Angle <=AngleBound3 && Yaverage > 250){ // Forward (FW) Movement Quadrant // Front_Right_Thruster.writeMicroseconds(Y_Signal); // Front_Left_Thruster.writeMicroseconds(Y_Signal); // Back_Right_Thruster.writeMicroseconds(Y_Signal); // Back_Left_Thruster.writeMicroseconds(Y_Signal); int FRT_Signal = max_thrust_signal; //Front Right Thruster Signal int FLT_Signal = max_thrust_signal; //Front Left Thruster Signal int BRT_Signal = max_thrust_signal; //Back Right Thruster Signal int BLT_Signal = max_thrust_signal; //Back Left Thruster Signal Serial.println("Moving Forward"); Serial.println(BLT_Signal); Front_Right_Thruster.writeMicroseconds(FRT_Signal); Front_Left_Thruster.writeMicroseconds(FLT_Signal); Back_Right_Thruster.writeMicroseconds(BLT_Signal); Back_Left_Thruster.writeMicroseconds(BRT_Signal); } //// else if(Current_Angle > AngleBound3 && Current_Angle <=AngleBound4){ // Drift Left (DL) Movement Quadrant (CURRENTLY NOT USED) //// //TBD //// } else if((Current_Angle > AngleBound4 && Current_Angle <= Mid_Point_Angle && Xaverage < -250) ){ // Counter-Clockwise (CCW) Movement Quadrant // Front_Right_Thruster.writeMicroseconds(map(X_Signal,min_thrust_signal,max_thrust_signal,max_thrust_signal,min_thrust_signal));//Needs to go opposite direction at same magnitude // Front_Left_Thruster.writeMicroseconds(X_Signal); // Back_Right_Thruster.writeMicroseconds(map(X_Signal,min_thrust_signal,max_thrust_signal,max_thrust_signal,min_thrust_signal));//Needs to go opposite direction at same magnitude // Back_Left_Thruster.writeMicroseconds(X_Signal); //Map Function Used to Flip the signal for thruster to "push" in the opposite direction int FRT_Signal = max_thrust_signal; //Front Right Thruster Signal int FLT_Signal = min_thrust_signal; //Front Left Thruster Signal int BRT_Signal = max_thrust_signal; //Back Right Thruster Signal int BLT_Signal = min_thrust_signal; //Back Left Thruster Signal Serial.println("Moving Left"); Serial.println(BLT_Signal); Front_Right_Thruster.writeMicroseconds(FRT_Signal); Front_Left_Thruster.writeMicroseconds(FLT_Signal); Back_Right_Thruster.writeMicroseconds(BLT_Signal); Back_Left_Thruster.writeMicroseconds(BRT_Signal); } //// else if(Current_Angle > AngleBound5 && Current_Angle <=AngleBound6){ // Drift Backwards Left (DBL) Movement Quadrant (CURRENTLY NOT USED) //// //TBD //// } else if(Current_Angle > AngleBound6 && Current_Angle <=AngleBound7 && Yaverage < -250){ // Backwards (BW) Movement Quadrant // Front_Right_Thruster.writeMicroseconds(Y_Signal); // Front_Left_Thruster.writeMicroseconds(Y_Signal); // Back_Right_Thruster.writeMicroseconds(Y_Signal); // Back_Left_Thruster.writeMicroseconds(Y_Signal); int FRT_Signal = min_thrust_signal; //Front Right Thruster Signal int FLT_Signal = min_thrust_signal; //Front Left Thruster Signal int BRT_Signal = min_thrust_signal; //Back Right Thruster Signal int BLT_Signal = min_thrust_signal; //Back Left Thruster Signal Serial.println("Moving Backwards"); Serial.println(BLT_Signal); Front_Right_Thruster.writeMicroseconds(FRT_Signal); Front_Left_Thruster.writeMicroseconds(FLT_Signal); Back_Right_Thruster.writeMicroseconds(BLT_Signal); Back_Left_Thruster.writeMicroseconds(BRT_Signal); } //// else if(Current_Angle > AngleBound7 && Current_Angle <=AngleBound8){ // Drift Backwards Right (DBR) Movement Quadrant (CURRENTLY NOT USED) //// //TBD //// } // //// Serial.println("The X Position is "); //// Serial.println(Input_ReceivedMessage[4]); //// Serial.println("The Y Position is"); // Serial.println(BLT_Signal); // else //if none of the actions above are being used the tell the thrusters that they should not be moving. // { // int FRT_Signal = stop_thrust_signal; //Front Right Thruster Signal // int FLT_Signal = stop_thrust_signal; //Front Left Thruster Signal // int BRT_Signal = stop_thrust_signal; //Back Right Thruster Signal // int BLT_Signal = stop_thrust_signal; //Back Left Thruster Signal // } else if(Xaverage < 250 && Xaverage > -250 && Yaverage < 250 && Yaverage > -250) { int FRT_Signal = stop_thrust_signal; //Front Right Thruster Signal int FLT_Signal = stop_thrust_signal; //Front Left Thruster Signal int BRT_Signal = stop_thrust_signal; //Back Right Thruster Signal int BLT_Signal = stop_thrust_signal; //Back Left Thruster Signal Serial.println(BLT_Signal); Front_Right_Thruster.writeMicroseconds(FRT_Signal); Front_Left_Thruster.writeMicroseconds(FLT_Signal); Back_Right_Thruster.writeMicroseconds(BLT_Signal); Back_Left_Thruster.writeMicroseconds(BRT_Signal); } Serial.println(Xaverage); delay(5); radio.stopListening(); //Gives the NRF24L01 the ability to send data back to the controller int Water_Reading = analogRead(H2O_Sensor); Output_SentMessage[0] = Water_Reading; Serial.println(Water_Reading); radio.write(&Output_SentMessage,sizeof(Output_SentMessage)); delay(50); } //////// FUNCTION PROTOTYPES ///////// int Limit_Motor_Signal(int ESC_Signal){ //Limits the motor signal of maximum and minimum thrust values int x; if(x >= max_thrust_signal){ x = max_thrust_signal; } if(x <= min_thrust_signal){ x = min_thrust_signal; } return x; } //Function Prototype //int Quadrant_Calculation_X(int Degree){ //Function to calculate the X positions of the movement interval bounds based on the angle. // int x; // if(Degree >= 0 && Degree <=90){ // x = 512 + 512*cos(Degree*2*PI/360); // } // else if(Degree > 90 && Degree <= 270){ // x = 512 + 512*cos(Degree*2*PI/360); // } // else if(Degree > 270 && Degree <= 360){ // x = 512 + 512*cos(Degree*2*PI/360); // } // return x; //} // //int Quadrant_Calculation_Y(int Degree){ // int y; // if(Degree >= 0 && Degree <=180){ // y = 512 + 512*sin(Degree*2*PI/360); // } // else if(Degree > 180 && Degree <= 360){ // y = 512 + 512*sin(Degree*2*PI/360); // } // return y; //}
0c47a9cf0484da940d1ecfe501210ae801652756
6c8183d3137add9f83ec4e6f5a0774c3d92f25b8
/SAOD/lab03/task03/menu.cpp
26ee348f815172d09f33de320d69856c36e690be
[]
no_license
romik1505/Data-Structures-Implementation
a5a47cf367ba060400618473f2725eb41aa1d859
996d1b2a34929a48e0c5061c4bf56c2a2f6e5d9b
refs/heads/master
2022-03-25T04:50:43.636386
2019-12-22T17:45:37
2019-12-22T17:45:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,197
cpp
menu.cpp
#include "menu.h" #include <iostream> #include "stack.h" #include "square.h" using namespace std; menu::menu(/* args */) { } menu::~menu() { } void menu::show_text_menu() { cout << "\n1. Введите стороны прямоугольника.\n"; cout << "2. Добавить узел в стек.\n"; cout << "3. Вывести стек.\n"; cout << "4. Удалить стек.\n"; cout << "0. Выход\n\n"; } void menu::show_menu() { char ch = 0; stack A; unsigned int a = 0; unsigned int b = 0; int buff = 0; do { cout << "Нажмите чтобы продолжить\n"; getchar(); getchar(); cin.clear(); system("clear"); show_text_menu(); cin >> ch; switch (ch) { case '1': cout << "Введите стороны прямоугольника a и b\n"; cin >> a >> b; cout << "Количество квадратов = " << square(a, b) << "\n"; break; case '2': cout << "Введите элемент в стек: "; cin >> buff; A.push(buff); break; case '3': A.print(); break; case '4': A.clear(); cout << "Стек удален \n"; break; case '0': break; } } while (ch != '0'); }
17a86bda20880c6f910da3636296ae3cfff088c2
a608e830d6a45a92c31389d17b1cd6e715a2d639
/ms2Server/src/cpp/Server.cpp
00b363bed1171ed418c6558e505e0d3f88bf7f18
[]
no_license
zeddkay/robot-command
bcaa33de63c299676ac9a7ecb5a5ad464c54ca80
26f0163535a1b3e0dd73b1971e1cdc71e82e0972
refs/heads/master
2021-05-08T13:32:18.750996
2017-09-06T02:55:19
2017-09-06T02:55:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
417
cpp
Server.cpp
#include "../header/MySocket.h" int main() { MySocket ServerSocket(SocketType::SERVER, "127.0.0.1", 5000, ConnectionType::UDP, 100); char buff[100]; int RxSize = ServerSocket.GetData(buff); std::cout << "Msg = " << buff << ", Bytes = " << RxSize << std::endl; std::string Pkt = "I Love BTN415 too!"; ServerSocket.SendData(Pkt.c_str(), strlen(Pkt.c_str())); //ServerSocket.DisconnectTCP(); return 1; }
5b026f2edcf163cec7d1f6df829a492079fae589
b5eda1ad5d91a93c494c11dd5e37e3c721cf61ac
/c/201906/7-46.cpp
4ed2bf4032bdbeee7cbc411a06c7924cb1891ca0
[]
no_license
wujiahai168/learn
1829aa095dceaf5a96c29d65a3bf1424e5167fdb
6994c8f0251a6488cb08257c94baa40fe3891ec2
refs/heads/master
2022-02-24T18:22:57.219214
2019-10-08T06:21:30
2019-10-08T06:21:30
74,726,166
1
2
null
null
null
null
UTF-8
C++
false
false
343
cpp
7-46.cpp
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; char *max( char *a, char *b ){ if( strcmp(a,b)>=0 ){ return a; }else{ return b; } } int main(){ char *p[] = {"aaa","bdasfas","dadsa"}; char *str = p[0]; for (int i=1; i<3; i++){ str = max( str,p[i] ); } cout<<"max---"<<endl; puts(str); }
b178c007412c03fcf10b548f5e01c2f135f7e703
7890642c47c4237ac65eb9a9393f045f9907c086
/packet-ip.cpp
eea5622f481e4837015035f860dbb337a0e6e197
[]
no_license
venkatarun95/monitor-link
b5230b891222a00433bd1537ee4d3462156d57e9
2cb524befc437c7d7d3010ab29e6a26e8c9ffa01
refs/heads/master
2020-03-19T15:20:38.315377
2018-06-25T02:57:27
2018-06-25T02:57:27
136,667,281
3
0
null
null
null
null
UTF-8
C++
false
false
1,994
cpp
packet-ip.cpp
#include "packet-ip.hpp" #include <cassert> #include <iostream> #include <netinet/ip.h> #include <netinet/ip6.h> namespace monitor { PacketIP::PacketIP() : packet(nullptr), pkt_len(0), cap_len(0), version(), proto(), src(), dst(), hdr_len(0), frag_off(0) {} PacketIP::PacketIP(const u_char* packet, size_t pkt_len, size_t cap_len) : packet(packet), pkt_len(pkt_len), cap_len(cap_len), version(), proto(), src(), dst(), hdr_len(0), frag_off(0) { #ifdef _IP_VHL // Version and leader length fields combined. Not yet supported. assert(false); #endif assert(pkt_len >= cap_len); // Get the version and header length first assert(cap_len > 1); ip* ip_hdr = (ip*) packet; // Handle IP versions if (ip_hdr->ip_v == 4) version = IPv4; else if (ip_hdr->ip_v == 6) version = IPv6; else assert(false); // Unrecognized IP version uint8_t transport_type; if (version == IPv6) { ip6_hdr* ip6 = (ip6_hdr*) packet; transport_type = ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt; src = ip6->ip6_src; dst = ip6->ip6_dst; if (ip6->ip6_ctlun.ip6_un1.ip6_un1_plen == 0) { std::cerr << "Jumbo payload not yet supported!" << std::endl; exit(1); } hdr_len = pkt_len - ntohs(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen); } else { // Check that our capture length is bigger than address hdr_len = ip_hdr->ip_hl * 4; assert(cap_len > hdr_len); // Get src and dst address src = ip_hdr->ip_src; dst = ip_hdr->ip_dst; transport_type = ip_hdr->ip_p; frag_off = ntohs(ip_hdr->ip_off) & 0x1fff; } // Type of transport layer switch(transport_type) { case 0x06: proto = TCP; break; case 0x11: proto = UDP; break; default: proto = Unknown; break; } // TODO(venkat): Deal with fragmentation } PacketTCP PacketIP::get_tcp() const { assert(is_tcp()); return PacketTCP(packet + hdr_len, pkt_len - hdr_len, cap_len - hdr_len); } } // namespace monitor
53e5dac4cd4141cb5b3038b02f7b1042fb1fd178
67aba88e3d048d35b743a8b71998722c940055c0
/src/mbgl/style/expression/within.cpp
0df0bd86ce4752b6f442f79df03a74cffc38946a
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "IJG", "Zlib", "blessing", "LicenseRef-scancode-openssl", "OpenSSL", "ISC", "LicenseRef-scancode-ssleay-windows", "MIT", "curl", "JSON", "BSL-1.0", "Apache-2.0", "Libpng", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "NCSA" ]
permissive
maxin0628/mapbox-gl-native
0a2ec1ab406acc5700b801f1e5f20f7bb28b51d4
c57af518426acc99fada188990e831cacc8170fe
refs/heads/master
2020-11-25T19:03:54.160858
2020-02-11T22:48:10
2020-02-12T10:24:05
228,801,776
0
0
NOASSERTION
2019-12-18T09:13:08
2019-12-18T09:13:07
null
UTF-8
C++
false
false
8,039
cpp
within.cpp
#include <mbgl/style/expression/within.hpp> #include <mapbox/geojson.hpp> #include <mapbox/geometry.hpp> #include <mbgl/style/conversion_impl.hpp> #include <mbgl/tile/geometry_tile_data.hpp> #include <mbgl/util/logging.hpp> #include <mbgl/util/string.hpp> #include <rapidjson/document.h> #include <mbgl/style/conversion/json.hpp> namespace mbgl { namespace { class PolygonFeature : public GeometryTileFeature { public: const Feature& feature; mutable optional<GeometryCollection> geometry; PolygonFeature(const Feature& feature_, const CanonicalTileID& canonical) : feature(feature_) { geometry = convertGeometry(feature.geometry, canonical); assert(geometry); geometry = fixupPolygons(*geometry); } FeatureType getType() const override { return FeatureType::Polygon; } const PropertyMap& getProperties() const override { return feature.properties; } FeatureIdentifier getID() const override { return feature.id; } optional<mbgl::Value> getValue(const std::string& /*key*/) const override { return optional<mbgl::Value>(); } const GeometryCollection& getGeometries() const override { assert(geometry); return *geometry; } }; bool rayIntersect(const mbgl::Point<double>& p, const mbgl::Point<double>& p1, const mbgl::Point<double>& p2) { return ((p1.y > p.y) != (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x); } // ray casting algorithm for detecting if point is in polygon bool pointWithinPolygon(const mbgl::Point<double>& point, const mapbox::geometry::polygon<double>& polygon) { bool within = false; for (auto ring : polygon) { auto size = ring.size(); // loop through every edge of the ring for (std::size_t i = 0; i < size - 1; ++i) { if (rayIntersect(point, ring[i], ring[i + 1])) { within = !within; } } } return within; } bool pointWithinPolygons(const mbgl::Point<double>& point, const mapbox::geometry::multi_polygon<double>& polygons) { for (auto polygon : polygons) { if (pointWithinPolygon(point, polygon)) return true; } return false; } bool pointsWithinPolygons(const mbgl::GeometryTileFeature& feature, const mbgl::CanonicalTileID& canonical, const mbgl::GeoJSON& geoJson) { return geoJson.match( [&feature, &canonical](const mapbox::geometry::geometry<double>& geometrySet) -> bool { mbgl::Feature f(geometrySet); PolygonFeature polyFeature(f, canonical); auto refinedGeoSet = convertGeometry(polyFeature, canonical); return refinedGeoSet.match( [&feature, &canonical](const mapbox::geometry::multi_polygon<double>& polygons) -> bool { return convertGeometry(feature, canonical) .match( [&polygons](const mapbox::geometry::point<double>& point) -> bool { return pointWithinPolygons(point, polygons); }, [&polygons](const mapbox::geometry::multi_point<double>& points) -> bool { return std::all_of(points.begin(), points.end(), [&polygons](const auto& p) { return pointWithinPolygons(p, polygons); }); }, [](const auto&) -> bool { return false; }); }, [&feature, &canonical](const mapbox::geometry::polygon<double>& polygon) -> bool { return convertGeometry(feature, canonical) .match( [&polygon](const mapbox::geometry::point<double>& point) -> bool { return pointWithinPolygon(point, polygon); }, [&polygon](const mapbox::geometry::multi_point<double>& points) -> bool { return std::all_of(points.begin(), points.end(), [&polygon](const auto& p) { return pointWithinPolygon(p, polygon); }); }, [](const auto&) -> bool { return false; }); }, [](const auto&) -> bool { return false; }); }, [](const auto&) -> bool { return false; }); } mbgl::optional<mbgl::GeoJSON> parseValue(const mbgl::style::conversion::Convertible& value_, mbgl::style::expression::ParsingContext& ctx) { if (isObject(value_)) { const auto geometryType = objectMember(value_, "type"); if (geometryType) { const auto type = toString(*geometryType); if (type && *type == "Polygon") { mbgl::style::conversion::Error error; auto geojson = toGeoJSON(value_, error); if (geojson && error.message.empty()) { return geojson; } ctx.error(error.message); } } } ctx.error("'Within' expression requires valid geojson source that contains polygon geometry type."); return nullopt; } } // namespace namespace style { namespace expression { Within::Within(GeoJSON geojson) : Expression(Kind::Within, type::Boolean), geoJSONSource(std::move(geojson)) {} Within::~Within() = default; using namespace mbgl::style::conversion; EvaluationResult Within::evaluate(const EvaluationContext& params) const { if (!params.feature || !params.canonical) { return false; } auto geometryType = params.feature->getType(); // Currently only support Point/Points in Polygon/Polygons if (geometryType == FeatureType::Point) { return pointsWithinPolygons(*params.feature, *params.canonical, geoJSONSource); } mbgl::Log::Warning(mbgl::Event::General, "within expression currently only support 'Point' geometry type"); return false; } ParseResult Within::parse(const Convertible& value, ParsingContext& ctx) { if (isArray(value)) { // object value, quoted with ["within", value] if (arrayLength(value) != 2) { ctx.error("'within' expression requires exactly one argument, but found " + util::toString(arrayLength(value) - 1) + " instead."); return ParseResult(); } auto parsedValue = parseValue(arrayMember(value, 1), ctx); if (!parsedValue) { return ParseResult(); } return ParseResult(std::make_unique<Within>(*parsedValue)); } return ParseResult(); } Value valueConverter(const mapbox::geojson::rapidjson_value& v) { if (v.IsDouble()) { return v.GetDouble(); } if (v.IsString()) { return std::string(v.GetString()); } if (v.IsArray()) { std::vector<Value> result; result.reserve(v.Size()); for (const auto& m : v.GetArray()) { result.push_back(valueConverter(m)); } return result; } // Ignore other types as valid geojson only contains above types. return Null; } mbgl::Value Within::serialize() const { std::unordered_map<std::string, Value> serialized; rapidjson::CrtAllocator allocator; const mapbox::geojson::rapidjson_value value = mapbox::geojson::convert(geoJSONSource, allocator); if (value.IsObject()) { for (const auto& m : value.GetObject()) { serialized.emplace(m.name.GetString(), valueConverter(m.value)); } } else { mbgl::Log::Error(mbgl::Event::General, "Failed to serialize 'within' expression, converted rapidJSON is not an object"); } return std::vector<mbgl::Value>{{getOperator(), *fromExpressionValue<mbgl::Value>(serialized)}}; } } // namespace expression } // namespace style } // namespace mbgl
5a12054e88c452cab00a9b2512a16c4f40d3224e
c3bdc6275a9b040f466e1e05da48d367cdc8ef8a
/TweetTheTemp2/TweetTheTemp2.ino
28e9e3a99d6a1ace3928df03c35842a1c00c0ef5
[]
no_license
amadues2013/Arduino
9a6315ca6dc7edbc298d8dba35d521c2d8cd6794
bf84bf8b191494980b25bfeb77837c82bcf9db48
refs/heads/master
2020-05-31T21:19:20.148047
2017-02-02T09:14:39
2017-02-02T09:14:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,923
ino
TweetTheTemp2.ino
/* Tweet the Temp Meaure the Temp and Humidity with an AM2302 sensor and tweet via a Twitter account using the Temboo Arduino Yun SDK. This example code is in the public domain. www.troykyo.com */ #include <Process.h> #include <Bridge.h> #include <Temboo.h> #include <YunServer.h> #include <YunClient.h> #include "TembooAccount.h" // contains Temboo account information #include "DHT.h" #define DHTPIN 2 // what pin we're connected to #define DHTTYPE DHT22 // DHT 22 (AM2302) DHT dht(DHTPIN, DHTTYPE); YunServer server; String startString; long hits = 0; Process date; int hours,minutes,seconds; String timeString; long delayTime =0; long minuteDelay =0; long time = 0; long numRuns = 0; int lastrun = 0; float h = 0; float t = 0; // Note that for additional security and reusability, you could // use #define statements to specify these values in a .h file. /* const String TWITTER_ACCESS_TOKEN = "233304728-fMNbzwwVJwQ6C5n5xgLvbwr6PIiGzfR0vi6eCGqU"; const String TWITTER_ACCESS_TOKEN_SECRET = "Rxe8u50lLQCo9qcMnN9akJUnqKrPq743hqzFMCfKtkpI6"; const String TWITTER_CONSUMER_KEY = "BgAjT1pVyQ2UOtAVBzIdow"; const String TWITTER_CONSUMER_SECRET = "eLvkC3tm3X7aT7jJHuulODW2K32SscuHg2CwygrUCa0"; */ void setup() { dht.begin(); Serial.begin(9600); Bridge.begin(); Console.begin(); delay(4000); if (!date.running()) { date.begin("date"); date.addParameter("+%T"); date.run(); } // Listen for incoming connection only from localhost // (no one from the external network could connect) server.listenOnLocalhost(); server.begin(); // get the time that this sketch started: Process startTime; startTime.runShellCommand("date"); while(startTime.available()) { char c = startTime.read(); startString += c; } } void loop() { timestamp(); tempcheck(); website(); if (minutes == 38){//tweet onece on the 38 telltemboo(); delayTime = millis(); delay (60000); } delay(1000*10); } void telltemboo(){ Serial.println("Running SendATweet - Run #" + String(numRuns++) + "..."); Console.println("Running SendATweet - Run #" + String(numRuns++) + "..."); // define the text of the tweet we want to send //String tweetText(String(t) +"*C Humidity: " + String(h) + "% "); String tweetText(timeString + String(t) + " Celcius " + String(h) + "% Humidity" ); Serial.println(tweetText); Console.println(tweetText); TembooChoreo StatusesUpdateChoreo; // invoke the Temboo client // NOTE that the client must be reinvoked, and repopulated with // appropriate arguments, each time its run() method is called. StatusesUpdateChoreo.begin(); // set Temboo account credentials StatusesUpdateChoreo.setAccountName(TEMBOO_ACCOUNT); StatusesUpdateChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); StatusesUpdateChoreo.setAppKey(TEMBOO_APP_KEY); // identify the Temboo Library choreo to run (Twitter > Tweets > StatusesUpdate) StatusesUpdateChoreo.setChoreo("/Library/Twitter/Tweets/StatusesUpdate"); // set the required choreo inputs // see https://www.temboo.com/library/Library/Twitter/Tweets/StatusesUpdate/ // for complete details about the inputs for this Choreo // add the Twitter account information StatusesUpdateChoreo.addInput("AccessToken", TWITTER_ACCESS_TOKEN); StatusesUpdateChoreo.addInput("AccessTokenSecret", TWITTER_ACCESS_TOKEN_SECRET); StatusesUpdateChoreo.addInput("ConsumerKey", TWITTER_CONSUMER_KEY); StatusesUpdateChoreo.addInput("ConsumerSecret", TWITTER_CONSUMER_SECRET); // and the tweet we want to send StatusesUpdateChoreo.addInput("StatusUpdate", tweetText); // tell the Process to run and wait for the results. The // return code (returnCode) will tell us whether the Temboo client // was able to send our request to the Temboo servers unsigned int returnCode = StatusesUpdateChoreo.run(); // a return code of zero (0) means everything worked if (returnCode == 0) { Serial.println("Success! Tweet sent!"); Console.println("Success! Tweet sent!"); } else { // a non-zero return code means there was an error // read and print the error message while (StatusesUpdateChoreo.available()) { char c = StatusesUpdateChoreo.read(); Serial.print(c); Console.print(c); } } StatusesUpdateChoreo.close(); } void timestamp() { // restart the date process: if (!date.running()) { date.begin("date"); date.addParameter("+%T"); date.run(); } //if there's a result from the date process, parse it: while (date.available()>0) { // get the result of the date process (should be hh:mm:ss): timeString = date.readString(); // find the colons: int firstColon = timeString.indexOf(":"); int secondColon= timeString.lastIndexOf(":"); // get the substrings for hour, minute second: String hourString = timeString.substring(0, firstColon); String minString = timeString.substring(firstColon+1, secondColon); String secString = timeString.substring(secondColon+1); // convert to ints,saving the previous second: hours = hourString.toInt(); minutes = minString.toInt(); seconds = secString.toInt(); // print the time: if (hours <= 9) Console.print("0"); // adjust for 0-9 Console.print(hours); Console.print(":"); if (minutes <= 9) Console.print("0"); // adjust for 0-9 Console.print(minutes); Console.print(":"); if (seconds <= 9) Console.print("0"); // adjust for 0-9 Console.print(seconds); } } void tempcheck(){ // only try to send the tweet if we haven't already sent it successfully // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) h = dht.readHumidity(); t = dht.readTemperature(); // check if returns are valid, if they are NaN (not a number) then something went wrong! if (isnan(t) || isnan(h)) { Serial.println("Failed to read from DHT"); Console.println("Failed to read from DHT"); } else { Serial.print("\t Humidity: "); Serial.print(h); Serial.print(" % "); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C"); Console.print("Humidity: "); Console.print(h); Console.print(" %\t"); Console.print("Temperature: "); Console.print(t); Console.print(" *C "); } time = millis(); Serial.print(" \tMinutes untill next tweet: "); Console.print(" \tMinutes untill next tweet: "); Serial.print(60-(time-delayTime)/60000); Console.print(60-(time-delayTime)/60000); Serial.print(" \tUptime: "); Console.print(" \tUptime: "); Serial.println(time/60000); Console.println(time/60000); } void website() { // Get clients coming from server YunClient client = server.accept(); // There is a new client? if (client) { // read the command String command = client.readString(); command.trim(); //kill whitespace Serial.println(command); Console.println(command); // is "temperature" command? //if (command == "temperature") { // get the time from the server: Process time; time.runShellCommand("date"); String timeString = ""; while(time.available()) { char c = time.read(); timeString += c; } Serial.println(timeString); // print the temperature: client.print("Current time on the Yun: "); client.println(timeString); client.print("<br>Current temperature: "); client.print(t); client.print(" degrees C"); client.print(h); client.print(" % Humidity"); client.print("<br>This sketch has been running since "); client.print(startString); client.print("<br>Hits so far: "); client.print(hits); //} // Close connection and free resources. client.stop(); hits++; } }
89deb68beefff4bf9ee57b6d14354aaaf693afe6
159cdc208fc48a4d0034e84820562b0642088cd6
/sched_mwh.cxx
0c54e0d6b4907743198f642d8a7b8fb710bce05e
[]
no_license
mildrock/bid_sched
114ba3f738e27575c2fa3896f2ca56133b067c5d
bf049283ab2de96758d36e59e016f8dc1f1f1b59
refs/heads/master
2020-07-25T18:33:29.822411
2019-03-13T07:59:02
2019-03-13T07:59:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,153
cxx
sched_mwh.cxx
//sched_mwh.cxx by wanggt //////////////////////////////////////////////////////////// #include"common.h" #include"psched.h" #include "dmdb.h" #include <iostream> #include<map> #include <stdlib.h> #include"operate_config.h" #include"sched_bid.h" using namespace::std; //定义为时段数+1 #define SDNUM 96 #define SQLSTRLEN 2048 string userNameStr; string passwordStr; string ipStr; string logPathStr; CDmDb *dmdb; double fhycGloble[SDNUM+1];// double llxjhGloble[SDNUM+1];//联络线计划 double xnyycGloble[SDNUM+1];//新能源预测 double sdjhGloble[SDNUM+1];//水调计划 double ddljhInputFl[SDNUM+1];//定电量输入负荷 const char Config[] = "db.ini"; /** * 写入算法执行情况 */ void writeAlgResult2DB(string msg,string detailMsg) { char insertSqlStr[SQLSTRLEN]; char dateStr[20]={0},timeStr[20]={0}; getSysTime(timeStr); getSysDateNoLine(dateStr); sprintf(insertSqlStr,"insert into HLJJHDB.HLJJHDB.BZJG(FAH,SJ,BZMS,FPFS,JSJG,XXXX) " " values('%s','%s','三公调度','平均分配','%s','%s')", dateStr,timeStr,msg.c_str(),detailMsg.c_str()); printf(insertSqlStr); int ret = dmdb->exec_sql(insertSqlStr); } /** * 读取数据库配置 */ void readConfig() { // 读配置文件,失败返回一个 异常类对象 try { // Code that could throw an exception ConfigHandle.init(Config); } catch (operatorconfig::File_not_found &filenf) { std::cerr << "**Warring: Attemped to open no exist file <" << filenf.filename << ">." << std::endl; exit(CONFIG_FILE_NOTFOUND); } userNameStr = ConfigHandle.read("userName",userNameStr); passwordStr = ConfigHandle.read("password",passwordStr); ipStr = ConfigHandle.read("ip",ipStr); logPathStr = ConfigHandle.read("logPath",logPathStr); } /** * 读取算法所需参数 */ void readAlgorithmPara() { string paraSql = "SELECT CSID,CSSZ FROM HLJJHDB.HLJJHDB.XTCS " "WHERE CSLX='DDLJH'"; long long retRedNum = dmdb->exec_select(paraSql.c_str(), 2, "读取算法参数数据"); map<string,string> paraMap; for(int i=0;i<retRedNum;i++) { string typeStr = dmdb->get_select_data(i,0).c_str(); string valStr = dmdb->get_select_data(i,1); paraMap[typeStr]= valStr; } mwStep=atof(paraMap["DDLJH_mwStep"].c_str()); pntNum=atoi(paraMap["DDLJH_pntNum"].c_str()); rampSd=atoi(paraMap["DDLJH_rampSd"].c_str()); sdnum =atoi(paraMap["DDLJH_sdnum"].c_str()); sd1 =atoi(paraMap["DDLJH_sd1"].c_str()); } /** *读取负荷预测 */ void readFhyc(string strDate) { long long retRedNum = -1; string fhycSql="select sd,sz from HLJJHDB.HLJJHDB.FHYC \ where rq='"+strDate+"' order by sd"; retRedNum = dmdb->exec_select(fhycSql.c_str(), 2, "读取负荷预测数据"); if(retRedNum!=SDNUM){ cout<<"####负荷预测数据错误"<<endl; writeAlgResult2DB("负荷预测数据错误",""); exit(LOAD_FORCAST_DATA_ERROR);//负荷预测数据有问题 } printf("id name\n"); for(int i=0;i<retRedNum;i++) { string sdStr = dmdb->get_select_data(i,0).c_str(); int sdInt = atoi(sdStr.c_str()); string valStr = dmdb->get_select_data(i,1); double valDouble = atof(valStr.c_str()); fhycGloble[sdInt]= valDouble; } string llxjhSql="select sd,sz from HLJJHDB.HLJJHDB.LLXJHXZ \ where rq='"+strDate+"' order by sd"; retRedNum = dmdb->exec_select(llxjhSql.c_str(), 2, "读取联络线计划数据"); if(retRedNum!=SDNUM){ cout<<"####联络线计划数据错误"<<endl; writeAlgResult2DB("联络线计划数据错误",""); exit(INTERCONECTION_DATA_ERROR);//联络线计划数据有问题 } for(int i=0;i<retRedNum;i++) { string sdStr = dmdb->get_select_data(i,0).c_str(); int sdInt = atoi(sdStr.c_str()); string valStr = dmdb->get_select_data(i,1); double valDouble = atof(valStr.c_str()); llxjhGloble[sdInt]= valDouble; } string xnyycSql = "select sd,sum(sz) from HLJJHDB.HLJJHDB.XNYYC \ where rq='"+strDate+"' group by sd order by sd"; retRedNum = dmdb->exec_select(xnyycSql.c_str(), 2, "读取新能源预测数据"); // if(retRedNum==SDNUM||retRedNum==0){ for(int i=0;i<retRedNum;i++) { string sdStr = dmdb->get_select_data(i,0).c_str(); int sdInt = atoi(sdStr.c_str()); string valStr = dmdb->get_select_data(i,1); double valDouble = atof(valStr.c_str()); xnyycGloble[sdInt]= valDouble; } // }else{ // cout<<"####新能源预测数据有问题"<<endl; // exit(NEW_ENERGY_DATA_ERROR);//新能源预测数据有问题 // } string sdjhSql = "select sd,sum(sz) from HLJJHDB.HLJJHDB.SDJH \ where rq='"+strDate+"' group by sd order by sd "; retRedNum = dmdb->exec_select(sdjhSql.c_str(), 2, "读取水电计划数据"); // if(retRedNum==SDNUM||retRedNum==0){ for(int i=0;i<retRedNum;i++) { string sdStr = dmdb->get_select_data(i,0).c_str(); int sdInt = atoi(sdStr.c_str()); string valStr = dmdb->get_select_data(i,1); double valDouble = atof(valStr.c_str()); sdjhGloble[sdInt]= valDouble; } // }else{ // cout<<"水电计划数据有问题"<<endl; // exit(WATER_SCHED_DATA);//新能源预测数据有问题 // } for(int i=1;i<=SDNUM;i++){ ddljhInputFl[i] =fhycGloble[i]+llxjhGloble[i]-xnyycGloble[i]-sdjhGloble[i]; wload0[i]=ddljhInputFl[i]; wload [i]=ddljhInputFl[i]; } } /** *读取日定电量 */ void readRDDL(string strDate) { long long retRedNum =-1; string maxRqInRddl = "select max(rq) from HLJJHDB.HLJJHDB.RDDL " "where rq<='"+strDate+"'"; retRedNum = dmdb->exec_select(maxRqInRddl.c_str(), 1, "读取日定电量日期"); if(retRedNum<=0){ cout<<"####日定电量没有最新数据"<<endl; writeAlgResult2DB("日定电量没有最新数据",""); exit(-104); } string maxRq = dmdb->get_select_data(0,0); string jzRddlSql = "select sid,sname,rddl,glsx,glxx from HLJJHDB.HLJJHDB.RDDL \ where rq='"+maxRq+"'"; retRedNum = dmdb->exec_select(jzRddlSql.c_str(), 5, "读取日定电量数据"); if(retRedNum<=0){ cout<<"####机组日定电量数据错误"<<endl; writeAlgResult2DB("机组日定电量数据错误",""); exit(-105); } fixbasData=NULL; fixbasNum =0; for(int i=0;i<retRedNum;i++){ string sidStr = dmdb->get_select_data(i,0); string snameStr = dmdb->get_select_data(i,1); string rddlStr = dmdb->get_select_data(i,2); string glsxStr = dmdb->get_select_data(i,3); string glxxStr = dmdb->get_select_data(i,4); struct fixstr *xp=(struct fixstr *)malloc(sizeof(struct fixstr)); if(xp==NULL){ printf("\nError --- %ld",__LINE__); exit(0); } memset(xp,0,sizeof(struct fixstr)); xp->i =i+1; sprintf(xp->id,"%s",sidStr.c_str()); sprintf(xp->descr,"%s",snameStr.c_str()); xp->mwmax[0]=atof(glsxStr.c_str()); xp->mwmin[0]=atof(glxxStr.c_str()); xp->mwh0 =atof(rddlStr.c_str()); xp->next =fixbasData; fixbasData=xp; fixbasNum++; } reverse(fixbasData); } void readAllDataFromDb(string strDate) { readAlgorithmPara(); readFhyc(strDate); readRDDL(strDate); } /** * 写入结果 */ void writeToDb(string strDate) { string deletSql = "DELETE FROM HLJJHDB.HLJJHDB.DDLJH WHERE RQ='"+strDate+"'"; int deleteNum = dmdb->exec_sql(deletSql.c_str()); cout<<"删除"<<deleteNum<<"条记录"<<endl; char insertDdljhSql[SQLSTRLEN]; struct fixstr *xp=fixbasData; long insertNum = 0; for(int i=0;i<fixbasNum;i++) { string sid = xp->id; string sname = xp->descr; for(int j=0;j<SDNUM;j++){ // insertDdljhSql = "INSERT INTO HLJJHDB.HLJJHDB.DDLJH(RQ,SJ,SD,SID,SNAME,SX,XX,SKT,XKT,GL) " // "VALUES('"+strDate+"','"+sd2sj[i]+"','"+(j+1)+"','"+sid+"',,,,,,)"; sprintf(insertDdljhSql,"INSERT INTO HLJJHDB.HLJJHDB.DDLJH(RQ,SJ,SD,SID,SNAME,SX,XX,SKT,XKT,GL) " "VALUES('%s','%s','%d','%s','%s','%f','%f','%f','%f','%f')", strDate.c_str(),sd2sj[j].c_str(),j+1,sid.c_str(),sname.c_str(),xp->mwmax[j+1], xp->mwmin[j+1],xp->mwup[j+1],xp->mwdn[j+1],xp->mw[j+1]); //printf("%s\n",insertDdljhSql); int ret = dmdb->exec_sql(insertDdljhSql); if(ret!=0) { cout<<"####插入数据出错"<<endl; writeAlgResult2DB("数据库错误,插入数据出错",""); exit(106); }else insertNum++; } xp=xp->next; } cout<<"插入"<<insertNum<<"条数据"<<endl; } void algrithm(string strDate) { readConfig(); sched_start("sched01"); //sched_readdat(); readAllDataFromDb(strDate); sched_dataprep(); //////////////////////////////////////////////////////////// sched_fun(fixbasData); sched_gross(); //sched_report(); writeToDb(strDate); } int main(long argc,char **argv) { string strDate = argv[1]; readConfig(); dmdb = new CDmDb(userNameStr.c_str(),passwordStr.c_str(),ipStr.c_str(),logPathStr.c_str()); int initRet = dmdb->init_database(); if(initRet!=0) { cout<<"####数据库初始化失败"<<endl; exit(99); } algrithm(strDate); delete(dmdb); writeAlgResult2DB("算法完成",""); printf("####算法成功完成!\n"); } //end of file
14c55899279bb5155e7bbbc6a77522db11a73ea0
d0e1263b0e76b0a8e0219c1202296bd372c3eabc
/MediaPortal-1-master/DirectShowFilters/DVBSubtitle3/Source/dvbsubs/DVBSubDecoder.h
4bed6162d591f421fed45bafb18f260018782997
[]
no_license
juancollsoler/ex.tv.player.app.v2
d431427e44eb731b7d958624885236bd90b0643f
b9db15ed171b5df03843e8d884f159c4e264c226
refs/heads/master
2020-05-19T03:10:21.872002
2019-05-03T17:15:15
2019-05-03T17:15:15
184,790,805
1
0
null
null
null
null
UTF-8
C++
false
false
3,134
h
DVBSubDecoder.h
/* dvbsubs - a program for decoding DVB subtitles (ETS 300 743) File: dvbsubs.h Copyright (C) Dave Chapman 2002 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ #pragma once #define MAX_REGIONS 32 #include "windows.h" #include <vector> #include "subtitle.h" #include "..\SubdecoderObserver.h" typedef unsigned __int64 uint64_t; typedef unsigned __int16 uint16_t; typedef unsigned __int8 uint8_t; typedef struct { int x,y; unsigned char is_visible; } visible_region_t; typedef struct { int acquired; int page_time_out; int page_version_number; int page_state; visible_region_t regions[MAX_REGIONS]; } page_t; typedef struct { int width,height; int depth; int win; int CLUT_id; int objects_start,objects_end; unsigned int object_pos[65536]; unsigned char img[720*576]; } region_t; class CSubtitle; class CDVBSubDecoder { public: CDVBSubDecoder(); ~CDVBSubDecoder(); int ProcessPES( const unsigned char* data, int length, int pid ); BITMAP* GetSubtitle(); long GetSubtitleId(); CSubtitle* GetSubtitle( unsigned int place ); CSubtitle* GetLatestSubtitle(); int GetSubtitleCount(); void ReleaseOldestSubtitle(); void Reset(); void SetObserver( MSubdecoderObserver* pObserver ); void RemoveObserver( MSubdecoderObserver* pObserver ); private: void Init_data(); void Create_region( int region_id, int region_width, int region_height, int region_depth ); void Do_plot( int r,int x, int y, unsigned char pixel ); void Plot( int r, int run_length, unsigned char pixel ); unsigned char Next_nibble(); void Set_clut( int CLUT_id,int CLUT_entry_id,int Y, int Cr, int Cb, int T_value ); void Decode_4bit_pixel_code_string( int r, int object_id, int ofs, int n ); void Process_pixel_data_sub_block( int r, int o, int ofs, int n ); void Process_page_composition_segment(); void Process_region_composition_segment(); void Process_CLUT_definition_segment(); void Process_object_data_segment(); void Process_display_definition_segment(); void Compose_subtitle(); char* Pts2hmsu( uint64_t pts, char sep ); uint64_t Get_pes_pts ( unsigned char* buf ); // Member data unsigned char m_Buffer[1920*1080]; // should be dynamically allocated int m_ScreenWidth; int m_ScreenHeight; CSubtitle* m_CurrentSubtitle; MSubdecoderObserver* m_pObserver; std::vector<CSubtitle*> m_RenderedSubtitles; };
ac417b0e6eef43018836c6163cd5fea01b2235a9
b0fa97e378226e980a9a75203f1976018addd7af
/1015/prime/prime/prime.cpp
ce7e6ecdecd754bfb691c1e3447a00cb079e0c28
[]
no_license
Han8464/PTA-code
4c8b818d53c1a5730d54c470a266d67f38cc8e90
5011b204d023f97c6096a0e940ab3dbbebb982ac
refs/heads/master
2020-03-18T17:39:08.265529
2019-03-05T10:34:17
2019-03-05T10:34:17
135,041,777
0
0
null
null
null
null
UTF-8
C++
false
false
1,028
cpp
prime.cpp
#include <cstdio> #include <cstdlib> #include <cmath> bool Isprime(int reverse) { if(reverse == 0 || reverse ==1) { return false; } int k = sqrt((double)reverse); for (int m = 2; m <= k;m ++) { if (reverse % m == 0) { return false; } } return true; } int main() { int n,d; scanf("%d",&n); int record[1000]; int cases = 0; while (n >= 0) { scanf("%d",&d); if(Isprime(n) == false) { record[cases] = 0; cases ++; scanf("%d",&n); continue; } int num[10000]; int count = 0; int reverse = 0; while(n > 0) { num[count] = n % d; n = n / d; count++; } int j = 0; for(int i = count - 1; i >= 0; i--) { reverse += (num[i] * pow((double)d,j)); j++; } if((Isprime(reverse) == true)) { record[cases] = 1; }else { record[cases] = 0; } cases ++; scanf("%d",&n); } cases -= 1; int tmp = 0; while(tmp <= cases) { if(record[tmp] == 1) { printf("Yes\n"); }else { printf("No\n"); } tmp ++; } system("pause"); return 0; }
7c0fd5495ea050fb50808453171979c5535022e3
ac87a0e387e795ccb862eb2f76107a9f66fd319f
/Codeforces/kth_largest_value.cpp
e8da6f4a37949115bb3c0f4c206e32ba9f3b0048
[]
no_license
prasanjit15/DailyCode
ac9541aa82276cc92224c356356143d5e0b287c2
cf19c808d6c343b6a47386debc90ba47e8c2abef
refs/heads/master
2023-05-14T00:06:21.092812
2021-06-02T06:44:36
2021-06-02T06:44:36
284,071,833
1
0
null
null
null
null
UTF-8
C++
false
false
1,034
cpp
kth_largest_value.cpp
#include <bits/stdc++.h> #define int long long using namespace std; void solve() { int n,q; cin >> n >> q; std::vector<int> v(n); int one = 0, zero = 0; for(int i =0;i < n;i++){ cin >> v[i]; if(v[i] == 1) one++; else zero++; } for(int i =0 ;i < q;i++) { int k;cin >> k; if(k == 2) { int h;cin >> h; if(h <= one) cout << 1 << endl; else cout << 0 << endl; } else { int h;cin >> h; if(v[h-1] == 1) { one--;zero++; v[h-1] = 0; } else { one++;zero--; v[h-1] = 1; } } } } int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); #endif ios::sync_with_stdio(false); cin.tie(0); //int tt;cin >> tt;while(tt--) solve(); return 0; }
7326c10a2ef2339bf4cdfa69a5314a5e18ed1ca1
e31af1497be840ff84102c12824fef88889a2f3c
/Magic/main.cpp
a1f39fea0d4351ebcb2266ab92e9be1999913c6d
[]
no_license
caelan-a/Magic
5692d877718b62bf2de1a8cfb3dde2574093c3ca
929c5fdede52c2daf1a96c90a7ba021e0c9c2229
refs/heads/master
2022-04-09T22:06:24.991145
2020-03-09T02:41:53
2020-03-09T02:41:53
43,582,042
1
0
null
null
null
null
UTF-8
C++
false
false
3,045
cpp
main.cpp
// Magic.cpp : Defines the entry point for the console application. // #include "stdafx.h" // Global Objects GLFWwindow* window; Camera camera; // Protofunctions void init(); void checkInput(); void render(); void cleanup(); void getSystemInfo(); void checkInput() { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); // Move input to class GLfloat cameraSpeed = 0.05f; if (glfwGetKey(window, GLFW_KEY_W)) camera.cameraPos += cameraSpeed * camera.cameraFront; if (glfwGetKey(window, GLFW_KEY_S)) camera.cameraPos -= cameraSpeed * camera.cameraFront; if (glfwGetKey(window, GLFW_KEY_A)) camera.cameraPos -= glm::normalize(glm::cross(camera.cameraFront, camera.cameraUp)) * cameraSpeed; if (glfwGetKey(window, GLFW_KEY_D)) camera.cameraPos += glm::normalize(glm::cross(camera.cameraFront, camera.cameraUp)) * cameraSpeed; } int main(int argc, char **argv) { init(); camera = Camera(); Drawing::init(camera); Shader::loadShaders(); while (!glfwWindowShouldClose(window)) { checkInput(); glClearColor(0.8f, 0.8f, 0.8f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); render(); glfwSwapBuffers(window); glfwPollEvents(); } cleanup(); exit(EXIT_SUCCESS); } void render() { using namespace Drawing; glUseProgram(Shader::flat); Drawing::drawGrid(); for (float i = 0; i < 10; i++) drawTexture(Textures::crate, Meshes::box, glm::vec3(3.0f * i, glm::sin(2 * glfwGetTime() + (5*i)) + 2.0f, 0.0f), glm::vec3(1.0f, 1.0f, 1.0f), glm::vec4(1.0f, 1.0f, 1.0f, 0.0f), glm::vec3(1.0f, 1.0f, 1.0f), 1.0f); glUseProgram(0); } void init() { if (glfwInit() != GL_TRUE) { std::cout << "Failed to initialise GLFW"; glfwTerminate(); exit(EXIT_FAILURE); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); if(!Preferences::fullscreen) window = glfwCreateWindow(Preferences::SCREEN_WIDTH, Preferences::SCREEN_HEIGHT, "Magic", nullptr, nullptr); else window = glfwCreateWindow(Preferences::SCREEN_WIDTH, Preferences::SCREEN_HEIGHT, "Magic", glfwGetPrimaryMonitor(), nullptr); if (window == nullptr) { std::cout << "Failed to create window"; glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { std::cout << "Failed to initialise GLEW"; exit(EXIT_FAILURE); } getSystemInfo(); //glViewport(0, 0, Preferences::SCREEN_WIDTH, Preferences::SCREEN_HEIGHT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_DEPTH_TEST); glfwSwapInterval(1); } void getSystemInfo() { GLint nrAttributes; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &nrAttributes); std::cout << "Maximum number of vertex attributes supported: " << nrAttributes << std::endl; } void cleanup() { glfwDestroyWindow(window); glfwTerminate(); }
dddfec5c85431528bbcbc3952c5592d4a34ec064
f87501ed4367b471cc091538c95008cbf4eb66d9
/MSJ_API/GameCoreMath.cpp
3cc892458fc69bdad63c7ee0811bf658a452a9ca
[]
no_license
KkyuCone/Win_API_MSJ_PO
728a7d9d1b2bcf037833a25d367b668266be433c
696d23a9186a006be56bc7a187fa6a680e8652a0
refs/heads/master
2020-08-16T06:56:53.992044
2019-10-16T06:23:06
2019-10-16T06:23:06
215,470,878
0
0
null
null
null
null
UHC
C++
false
false
335
cpp
GameCoreMath.cpp
#include "stdafx.h" #include "GameCoreMath.h" const float GameCoreMath::Pi = 3.14159265359f; // 파이 const float GameCoreMath::DegTransRad = Pi / 180; // 라디안으로 변환 (호도법) const float GameCoreMath::RadTransDeg = 180 / Pi; // 각도로 변환 GameCoreMath::GameCoreMath() { } GameCoreMath::~GameCoreMath() { }
20b9a8f679992dd79c6a02d707a2fc85adb481ae
33213a6d739067d0ff18d4b7fbb0a6a7f93f147e
/Activity2.cpp
754d0b5c86176dbe854e861c0dee46079d46362b
[]
no_license
KirveyBalansag/Myrepository
284d97f15e812c747f7dfa443c2c271a1ba1a86a
2cb4beba71ba05f0151c0c176f41c479c80f8a3d
refs/heads/main
2022-12-30T12:49:31.163184
2020-10-24T15:08:08
2020-10-24T15:08:08
306,907,781
0
0
null
null
null
null
UTF-8
C++
false
false
563
cpp
Activity2.cpp
#include <iostream> using namespace std; int main() { int n, i; float num[100], s=0.0, ave; cout << "Enter the numbers of data: "; cin >> n; while (n > 100 || n <= 0) { cout << "Error! number should in range of (1 to 100)." << endl; cout << "Enter the number again: "; cin >> n; } for(i = 0; i < n; ++i) { cout << i + 1 << ". Enter number: "; cin >> num[i]; s += num[i]; } ave = s / n; cout << "Average = " << ave; return 0; }
3e7bb29bf9e70327aca637466469f4e29bb21ecc
c73b50eea79bff9831ca724f2cffdd9bb3fbd448
/2178.cpp
d2cbc29b7079e70ee77a68406bd4b3e96535049e
[]
no_license
ParkGeunYeong/algorithms
cb2250964cd48551867586a5083f9438d075a8fe
8f40e77da22ea241353a3e3dccc40aa70501592d
refs/heads/master
2020-05-02T10:08:39.484887
2019-07-24T13:13:01
2019-07-24T13:13:01
177,889,427
0
0
null
null
null
null
UTF-8
C++
false
false
967
cpp
2178.cpp
#include<iostream> #include<queue> #include<cstring> using namespace std; int board[101][101]; int check[101][101]; int moveTo[4][2] = { {0,1},{0,-1} ,{1,0} ,{-1,0} }; queue<pair<int,int>> q; int N, M; int go(int r, int c) { check[r][c] = 1; q.push(make_pair(r,c)); while (!q.empty()) { int goR = q.front().first, goC = q.front().second; for (int i = 0; i < 4; i++){ int moveGoR = goR + moveTo[i][0], moveGoC = goC + moveTo[i][1]; if (moveGoR > N || moveGoC > M || moveGoR < 1 || moveGoC < 1 || check[moveGoR][moveGoC] == -1 || check[moveGoR][moveGoC] >= 1) continue; q.push({ moveGoR, moveGoC }); check[moveGoR][moveGoC] = check[goR][goC] + 1; } q.pop(); } return check[N][M]; } int main() { cin >> N >> M; for (int i = 1; i <= N; i++) { string temp; cin >> temp; for (int j = 1; j <= M; j++) { board[i][j] = temp[j - 1] - '0'; if (board[i][j] == 0) check[i][j] = -1; } } cout << go(1, 1) << '\n'; return 0; }
cd55115a868c820438290df4eaca308ac2d4ff19
a772f6660e0891950cc444c08a813b242a624f1e
/RosaSensors/RosaSensors/UartStd.cpp
4757966c5ed02fae1e5de3357ae246bc51468823
[]
no_license
OpenLEAD/uCpressure
5a899f18dd8004a6d19413b4b40f6b3685f77142
983b8c497e9668b2778111fddd8f99f71965735e
refs/heads/master
2020-05-31T06:41:43.480913
2015-01-07T20:32:35
2015-01-07T20:32:35
27,591,279
0
0
null
null
null
null
UTF-8
C++
false
false
2,298
cpp
UartStd.cpp
/* * UartStd.cpp * * Created: 11/18/2014 8:50:11 PM * Author: Renan & Eduardo Elael */ #include "UartStd.h" namespace Rosa{ const UartStd UART1( &UCSR1A, &UCSR1B, &UCSR1C, &UBRR1, &UDR1 ); const UartStd UART0( &UCSR0A, &UCSR0B, &UCSR0C, &UBRR0, &UDR0 ); void UartStd::enable(void) const { /* Set baud rate */ *(UBRR) = (((F_CPU / (config->baud * 16UL))) - 1); /* Set frame format: 8data, no parity & 2 stop bits */ *(UCSRC) = (1<<UCSZ1) | (1<<UCSZ0) | (config->stopbit << USBS); /* Enable receiver and transmitter */ *(UCSRB) = (1<<RXEN) | (1<<TXEN);// | (1<<RXCIE); } uint8_t UartStd::read(bool* status) const { uint8_t readed,data; while (((readed=*(UCSRA)) & RX_COMPLETE )==0) continue; data = *(UDR); if (status != NULL) { if ((readed & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0) *status = true; else *status = false; } return data; } bool UartStd::read( uint8_t timeout_ms, uint8_t* data) const { uint8_t readed; TCCR1B = 0; //set NO CLOCK TCCR1A=0, TCCR1B = 0b101; TCNT1 =(uint16_t) 0; //Clear counter OCR1A = (uint16_t) (timeout_ms << 3); //set number of cycles to compare (with PRESCALER 1024 set on 0b101<<CS0) 8 = 7.8 = /1000f * F_CPU/1024f; if(TIFR1 & (1<<OCF1A)) TIFR1 = 1<<OCF1A; //Clear compare flag TCCR1B = 0b101; //set PRESCALER 1024 while (((readed=*(UCSRA)) & RX_COMPLETE )==0){ if(TIFR1 & (1<<OCF1A)){ //Check for compare flag each cycle TCCR1B = 0; //set NO CLOCK TIFR1 = 1<<OCF1A; return false; } } TCCR1B = 0; //set NO CLOCK} *data = *UDR; if (readed & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN)) return false; return true; } void UartStd::read_stream( uint8_t& size , uint8_t* data, uint8_t timeout_byte) const { uint8_t sizemax = size; data[0]=read(); for(size = 1; size < sizemax; size++) if(!read(timeout_byte,data+size)) break; } void UartStd::send(uint8_t data) const{ *(UCSRA) |= (1<<TXC); while ((*(UCSRA) & DATA_REGISTER_EMPTY)==0); *(UDR) = data; } bool UartStd::transmit_ongoing( void ) const { if ((*(UCSRA) & (1<<TXC)) == 0) return true; else { *(UCSRA) |= (1<<TXC); return false; } } void UartStd::flush( void ) const { uint8_t dummy; while (*UCSRA & RX_COMPLETE) dummy = *UDR; } }
5a1fad708c317cdc5cdf25f0361a8b11cc352b62
e3b135c2c94dd50e7a1f4d65cf8d28100aa5c181
/sensor/include/httpSession.h
fb130002883d51fb2d6b07ecdc27aba37196f223
[]
no_license
bkochergin/net_sensor
ec488bf1b201e173c1a5b9d9d9b19b79f6126d3f
f69cbde8d716d8a1e0a90a0f4c37bc3a93faf2a1
refs/heads/master
2020-04-02T20:33:25.612756
2016-02-27T16:38:31
2016-02-27T16:38:31
64,683,459
0
0
null
null
null
null
UTF-8
C++
false
false
2,460
h
httpSession.h
/* * Copyright 2010-2015 Boris Kochergin. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef HTTP_SESSION_H #define HTTP_SESSION_H #include <string> #include <utility> #include <vector> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #ifdef __FreeBSD__ #include <netinet/if_ether.h> #endif #ifdef __linux__ #include <netinet/ether.h> #endif #include <include/httpParser.h> #include <include/timeStamp.h> enum HTTPMessageState { NO_STATE, PATH_STATE, URL_STATE, HEADER_FIELD_STATE, HEADER_VALUE_STATE, COMPLETE_STATE }; struct HTTPMessage { HTTPMessage(const http_parser_type &_type, const TimeStamp &_time); http_parser_type type; TimeStamp time; std::vector <std::string> message; std::vector <std::pair <std::string, std::string>> headers; }; struct HTTPSession { HTTPSession(); TimeStamp time; char clientMAC[ETHER_ADDR_LEN]; char serverMAC[ETHER_ADDR_LEN]; uint32_t clientIP; uint32_t serverIP; uint16_t clientPort; uint16_t serverPort; http_parser parsers[2]; HTTPMessageState requestState; HTTPMessageState responseState; std::vector <HTTPMessage> requests; std::vector <HTTPMessage> responses; }; #endif
34f98862ab658740c8631d92d52738e0e9d04d13
634120df190b6262fccf699ac02538360fd9012d
/Develop/Server/GameServer/unittest/TestFactionSystem.cpp
43d9275c2393600652daeb31e7c8b7b61fca1ae6
[]
no_license
ktj007/Raiderz_Public
c906830cca5c644be384e68da205ee8abeb31369
a71421614ef5711740d154c961cbb3ba2a03f266
refs/heads/master
2021-06-08T03:37:10.065320
2016-11-28T07:50:57
2016-11-28T07:50:57
74,959,309
6
4
null
2016-11-28T09:53:49
2016-11-28T09:53:49
null
UHC
C++
false
false
7,335
cpp
TestFactionSystem.cpp
#include "stdafx.h" #include "GUTHelper.h" #include "GEntityPlayer.h" #include "MockField.h" #include "GPlayerFactions.h" #include "GFactionInfo.h" #include "GFactionSystem.h" #include "CSFactionCalculator.h" #include "MockLink.h" #include "CCommandTable.h" #include "GDuel.h" #include "GBattleArenaMgr.h" #include "GMatchRule_SameTeamMember.h" #include "GConst.h" #include "GPlayerBattleArena.h" #include "GEntityNPC.h" #include "GEntityNPC.h" #include "GTestForward.h" #include "GHateTable.h" #include "GConfig.h" SUITE(FactionSystem) { struct Fixture { Fixture() { m_pField = GUTHelper_Field::DefaultMockField(); m_pPlayer = GUTHelper::NewEntityPlayer(m_pField); m_pFactionInfo = test.faction.NewFactionInfo(CSFactionCalculator::GetNormalMaxQuantity()); GConfig::m_strAutoTestType = L""; } virtual ~Fixture() { m_pField->Destroy(); } GUTHelper m_Helper; MockField* m_pField; GEntityPlayer* m_pPlayer; GFactionInfo* m_pFactionInfo; DECLWRAPPER_NPCInfoMgr; DECLWRAPPER_FieldInfoMgr; DECLWRAPPER_FactionInfoMgr; DECLWRAPPER_FactionRelationInfoMgr; }; namespace Increase { // 이미 최대량인 경우 TEST_FIXTURE(Fixture, CurrentQuantityIsMax) { m_pPlayer->GetPlayerFactions().Increase(m_pFactionInfo->m_nID, CSFactionCalculator::GetMaxQuantity() - m_pFactionInfo->m_nDefaultQuantity); uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nIncreaseQuantity = 100; CHECK_EQUAL(true, gsys.pFactionSystem->Increase(m_pPlayer, m_pFactionInfo->m_nID, nIncreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity, nAfterFactionQuantity); } // 증가시키려는 량이 0인 경우 TEST_FIXTURE(Fixture, IncreaseQuantityIsZero) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nIncreaseQuantity = 0; CHECK_EQUAL(true, gsys.pFactionSystem->Increase(m_pPlayer, m_pFactionInfo->m_nID, nIncreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity, nAfterFactionQuantity); } // 증가시키면 최대량보다 큰 경우 TEST_FIXTURE(Fixture, BiggerThanMaxQuantity) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nIncreaseQuantity = CSFactionCalculator::GetMaxQuantity() - nBeforeFactionQuantity + 1; CHECK_EQUAL(true, gsys.pFactionSystem->Increase(m_pPlayer, m_pFactionInfo->m_nID, nIncreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(CSFactionCalculator::GetMaxQuantity(), nAfterFactionQuantity); } TEST_FIXTURE(Fixture, Normal) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nIncreaseQuantity = 100; CHECK_EQUAL(true, gsys.pFactionSystem->Increase(m_pPlayer, m_pFactionInfo->m_nID, nIncreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity + nIncreaseQuantity, nAfterFactionQuantity); } // 팩션의 수치의 퍼센트가 올라간 경우 TEST_FIXTURE(Fixture, IncreaseFactionQuantityPercent) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nIncreaseQuantity = 1000; MockLink* pLink = m_Helper.NewLink(m_pPlayer); CHECK_EQUAL(true, gsys.pFactionSystem->Increase(m_pPlayer, m_pFactionInfo->m_nID, nIncreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity + nIncreaseQuantity, nAfterFactionQuantity); CHECK_EQUAL(1, pLink->GetCommandCount()); CHECK_EQUAL(MC_FACTION_INCREASE, pLink->GetCommand(0).GetID()); CHECK_EQUAL(m_pFactionInfo->m_nID, pLink->GetParam<uint8>(0, 0)); CHECK_EQUAL(m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID), pLink->GetParam<uint16>(0, 1)); } } namespace Decrease { // 이미 최소량인 경우 TEST_FIXTURE(Fixture, CurrentQuantityIsMin) { m_pPlayer->GetPlayerFactions().Decrease(m_pFactionInfo->m_nID, m_pFactionInfo->m_nDefaultQuantity); uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nDecreaseQuantity = 100; CHECK_EQUAL(true, gsys.pFactionSystem->Decrease(m_pPlayer, m_pFactionInfo->m_nID, nDecreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity, nAfterFactionQuantity); } // 감소시키려는 량이 0인 경우 TEST_FIXTURE(Fixture, DecreaseQuantityIsZero) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nDecreaseQuantity = 0; CHECK_EQUAL(true, gsys.pFactionSystem->Decrease(m_pPlayer, m_pFactionInfo->m_nID, nDecreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity, nAfterFactionQuantity); } // 감소시키면 최소량보다 작은 경우 TEST_FIXTURE(Fixture, SmallerThanMinQuantity) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nDecreaseQuantity = nBeforeFactionQuantity - CSFactionCalculator::GetMinQuantity() + 1; CHECK_EQUAL(true, gsys.pFactionSystem->Decrease(m_pPlayer, m_pFactionInfo->m_nID, nDecreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(CSFactionCalculator::GetMinQuantity(), nAfterFactionQuantity); } TEST_FIXTURE(Fixture, Normal) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nDecreaseQuantity = 100; CHECK_EQUAL(true, gsys.pFactionSystem->Decrease(m_pPlayer, m_pFactionInfo->m_nID, nDecreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity - nDecreaseQuantity, nAfterFactionQuantity); } // 팩션의 수치의 퍼센트가 내려간 경우 TEST_FIXTURE(Fixture, DecraseFactionQuantityPercent) { uint16 nBeforeFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); uint16 nDecreaseQuantity = 1000; MockLink* pLink = m_Helper.NewLink(m_pPlayer); CHECK_EQUAL(true, gsys.pFactionSystem->Decrease(m_pPlayer, m_pFactionInfo->m_nID, nDecreaseQuantity)); uint16 nAfterFactionQuantity = m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID); CHECK_EQUAL(nBeforeFactionQuantity - nDecreaseQuantity, nAfterFactionQuantity); CHECK_EQUAL(1, pLink->GetCommandCount()); CHECK_EQUAL(MC_FACTION_DECREASE, pLink->GetCommand(0).GetID()); CHECK_EQUAL(m_pFactionInfo->m_nID, pLink->GetParam<uint8>(0, 0)); CHECK_EQUAL(m_pPlayer->GetPlayerFactions().GetQuantity(m_pFactionInfo->m_nID), pLink->GetParam<uint16>(0, 1)); } } }
a4af9561bc662e92fc84d2062c3a847806d37ccf
ba55857fbe5dace2baa61089d05e3f35aeb685a7
/Deuterium/DeuteriumRenderer/d_error_stack.h
cf016dea79fcded0cff34400b3da95a77d535f24
[]
no_license
niofire/Deuterium-Engine
6a9d6af8abc7e5e9af256ca9cc0e2648c5c5651d
8289ab27cfc35b94d645deaf8ef9d0105bbb10c7
refs/heads/master
2020-03-31T00:48:38.385350
2015-01-12T20:04:39
2015-01-12T20:04:39
19,597,136
1
1
null
null
null
null
UTF-8
C++
false
false
713
h
d_error_stack.h
#pragma once #include <stack> #define D_ERROR(X) dErrorStack::get_instance().push(dError(X)); namespace deuterium { class dError { public: dError(const char* msg) { _msg = std::string(msg); } dError(std::string msg) { _msg = msg; } ~dError(void) {}; const char* get_message() { return _msg.c_str();} private: std::string _msg; }; class dErrorStack { public: dErrorStack(); ~dErrorStack(); static dErrorStack& get_instance() { return _stack;} bool empty(); void clear(); std::string pop(); void push(dError err); void push(const std::string& err_msg) { this->push(dError(err_msg));} private: static dErrorStack _stack; std::stack<dError> _error_stack; }; }
c8ff9f8bc7f2631d4aef94a9ae845eeb57dab753
34ccf820d90c1acdc54d975bc6d66b408cd0d034
/include/iConsumer.h
996cacb5cad28acbc4dd51ce60ee17ab23eb6a36
[ "MIT" ]
permissive
tompatman/zmqplus
59dccab685aa26859f4a69f93788240389aeb533
efea491f2e9ca8f531ec7e102564fb56b1d62e0f
refs/heads/master
2022-12-14T10:02:24.298267
2020-09-08T21:11:45
2020-09-08T21:11:45
292,928,518
0
0
null
null
null
null
UTF-8
C++
false
false
451
h
iConsumer.h
/* * iConsumer.h * * Created on: May 31, 2013 * Author: service */ #ifndef ICONSUMER_H_ #define ICONSUMER_H_ #include "zmq.hpp" class iConsumer { public: iConsumer() {}; virtual ~iConsumer() {}; virtual void setup_que(int timeout_ms = 500) = 0; // Returns true if there was an update. virtual bool update_data_share() = 0; virtual zmq::socket_t *get_sub_socket_for_poll() = 0; }; #endif /* ICONSUMER_H_ */
2a84ba9d7a08c3907ff080b614c634ce34655145
e37a4775935435eda9f176c44005912253a720d8
/datadriven/src/sgpp/datadriven/algorithm/DBMatOffline.hpp
814aab30d61e8ba9bf9547db4aabf468faceb30a
[]
no_license
JihoYang/SGpp
b1d90d2d9e8f8be0092e1a9fa0f37a5f49213c29
7e547110584891beed194d496e23194dd90ccd20
refs/heads/master
2020-04-25T10:27:58.081281
2018-09-29T19:33:13
2018-09-29T19:33:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,943
hpp
DBMatOffline.hpp
// Copyright (C) 2008-today The SG++ project // This file is part of the SG++ project. For conditions of distribution and // use, please see the copyright notice provided with SG++ or at // sgpp.sparsegrids.org #pragma once #include <sgpp/base/grid/Grid.hpp> #include <sgpp/datadriven/configuration/DensityEstimationConfiguration.hpp> #include <sgpp/datadriven/configuration/RegularizationConfiguration.hpp> #include <list> #include <string> #include <vector> namespace sgpp { namespace datadriven { using sgpp::base::Grid; using sgpp::base::DataVector; using sgpp::base::DataMatrix; /** * Class that is used to decompose and store the left-hand-side * matrix for the density based classification approach * (The classification is divided into two parts: the offline step that does not * depend on the actual data and the online step that depends on the data). * Uses Gnu Scientific Library (GSL). */ class DBMatOffline { public: /** * Constructor * Build DBMatOffline Object from configuration * * @param gridConfig The configuration of the grid * @param adaptivityConfig The configuration of the grid adaptivity * @param regularizationConfig The configuration of the grid regularization * @param densityEstimationConfig The configuration of the matrix decomposition */ explicit DBMatOffline( const sgpp::base::RegularGridConfiguration& gridConfig, const sgpp::base::AdpativityConfiguration& adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration& regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration& densityEstimationConfig); /** * Constructor * Create offline object from serialized offline object * * @param fileName path to the file that stores serialized offline object */ explicit DBMatOffline(const std::string& fileName); /** * Copy Constructor * * @param rhs Object to copy */ DBMatOffline(const DBMatOffline& rhs); /** * Default move constructor */ DBMatOffline(DBMatOffline&& rhs) = default; /** * Default virtual destructor */ virtual ~DBMatOffline() = default; /** * Default copy assign operator */ DBMatOffline& operator=(const DBMatOffline& rhs); /** * Default move assign operator */ DBMatOffline& operator=(DBMatOffline&& rhs) = default; /** * Interface for the clone idiom * @return a copy of this very object as a pointer to a new DBMatOffline object which is owned by * the caller. */ virtual DBMatOffline* clone() = 0; /** * Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined * @return true if object can be refined, else false; */ virtual bool isRefineable() = 0; /** * Get a reference to the grid configuration object * @return Grid configuration object */ sgpp::base::RegularGridConfiguration& getGridConfig(); /** * Get a reference to the grid adaptivity configuration object * @return Grid adaptivity configuration object */ sgpp::base::AdpativityConfiguration& getAdaptivityConfig(); /** * Get a reference to the grid regularization configuration object * @return Grid regularization configuration object */ sgpp::datadriven::RegularizationConfiguration& getRegularizationConfig(); /** * Get a reference to the matrix decomposition configuration object * @return Matrix decomposition configuration object */ sgpp::datadriven::DensityEstimationConfiguration& getDensityEstimationConfig(); /** * Get a reference to the decomposed matrix. Throws if matrix has not yet been decomposed. * * @return decomposed matrix */ DataMatrix& getDecomposedMatrix(); /** * Allows access to lhs matrix, which is meant ONLY FOR TESTING */ DataMatrix& getLhsMatrix_ONLY_FOR_TESTING(); /** * Returns a reference to the sparse grid * @return grid */ Grid& getGrid(); /** * Builds the right hand side matrix with or without the regularization term depending on the type * of decomposition */ virtual void buildMatrix(); /** * Decomposes the matrix according to the chosen decomposition type. * The number of rows of the stored result depends on the decomposition type. */ virtual void decomposeMatrix() = 0; /** * Prints the matrix onto standard output */ void printMatrix(); /** * Serialize the DBMatOffline Object * @param fileName path where to store the file. */ virtual void store(const std::string& fileName); /** * Sets interaction Term * @param interactions Interaction terms used for geometrically aware grids */ void setInter(std::vector<std::vector <size_t>> interactions); protected: DBMatOffline(); // configuration of the grid sgpp::base::RegularGridConfiguration gridConfig; // config of the grid adaptivity sgpp::base::AdpativityConfiguration adaptivityConfig; // config of the grid regularization sgpp::datadriven::RegularizationConfiguration regularizationConfig; // config of the matrix decomposition sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig; DataMatrix lhsMatrix; // stores the (decomposed) matrix bool isConstructed; // If the matrix was built bool isDecomposed; // If the matrix was decomposed /** * An offline object works on a hierarchical basis grid. */ std::unique_ptr<Grid> grid; public: // vector of interactions (if size() == 0: a regular SG is created) std::vector<std::vector <size_t>> interactions; protected: /** * Build the initial sparse grid */ void InitializeGrid(); /** * Read the configuration from a serialized DBMatOffline object. * * @param fileName path of the serialized DBMatOffline object * @param gridConfig The configuration of the grid of the file to populate * @param adaptivityConfig The configuration of the grid adaptivity of the file to populate * @param regularizationConfig The configuration of the grid regularization of the file to populate * @param densityEstimationConfig The configuration of the matrix decomposition of the file to populate */ void parseConfig(const std::string& fileName, sgpp::base::RegularGridConfiguration& gridConfig, sgpp::base::AdpativityConfiguration& adaptivityConfig, sgpp::datadriven::RegularizationConfiguration& regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration& densityEstimationConfig) const; /** * Read the Interactionsterms from a serialized DBMatOfflibe object. * @param fileName path of the serialized DBMatOffline object * @param interactions the interactions to populate */ void parseInter(const std::string& fileName, std::vector<std::vector<size_t>>& interactions) const; }; } // namespace datadriven } // namespace sgpp
cc97e1300baad7aeec5352a8144a8fc4028d1e28
12e61197f435a7a32e50db23cb0570deba8dabe2
/components/Schedule.hpp
32bc6f59c11718897a76d52230c5bc07559faf65
[]
no_license
bsloan334/WaffleSupreme
09eebb88abcf1116f443ceed85dfb3457d628c7e
d278831319eead21774cea977b480a6aa32f1e04
refs/heads/master
2021-05-02T10:23:10.874188
2018-04-23T19:30:39
2018-04-23T19:30:39
120,793,618
0
0
null
2018-03-03T14:48:22
2018-02-08T17:25:38
C++
UTF-8
C++
false
false
515
hpp
Schedule.hpp
#pragma once #include <cstdlib> #include <cstdint> using namespace std; // // Record of process time requirements, priority, and remaining process time used for CPU scheduling // class Schedule { public: Schedule() { } Schedule(int burst, int p, string queue, int slice, int remain) : burstTime(burst), priority(p), queueType(queue), timeSlice(slice), timeRemaining(remain) { } private: int32_t burstTime; int32_t priority; string queueType; int32_t timeSlice; int32_t timeRemaining; };
3acc9db1ce5bce5f8406005003b55eae09335064
b0576ba30cba77196caa2260bd5ed7a64f665cf5
/libs/util/file_util.h
fe16a7f8eeca4fed03f65afb9706432975ccaa48
[]
no_license
oj-lappi/viz-openGL
54e68ceca76b57e4900a4eb4f19b87391c357b87
2313867c28805e8a3a85ac2e0da2be41bc5d1b03
refs/heads/master
2021-09-08T23:12:39.469425
2018-03-12T20:22:42
2018-03-12T20:22:42
116,152,043
0
0
null
null
null
null
UTF-8
C++
false
false
1,477
h
file_util.h
#include <string> #include <fstream> #include <iostream> #include <sstream> #include <limits> std::string readFile(const char *filePath) { std::string content; std::ifstream fileStream(filePath, std::ios::in); if(!fileStream.is_open()) { std::cerr << "Could not read file " << filePath << ". File does not exist." << std::endl; return ""; } std::string line = ""; while(std::getline(fileStream, line)){ content+= line+ "\n"; } content += "\0"; fileStream.close(); return content; } static std::string read_shader_file (const char *shader_file) { // no feedback is provided for stream errors / exceptions. std::ifstream file (shader_file); if (!file) return std::string (); file.ignore(std::numeric_limits<std::streamsize>::max()); auto size = file.gcount(); if (size > 0x10000) // 64KiB sanity check for shaders: return std::string (); file.clear(); file.seekg(0, std::ios_base::beg); std::stringstream sstr; sstr << file.rdbuf(); file.close(); return sstr.str(); } const char* read_ascii_2_char(const char *path) { std::ifstream file (path, std::ios::in|std::ios::binary|std::ios::ate); if (file.is_open()) { file.seekg(0, std::ios::end); int size = file.tellg(); char *contents = new char [size]; file.seekg (0, std::ios::beg); file.read (contents, size); file.close(); contents[size] = '\0'; return contents; } }
6f16256d2b93a29ede6b5f04072b1c9da1982a9d
fa5c9dc51e372dc66396ad695459f8ecaef75811
/src/Menge/MengeVis/Viewer/ViewConfig.h
e38b3befed4cea17ec76e1562a53d2b51fefb6cb
[ "Apache-2.0" ]
permissive
zchenpds/Menge
e8bdb1a0655ac818ed0d4f169720b6a6bef3d16a
ba32a9c05ecddbd21def21cd9c725ddeb461e86f
refs/heads/master
2021-01-22T07:58:57.687690
2017-04-23T16:18:27
2017-04-23T16:18:27
92,593,508
1
0
null
2017-05-27T11:06:25
2017-05-27T11:06:25
null
UTF-8
C++
false
false
6,621
h
ViewConfig.h
/* Menge Crowd Simulation Framework Copyright and trademark 2012-17 University of North Carolina at Chapel Hill Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 or LICENSE.txt in the root of the Menge repository. Any questions or comments should be sent to the authors menge@cs.unc.edu <http://gamma.cs.unc.edu/Menge/> */ /*! * @file ViewConfig.h * @brief Specification for parsing the view configuration file. */ #ifndef __VIEW_CONFIG_H__ #define __VIEW_CONFIG_H__ #include <string> #include <vector> #include "MengeVis/VisConfig.h" #include "MengeVis/SceneGraph/GLCamera.h" #include "MengeVis/SceneGraph/GLLight.h" #include "MengeCore/Runtime/Logger.h" namespace MengeVis { namespace Viewer { // forward declarations class Watermark; /*! * @brief A set of parameters specifying a single camera. */ class CameraParam { public: /*! * @brief Default constructor. */ CameraParam() { _posX = _posY = _tgtX = _tgtY = _tgtZ = 0.0f; _posZ = 10.f; _farPlane = 200.f; _nearPlane = 0.01f; _orthoScale = 1.f; _fov = 0.f; _projType = SceneGraph::GLCamera::ORTHO; } /*! * @brief Camera x-position in world space. */ float _posX; /*! * @brief Camera y-position in world space. */ float _posY; /*! * @brief Camera z-position in world space. */ float _posZ; /*! * @brief Camera's target x-position in world space. */ float _tgtX; /*! * @brief Camera's target y-position in world space. */ float _tgtY; /*! * @brief Camera's target z-position in world space. */ float _tgtZ; /*! * @brief Distance to camera's far plane. */ float _farPlane; /*! * @brief Distance to camera's near plane. */ float _nearPlane; /*! * @brief The "scale" factor applid to the camera in orthographic view. */ float _orthoScale; /*! * @brief The camera's horizontal field of view (in degrees). */ float _fov; /*! * @brief The camera's projection type (perspective or orthographic). * * @see SceneGraph::GLCamera */ SceneGraph::GLCamera::CamEnum _projType; }; //////////////////////////////////////////////////////////////////////////// /*! * @brief A set of parameters specifying a single light */ class LightParam { public: /*! * @brief Default constructor. */ LightParam() { _r = _g = _b = 1.f; _x = _y = _z = 1.f; _w = 0.f; // 0 --> directional, 1 --> point } /*! * @brief The red channel of the light's diffuse color. */ float _r; /*! * @brief The green channel of the light's diffuse color. */ float _g; /*! * @brief The blue channel of the light's diffuse color. */ float _b; /*! * @brief The alpha channel of the lights' diffuse color. */ float _a; /*! * @brief The x-value of the light position */ float _x; /*! * @brief The y-value of the light position */ float _y; /*! * @brief The z-value of the light position */ float _z; /*! * @brief The w-value of the light position. Determines if the light * Is a point or directional light. */ float _w; /*! * @brief The space in which the light lives. */ SceneGraph::GLLight::LightSpace _space; }; //////////////////////////////////////////////////////////////////////////// /*! * @brief The specification of an OpenGL GLViewer for a scene * * @see GLViewer */ class MENGEVIS_API ViewConfig { public: /*! * @brief Default constructor. */ ViewConfig(); /*! * @brief Destructor. */ ~ViewConfig(); /*! * @brief Parses the XML configuration file. * * @param fileName The name of the view configuration file to parse. * @returns A boolean reporting success (true) or failure (false). */ bool readXML( const std::string & fileName ); /*! * @brief Sets the view configuration to a set of default values. */ void setDefaults(); /*! * @brief Set the camera properties based on the configuration * * @param camera The camera to set * @param i The index of the camera */ void setCamera( SceneGraph::GLCamera & camera, size_t i=0 ) const; /*! * @brief Sets the vector of cameras based on the camera specifications * * @param cameras A vector to populate with cameras. Any pre-existing cameras * will be deleted. */ void setCameras( std::vector< SceneGraph::GLCamera > & cameras ) const; /*! * @brief Set the light properties based on the configuration * * @param light The light to set * @param i The index of the light specification to apply */ void setLight( SceneGraph::GLLight & light, size_t i=0 ) const; /*! * @brief Sets the vector of lights based on the light specifications * * @param lights A vector to populate with lights. Any pre-existing lights * will be deleted. */ void setLights( std::vector< SceneGraph::GLLight > & lights ) const; /*! * @brief The folder the view configuration file is located in. */ std::string _viewFldr; /*! * @brief Width of viewport (in pixels). */ int _width; /*! * @brief Height of viewport (in pixels). */ int _height; /*! * @brief The name of the background image to use. */ std::string _bgImg; /*! * @brief The optional watermark. */ Watermark * _waterMark; /*! * @brief Font name. */ std::string _fontName; /*! * @brief Default font color. */ float _fontColor[4]; /*! * @brief The set of cameras for the configuration */ std::vector< CameraParam > _camSpecs; /*! * @brief The set of cameras for the configuration */ std::vector< LightParam > _lightSpecs; }; } // namespace Viewer } // namespace MengeVis /*! * @brief Streaming output operator to display configuration specification. * * @param out The output stream to which to write the view configuration. * @param cfg The configuration to convert to a string. * @returns The output stream. */ MENGEVIS_API Menge::Logger & operator<< ( Menge::Logger & out, const MengeVis::Viewer::ViewConfig & cfg ); #endif // __VIEW_CONFIG_H__
0020f8ef6ff881de14005fbe44580bb5cfa01b37
4de452c3335e71de23fbb26fc507de715e23a663
/ch5/main.cpp
293c69036d8265d762ee7b82e0ee5204402e4359
[]
no_license
liuxuanhai/Cpp-Concurrency
254759f6ecfcab5c4596aa5c16c367f4cc798988
b1fd8fb01bf1f7acd34e7e72160d89777ea19d36
refs/heads/master
2020-07-20T20:30:25.447364
2017-03-22T12:37:38
2017-03-22T12:37:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
451
cpp
main.cpp
#include <iostream> #include <atomic> #include <thread> #include <vector> using namespace std; vector<int> data; atomic<bool> dataReady(false); void read() { while (!dataReady.load()) { this_thread::sleep_for(chrono::milliseconds(1)); } cout << data[0] << endl; } void write() { data.push_back(1); dataReady = true; } int main() { thread readThread(read); thread writeThread(write); readThread.join(); writeThread.join(); return 0; }
73fd21ec2109d6272f36ee0dbeae79a2a920932e
08ebe9d447f28f94e90578ec0a9567f92c508afc
/HuaweiModbus/serialport.h
ee1daae5379dcd04cbc9e0737fbf80655d7dc39b
[]
no_license
ChinaClever/CleverTool
bfaab789dcbd3944b3429a0489e0f38e6b228879
de268c48bc4ae39d9feb9e1d94e8f5e128d307b7
refs/heads/master
2022-11-25T16:52:11.962347
2021-09-14T06:26:27
2021-09-14T06:26:27
84,779,412
2
3
null
null
null
null
UTF-8
C++
false
false
549
h
serialport.h
#ifndef SERIALPORT_H #define SERIALPORT_H #include <QtGui> #include <QtCore> #include <QSerialPort> class SerialPort : public QThread { Q_OBJECT explicit SerialPort(QObject *parent = nullptr); public: static SerialPort *bulid(QObject *parent = nullptr); bool open(const QString &name,qint32 baudRate = QSerialPort::Baud19200); bool transmit(const QByteArray &witeArray, int msecs=1); signals: protected slots: void writeSlot(); private: QSerialPort *mSerial; QByteArray mWriteArrays; }; #endif // SERIALPORT_H
477e9ab1a59298e00c50eaa8b652fe9a2b805e16
b384c68c73ce159f40777f06b7cca0b81eb8a969
/slot.cpp
965755064eb2299cbce232b66369c209daf7ae04
[]
no_license
barraemme/bonsai-care
57a6d0d5d1ae81a5cba698061ce5f69c970beff6
8fd5694135db33bf0448d5dcb72c758eca4c184d
refs/heads/master
2021-01-10T23:32:22.300657
2012-03-16T14:10:17
2012-03-16T14:10:17
3,253,829
0
0
null
null
null
null
UTF-8
C++
false
false
3,036
cpp
slot.cpp
/** * Copyright (c) 2011 Nokia Corporation. */ // Class header #include "slot.h" // Platform includes #include <QtCore/QDebug> /*! \class Slot \brief Slot depicts one calendar event, which can span over multiple hours. */ Slot::Slot(const int bonsaiId, const QDate &day, OperationModel* operationModel, QObject *parent) : QObject(parent), m_bonsai_id(bonsaiId), m_date(day), m_operation_model(operationModel) { qDebug() << "created Slot " << bonsaiId << " - " << day; } Slot::~Slot() { } QDate Slot::date() const { return m_date; } OperationModel * Slot::operations() { return m_operation_model; } /* bool Slot::setStartTime(const QTime &time) { if (time != m_start) { m_start = time; emit dataChanged(); return true; } return false; } bool Slot::setItemData(const QString &data) { if (data != m_data) { m_data = data; // Uncomment, if you want debug output of the event's description changes. // qDebug() << "Item data changed to: " << data; emit dataChanged(); return true; } return false; } bool Slot::setHourSpan(int hours) { if (hours != m_hours) { qDebug() << "Slot::setHourSpan():" << hours << "(on item" << m_hourId << ")"; m_hours = hours; emit dataChanged(); return true; } return false; } QString Slot::startTime() const { return m_start.toString("HH:mm"); } QString Slot::endTime() const { // Add the hourSpan to the start time in seconds, and return the end time! QTime endTime = m_start.addSecs(60*60*hourSpan()); return endTime.toString("HH:mm"); } QString Slot::itemData() const { return m_data; } int Slot::hourSpan() const { return m_hours; } QString Slot::toString() const { return startTime() + ": " + itemData(); } bool Slot::setSpanStatus(bool spanned, int parentIndex) { qDebug() << "setSpanStatus:" << spanned << "on Item:" << m_hourId << "with parentIndex:" << parentIndex; m_spanned = spanned; if (m_spanned) { m_parentIndex = parentIndex; } else { m_parentIndex = -1; } emit dataChanged(); return true; } bool Slot::spanned() const { return m_spanned; } int Slot::parentIndex() const { return m_parentIndex; } int Slot::hourId() const { return m_hourId; } QDataStream &operator<<(QDataStream &stream, const Slot &Slot) { stream << Slot.m_hourId; stream << Slot.m_start; stream << Slot.m_data; stream << Slot.m_hours; stream << Slot.m_spanned; stream << Slot.m_parentIndex; return stream; } QDataStream &operator>>(QDataStream &stream, Slot &Slot) { stream >> Slot.m_hourId; stream >> Slot.m_start; stream >> Slot.m_data; stream >> Slot.m_hours; stream >> Slot.m_spanned; stream >> Slot.m_parentIndex; return stream; } */
8da102dbcc4ed2bf01acec11c8256cb5745e47d3
eab6cb92bc3e3ba8efba85ef95b70eb1b5b1ee37
/src/ofApp.h
68276d13f54bd98b785096eee1b7070f33945f6f
[]
no_license
jaysonh/MBJ_Performance
099868159f37168ca2d44a08b6245c47bca8c4d2
c083fb14042125227416155c5cc16bf175e8c773
refs/heads/master
2020-05-24T17:22:24.714701
2019-06-03T21:35:30
2019-06-03T21:35:30
187,382,310
0
0
null
null
null
null
UTF-8
C++
false
false
2,709
h
ofApp.h
#pragma once #include "ofMain.h" #include "LaserManager.hpp" #include "Timeline.hpp" #include "ofxGui.h" #include "OscManager.hpp" #include "DEFINITIONS.h" #include "SyphonManager.h" #include "DualLaserManager.h" #include "DMXHandler.h" #define WINDOW_WIDTH 1280 #define WINDOW_HEIGHT 640 class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseEntered(int x, int y); void mouseExited(int x, int y); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void laserResetBtnPressed(); void testPatternBtnPressed(); void startPerformanceBtnPressed(); void loadKeystone(); void saveKeystone(); void resetKeystone(); void timeSourceAbletonPressed(); void timeSourceStartPressed(); void timeSourceSelectionPressed(); void exit(); void audioIn(float * input, int bufferSize, int nChannels); SyphonManager syphonManager; ofTrueTypeFont font; ofTrueTypeFont fontBig; //LaserManager laserManager; DualLaserManager dualLaserManager; ofxIlda::Frame warpedFrame; Timeline timeline; ofxPanel gui; ofxPanel guiKeystone; ofxFloatSlider microphoneDamp; ofxFloatSlider microphoneMult; ofxButton testPatternCentreBtn; ofxButton laserResetCentreBtn; ofxButton laserResetLeftBtn; ofxButton testPatternLeftBtn; ofxButton laserResetRightBtn; ofxButton testPatternRightBtn; ofxButton blankLaserBtn; ofxButton noEffectBtn; ofxButton startPerformanceBtn; ofxButton timeSourceAbleton; ofxButton timeSourceStart; ofxButton startFromSelectedBtn; ofxButton loadKeystoneBtn; ofxButton saveKeystoneBtn; ofxButton resetKeystoneBtn; ofxButton revertStartBtn; ofxButton clearOffsetBtn; ofxButton skipBackBtn; ofxButton skipForwardBtn; ofxIntSlider startTimeMinSlider; ofxIntSlider startTimeSecSlider; ofSoundStream soundStream; OscManager oscManager; DMXHandler dmxHandler; shared_ptr<vector <float>>audioVals; float curVol = 0.0; };
5e5bd9556ea9f892b15d8998be40f23289a9e764
808a2fa8c5dab511aaa9e29139f3d6cd3c8e5137
/deep8/src/math/Random.cpp
b37d614a08b0227169ac81d21c7f57ce920ccaad
[]
no_license
amazingyyc/Deep8
a55b4fc0cae53dd6851cdb50ed1de007b1c1774e
778855cd94864cf7062719dbfabca3fab15e1a90
refs/heads/master
2020-03-28T12:55:43.862684
2019-04-08T10:48:35
2019-04-08T10:48:35
148,347,819
6
0
null
2019-04-08T10:48:36
2018-09-11T16:35:41
C++
UTF-8
C++
false
false
175
cpp
Random.cpp
#include "math/Uniform.h" #include "math/Random.h" namespace Deep8 { namespace Math { void Random(Tensor &x, float lower, float upper) { Uniform(x, lower, upper); } } }
b10b6135cf9f72c404373eb33290010700999884
bebdd97d5a58216cf6f929f93119a1d48a6bf552
/code/Light.cpp
55418af8a11f1f5f9b1da575c80905d30ca006a1
[ "MIT" ]
permissive
Alriightyman/GameEngine
b81192f4c111912c8ae752b0f644e675ce12727e
f313db23d6aae99f8f90e6292756abe73007b56e
refs/heads/master
2021-01-01T15:34:33.299834
2020-03-09T13:44:24
2020-03-09T13:44:24
26,283,088
2
1
null
null
null
null
UTF-8
C++
false
false
2,260
cpp
Light.cpp
//////////////////////////////////////////////////////////////////////////////// // Filename: Light.cpp //////////////////////////////////////////////////////////////////////////////// #include "light.h" #include <memory> #include <iostream> namespace Engine { bool Light::isInitialized = false; Light::Light() { } Light::Light(const Light& other) { } Light::~Light() { } void Light::LoadScript(Script* script) { using namespace luabridge; script->LoadScript("Content/Scripts/Light/Light.lua"); // run initialization function. LuaRef f = getGlobal(script->GetState(),"Initialize"); if (f.isFunction()) { std::shared_ptr<luabridge::LuaRef> func = std::make_shared<LuaRef>(f); try { (*func)(this); } catch(LuaException const& e) { std::cout << "Light::LoadScript() LuaException!\n " << e.what() << std::endl; return; } } } void Light::SetSpecularColor(Color color) { m_specularColor = color; } void Light::SetSpecularPower(float power) { m_specularPower = power; } void Light::SetAmbientColor(Color color) { m_ambientColor = color; } void Light::SetDiffuseColor(Color color) { m_diffuseColor = color; return; } void Light::SetDirection(Vector3 direction) { m_direction = direction; } Color Light::GetAmbientColor() const { return m_ambientColor; } Color Light::GetDiffuseColor() const { return m_diffuseColor; } Vector3 Light::GetDirection() const { return m_direction; } Color Light::GetSpecularColor() const { return m_specularColor; } float Light::GetSpecularPower() const { return m_specularPower; } void Light::Bind(Script* script) { using namespace luabridge; if(!isInitialized) { isInitialized = true; getGlobalNamespace(script->GetState()) .beginClass<Light>("Light") .addProperty("Direction",&Light::GetDirection,&Light::SetDirection) .addProperty("AmbientColor",&Light::GetAmbientColor,&Light::SetAmbientColor) .addProperty("DiffuseColor",&Light::GetDiffuseColor,&Light::SetDiffuseColor) .addProperty("SpecularColor",&Light::GetSpecularColor,&Light::SetSpecularColor) .addProperty("SpecularPower",&Light::GetSpecularPower,&Light::SetSpecularPower) .endClass(); } } }
19764c2ce7e2a50d4f0bb7d0f3e7da6b6b7ea84a
3629482e2e187feaddc6cb3f3ad444a2bd5a95ea
/plugins/devtools/bridge/inspector/protocol/stacktrace.h
c6aa00a51efca89b08b3797c11338a48682e4787
[ "Apache-2.0" ]
permissive
jiangtao89/kraken
222a1d69450fecbdd3cbc630a2a44dad9e21bec3
2f4f9716943cd68774d77b2bff612da44d0c8913
refs/heads/main
2023-06-22T21:10:36.488206
2022-07-27T08:08:55
2022-07-27T08:08:55
360,130,160
0
0
null
null
null
null
UTF-8
C++
false
false
3,503
h
stacktrace.h
/* * Copyright (C) 2020-present The Kraken authors. All rights reserved. */ #ifndef KRAKEN_DEBUGGER_STACKTRACE_H #define KRAKEN_DEBUGGER_STACKTRACE_H #include "inspector/protocol/call_frame.h" #include "inspector/protocol/error_support.h" #include "inspector/protocol/maybe.h" #include "inspector/protocol/stacktrace_id.h" #include "kraken_foundation.h" #include <vector> namespace kraken { namespace debugger { class StackTrace { KRAKEN_DISALLOW_COPY(StackTrace); public: static std::unique_ptr<StackTrace> fromValue(rapidjson::Value *value, ErrorSupport *errors); ~StackTrace() {} bool hasDescription() { return m_description.isJust(); } std::string getDescription(const std::string &defaultValue) { return m_description.isJust() ? m_description.fromJust() : defaultValue; } void setDescription(const std::string &value) { m_description = value; } std::vector<std::unique_ptr<CallFrame>> *getCallFrames() { return m_callFrames.get(); } void setCallFrames(std::unique_ptr<std::vector<std::unique_ptr<CallFrame>>> value) { m_callFrames = std::move(value); } bool hasParent() { return m_parent.isJust(); } StackTrace *getParent(StackTrace *defaultValue) { return m_parent.isJust() ? m_parent.fromJust() : defaultValue; } void setParent(std::unique_ptr<StackTrace> value) { m_parent = std::move(value); } bool hasParentId() { return m_parentId.isJust(); } StackTraceId *getParentId(StackTraceId *defaultValue) { return m_parentId.isJust() ? m_parentId.fromJust() : defaultValue; } void setParentId(std::unique_ptr<StackTraceId> value) { m_parentId = std::move(value); } rapidjson::Value toValue(rapidjson::Document::AllocatorType &allocator) const; template <int STATE> class StackTraceBuilder { public: enum { NoFieldsSet = 0, CallFramesSet = 1 << 1, AllFieldsSet = (CallFramesSet | 0) }; StackTraceBuilder<STATE> &setDescription(const std::string &value) { m_result->setDescription(value); return *this; } StackTraceBuilder<STATE | CallFramesSet> & setCallFrames(std::unique_ptr<std::vector<std::unique_ptr<CallFrame>>> value) { static_assert(!(STATE & CallFramesSet), "property callFrames should not be set yet"); m_result->setCallFrames(std::move(value)); return castState<CallFramesSet>(); } StackTraceBuilder<STATE> &setParent(std::unique_ptr<StackTrace> value) { m_result->setParent(std::move(value)); return *this; } StackTraceBuilder<STATE> &setParentId(std::unique_ptr<StackTraceId> value) { m_result->setParentId(std::move(value)); return *this; } std::unique_ptr<StackTrace> build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class StackTrace; StackTraceBuilder() : m_result(new StackTrace()) {} template <int STEP> StackTraceBuilder<STATE | STEP> &castState() { return *reinterpret_cast<StackTraceBuilder<STATE | STEP> *>(this); } std::unique_ptr<StackTrace> m_result; }; static StackTraceBuilder<0> create() { return StackTraceBuilder<0>(); } private: StackTrace() {} Maybe<std::string> m_description; std::unique_ptr<std::vector<std::unique_ptr<CallFrame>>> m_callFrames; Maybe<StackTrace> m_parent; Maybe<StackTraceId> m_parentId; }; } // namespace debugger } // namespace kraken #endif // KRAKEN_DEBUGGER_STACKTRACE_H
4b2cb181a9fbf589619e947a882c526b08326061
e08a0f0e9421f538b053a0f02f7d3780ee2c0b35
/1062.Talent_and_Virtue.cpp
c9eefa7f4c8d668f65695da6ef7f978b92fb124b
[]
no_license
unknowndai/zju-pat
ea3eb955fde8e334592927f95f02e776c4e9fae9
f48aa87755a3cae3e575a7316b6ac775813c97d1
refs/heads/master
2016-09-05T11:58:23.299365
2015-07-16T13:58:13
2015-07-16T13:58:13
35,673,487
0
0
null
null
null
null
UTF-8
C++
false
false
1,575
cpp
1062.Talent_and_Virtue.cpp
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<vector> #include<map> #include<algorithm> using namespace std; typedef struct people { int id, talent, virtue, tol, type; people(int id, int talent, int virtue, int tol, int type) : id(id), \ talent(talent), virtue(virtue), tol(tol), type(type){} }people; int lowLine, highLine, num; vector<people> peo; int cmp(people a, people b) { if (a.type != b.type) { return a.type < b.type; }else if (a.tol != b.tol) { return a.tol > b.tol; }else if (a.virtue != b.virtue) { return a.virtue > b.virtue; }else return a.id < b.id; } int main() { #ifndef ONLINE_JUDGE freopen("/Users/jianwen/Documents/project/pat/data.txt", "r", stdin); #endif cin>>num>>lowLine>>highLine; int tmpid, tmptalent, tmpvirtue, tmptype; int nPeo = 0; for (int i = 0; i < num; ++i) { cin>>tmpid>>tmpvirtue>>tmptalent; if (tmpvirtue < lowLine || tmptalent < lowLine) { continue; } if (tmpvirtue >= highLine && tmptalent >= highLine) // sagas { tmptype = 0; }else if (tmpvirtue >= highLine) // noblemen { tmptype = 1; }else if (tmpvirtue >= tmptalent) // fool men { tmptype = 2; }else tmptype = 3; // small men peo.push_back(people(tmpid, tmptalent, tmpvirtue, tmptalent + tmpvirtue, tmptype)); nPeo++; } cout<<nPeo<<endl; sort(peo.begin(), peo.end(), cmp); for (int i = 0; i < nPeo; ++i) { printf("%08d %d %d\n", peo[i].id, peo[i].virtue, peo[i].talent); } return 0; }
75e3d5239a937da536903170167ee699a8544462
ec3de2effc71762bebba4837da269b8f9103cd76
/src/dod/barycentric.h
3e53f0add8dcac341dcf78172a507597f61edcbf
[]
no_license
mitch092/software_renderer
dbb4d49e1dbbb8f05c299922c6621794dfca1856
a476c9b44e19234b26d4d79b8c8b02a6a368c35e
refs/heads/master
2021-06-28T05:46:50.092696
2021-03-01T04:09:50
2021-03-01T04:09:50
212,499,723
1
0
null
null
null
null
UTF-8
C++
false
false
2,999
h
barycentric.h
#pragma once #include <glm/glm.hpp> #include <vector> #include "Primitives.h" #include "RectangularArray.h" // I need to optimize everything in this file more! struct BarycentricCache { BarycentricCache(const Triangle& triangle) { v0 = triangle.b - triangle.a; v1 = triangle.c - triangle.a; tria = glm::vec2(triangle.a); invDenom = 1.0f / (v0.x * v1.y - v1.x * v0.y); } glm::vec3 calculate_barycentric_coordinates(const glm::uvec2& pixel) { glm::vec2 v2 = glm::vec2(pixel) - tria; float v = (v2.x * v1.y - v1.x * v2.y) * invDenom; float w = (v0.x * v2.y - v2.x * v0.y) * invDenom; float u = 1.0f - v - w; return glm::vec3(u, v, w); } glm::vec3 v0, v1; glm::vec2 tria; float invDenom; }; /* void calculate_bcaches(const std::vector<Triangle>& triangles, const size_t& visible_triangles_size, std::vector<BarycentricCache>& bcaches) { for (size_t i = 0; i != visible_triangles_size; ++i) { glm::vec3 v0 = triangles[i].b - triangles[i].a; glm::vec3 v1 = triangles[i].c - triangles[i].a; float invDenom = 1.0f / (v0.x * v1.y - v1.x * v0.y); bcaches[i] = BarycentricCache{v0, v1, triangles[i].a, invDenom}; } } void barycentric(const std::vector<BarycentricCache>& bcaches, const JaggedArray<glm::uvec2>& pixel_list, const size_t& visible_triangles_size, JaggedArray<glm::vec3>& bcoords_per_box) { assert(bcaches.size() != 0); assert(pixel_list.size() != 0); assert(bcoords_per_box.size() != 0); assert(bcaches.size() == pixel_list.size()); assert(pixel_list.size() == bcoords_per_box.size()); for (size_t i = 0; i != visible_triangles_size; ++i) { const auto& cache = bcaches[i]; bcoords_per_box[i].clear(); for (size_t j = 0; j != pixel_list[i].size(); ++j) { // glm::vec3 v2 = glm::vec3(pixel_list[i][j], 0) - cache.tria; glm::vec2 v2 = glm::vec2(pixel_list[i][j]) - glm::vec2(cache.tria); float v = (v2.x * cache.v1.y - cache.v1.x * v2.y) * cache.invDenom; float w = (cache.v0.x * v2.y - v2.x * cache.v0.y) * cache.invDenom; float u = 1.0f - v - w; bcoords_per_box[i].emplace_back(u, v, w); } } } void barycentric_alternative(const std::vector<Triangle>& triangles, const JaggedArray<glm::uvec2>& pixel_list, const size_t& visible_triangles_size, JaggedArray<glm::vec3>& bcoords_per_box) { for (size_t i = 0; i != visible_triangles_size; ++i) { auto& tri = triangles[i]; bcoords_per_box[i].clear(); for (size_t j = 0; j != pixel_list[i].size(); ++j) { glm::vec3 vec = glm::cross(glm::vec3(tri.c.x - tri.a.x, tri.b.x - tri.a.x, tri.a.x - (float)pixel_list[i][j].x), glm::vec3(tri.c.y - tri.a.y, tri.b.y - tri.a.y, tri.a.y - (float)pixel_list[i][j].y)); float u = 1.0f - (vec.x + vec.y) / vec.z; float v = vec.y / vec.z; float w = vec.x / vec.z; bcoords_per_box[i].emplace_back(u, v, w); } } }*/
31f5bf0526555bc8b3fac48a9fffc5dfe6af105c
c002e0807aaa361c87c4a8b43bf2f53f755a1eca
/DataStruct/Chapter3-Homework/Huffman.cpp
28100cd6361c2939d6fc889b4155f7008e467fa2
[ "MIT" ]
permissive
AlongWY/HIT-WorkShop
d6f815fb9a360657f6c4a8690186e9bf4097bcca
d1b7a75493608b58c7b56f303e5996b20dd6d4c0
refs/heads/master
2022-01-18T21:38:58.214527
2021-12-29T11:40:48
2021-12-29T11:40:48
213,611,806
4
5
null
null
null
null
UTF-8
C++
false
false
6,098
cpp
Huffman.cpp
// // Created by along on 17-11-11. // #include "Huffman.h" #include <fstream> #include <sstream> #include <bitset> #include <queue> using namespace std; struct Huffman::Node { bool leaf; char data; unsigned weight; Node *parent; Node *left; Node *right; Node(char _data, unsigned _weight, Node *_left, Node *_right, bool _leaf) : data(_data), weight(_weight), left(_left), right(_right), leaf(_leaf), parent(nullptr) {}; Node(char _data, unsigned _weight, bool _leaf) : data(_data), weight(_weight), left(nullptr), right(nullptr), leaf(_leaf), parent(nullptr) {}; bool operator<(const Node &rhs) const { return weight < rhs.weight; } bool operator==(const Node &rhs) const { return leaf == rhs.leaf && data == rhs.data; } bool operator!=(const Node &rhs) const { return !(rhs == *this); } }; struct Huffman::NodeComp { bool operator()(const Node *left, const Node *right) const { return *right < *left; } }; void Huffman::makeTree(map<char, unsigned> wordsCount) { priority_queue<Node *, vector<Node *>, NodeComp> heap; //将统计数据存入优先队列 for (auto &word:wordsCount) { auto theNode = new Node(word.first, word.second, true); nodes.insert({word.first, theNode}); heap.push(theNode); } wordsCount.clear(); //构建huffman树 while (!heap.empty()) { Node *first = heap.top(); heap.pop(); if (heap.empty()) { root = first; break; } Node *second = heap.top(); heap.pop(); auto *parentNode = new Node(' ', first->weight + second->weight, first, second, false); first->parent = parentNode; second->parent = parentNode; heap.push(parentNode); } } string Huffman::getCode(char data) { auto node = nodes[data]; string code; while (node != root) { code.insert(0, node == node->parent->left ? "0" : "1"); node = node->parent; } return code; } string Huffman::encode(string &data) { makeTree(data); stringstream sStream(data); return encode(sStream); } string Huffman::decode(string &code) { string data; stringstream sStream(code); char isOne; const Node *node = root; while (sStream >> isOne) { node = isOne == '0' ? node->left : node->right; if (node->leaf) { data += node->data; node = root; } } return data; } void Huffman::encodeFile(string &in, string &out) { ifstream inFile(in); ofstream outFile(out, ios::binary); if (!inFile) { cerr << "Cant Open the File:" << in << endl; exit(EXIT_FAILURE); } if (!outFile) { cerr << "Cant Open the File:" << out << endl; exit(EXIT_FAILURE); } makeTree(inFile); string code = encode(inFile); //写入huffman重建数据 unsigned long size = nodes.size(); outFile.write((char *) &size, sizeof(size)); for (auto &pair:nodes) { outFile.write(&pair.first, sizeof(char)); outFile.write((char *) &pair.second->weight, sizeof(unsigned)); } //写入存储数据 size = code.size(); outFile.write((char *) &size, sizeof(size)); unsigned long codeToSave; for (unsigned long i = 0; i != (size / 64 * 64 + 64) - size; ++i) code += '0'; for (unsigned long i = 0; i <= size / 64; ++i) { bitset<64> toWriteByte(code.substr(i * 64, 64)); codeToSave = toWriteByte.to_ulong(); outFile.write((char *) &codeToSave, sizeof(unsigned long)); } inFile.close(); outFile.close(); } void Huffman::decodeFile(string &in, std::string &out) { ifstream file(in, ios::binary); ofstream outFile(out); if (!file) { cerr << "Cant Open the File:" << in << endl; exit(EXIT_FAILURE); } unsigned long mapSize; unsigned weight; char aChar; std::map<char, unsigned> wordsCount; file.read((char *) &mapSize, sizeof(unsigned long)); for (int i = 0; i != mapSize; ++i) { file.read(&aChar, sizeof(char)); file.read((char *) &weight, sizeof(unsigned)); wordsCount.insert({aChar, weight}); } makeTree(wordsCount); unsigned long codeSize, someCode; string code; file.read((char *) &codeSize, sizeof(unsigned long)); for (unsigned long i = 0; i <= codeSize / 64; ++i) { file.read((char *) &someCode, sizeof(unsigned long)); bitset<64> readByte(someCode); code += readByte.to_string(); } code.resize(codeSize); stringstream sStream(code); outFile << decode(code); } void Huffman::makeEmpty(Huffman::Node *&node) { if (node == nullptr) return; makeEmpty(node->left); makeEmpty(node->right); delete node; node = nullptr; } Huffman::~Huffman() { makeEmpty(root); } Huffman::Huffman() : root(nullptr) {} void Huffman::makeTree(std::string &data) { std::stringstream sStream(data); auto wordCounts = countWords(sStream); makeTree(wordCounts); } void Huffman::printCode(std::ostream &out) { unsigned long total = 0; for (auto &pair:nodes) { total += pair.second->weight; } for (auto &pair:nodes) { out << pair.first << ":" << (double) (pair.second->weight) / total << ":" << getCode(pair.first) << endl; } } std::map<char, unsigned> Huffman::countWords(std::istream &data) { char word; map<char, unsigned> wordCounts; //重置流状态 data.clear(); data.seekg(0, ios::beg); while (data.get(word)) { if (wordCounts.find(word) == wordCounts.end()) wordCounts[word] = 0; ++wordCounts[word]; } return wordCounts; } void Huffman::makeTree(std::istream &data) { auto wordCounts = countWords(data); makeTree(wordCounts); } std::string Huffman::encode(std::istream &data) { char aChar; string code; //重置流状态 data.clear(); data.seekg(0, ios::beg); while (data.get(aChar)) { code.append(getCode(aChar)); } return code; }
e6f1aa7384150b801690b1c0387363781e1222a7
5ff792d68a3852619560268c5f23f80bb3a1412f
/main_bitand_operator_used_to_define_refence.cpp
336be2474788ca386ac141ecde3aec3b78c318e6
[]
no_license
an3e/cppearls
3edeb6d4229383bc9927faea0d876d8bbb64091f
c1f2c9024e220a3292843494981a032073624542
refs/heads/master
2021-01-19T04:55:52.978093
2015-09-09T11:23:34
2015-09-09T11:23:34
39,006,803
0
0
null
null
null
null
UTF-8
C++
false
false
294
cpp
main_bitand_operator_used_to_define_refence.cpp
#include <iostream> int main(int argc, char** argv) { int x = 0x33; int bitand y = x; std::cout << "x = " << std::hex << x << "; y = " << std::hex << y << std::endl; x = x * 2; std::cout << "x = " << std::hex << x << "; y = " << std::hex << y << std::endl; return 0; }
31c4641628cfd6a8e7a2d8ab40e6ce417afdad7b
61ee1c13ea309b5899a1d84507cb4c065547d62f
/C++ Practice(DSalgo)/Graph/Dijkstra.cpp
8a95d793a500e465a6cc726d82050b4fd80a093f
[]
no_license
Adarshkumarmaheshwari/SI-AlgoDS-Practice
59fe0b0192b81729553c2d939a19bb3e01c811ce
92b5b1f8cffcf699c1f8c6c2b43ecf377b3e583e
refs/heads/master
2023-07-01T14:43:05.031776
2021-08-05T17:40:44
2021-08-05T17:40:44
370,755,434
0
0
null
null
null
null
UTF-8
C++
false
false
1,771
cpp
Dijkstra.cpp
#include "bits/stdc++.h" using namespace std; #define V 9 int selectMinVertex(int dis[], bool processed[]) { int min = INT_MAX; int minIndex; for (int i = 0; i < V; i++) { if (processed[i] == false && dis[i] <= min) { min = dis[i]; minIndex = i; } } return minIndex; } void printSolution(int dis[]) { printf("Vertex \t\t Distance from Source\n"); for (int i = 0; i < V; i++) printf("%d \t\t %d\n", i, dis[i]); } void dijkstra(int graph[V][V], int src) { int dis[V]; //output Array store shortest distance from src to i bool processed[V]; for (int i{0}; i < V; i++) { dis[i] = INT_MAX; processed[i] = false; //initially it will be false } dis[src] = 0; for (int i{0}; i < V-1; i++) { int u = selectMinVertex(dis, processed); processed[u] = true; for (int j = 0; j < V; j++) { if (processed[j] == false && graph[u][j] && dis[u] != INT_MAX && dis[u] + graph[u][j] < dis[j]) { dis[j] = dis[u] + graph[u][j]; } } } printSolution(dis); } int main() { int graph[V][V] = {{0, 4, 0, 0, 0, 0, 0, 8, 0}, {4, 0, 8, 0, 0, 0, 0, 11, 0}, {0, 8, 0, 7, 0, 4, 0, 0, 2}, {0, 0, 7, 0, 9, 14, 0, 0, 0}, {0, 0, 0, 9, 0, 10, 0, 0, 0}, {0, 0, 4, 14, 10, 0, 2, 0, 0}, {0, 0, 0, 0, 0, 2, 0, 1, 6}, {8, 11, 0, 0, 0, 0, 1, 0, 7}, {0, 0, 2, 0, 0, 0, 6, 7, 0}}; dijkstra(graph, 0); return 0; }
bc281d75a776430db58c7fa004a07f4428f1b8cd
438bb3e6820026ac5bcc3ba2de34ec1ef6228a18
/src/chess-engine/Pieces/Queen.cpp
d0c44ece1dbd96c3944aabd2ab91a58f58b4084a
[]
no_license
dbtdsilva/chess-opengl
4e4419d611f43b470a8b6c6d18979107856b1c65
4874b60eac35ac3d051fae36ddb120fc69e62afb
refs/heads/master
2020-12-30T22:58:50.885316
2015-11-16T20:20:11
2015-11-16T20:20:11
25,787,743
0
1
null
null
null
null
UTF-8
C++
false
false
757
cpp
Queen.cpp
/* * Queen.cpp * * Author: Diogo Silva (dbtds@ua.pt) * */ #include "Queen.hpp" using namespace std; static vector<Point2D<int> > createPossibleMoves() { vector<Point2D<int> > moves; moves.push_back(createPoint(1, 1)); // Diagonal Right moves.push_back(createPoint(1,-1)); // Digonal Left moves.push_back(createPoint(-1,1)); // Diagonal Behind Right moves.push_back(createPoint(-1,-1)); // Diagonal Behind Left moves.push_back(createPoint(0, 1)); // Right moves.push_back(createPoint(0,-1)); // Left moves.push_back(createPoint(1, 0)); // Front moves.push_back(createPoint(-1,0)); // Behind return moves; } Queen::Queen(Player player) : ChessPiece(player, createPossibleMoves(), true) {} string Queen::getType() { return "Queen"; }
35d3b21f2663610b112f75687decb69a541da49f
e74e7ceb1754a77afc25b33beced1cee49ddbe82
/unit_02.cpp
e9d0940a6ee3ff07389343a8edbfc9e80d76fdca
[]
no_license
EXOVBF/Decay
5290fd1d82b2d33f9054ef39777dfff0203112a9
418a821f5f1ac7efce9500b49142373ff1376edd
refs/heads/master
2021-01-18T15:15:25.128412
2014-11-19T10:05:05
2014-11-19T10:05:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,785
cpp
unit_02.cpp
/**************************************************************************************************************************** this program reads lhe file, select some events and then do the hadronization ---> time saving! compile with -----> c++ -O2 -ansi -pedantic -W -Wall `pythia8-config --cxxflags --libs --ldflags` -o unit_02.exe unit_02.cpp ****************************************************************************************************************************/ #include "Pythia.h" #include <vector> using namespace Pythia8; using namespace std; //************************************************************************************************** bool lhe_event_preselection(Event* event) { vector<Particle> outQuark; for(int iPart = 0; iPart < event->size(); iPart++) { Particle particle = event->at(iPart); cout << particle.status() << endl; if(particle.status()>0 && abs(particle.id())>0 && abs(particle.id())<7) { outQuark.push_back(particle); } } if(outQuark.size() < 3) { return false; } else { return true; } } //************************************************************************************************** int main() { // Number of events to print. int nPrint = 10; // Generators Pythia pythia; Pythia pythiaPreselector; // Stick with default values, so do not bother with a separate file // for changes. However, do one change, to show readString in action. pythiaPreselector.readString("PartonLevel:ISR = off"); pythiaPreselector.readString("PartonLevel:FSR = off"); pythiaPreselector.readString("PartonLevel:MI = off"); pythiaPreselector.readString("HadronLevel:Hadronize = off"); pythia.readString("HadronLevel:Hadronize = on"); // Initialize Les Houches Event File run. List initialization information. pythiaPreselector.init("../MC_data/signal_lvj/MGraviton_2500.lhe"); pythia.init("../MC_data/signal_lvj/MGraviton_2500.lhe"); // Allow for possibility of a few faulty events. int skippedEvents = 0; int iAbort = 0; // Begin event loop; generate until none left in input file. for (int iEvent = 0; ; ++iEvent) { // Generate events, and check whether generation failed. if (!pythiaPreselector.next()) { // If failure because reached end of file then exit event loop. if (pythiaPreselector.info.atEndOfFile()) break; } cout << "preselction" << endl; pythiaPreselector.LHAeventList(); pythiaPreselector.info.list(); pythiaPreselector.process.list(); pythiaPreselector.event.list(); if(lhe_event_preselection(&pythiaPreselector.event)) { if(!pythia.next()) { // If failure because reached end of file then exit event loop. if (pythiaPreselector.info.atEndOfFile()) break; else { iAbort++; } } } else { if(pythia.LHAeventSkip(1)) { skippedEvents++; } } cout << "### skipped: " << skippedEvents << endl; // List first few events: Les Houches, hard process and complete. if (iEvent < nPrint) { cout << endl << "########## EVENT: " << iEvent << endl; pythia.LHAeventList(); pythia.info.list(); pythia.process.list(); pythia.event.list(); } // End of event loop. do event by event. int help; cin >> help; } cout << "### failed: " << iAbort << endl; // Give statistics. Print histogram. pythia.statistics(); // Done. return 0; }
d36196d60f6aaed016cec3c3ea4abe1e48f8b5b2
eb7c2150e1a5678811f27ec197bef36e36069a6c
/core/dialogjsonwriter.h
610184269557b72c4f4f50521d6a3b73d9dc13a0
[]
no_license
QtWorks/VirtualClientDialogEditor
769c9a237d93fc1a427560a7de42737590cd000e
a6aa7c82a3bb542c7d578190bd2db868f5e9221e
refs/heads/master
2020-05-18T09:12:51.131166
2019-04-24T20:52:47
2019-04-24T20:52:47
184,317,111
1
0
null
2019-04-30T19:07:55
2019-04-30T19:07:55
null
UTF-8
C++
false
false
247
h
dialogjsonwriter.h
#pragma once #include "dialog.h" #include <QJsonObject> namespace Core { class DialogJsonWriter { public: DialogJsonWriter(); QString write(const Dialog& dialog, bool compact = false); QJsonObject writeToObject(const Dialog& dialog); }; }
b4838fe29a8d1341944c3e1d58fe597306581915
32df5b091b36e0155c729d582f5c0dfba2de21f4
/DatalogInterpreter/LexicalAnalyzer.cpp
b26f4e35a54441f1b7366a942d46efe6190a8df1
[]
no_license
jordanchip/school-projects
adfb2be028a7c93b812b4a2541d516f6520bde1e
b4a99f6874e4934ec18333b2c60022ac95321b7a
refs/heads/master
2020-05-31T01:16:03.567044
2015-09-23T17:06:34
2015-09-23T17:06:34
42,881,883
0
0
null
null
null
null
UTF-8
C++
false
false
897
cpp
LexicalAnalyzer.cpp
#include <fstream> #include <iostream> #include <iomanip> #include <cstring> #include <string> #include <vector> #include <cstdlib> #include <ctype.h> #include "LexicalAnalyzer.h" #include "Token.h" #include "Scanner.cpp" #include <vector> #include "DatalogProgram.h" #include "Predicate.cpp" #include "Parameter.cpp" #include "Database.cpp" using namespace std; int main(int argc, char* argv[]) { string inputFile; //These variables are for scanning in the file vector<Token> Tokens; Scanner scan1; ifstream inStream1; inStream1.open(argv[1]); if (inStream1.is_open()) { scan1.scan(Tokens, inStream1); inStream1.close(); } //tokensToString(Tokens); //Now we want to Parse in the Tokens and see if they are a valid member of the language DatalogProgram dP1(Tokens); if (dP1.parseTokens()) { //dP1.toString(); Database dB1(dP1); dB1.answerQueries(); } return 0; }
fb66ec9dfebc5667278af68d5a557ca52233b7aa
a58ee7b46968f35af46b748ad2d3224682afbd2d
/CPP/src/test/test_address_lamdba.h
5fbdd706619d6d6527ddc9df3ad9d3648254ddf7
[]
no_license
xju2/learn_ml_in_a_hard_way
bf2c13a549d7aa29af31f9c31b3a6d7ec9b08c11
40dc4cfa5161c1bd1711107b0b6f97156d9f7f6b
refs/heads/master
2023-02-25T22:44:22.785936
2023-02-24T23:55:47
2023-02-24T23:55:47
144,209,303
1
1
null
null
null
null
UTF-8
C++
false
false
317
h
test_address_lamdba.h
#include <functional> #include <iostream> using namespace std; template<typename T, typename... U> inline uintptr_t get_address(std::function<T(U...)> f) { typedef T(fnType)(U...); fnType ** fnPointer = f.template target<fnType*>(); return (fnPointer != nullptr) ? reinterpret_cast<uintptr_t>(*fnPointer) : 0; }
8c9a8a141ec1d7aa7a1f125da61801645dedc4c3
53242e8aa6072a84cf5a122c82cd7c117d0a1054
/Codes/SAE_CPP/DriverModel_SAE_4.cpp
196761695fa2bd1053d98e8d8efd1cba43b80749
[]
no_license
fsagir/SPR4123
12ff51f8e510dd33e83420657816feec2d76e2fd
0ea9f498f1bb8b7b92b9344dcc3c8a562b0d3191
refs/heads/master
2021-09-15T03:24:20.691701
2017-10-07T22:52:27
2017-10-07T22:52:27
105,476,916
1
0
null
null
null
null
UTF-8
C++
false
false
15,892
cpp
DriverModel_SAE_4.cpp
/*==========================================================================*/ /* DriverModel.cpp DLL Module for VISSIM */ /* */ /* Interface module for external driver models. */ /* Dummy version that simply sends back VISSIM's suggestions to VISSIM. */ /* */ /* Version of 2010-03-02 Lukas Kautzsch */ /*==========================================================================*/ #include "DriverModel.h" #include <cmath> #include "Vehicle_data.h" #include "IDM_acc.h" #include <vector> #include "Simulation_Data.h" #include <random> #include <chrono> /*==========================================================================*/ BOOL APIENTRY DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: vehicle_desired_vel_array = std::vector<double>(3601, 27.7); vehicle_X_coordinate_array = std::vector<double>(3601, -1000); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } /*--------------------------------------------------------------------------*/ DRIVERMODEL_API int DriverModelGetValue (long type, long index1, long index2, long *long_value, double *double_value, char **string_value) { /* Gets the value of a data object of type <type>, selected by <index1> */ /* and possibly <index2>, and writes that value to <*double_value>, */ /* <*float_value> or <**string_value> (object and value selection */ /* depending on <type>). */ /* Return value is 1 on success, otherwise 0. */ unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); //seed random generator std::default_random_engine generator(seed); //create distribution std::normal_distribution<double> distribution_SAE_2(0.0, 0.00046); std::normal_distribution<double> distribution_SAE_0(0.0, 0.0046); //generate value using normal distribution and seeded generator double RandomValue_SAE2 = distribution_SAE_2(generator); double RandomValue_SAE0 = distribution_SAE_0(generator); //aquire absolute value RandomValue_SAE2 = abs(RandomValue_SAE2); RandomValue_SAE0 = abs(RandomValue_SAE0); switch (type) { case DRIVER_DATA_STATUS : *long_value = 0; return 1; case DRIVER_DATA_VEH_TURNING_INDICATOR : *long_value = turning_indicator; return 1; case DRIVER_DATA_VEH_DESIRED_VELOCITY : /* *double_value = current_velocity + current_acceleration * time_step; */ *double_value = desired_velocity; return 1; case DRIVER_DATA_VEH_COLOR : *long_value = vehicle_color; return 1; case DRIVER_DATA_WANTS_SUGGESTION : *long_value = 1; return 1; case DRIVER_DATA_DESIRED_ACCELERATION : /* Calculation of IDM acceleration - SAE Level 0 */ space_headway = relative_distance - vehicle_length; if (cur_link != 7) { desired_velocity = 45 + (desired_velocity - 88) / 42 * 10; } ratio = current_velocity / desired_velocity; desired_space_headway = jam_distance + current_velocity * time_headway + 0.5 * current_velocity * relative_velocity / sqrt(a * b); space_ratio = desired_space_headway / space_headway; /* checking if the vehicle is the first vehicle*/ if (vehicle_ID == -1) { acc_idm = a * (1 - ratio * ratio * ratio * ratio); } else { acc_idm = a * (1 - ratio * ratio * ratio * ratio - space_ratio * space_ratio); } /* Calculation of CAH acceleration - will be used to calculate ACC acceleration */ if (leading_veh_acc > a) { effective_acc = a; } else { effective_acc = leading_veh_acc; } leading_veh_spd = current_velocity - relative_velocity; if (relative_velocity <= 0) { heaviside_step = 0; } else { heaviside_step = 1; } if (vehicle_ID == -1) { acc_cah = a * (1 - ratio * ratio * ratio * ratio); } else if (leading_veh_spd * relative_velocity <= -2 * space_headway * effective_acc) { acc_cah = ( pow(current_velocity,2) * effective_acc )/( pow(leading_veh_spd,2) - 2 * space_headway * effective_acc); } else { acc_cah = effective_acc - ( pow(relative_velocity,2) * heaviside_step ) / ( 2 * space_headway); } /* Calculation of ACC acceleration - SAE Level 1*/ if (vehicle_ID == -1) { acc_acc = a * (1 - ratio * ratio * ratio * ratio); } else if (acc_idm >= acc_cah) { acc_acc = acc_idm; } else { acc_acc = (1-c) * acc_idm + c * (acc_cah + b * tanh((acc_idm - acc_cah)/b)); } if ( x_coordinate > 700 && x_coordinate <1000) { if (vehicle_ID == -1) { *double_value = acc_idm; } else { *double_value = acc_idm; } } else { if (vehicle_ID == -1) { *double_value = acc_acc; } else { *double_value = acc_acc; } } return 1; case DRIVER_DATA_DESIRED_LANE_ANGLE : if ( x_coordinate > 700 && x_coordinate <1000) { *double_value = DataMap[VehicleID].Random_value = DataMap[VehicleID].LateralDeviation(); /*DataMap[VehicleID].Random_value = RandomValue_SAE0; if (desired_lane_angle >= 0) { *double_value = RandomValue_SAE0; } else { *double_value = -RandomValue_SAE0; }*/ } else { *double_value = DataMap[VehicleID].Random_value = (DataMap[VehicleID].LateralDeviation()) / 10; /* DataMap[VehicleID].Random_value = RandomValue_SAE2; if (desired_lane_angle >= 0) { *double_value = RandomValue_SAE2; } else { *double_value = -RandomValue_SAE2; }*/ } return 1; case DRIVER_DATA_ACTIVE_LANE_CHANGE : if (x_coordinate > 700 && x_coordinate <1000){ *long_value = active_lane_change; } else { lane_change_to_left = 0.0; lane_change_to_right = 0.0; *long_value = 0l; if (cur_link == 7) number_of_lanes = 2; else number_of_lanes = 1; if (number_of_lanes == 1 || DataMap[vehicle_ID_current_upstrm].Lane_change_in_progress == true || DataMap[vehicle_ID].Lane_change_in_progress == true || DataMap[vehicle_ID_current_two_upstream].Lane_change_in_progress == true || DataMap[vehicle_ID_current_two_downstream].Lane_change_in_progress == true) { *long_value = 0; return 1; } /*c) Checking for the changed new acceleration of the vehcile behind self when self moves away*/ //space_headway_current_upstream = vehicle_headwy_current_downstrm + vehicle_headwy_current_upstrm - vehicle_length - (vehicle_rel_spd_current_downstrm - vehicle_rel_spd_current_upstrm) * time_ln_ch; //ratio_current_upstream = (current_velocity - vehicle_rel_spd_current_upstrm) / vehicle_ID_array[vehicle_ID_current_upstrm]; //desired_space_headway = jam_distance + (current_velocity - vehicle_rel_spd_current_upstrm) * time_headway + 0.5 * (current_velocity - vehicle_rel_spd_current_upstrm) * (vehicle_rel_spd_current_downstrm - vehicle_rel_spd_current_upstrm) / sqrt(a * b); //space_ratio = desired_space_headway / space_headway_left_self; /* checking if the vehicle is the first vehicle*/ //if (vehicle_ID == -1) { // acc_idm_current_upstream = ACC_idm(vehicle_headwy_current_downstrm + vehicle_headwy_current_upstrm, vehicle_length, -(vehicle_rel_spd_current_downstrm - vehicle_rel_spd_current_upstrm), time_ln_ch, // (current_velocity - vehicle_rel_spd_current_upstrm), vehicle_desired_vel_array[vehicle_ID_current_upstrm], // jam_distance, time_headway, a, b, space_ratio); //} if (vehicle_ID_current_upstrm > 0) acc_idm_current_upstream = ACC_idm(vehicle_headwy_current_downstrm + vehicle_headwy_current_upstrm, vehicle_length, -(vehicle_rel_spd_current_downstrm - vehicle_rel_spd_current_upstrm), time_ln_ch, (current_velocity - vehicle_rel_spd_current_upstrm), vehicle_desired_vel_array[vehicle_ID_current_upstrm], jam_distance, time_headway, a, b, space_ratio) - pow(space_ratio, 2); else acc_idm_current_upstream = 0; if (cur_veh_lane != number_of_lanes /*&& DataMap[vehicle_ID_left_upstrm].Lane_change_in_progress == false && DataMap[vehicle_ID_left_downstrm].Lane_change_in_progress == false*/) { //leftmost lane /*a) Checking for the changed new acceleration of the upstream vehcile on the left*/ if (vehicle_ID_left_upstrm > 0) acc_idm_left_upstream = ACC_idm(vehicle_headwy_left_upstrm, vehicle_length_left_upstrm, vehicle_rel_spd_left_upstrm, time_ln_ch, (current_velocity - vehicle_rel_spd_left_upstrm), vehicle_desired_vel_array[vehicle_ID_left_upstrm], jam_distance, time_headway, a, b, space_ratio) - pow(space_ratio, 2); else acc_idm_left_upstream = 0; /*space_headway_left_upstream = vehicle_headwy_left_upstrm - vehicle_length_left_upstrm + vehicle_rel_spd_left_upstrm * time_ln_ch ; ratio_left_upstream = (current_velocity - vehicle_rel_spd_left_upstrm) / vehicle_ID_array[vehicle_ID_left_upstrm] ; desired_space_headway = jam_distance + (current_velocity - vehicle_rel_spd_left_upstrm) * time_headway + 0.5 * (current_velocity - vehicle_rel_spd_left_upstrm) * (-vehicle_rel_spd_left_upstrm) / sqrt(a * b); space_ratio = desired_space_headway / space_headway_left_upstream;*/ //acc_idm_left_upstream = a * (1 - pow(ratio_left_upstream, 4) - pow(space_ratio,2)); /*b) Checking for the changed new acceleration of the self vehcile when it moves to the left*/ //space_headway_left_self = vehicle_headwy_left_downstrm - vehicle_length_left_downstrm - vehicle_rel_spd_left_downstrm * time_ln_ch; //ratio_left_downstream = current_velocity / desired_velocity; //desired_space_headway = jam_distance + current_velocity * time_headway + 0.5 * vehicle_rel_spd_left_downstrm * current_velocity / sqrt(a * b); //space_ratio = desired_space_headway / space_headway_left_self; /* checking if the vehicle is the first vehicle*/ if (vehicle_ID_left_downstrm == -1) { acc_idm_left_self = ACC_idm(vehicle_headwy_left_downstrm, vehicle_length_left_downstrm, -vehicle_rel_spd_left_downstrm, time_ln_ch, current_velocity, desired_velocity, jam_distance, time_headway, a, b, space_ratio); } else { acc_idm_left_self = ACC_idm(vehicle_headwy_left_downstrm, vehicle_length_left_downstrm, -vehicle_rel_spd_left_downstrm, time_ln_ch, current_velocity, desired_velocity, jam_distance, time_headway, a, b, space_ratio) - pow(space_ratio, 2); } if (!(acc_idm_left_upstream <= -b_safe || acc_idm_left_self <= -b_safe)) { if (acc_idm_left_self - acc_idm + p * (acc_idm_left_upstream - vehicle_acc_left_upstrm + acc_idm_current_upstream - vehicle_acc_current_upstrm) >= acc_thr) { lane_change_to_left = acc_idm_left_self - acc_idm + p * (acc_idm_left_upstream - vehicle_acc_left_upstrm + acc_idm_current_upstream - vehicle_acc_current_upstrm); } } } else { acc_idm_left_upstream = 0; acc_idm_left_self = 0; lane_change_to_left = 0; } if (cur_veh_lane != 1 /*&& DataMap[vehicle_ID_right_upstrm].Lane_change_in_progress == false && DataMap[vehicle_ID_right_downstrm].Lane_change_in_progress == false*/) { //rightmost lane /*d) Checking for the changed new acceleration of the upstream vehcile on theright*/ //space_headway_right_upstream = vehicle_headwy_right_upstrm - vehicle_length_right_upstrm + vehicle_rel_spd_right_upstrm * time_ln_ch; //ratio_right_upstream = (current_velocity - vehicle_rel_spd_right_upstrm) / vehicle_ID_array[vehicle_ID_right_upstrm]; //desired_space_headway = jam_distance + (current_velocity - vehicle_rel_spd_right_upstrm) * time_headway + 0.5 * (current_velocity - vehicle_rel_spd_right_upstrm) * (-vehicle_rel_spd_right_upstrm) / sqrt(a * b); //space_ratio = desired_space_headway / space_headway_right_upstream; if (vehicle_ID_right_upstrm > 0) acc_idm_right_upstream = ACC_idm(vehicle_headwy_right_upstrm, vehicle_length_right_upstrm, vehicle_rel_spd_right_upstrm, time_ln_ch, (current_velocity - vehicle_rel_spd_right_upstrm), vehicle_desired_vel_array[vehicle_ID_right_upstrm], jam_distance, time_headway, a, b, space_ratio) - pow(space_ratio, 2); else acc_idm_right_upstream = 0; /*e) Checking for the changed new acceleration of the self vehcile when it moves to the right*/ //space_headway_right_self = vehicle_headwy_right_downstrm - vehicle_length - vehicle_rel_spd_right_downstrm * time_ln_ch; //ratio_right_downstream = current_velocity / desired_velocity; //desired_space_headway = jam_distance + current_velocity * time_headway + 0.5 * vehicle_rel_spd_right_downstrm * current_velocity / sqrt(a * b); //space_ratio = desired_space_headway / space_headway_right_self; /* checking if the vehicle is the first vehicle*/ if (vehicle_ID_right_downstrm == -1) { acc_idm_right_self = ACC_idm(vehicle_headwy_right_downstrm, vehicle_length_right_downstrm, -vehicle_rel_spd_right_downstrm, time_ln_ch, current_velocity, desired_velocity, jam_distance, time_headway, a, b, space_ratio); } else { acc_idm_right_self = ACC_idm(vehicle_headwy_right_downstrm, vehicle_length_right_downstrm, -vehicle_rel_spd_right_downstrm, time_ln_ch, current_velocity, desired_velocity, jam_distance, time_headway, a, b, space_ratio) - pow(space_ratio, 2); } if (!(acc_idm_right_upstream <= -b_safe || acc_idm_right_self <= -b_safe)) { if (acc_idm_right_self - acc_idm + p * (acc_idm_right_upstream - vehicle_acc_right_upstrm + acc_idm_current_upstream - vehicle_acc_current_upstrm) >= acc_thr) { lane_change_to_right = acc_idm_right_self - acc_idm + p * (acc_idm_right_upstream - vehicle_acc_right_upstrm + acc_idm_current_upstream - vehicle_acc_current_upstrm); } } } else { acc_idm_right_upstream = 0; acc_idm_right_self = 0; lane_change_to_right = 0; } /*Check if the vehicle should change lane to the left*/ if ((lane_change_to_left > lane_change_to_right) && (lane_change_to_left >= acc_thr)) { *long_value = 1; } else if ((lane_change_to_right > lane_change_to_left) && (lane_change_to_right >= acc_thr)) { *long_value = -1; } else if ((lane_change_to_right == lane_change_to_left) && (lane_change_to_right > acc_thr)) { *long_value = 1; } else { *long_value = 0; } //*long_value = (rand() % 3) - 1; } return 1; case DRIVER_DATA_REL_TARGET_LANE : /**long_value = (rand() % 3) - 1;*/ return 1; case DRIVER_DATA_SIMPLE_LANECHANGE : *long_value = 1; return 1; default : return 0; } } /*==========================================================================*/ DRIVERMODEL_API int DriverModelExecuteCommand (long number) { /* Executes the command <number> if that is available in the driver */ /* module. Return value is 1 on success, otherwise 0. */ switch (number) { case DRIVER_COMMAND_INIT : return 1; case DRIVER_COMMAND_CREATE_DRIVER : return 1; case DRIVER_COMMAND_KILL_DRIVER : return 1; case DRIVER_COMMAND_MOVE_DRIVER : return 1; default : return 0; } } /*==========================================================================*/ /* Ende of DriverModel.cpp */ /*==========================================================================*/
6efeb75ca0f553ecf14efd927a383d716282f59c
9ada6ca9bd5e669eb3e903f900bae306bf7fd75e
/case3/ddtFoam_Tutorial/0.003450000/rhoEu
8d1ef73c38fd28afc690001e86fc04988fcf0486
[]
no_license
ptroyen/DDT
a6c8747f3a924a7039b71c96ee7d4a1618ad4197
6e6ddc7937324b04b22fbfcf974f9c9ea24e48bf
refs/heads/master
2020-05-24T15:04:39.786689
2018-01-28T21:36:40
2018-01-28T21:36:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
114,505
rhoEu
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.003450000"; object rhoEu; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField nonuniform List<scalar> 12384 ( 509958 516721 506680 484948 487962 438551 411795 316563 224125 33507.2 -156672 -369410 -491795 -510189 -120739 -33321.4 62147.5 120363 139341 121043 106194 60856.5 62014.9 6636.68 27153.7 -8561.78 5768.57 3103.22 8681.11 1183.71 19738.3 14658 84286.8 79424.7 58893.4 32070.4 -50349 -110696 -201196 -275691 -335291 -389485 -447588 -520117 45243.3 150254 146047 108160 80847.1 65475.2 61032.3 84636.9 91889 115083 143135 144169 163592 138148 147905 88144.3 68775.5 55062.4 12896.6 10761.4 -2993.37 -30697.3 -19873 -30292.4 -72720.8 -101749 -210617 -238896 -240440 -290104 -233160 -254108 -261090 -235409 -206088 -209021 -219384 -228066 -231583 -231346 -226113 -219005 -216873 -207232 -196368 -184853 -163032 -151069 -132566 -147084 -167315 -206472 -225632 -253448 -266805 -285998 -299931 -331048 -316116 -300843 -413382 -414875 -420559 -424498 -423619 -411760 -400680 -378595 -365702 -350157 -337663 -331900 -332216 -341698 -355753 -375159 -396487 -415134 -412273 -424806 -347471 -265373 -240757 -256550 -293238 -318243 -264045 -255287 -355934 -461843 -377127 -326899 -286412 -294860 -335355 -256366 103882 186327 270643 218164 45403.2 -19571.9 -223158 -186096 -282585 -255227 -277356 -271391 -273418 -277172 -276346 -282124 -284005 -295461 -355428 -433789 -478635 -483742 -464026 -459293 -574625 -574115 -564909 -540330 -515741 -472552 -430187 -404081 -390913 -397292 -425285 -505690 -559672 -527959 -484415 -474868 -483040 -502060 -508853 -526373 -525732 -550318 -529166 -554407 -585706 -638582 -705281 -733111 -583129 -383085 -579435 -582383 -594520 -588004 -521203 -494678 -413044 -370220 -328007 -284593 -270541 -350972 -436236 -416252 -333486 -249672 -170813 -105443 -37113.4 11025.4 49784.5 66958.4 70719.5 59558.9 61940.2 27392 28994.4 -13164.6 -3288.95 -29733.6 28039.5 16095.3 3068.97 16982.7 10529.7 52164.9 101727 127487 179920 148514 178004 212982 280646 308481 307592 257208 284541 193916 194881 128841 99560.6 79682.3 39474.5 21100.5 -15442.2 -19773.9 -46522.8 -51273.7 -69881.9 -74343.2 -137948 -44157.1 4518.62 1782.09 -20391.4 -30351.8 -24579.6 -32706.8 8284.01 32604.8 -74200 -145515 -176241 -179744 -172609 -141034 -122457 -90672.7 -123123 -121976 -144922 -134257 -134485 -133808 -158862 -179027 -201965 -242633 -283458 -315287 -575081 -494626 -467804 -434239 -430224 -385409 -365799 -270165 -180764 -111969 -86077.5 -70276.7 -79536.9 -97834.6 -89591.6 -98655.8 -95483.2 -93936.5 -91564.9 -90944.4 -90511.8 -98478.2 -97120 -103588 -110078 -118354 -130962 -130745 -135900 -126912 -600146 -553364 -532143 -520106 -519346 -492019 -511530 -421070 -355783 -278120 -201566 -194681 -195663 -225306 -235113 -266398 -264752 -279329 -256789 -217865 -186935 -196115 -167368 -148118 -158494 -137428 -162437 92895.5 267359 820079 -651560 -553797 -513219 -513356 -495745 -534281 -508504 -547474 -513275 -542732 -518139 -540528 -529862 -533500 -528425 -512341 -528650 -513445 -526233 -474097 -492246 -394182 -454989 -186846 434294 500078 717391 410248 407143 362709 574230 540942 552505 515267 521997 471223 454246 385885 321442 156952 -15468.7 -235719 -434949 -514727 -2683.34 160084 213205 228714 211563 178272 139875 97672.3 81797 40078.8 43378.9 24831.8 24416.3 32311.3 48379.7 42593.8 65939 50789.8 80760 119722 75297.5 64591.9 -27825.8 -95220 -194407 -271645 -334324 -383322 -437993 -505144 44567.9 126455 66190.2 -11179.8 -48872.8 -63090.1 -54216.5 -44502.8 -10015.4 33980.5 75103.5 134179 156809 182988 168468 181086 133469 141767 97265.5 97694.5 83493.6 56186.7 75913.7 32745.3 6431.51 -65814.8 -183123 -230784 -239853 -290816 -218500 -218361 -196180 -181724 -217178 -241990 -255633 -259786 -258809 -253542 -247003 -248833 -232455 -232801 -220781 -213229 -189494 -167296 -143425 -140484 -161593 -181180 -203520 -231056 -247191 -261102 -284038 -316056 -320478 -291105 -416123 -414583 -408784 -396421 -374777 -346559 -324110 -301130 -284993 -274142 -261396 -256605 -259538 -269457 -288744 -314251 -338014 -357401 -362291 -337240 -316091 -293154 -246160 -267244 -301541 -314863 -287740 -248469 -295570 -376827 -356236 -265758 -282179 -282628 -112619 223103 408916 399675 464419 368919 284227 142421 -40216.2 -52612.8 -144406 -158302 -194089 -214901 -233420 -252608 -269302 -270878 -275598 -285450 -325022 -403878 -462567 -475352 -454843 -453028 -534476 -533378 -522049 -510011 -479835 -450610 -415850 -393046 -391727 -403491 -464420 -536063 -546782 -498286 -468143 -466237 -471619 -478063 -479266 -482603 -470286 -465517 -447016 -466566 -534046 -606467 -699217 -715763 -579938 -420844 -547882 -568898 -569051 -488244 -441135 -419950 -399166 -400943 -350084 -310106 -305710 -382920 -437785 -392789 -303850 -221843 -139135 -58331.6 -3605.85 20996 15162.9 -31973.1 -76966.3 -118814 -110824 -129418 -58793.5 -57338.2 13078.8 -39195.7 -837.338 15337.3 10571.1 29281.9 57370.3 42966.6 120846 188629 213449 223718 222523 276788 310074 321065 291262 286042 252714 225848 193519 187649 192851 181611 180998 154688 121240 88139.4 45850.6 8093.99 -33712.7 -48851.6 -141173 -30223 18077.9 31816.5 16024.7 23088.8 24472.8 58895.7 83864.6 96380.4 44318 -111098 -101770 -126339 -101917 -79934.2 -31312.6 -49369.6 -52712.7 -73685.8 -47694.3 -39923.5 -25023.9 -25275.7 -53408.6 -78996.5 -176192 -227584 -248648 -262553 -562463 -484270 -434984 -363595 -368122 -282891 -243674 -157572 -72108.2 -1344.05 46177.5 69863 83880.8 58425 54261.8 25850.7 -3369.37 -35212.8 -58987.3 -75538.8 -77356.9 -73833.9 -68904.8 -61362.1 -56479.4 -60167.8 -83330.3 -110306 -132183 -151850 -597989 -530619 -504390 -492341 -474007 -443256 -426547 -326720 -227585 -110216 -65837.5 -23151.5 -41494 -30107.5 -76237.1 -93551.2 -138856 -152655 -202060 -170653 -170224 -134621 -105418 -96066.8 -56290.8 -56044.5 -24214 140555 457255 846215 -552987 -551444 -484977 -455410 -443992 -384320 -437205 -387483 -432084 -423015 -475887 -475016 -488098 -478467 -475916 -456314 -458077 -437158 -436750 -392931 -381970 -295541 -327149 -103063 226983 653909 668442 635277 503948 673105 612721 576881 566410 545841 531675 509733 490073 437089 388019 269873 137657 -80596.6 -331819 -487403 175562 221240 241545 249231 243225 210465 166847 106531 77047.9 35726.7 32746.9 21859.8 27097.5 30476.1 56517.1 74805.4 94456.3 100582 109190 142364 98453.6 88680.6 -12377.8 -89596 -190673 -275583 -339579 -377959 -418560 -470829 27993.6 92708.4 15033.1 -48447.2 -82202 -96452.4 -94781.5 -63109.2 -35169.9 -16511.8 16278.9 47424 100046 131193 159599 176022 142515 170646 129843 145138 148330 118698 156141 94459.1 61038.1 -32260.1 -164119 -224801 -242629 -305731 -212538 -184915 -160022 -210511 -254381 -273186 -261670 -259080 -256233 -263212 -267787 -269363 -281148 -280511 -281624 -273015 -261475 -235413 -185982 -157531 -145436 -160022 -187082 -222245 -233933 -246886 -272938 -311130 -315236 -283010 -426213 -421295 -398876 -362420 -321405 -295016 -270420 -263718 -253686 -246992 -240164 -231822 -234824 -244136 -251080 -267062 -283038 -288358 -289832 -296396 -284159 -284500 -282037 -282088 -295451 -310194 -278402 -263471 -258429 -313870 -349173 -248895 -247750 -64565.6 207092 370364 413268 422688 471981 479644 327736 280099 45274.3 71869.9 -45897.1 -43340.6 -102578 -133209 -174798 -213514 -249063 -272041 -270424 -276346 -306253 -374912 -443953 -461106 -443230 -449267 -483844 -477291 -476021 -456174 -448897 -422973 -401797 -392739 -402221 -449999 -518214 -536983 -507336 -475383 -469215 -465911 -467177 -461799 -455375 -432306 -422860 -383671 -365693 -388290 -458434 -544236 -674146 -698192 -602797 -514483 -524184 -507847 -435992 -410602 -397318 -408082 -425852 -397365 -379539 -334357 -336332 -420995 -480741 -434336 -342199 -242171 -153929 -108395 -122130 -191665 -259414 -246843 -224082 -212930 -225757 -253089 -280255 -274767 -144027 -26477.3 -63138.6 -41330.7 -37802.1 1314.57 39085.3 102662 118886 221751 255403 238270 238883 221884 207731 153512 117271 49213.1 4629.57 -58255.8 -84624.1 -94912.1 -74795 -10806.4 64580.7 132941 174916 172114 146191 114947 65861.8 9412.38 -136595 -19080.4 65062.2 87490.3 83077.1 76799.1 125325 131816 177978 132585 87734.5 -59004.5 -119405 -117433 -125736 -108778 -132446 -141654 -152169 -128749 -115530 -78136.2 -50663.9 -24293.9 1112.53 -17559 -69366.6 -146197 -234533 -254860 -538984 -468599 -400949 -301563 -272568 -174289 -118429 -22697.3 42396.2 86334.8 102799 103809 80632.5 76766.7 62842.6 77584.5 89397.2 94516.5 85112.1 55265.5 29976.2 4597.74 5480.82 4299.73 22681.8 36589.4 24952.5 -15608.2 -57866.3 -74176.2 -578750 -514750 -459876 -434814 -396590 -352612 -326077 -192855 -62270.9 -16366.5 79362.7 36189.8 64533.7 53481 98408.2 66147.7 47425.6 45323.3 24285.2 2921.1 -10296.1 -12323.2 8136.55 56917.4 64238.8 152629 220482 404463 638054 1.09477e+06 -489750 -432319 -366006 -298191 -272232 -199624 -201833 -131601 -105733 -99621.9 -213344 -327863 -370162 -348513 -353843 -312007 -310062 -273410 -261950 -220129 -193016 -114577 -157177 98509.7 302703 660733 1.19215e+06 1.13443e+06 1.10098e+06 994682 538163 501098 469953 464159 463211 463055 459010 443063 432218 367343 246642 73770.3 -185430 -437425 215876 229663 292594 373380 406378 367895 284969 188932 115218 65087.3 39040.7 36408.2 22722.6 31473.1 47008.2 80238.8 105744 145903 140455 180922 114615 96396.5 -13835.9 -97160.9 -202404 -290216 -350488 -384708 -409035 -448544 9900.78 52138.8 4272.98 -48937 -99974.3 -116387 -80002.7 -32806.3 2227.24 29688.9 14433 27028.4 33506 74065.9 100703 133003 116808 146994 134062 136807 163949 140834 166837 155502 75734.4 -2909.7 -157214 -227369 -253286 -332127 -165442 -145625 -203656 -260197 -270793 -237858 -232271 -241234 -262920 -282903 -294142 -316385 -326827 -337165 -344501 -343608 -327118 -275466 -224382 -167411 -165835 -170439 -187758 -214584 -225523 -227770 -256935 -301688 -307602 -268949 -426480 -407621 -352673 -298065 -276182 -276359 -291541 -291998 -293826 -285654 -275292 -264457 -263528 -255926 -261342 -247379 -220953 -220635 -247995 -269536 -280250 -267936 -287914 -298561 -298381 -295317 -294378 -269495 -273563 -262839 -311883 -239586 -121625 146825 339856 347678 365002 379280 481642 407541 321632 206060 6604.68 2188.42 -47628.1 -40623.9 -75676.8 -82723.6 -139024 -184195 -233511 -270650 -276771 -271725 -292767 -358771 -427941 -445566 -430898 -443930 -431943 -440094 -439633 -440692 -428071 -412297 -397665 -403015 -436648 -506563 -527577 -510620 -484293 -480129 -480372 -477812 -469865 -458798 -451390 -424486 -412923 -374825 -344167 -318518 -397955 -477428 -615916 -668462 -630795 -602244 -341875 -309975 -355005 -377660 -407141 -426365 -434101 -427915 -387055 -352606 -366172 -469627 -546282 -508155 -408223 -301422 -237719 -264660 -328150 -283447 -206724 -147291 -116073 -98630.6 -88748.2 -126014 -201333 -309000 -336421 -106080 -96909.3 -157764 -156747 -82056.6 -17555.8 20556.8 133715 136995 232115 231088 164444 88045 -8901.45 -29164.3 -55702.8 -70539 -102629 -119907 -157092 -183480 -206875 -224734 -237526 -228906 -163972 -33225.8 95131.3 148475 117449 60720.8 -90112.2 -13675.2 56640.1 89510.6 113038 146575 175253 215990 196729 108048 44284.4 -79911.6 -157766 -207064 -168539 -179079 -169750 -189204 -193616 -224124 -220170 -227586 -189396 -110607 -35666.2 22826.8 52022.8 -3131.32 -102758 -173481 -474956 -427190 -347897 -230746 -188308 -77711.6 -22675.1 24117.3 57216.7 129119 153223 170228 189623 153165 107126 61471.2 13752.1 -23018.7 10215.4 53481.9 77782.2 78092.1 74687.7 73301.1 71901.3 86136.6 93588 67011.2 37451.2 17399.7 -502954 -431057 -377526 -359493 -331359 -281043 -255160 -118752 -18484.8 86774.8 81649.1 137586 79448.2 52699.6 3386.33 75280.7 118593 106745 126246 98336.5 116131 104394 128968 132894 195589 242579 433890 604019 817710 875721 -207031 -266005 -202175 -196826 -169931 -148446 -98749.6 -23949.8 59125.9 163171 202342 108034 -167104 -242860 -237204 -200079 -179948 -127557 -130086 -66957.6 -93613.3 25366.4 -34337.4 146831 348345 685392 1.14971e+06 1.74503e+06 1.70916e+06 1.9478e+06 424545 393414 371417 374264 387430 407184 415310 418041 426492 400390 356722 202198 -41662.8 -375115 164499 215461 353899 514899 589872 526655 393608 276363 164348 89020.3 51206.7 32335.6 27941.3 20296.9 41802.1 80469.9 123692 180606 174737 206748 130925 90082.6 -18299.1 -104868 -205088 -287616 -351407 -380784 -398564 -429029 -12225.7 -1475.61 -31675.1 -100451 -138939 -116533 -61956 3329.43 64338.7 58957.8 58677.9 24022.8 28445.3 39570.8 63315.1 102455 102484 131263 133603 127619 153701 152952 145596 161149 83815.1 -11516.5 -152290 -231440 -265708 -356820 -151704 -166637 -241811 -255068 -198810 -203686 -227832 -254904 -268708 -297276 -318801 -336174 -358927 -372288 -377216 -373918 -335320 -274357 -222260 -213884 -184370 -196096 -204522 -222548 -215594 -228596 -270218 -303086 -288431 -250414 -428508 -394210 -305480 -261597 -285722 -319047 -324016 -321184 -304011 -299761 -297571 -294294 -287396 -283132 -241365 -194230 -182451 -208851 -242880 -265373 -271124 -285055 -276408 -303282 -325160 -319886 -302676 -300357 -274516 -271894 -325363 -194892 9667.47 297921 320711 345329 324500 358771 334778 261723 81900.3 -51716.8 -201115 -195903 -217734 -192068 -146360 -130450 -150785 -201532 -249556 -272445 -276012 -268999 -284648 -343527 -412469 -429048 -423171 -442884 -449860 -448952 -448912 -440442 -429220 -404226 -398130 -410875 -488463 -525094 -515823 -494731 -494505 -505387 -508963 -497089 -487650 -469562 -461127 -434425 -425477 -394779 -367403 -329793 -338559 -426015 -541534 -621987 -639471 -644309 -219778 -256719 -330496 -391493 -422573 -426671 -434603 -435051 -399348 -368283 -403138 -521547 -607009 -581671 -478301 -399700 -361920 -343843 -281121 -192843 -128489 -109880 -105046 -81265.2 -44832.7 -25396.2 -80723 -204254 -346037 -321785 -188566 -274961 -278984 -196244 -61869.9 -14016.1 26690.2 128962 95179.2 85303.9 1686.72 -82526.4 -119027 -132901 -131223 -149243 -155836 -191122 -211885 -233587 -251435 -272406 -278126 -287164 -285329 -275961 -246035 -29489.5 128302 147572 -19907.6 50735.8 83316.5 100661 111812 157552 219614 225800 173912 82350 97082.3 -38243.9 -28043 -154119 -134545 -143819 -175245 -187456 -206690 -184377 -185473 -191185 -197209 -203343 -179245 -49709.1 34151.4 113593 69589.5 52816.5 -406151 -351526 -273813 -175647 -121970 -23753.5 -10636.2 33892 131937 147095 188673 137604 115300 118012 119975 83469.3 71489.3 38064.7 3637.67 -37378.5 -47568.6 28092.2 61207.9 71213.5 77789.9 84840.3 90353 101121 93861.8 95416.4 -441534 -371544 -300583 -290300 -251841 -238459 -164619 -39469.3 56427 127828 143721 112161 101603 132693 90887.1 68049.5 55230.3 82209.7 97138.3 137521 122633 157815 139535 199653 177020 361655 449710 695341 620975 610483 -67919 -120057 -144078 -147552 -130698 -109435 -77087.2 -88604 17858.3 129186 310881 399819 351552 -5102.72 -152903 -162205 -101686 -105096 -55877.1 -77068.6 1267.38 -44665.7 142209 103394 387295 617212 939851 1.56631e+06 1.9083e+06 2.52321e+06 388238 335056 321198 328876 339372 362992 389546 390578 405326 397216 397086 313971 113097 -269576 64407.2 153499 315205 557847 658259 554454 410319 278847 188104 96838.8 54914.3 33222.6 18509.4 24888.8 40809.8 94016 147681 218714 207424 221629 118505 57781.8 -48570 -127639 -208044 -278481 -332539 -369636 -389097 -412696 -27274.3 -57059.4 -123191 -169690 -165192 -117386 -69244.2 -8606.88 39076.8 70840.9 53527.2 49481.3 43843.6 54146.5 79216.9 113515 158920 153465 134780 126647 130104 116321 131842 89342.7 63383.1 -28628.9 -155379 -232366 -274064 -364925 -140370 -198376 -239556 -178208 -176043 -197095 -226760 -231544 -275552 -296634 -341206 -354101 -379309 -384325 -393485 -367664 -307183 -248282 -247864 -234788 -248306 -228919 -238706 -213603 -212315 -253966 -302063 -302174 -275190 -249005 -410620 -315198 -247359 -282363 -322230 -327380 -325335 -311843 -306836 -287888 -283045 -283250 -276584 -225991 -185931 -172401 -195766 -226883 -252144 -264770 -277252 -292177 -326848 -340312 -350568 -355205 -344241 -318709 -309769 -274688 -265085 -144374 129513 302798 335142 276378 283995 244501 197879 37577.7 -159568 -286550 -323595 -359366 -371233 -352067 -298510 -210447 -148943 -185006 -242641 -269902 -269292 -263316 -276314 -337772 -393793 -417397 -417390 -437789 -467392 -478729 -471336 -459454 -431521 -409652 -408643 -469950 -517797 -524282 -506857 -509434 -529551 -542594 -528464 -507978 -484829 -460164 -440963 -419193 -413994 -398077 -379041 -346593 -327903 -365256 -471830 -566655 -622997 -645044 -220813 -266568 -339371 -390673 -403674 -426693 -432700 -428436 -401611 -387764 -416914 -564431 -637682 -600364 -513375 -449121 -394890 -311125 -197031 -133332 -128828 -170422 -176052 -123764 -59156.5 -20291 -47088 -149936 -295790 -405135 -280159 -375016 -365525 -306992 -227258 -137484 -82062.1 -23975.5 9941.86 -114767 -156247 -159631 -183248 -192829 -221870 -239611 -277324 -313580 -347051 -362237 -368676 -351577 -330273 -304576 -286236 -287436 -280310 -286629 -41984.1 138265 19112.2 45989.7 40395.2 47951.3 93562.3 144603 208146 196382 117172 165400 203873 18051.4 43977.2 -106625 -154794 -119846 -150015 -165950 -158278 -168591 -194202 -176408 -178582 -154125 -133333 -153708 -40412 140459 237404 173045 -341816 -275796 -200469 -140455 -91518.4 -43270.5 17143.4 96882.2 135885 97088.3 100161 122718 103806 67403.8 22666.8 31609.5 23602.6 16021.3 10428.1 9134.21 -11215.4 -40328.4 -39415.4 299.185 42811.5 60774.4 65957 80844.1 109199 128137 -349188 -277412 -253718 -230102 -193430 -165652 -103590 -32872.8 49848.8 55447.7 94883.6 90981 127710 117745 148819 145926 151094 112184 59435.7 57943.2 108402 101912 132606 129043 228443 293268 453784 452763 372786 237969 -41925.7 -132469 -29415.5 -84860.2 -87294.1 -54232.4 -52427.2 28477.3 38084 97853.4 161120 360155 527301 494426 113301 -134990 -159204 -88313.4 -90573.6 -57392.9 -57984.4 -15878.9 53380.9 277906 457395 619751 666302 1.13371e+06 1.66642e+06 2.37244e+06 374915 303571 316347 307027 303223 301093 330995 335352 362106 340424 370189 370600 250402 -146901 33824.5 103936 254705 489182 612020 532993 356598 259396 174342 105501 60821.1 25586.7 24432.6 25033.4 56658.1 122314 186717 258416 221901 198741 56722.7 -19856.7 -112408 -168098 -217673 -256361 -301825 -344558 -375717 -406343 -96027.6 -154402 -206864 -208365 -175976 -151435 -134019 -113623 -72247.1 -24316.3 34074.7 61956.1 83680.3 93845.1 121888 134174 139163 147491 98332 59186.6 40101.7 16967.6 48725 7357.29 11028 -44724.9 -149620 -232248 -275213 -367613 -159030 -211304 -175494 -138418 -166254 -178483 -190067 -227371 -286216 -319401 -352240 -364928 -383115 -392367 -379104 -332051 -270755 -257843 -251337 -266698 -253939 -257537 -233339 -244919 -276111 -316450 -313877 -278581 -255066 -258838 -376579 -269262 -258170 -309786 -326066 -323765 -322823 -323462 -309403 -292641 -279953 -249428 -198707 -168328 -174033 -195002 -224182 -252286 -272870 -296394 -328160 -363646 -378888 -389533 -383740 -368104 -355443 -345476 -313177 -283227 -238315 -31807.3 203145 310084 267494 279122 243726 210662 84853.7 -90796.3 -260547 -290167 -353594 -372604 -394036 -393625 -400942 -349014 -264157 -155860 -193540 -239828 -242996 -238244 -249547 -320178 -371350 -402580 -411980 -422605 -496714 -498905 -491174 -462096 -433322 -414499 -444536 -493139 -527627 -517153 -528496 -548084 -562626 -552120 -526862 -490885 -456495 -421000 -395775 -371703 -373223 -380454 -385313 -344550 -319687 -331210 -409632 -507249 -590514 -625767 -208675 -291399 -351422 -387534 -411307 -414608 -422379 -419836 -393553 -388298 -454111 -583384 -639027 -612171 -528512 -449981 -363275 -247935 -164074 -155481 -189899 -222506 -211235 -162123 -80463.4 -36800.4 -53412.9 -137285 -267634 -402544 -331751 -487911 -475280 -419070 -335107 -274628 -209158 -221461 -228534 -224747 -248994 -232544 -230340 -260296 -292096 -345716 -391208 -432877 -460746 -464417 -449814 -422845 -391443 -345351 -320496 -270046 -253233 -263483 -280127 179751 82528.4 46916.5 4940.91 36216.2 47887.2 110334 152164 123502 162631 247518 216718 133375 60981.4 -51613.3 -70295.4 -79388 -110311 -112274 -92594.6 -109762 -124963 -170333 -182544 -176368 -113842 -58841.3 -31518.6 21694.2 247387 279062 -262904 -197127 -154982 -106120 -45916.4 3788.83 61722.2 109129 64169.2 63825.5 86938.3 33052.5 32768.4 57524.8 49650.9 -18829.7 -34131.2 -24328 -24803.4 -16537.3 -3000.99 -4615.77 -13195.2 -50729 -54673.9 -2462.15 21541.2 37207.6 65230.4 141250 -283505 -249135 -170312 -137304 -131939 -113842 -106553 -41427.7 -20111.3 46134.4 126283 143930 110758 193913 100658 179805 200544 206284 170734 156491 75899.3 70504.1 68138 121501 139092 243864 290989 297108 220371 347191 -47930.6 -85174.9 -48611.6 -77978.1 -69151.1 -91498.3 21832.1 -8575.37 115951 123462 225684 278161 427956 558901 522893 185925 -91456.1 -162530 -97135.7 -103228 -45911.6 -65422.7 105823 353238 558753 591010 654627 830454 1.0971e+06 1.51342e+06 341374 292740 291517 278855 269529 261069 278700 284833 247970 191631 223412 308589 301645 -33228.9 -7325.49 91544.6 218018 474086 568043 460203 333225 232453 174024 125422 68618.6 55318 39653.6 49978.1 95004.7 172780 249807 276408 168339 74870.2 -68372.2 -128419 -182597 -195359 -212686 -239602 -282567 -329373 -365044 -379304 -184941 -238325 -247224 -218349 -210179 -211364 -213311 -211433 -195933 -162979 -113267 -68045 -30326.6 6858.89 34240.3 57943.3 42385.1 5515.21 -25852.1 -69017.6 -99307.9 -104599 -74247.8 -66277.2 -59650.2 -71510.3 -151870 -221363 -264338 -349328 -154900 -195498 -125384 -121344 -133685 -140045 -175676 -236786 -291701 -316002 -336232 -346382 -368329 -364266 -337498 -283508 -258287 -252314 -252797 -262498 -267847 -267988 -290546 -298919 -309036 -296324 -289499 -280662 -278043 -288117 -334185 -219292 -251595 -284922 -284330 -300985 -322796 -332058 -336457 -319846 -287949 -231083 -195895 -198031 -213296 -250464 -273457 -311726 -349564 -392074 -418298 -428166 -425768 -408110 -395669 -371246 -352211 -340237 -319076 -266472 -184481 7310.35 239300 308173 319920 271981 281490 177546 34800.4 -148618 -215288 -273455 -301595 -307429 -341072 -368270 -387502 -405586 -361344 -249180 -185575 -169759 -190011 -182831 -223761 -285698 -332437 -381825 -396972 -390506 -498373 -497303 -481459 -455993 -429978 -439119 -478221 -527193 -531514 -546135 -565733 -587061 -568521 -538206 -488422 -448773 -399997 -369705 -335048 -323384 -318464 -351597 -356615 -342613 -296393 -287033 -351543 -433661 -516399 -587188 -207567 -312282 -371735 -398176 -397923 -406933 -404148 -399549 -387029 -395346 -492552 -618175 -644440 -586363 -497677 -418890 -320681 -224139 -166907 -161911 -193956 -236346 -256768 -218357 -110941 -49958 -83494.9 -149592 -265032 -361117 -378621 -497272 -523941 -479560 -403796 -334959 -319248 -325963 -358583 -338851 -316177 -306829 -288525 -299475 -360060 -425696 -481431 -510847 -511862 -488834 -476219 -398961 -343612 -294281 -269388 -257601 -219519 -220367 -246376 108850 138679 63020.4 50869.9 85941.8 96270 93884.8 129715 178029 238345 294212 250277 276723 27232 44095.6 7991.77 -20564.7 -73056.9 -43214.6 -26502.6 -21695.1 1988.64 -46248.1 -94368.4 -170938 -147547 -110799 24496.8 61286.4 126508 304254 -197780 -128756 -101196 -40149.1 6606.63 33364.1 61730.3 52105.3 35359.8 -3323.11 15403 32414.1 18125.1 13726.3 4810.59 -25520.3 -37035.5 -66181.4 -56564.6 -38595 -31960.2 -10998.6 3719.27 4353.13 -9855.96 -42896 -39462.9 -3902.59 41333.2 139287 -264105 -231226 -154153 -99731.6 -66591.7 -62510.3 -41418.8 -45949.5 9010.79 11149.7 133818 82842.2 261893 164435 257501 217964 249509 248526 248739 213306 215717 140060 149475 128309 175487 179729 183727 117673 166061 304620 -114577 -99342.5 -71785.3 980.565 -69901.2 -19789.8 -583.217 76883.5 81296 206835 238182 342178 400039 520031 579219 536465 212902 -33854.4 -155475 -92577 -104237 38437.9 213723 535632 704120 654866 662674 449836 105669 167992 319547 277061 269416 256356 246856 249989 258919 177889 80412.2 24265.8 36111.7 144417 282007 80112.7 13304.1 -13642.9 -19488.8 72370.7 185963 373597 545285 460879 325808 244510 182567 123982 104593 73096 74502.3 109351 179077 250603 263509 187436 12403 -93139.6 -179724 -195686 -197078 -190067 -212874 -264741 -315793 -341134 -329156 -287382 -249143 -241977 -276939 -274288 -254723 -242644 -233754 -231775 -232782 -234219 -233339 -231283 -218753 -191468 -147839 -109062 -72100.6 -72792.5 -88886.9 -136825 -190136 -197063 -215804 -209039 -179306 -154824 -127216 -120498 -164948 -218744 -250602 -259853 -151122 -172080 -143680 -131915 -94753.8 -99278.2 -98530.6 -120107 -168852 -229227 -268338 -285881 -293427 -308527 -326511 -322068 -293596 -272474 -260227 -259422 -266625 -278778 -292672 -308094 -314143 -327061 -328056 -317326 -305055 -301437 -289555 -316062 -357463 -307077 -256137 -216331 -245798 -243117 -248831 -266403 -286895 -318076 -336161 -324659 -289468 -266844 -250733 -266462 -299711 -341397 -373234 -403399 -436150 -459222 -468776 -463240 -442115 -418231 -381376 -357086 -343268 -361411 -369113 -293970 -364387 -242801 -66484.6 80860.8 236737 279360 293142 311501 273860 181927 -14974.4 -107237 -213889 -241974 -256148 -264174 -283534 -309609 -344850 -354843 -372108 -314428 -199441 -156407 -123384 -135402 -155891 -221007 -294582 -361097 -380272 -384348 -403411 -437838 -490165 -479033 -464854 -449345 -442933 -465511 -515041 -531988 -548019 -575271 -597901 -574581 -531030 -474088 -422222 -386682 -349563 -329696 -293534 -288109 -277840 -283298 -331139 -316442 -301139 -306991 -313635 -313720 -321430 -284095 43318.7 -51080.9 -192423 -362444 -403476 -386762 -373433 -378670 -372723 -377986 -380676 -431719 -548875 -630501 -637533 -556912 -469613 -390518 -301732 -221086 -182708 -191642 -229157 -271026 -292637 -245222 -128107 -71479.5 -107296 -192708 -311493 -385966 -380735 -356677 -408458 -525703 -561813 -504314 -456298 -410456 -387407 -415685 -429537 -450293 -426250 -389967 -350686 -359272 -398906 -458964 -495698 -511115 -515926 -502780 -460238 -410483 -330688 -208333 -149786 -119909 -173230 -162279 -170525 -159238 -157757 87417.5 285211 218627 76977.4 122676 156806 163752 174461 244032 316071 290694 335741 238859 76117.1 110207 20375.4 -24450 21720.7 5453.73 12822.2 41988.8 71998.2 43300.6 57663.8 -53052.1 -98951.8 -162468 -56086.9 81954 66115.4 224030 335598 57725.5 -87460.9 -40184.2 -1867.13 15945.5 35567.9 19617.6 26801.2 350.378 -4662.05 -53150.3 -34728.4 -40579.8 -35953.1 -1834.48 6281.95 -18254 -27179.6 -47748.3 -62369 -67049.9 -38989 -20532.8 500.778 16751.6 26576.7 15192.2 -10411.9 -42703.9 -68.7547 150184 59708.9 68749.2 -124060 -156640 -152023 -130383 -96128.3 -53458.5 -33923.2 12996.8 8303.96 58144.3 51119.9 172177 182026 375804 317292 310128 285185 344435 325030 296322 255287 261464 194587 179215 204310 185111 55177.3 117086 57152.3 239933 217857 496848 213976 19636.8 11895.4 23654.8 80281.2 89559 234147 130668 222628 188533 328162 338097 495909 497316 594485 614676 600202 267695 74436 -89757.3 38363.4 52012 463192 727701 772384 673899 381224 50372 -1147.58 -29541.3 -108262 -138589 296198 256606 255053 241414 251662 249437 218989 105782 -9605.03 -30606.1 -32939.9 23829.3 184866 159600 114347 62876.8 27023.2 57499.1 166263 328666 457298 459295 360180 278492 204199 174356 139582 140681 172159 217220 252380 258199 140921 -9450.34 -149457 -228277 -249531 -225099 -211080 -203881 -235911 -284458 -313680 -311805 -293655 -290073 -289133 -299361 -304154 -282610 -257917 -235615 -216853 -207409 -210473 -215582 -220897 -228994 -228266 -210826 -194435 -167935 -162669 -179350 -198670 -203771 -227229 -236041 -249752 -246029 -227966 -213310 -181304 -165877 -188585 -220404 -199123 -166222 -154135 -133234 -88381.4 -68735 -78660.8 -76596.1 -84162.2 -98509.4 -150046 -190343 -235185 -247430 -253022 -264113 -289235 -284075 -279691 -266911 -264037 -272282 -279470 -289181 -294445 -300907 -309282 -314556 -321232 -322822 -319151 -315436 -326174 -324566 -275582 -226106 -187280 -189081 -179744 -173379 -185523 -202428 -244570 -265529 -295311 -286013 -273561 -272404 -297346 -330064 -365893 -401650 -439536 -476115 -493685 -496480 -486028 -457152 -410325 -376191 -348765 -347765 -384573 -422454 -418045 -349078 -291252 -148881 36081.7 187725 262501 302788 312610 330757 296235 139977 43267.7 -138769 -200845 -219629 -254103 -239729 -251381 -275569 -302261 -327410 -318997 -307499 -254153 -162717 -132209 -101789 -126422 -187798 -277615 -344032 -370578 -386566 -407575 -454636 -473884 -461183 -456168 -450380 -462043 -504279 -535007 -563915 -589656 -609126 -591119 -535159 -464251 -413905 -359286 -319387 -282270 -260436 -258158 -259213 -217021 -238278 -270494 -313075 -300616 -275250 -268773 -243921 -228690 -179947 -205283 -253486 -363220 -450470 -428888 -376151 -362651 -367832 -364477 -385889 -419300 -502888 -602653 -641121 -607640 -530982 -459784 -385573 -312452 -244250 -203228 -207275 -233264 -298155 -319728 -278445 -153859 -88465.4 -154445 -242749 -335998 -380347 -378805 -370415 -471792 -572680 -580137 -537597 -503035 -472635 -461050 -466598 -479072 -480459 -481853 -449368 -431146 -397676 -418282 -451186 -478694 -492257 -507197 -516413 -487134 -410981 -322949 -210710 -85541.6 -15613.2 14316.7 -12408.2 -64976.1 -109114 -125195 -132724 40570.3 234817 271139 135138 164295 215499 253920 302194 302252 346809 353171 195874 240383 142726 165065 162677 95575.1 143710 119697 124995 132938 123972 110650 52626.7 -8128.35 -125532 -151521 -25429 146223 52967 338525 227322 -42567.5 59896.8 67119.5 50846.2 41355.4 27174.9 14917.1 -42048.9 -6301.89 -76533.4 -46790 -63333.4 -76401.8 -60332.7 -49753.4 12407.8 887.975 -20105.5 -36270.4 -38483.2 -36665.6 -23523.7 -6999.58 15783.1 34940 45094.3 40762.3 23087 -7195.1 50440.1 122390 156534 154102 115037 62002.4 57075 43954.4 49000.7 44249.1 52132.2 93431.5 113310 197797 146134 247238 322339 432352 407817 389565 359459 417237 373525 344125 303732 283743 207149 166765 76724.6 125543 77229.2 115324 146267 166557 246316 370845 291008 266158 326747 284212 396146 316384 356995 279031 332791 330569 452657 490836 602629 605722 696570 681534 666132 299302 166713 90328.7 184636 681763 884967 776927 401203 58970.1 -48616.5 -53478 -73562.8 -83423.3 -111170 302751 259131 250527 279409 318334 285089 227089 105766 -23016.7 -38163.5 -29149.1 -29139.6 62094.9 142818 130466 47840 17262.9 75698.2 127035 277436 398734 417068 384708 321871 292382 259314 251498 257204 265725 268533 210520 105131 -53266.7 -196257 -272733 -292642 -277231 -228345 -212592 -208792 -234904 -267741 -288788 -303809 -317465 -325867 -328005 -318878 -306425 -283728 -245940 -202992 -179162 -174490 -184025 -191946 -200951 -206613 -205464 -205369 -196354 -193998 -207806 -218278 -223080 -217293 -202576 -211737 -223527 -231742 -221339 -218640 -208163 -199880 -203618 -200279 -161890 -156572 -148845 -81005.4 -44347.7 -55253 -63601.9 -70679.9 -66516.2 -93392.3 -113833 -151060 -184694 -227502 -225530 -240447 -243344 -255578 -256977 -263720 -267387 -268141 -272433 -281313 -304180 -339002 -360325 -370780 -371431 -357984 -343677 -331150 -300966 -251438 -210285 -177801 -163609 -168681 -172598 -169307 -164331 -194124 -221265 -222479 -248873 -245766 -265297 -300077 -332327 -384651 -425634 -458168 -481591 -489710 -492370 -489657 -473079 -432840 -390567 -354832 -355470 -365264 -386401 -391885 -348831 -279045 -165327 -57339.6 85435.7 231743 247232 368118 333028 315320 281721 200822 31085.3 -112433 -188605 -243846 -240181 -233725 -240659 -248389 -275114 -291493 -304195 -286769 -251370 -201637 -145814 -138033 -153625 -220288 -300090 -350683 -377535 -417523 -436132 -455451 -459794 -456874 -457987 -472206 -504106 -538339 -567371 -592304 -605764 -587288 -514308 -418882 -337308 -298313 -271235 -259900 -222568 -227460 -205176 -173817 -120696 -98088.7 -163269 -257464 -294814 -252244 -239941 -275780 -273510 -248450 -400000 -429891 -488071 -496586 -451787 -412211 -411849 -402869 -419467 -453433 -514351 -586713 -635730 -635269 -581441 -499227 -440289 -400898 -339293 -284510 -247192 -234389 -286572 -341461 -346058 -296198 -171763 -108888 -203239 -299447 -372812 -394349 -396201 -447852 -536544 -606506 -593107 -563613 -535383 -513526 -498394 -500705 -504815 -507841 -503864 -501548 -462478 -452174 -421921 -439263 -440617 -476850 -479265 -512780 -471431 -379705 -264378 -162268 -64033 39639.7 75840.9 93942 83076.3 33292.7 -33464 -69332.7 -78415.9 -78613.9 45789.7 195252 168476 169169 241486 279152 345654 337363 300422 280611 252929 281558 226575 241800 261975 213425 263454 220452 203782 163871 139798 78030 55998 -75094.4 -165916 -166307 32020.2 163295 62906.8 242050 166576 51492.4 77427.8 104327 94773.9 60822.2 31295.3 14191.6 -62097.4 -51579.3 -51906.9 -94955.2 -79950.2 -88683.1 -97153.4 -40002.5 25780.2 23847.7 5345.91 -3518.05 -8282.45 -113.963 10228.5 25081.2 44035.5 58107.6 64206.7 62385.8 52012.3 62955 68287.7 65323.1 62208.6 61475.3 57694.9 64582 68346.9 74541.1 79137.8 89771.8 101581 127823 136902 174307 146455 255248 424951 510603 479476 463382 422928 455726 409787 394739 321377 247523 113691 122992 53144.1 101372 118337 188474 183467 159668 148942 221250 266157 302589 379619 331403 425699 357198 440721 402100 482825 512041 591423 625326 682135 673429 788857 771129 716476 305494 204956 416950 838891 828917 493197 49310.7 -30168.2 -56651.8 -48358.7 -41374 -53659.9 -95874.7 297820 248600 281993 317019 315517 313535 260758 149487 -3495.62 -55994.2 -53041.8 -20336.8 5552.84 87299.3 45307.2 -20396.9 11209.3 89707.9 102876 215140 311480 346881 348606 338268 316544 304121 291491 268370 229279 158539 62543.8 -73757 -209314 -299066 -319762 -294474 -244820 -215634 -211886 -225381 -256994 -294605 -319947 -328786 -332444 -329039 -325104 -321703 -301338 -259061 -215047 -177373 -148735 -147913 -156212 -170505 -180096 -185185 -184539 -189824 -198572 -217215 -235724 -238832 -216074 -195676 -185041 -180979 -196364 -206097 -213563 -210565 -205308 -209313 -195045 -176931 -164011 -156540 -104249 -43052.9 -38095.2 -56498.2 -76003.1 -76536 -85288.8 -84306.5 -109713 -115522 -149209 -192650 -229686 -227684 -229626 -227680 -231239 -235963 -247549 -265232 -297020 -332025 -358260 -361802 -365108 -354448 -342456 -325437 -305474 -275596 -240920 -206303 -169699 -158270 -149690 -143349 -127456 -131670 -158588 -163001 -174867 -168065 -182566 -193433 -219037 -271864 -318287 -365128 -400807 -420440 -426256 -434781 -448041 -466022 -466864 -454348 -424264 -392755 -368325 -371362 -362760 -319843 -251045 -161948 -98284 4668.51 58051.1 234266 368828 403202 349325 323075 264247 163391 6486.63 -69774.9 -193365 -256980 -253342 -245241 -233708 -240998 -246825 -277132 -296109 -295710 -276143 -242237 -218511 -215047 -248153 -306996 -349741 -386470 -416360 -439668 -455234 -463116 -464778 -471864 -489512 -518221 -548824 -576959 -597452 -606365 -592706 -533139 -433386 -345118 -285673 -247141 -220079 -184539 -158362 -132992 -63987.2 -55322.2 -17315.1 -13581.2 -112393 -230303 -263597 -230049 -249694 -347007 -366848 -412037 -481245 -503164 -534712 -534423 -514897 -501649 -534811 -508950 -522937 -559946 -599017 -625923 -625417 -601004 -544585 -486503 -439163 -408543 -374141 -340086 -307024 -314013 -345151 -375927 -365123 -316768 -183989 -130027 -242367 -348525 -417737 -449281 -479213 -535790 -598448 -623221 -609331 -589286 -569306 -554071 -537876 -529839 -527566 -523876 -519544 -510500 -502267 -484697 -459000 -451376 -422566 -462838 -462048 -487857 -433525 -311857 -184456 -68590.3 13422.6 56113.3 116760 110060 112390 109897 67364.5 5615.95 -18930.8 -35720.6 -53192.7 -50021.1 -15832.7 38555 80914.5 189824 239753 274359 332199 301937 341150 275790 414457 366729 350912 332985 275178 278151 226698 183217 122260 73695.3 10901.9 -61874.4 -174772 -227160 -146765 63516.8 174651 93425.2 157572 178123 158386 86184.9 101632 94072.3 74758.9 16086.5 2344.15 -60940.3 -78986.8 -61681.8 -81343.8 -66685.6 -84246.4 -60036.1 -1920.59 76462.6 58422.4 46472.2 38492.7 32141.5 34925.5 48229.8 55497.4 66944.2 73425.6 80090.3 75831.5 93878.1 118791 116610 134430 141925 139226 138842 137503 136308 144792 143489 166841 163512 182928 154744 232937 183927 408086 499905 579702 540801 530499 520501 510790 400141 384375 191557 207225 55403.1 104187 68537.5 148126 187514 260891 267313 227116 309516 268323 329350 311063 396189 371341 490942 463308 587813 568628 637753 686091 762694 740181 787264 785515 926964 920866 790367 373826 435140 707487 486338 97233 43718.7 -11273.4 -31153.4 -17741.9 -28405.3 -39078.1 -49417.1 324812 284151 302246 286040 270155 279244 277194 196583 81230.9 -25974.2 -69981.6 -51933.3 -40697.1 -13433.7 -31570.1 -36978.5 2159.59 118297 93494.4 158657 221012 248062 236925 223567 213329 200090 185832 162858 115333 52251.9 -45669.3 -163265 -274809 -321428 -336576 -334382 -310542 -291701 -287945 -302042 -319221 -328817 -329729 -324414 -320281 -321856 -320909 -313567 -295516 -259475 -213923 -171248 -136828 -113967 -110805 -115624 -130638 -142084 -157503 -174301 -202196 -230605 -248453 -244362 -223600 -196685 -186214 -173780 -180264 -179586 -192223 -204294 -201105 -193454 -189119 -186712 -177798 -139871 -81041.6 -59030.2 -68754.7 -88791.4 -110097 -110499 -111197 -124730 -120389 -121708 -122472 -165620 -200889 -230326 -231585 -231666 -233578 -254566 -283700 -310442 -325220 -329604 -331596 -308179 -305647 -290535 -276210 -266192 -242318 -212779 -184619 -161785 -152283 -139292 -150090 -161037 -153071 -148570 -134791 -131619 -141392 -124900 -112519 -117888 -132069 -182308 -227828 -276161 -303367 -329410 -343996 -356988 -388784 -415231 -450309 -460750 -442925 -410555 -386885 -356817 -326698 -265939 -189629 -127679 -39001.1 30440.4 187693 360694 420539 393540 336392 293854 236830 89981.6 -22939.3 -56211.8 -155588 -249139 -282245 -269291 -254216 -239502 -237791 -244890 -278861 -304884 -316277 -317772 -316288 -324080 -347572 -374593 -405361 -430205 -453807 -471811 -483936 -487383 -500043 -520437 -543122 -564496 -581109 -590217 -591466 -573984 -527315 -430314 -335700 -263811 -225038 -210996 -191551 -168951 -128539 -30100.2 49178 87994.9 127952 131046 81412.8 -65444.4 -195072 -246004 -264695 -323334 -385840 -450454 -496193 -531926 -556848 -573501 -580848 -592444 -605371 -598821 -601689 -606741 -603126 -592927 -572112 -537010 -496469 -459593 -433179 -418875 -397438 -380132 -371155 -372581 -390417 -385053 -365142 -319553 -192331 -142041 -278761 -384805 -470038 -519054 -561625 -602053 -629548 -633765 -626728 -612521 -599412 -589025 -573997 -564639 -554230 -544053 -536646 -523188 -513834 -492854 -480970 -471030 -434973 -475567 -452451 -437109 -346305 -206058 -83635.7 1654.78 64298.4 85919.5 85632.3 127259 102221 97091.1 98861.6 62150.1 25365.4 10394.1 -36918.5 -46330.4 -38660.2 -65415.1 -22526.1 -5714.55 43279.6 146719 199214 228155 324946 407729 461574 478181 368710 352107 310422 234585 189030 115182 56736.6 -1286.14 -59086.4 -133003 -198590 -271584 -246070 -105009 95531.7 183683 172385 114724 140641 154246 125555 124612 91899 60723.2 6510.93 -13696.9 -55337.5 -49499.5 -39195.5 -41760.7 -37593.6 -32675.4 -34979.7 66608.9 126581 107598 77851.8 58831.8 65805 81141.8 74959 73464.9 74248.9 73599.5 84143.2 96965.9 116503 131848 165844 177454 186731 193839 203365 208817 208791 223190 226721 229205 218842 227726 195043 262086 295793 480128 575021 574742 555868 551228 556805 463523 335407 225406 221745 76499.5 117032 118155 98826.6 201743 277519 341094 400571 332180 386398 335114 401413 370269 487670 444705 613766 612246 764750 789203 858911 863015 887907 849411 910963 978308 1.08592e+06 936526 728057 312146 321818 239486 139784 54637 15610.4 33346.8 25783.8 12553.3 -192.219 -46091.7 337439 311182 302597 241598 196081 227468 243798 211014 183022 64436.3 -2194.04 -46509.7 -77683.3 -67501.7 -69520.1 -44047.8 1422.78 122737 137246 107878 142050 151009 131950 106988 100466 92694 99089.3 85834.8 80264.7 34824.2 -45635.4 -157086 -242849 -286359 -322310 -362397 -395479 -405798 -402447 -386238 -370911 -352525 -334970 -322398 -317864 -314685 -314962 -307626 -292363 -268371 -232694 -191266 -146490 -104292 -71456.8 -62914.7 -58723.2 -72739.4 -92897.2 -126799 -167845 -205827 -232923 -242764 -239467 -217625 -196648 -180927 -181106 -178781 -180277 -188519 -205489 -206899 -214356 -194508 -193163 -160730 -150993 -161483 -176749 -200743 -195576 -207028 -214600 -223211 -224536 -187910 -156309 -137492 -160443 -200382 -235868 -253600 -272111 -285421 -296873 -301783 -301411 -285144 -285582 -254388 -242638 -224773 -210946 -199006 -182762 -172374 -161281 -159554 -158491 -164802 -155081 -161438 -172842 -182723 -183366 -163615 -137239 -115181 -66500.6 -59176.3 -57941.8 -101123 -133715 -181588 -212091 -232161 -246253 -264244 -284968 -327727 -374273 -423804 -444815 -440595 -416857 -385774 -316045 -261615 -209702 -121631 -33514.8 120626 271265 369362 399233 384819 294179 241037 154761 -24664.3 -91112.2 -93062.9 -97103.5 -197517 -264625 -292595 -292177 -282811 -254711 -245521 -235397 -261298 -294827 -327123 -350994 -368744 -384971 -404088 -420157 -438114 -452345 -465799 -476308 -489268 -505477 -522765 -534652 -544891 -549109 -541836 -511947 -462098 -385410 -320576 -264808 -234429 -221292 -205500 -179283 -157098 -61991.6 35813 164230 260417 212054 226092 186593 93463.3 -50613.4 -135457 -172292 -184428 -230611 -316552 -413291 -485918 -542001 -570582 -601108 -625688 -627554 -626231 -615271 -596269 -564530 -526922 -487902 -458380 -423112 -409517 -390638 -386351 -380489 -375132 -368579 -368485 -361047 -353045 -339675 -311101 -193601 -148904 -291384 -400575 -486465 -553843 -596848 -627207 -634036 -634981 -633257 -624706 -621390 -609560 -603371 -589396 -580560 -566368 -554546 -541882 -524147 -516319 -496457 -473292 -456944 -484201 -404843 -339759 -194644 -68560.3 16632.1 64711.3 74377.5 87596.4 80214.2 60444.7 86840.8 70232.7 59624.7 75758.2 49687.1 -2043.18 -797.888 -5531.99 -36646.9 -12889.3 -31437.9 -28208.1 242.851 24072.7 112347 134039 203702 250410 374648 354063 356604 260255 245342 165574 89739 12864.4 -60159 -110699 -169982 -235442 -287130 -308089 -302849 -225166 -52915.3 96185.4 209863 244844 231324 230362 224304 202748 195073 155924 104293 59871.9 47798.1 26022 -593.595 18543.8 -6606.59 7013.74 -54462 39529.3 121487 171300 126219 134829 110206 95978.5 95487.5 79779 68488 76106.8 69116.9 97798.5 95595.4 136915 148470 149405 186914 190948 202858 215686 198652 247949 220612 224800 229816 201794 259847 168075 337175 261371 578505 586933 599920 578980 532531 471928 366309 211865 239457 125673 143840 95765.3 125115 111356 201491 322289 364144 435536 379413 429161 400782 471354 427500 561162 532084 753381 777575 925717 918354 949452 886719 907793 853607 1.02152e+06 1.05398e+06 1.03642e+06 329121 -40016.4 94829.6 209110 153356 90480 81300.9 31956.1 22270.9 46574.7 27142 5689.4 369558 341427 307904 207388 159368 172731 177779 180993 197943 131203 91345.1 30522.2 -32732.3 -54421.4 -50847.5 -18336 34194.8 115586 196841 86850.9 87903.1 86161.3 68732 57887.8 64402 72954.2 110796 135817 155048 137529 79555.3 2990.59 -51245.2 -67340.5 -93159 -170305 -268228 -369650 -421042 -443141 -445656 -436400 -406953 -372370 -344393 -327173 -313021 -306940 -300427 -289820 -268356 -246960 -209038 -158814 -107226 -65344.4 -43863.7 -40208.8 -42040.6 -63962.7 -101380 -137955 -177858 -211704 -231746 -233528 -227336 -202477 -196058 -185139 -184499 -188147 -181248 -196989 -177567 -168921 -145116 -156656 -180607 -222408 -249007 -283402 -291712 -315312 -325458 -333196 -323465 -303644 -268338 -203054 -145164 -152736 -186726 -211462 -228896 -248271 -252090 -253554 -250600 -253652 -267560 -246118 -243816 -235141 -217853 -216412 -208026 -203612 -203467 -204593 -210684 -216595 -229711 -234594 -246562 -239463 -235145 -227009 -189134 -134445 -85241.9 -18521.8 -7957.92 -48769.2 -84795.3 -112557 -134309 -154026 -169110 -177798 -192801 -216840 -269273 -309160 -368017 -404019 -420590 -402928 -360451 -334381 -281461 -235026 -91377.9 7248.48 130895 213833 264099 221800 157786 50417.1 -33070.7 -153926 -182625 -143876 -90211.5 -103402 -159590 -248646 -296928 -322450 -308858 -294678 -267914 -242174 -235094 -238799 -260534 -284504 -309571 -321078 -336007 -344602 -359896 -364961 -378592 -383377 -397956 -403424 -402852 -403416 -390885 -369043 -339226 -302702 -274318 -247800 -231879 -221370 -210422 -196186 -164595 -103223 -57662.8 83691.8 274525 306604 301363 275013 304348 289801 241987 122113 70073.2 55881.9 58073.3 -3681.86 -128655 -256968 -357932 -466708 -533924 -577568 -597127 -608347 -605891 -593231 -573254 -539106 -500812 -468588 -425720 -399223 -375432 -359579 -345265 -337917 -332957 -326627 -323839 -321536 -322193 -298067 -186794 -145716 -275949 -366064 -459220 -518059 -559735 -584699 -596730 -600284 -594579 -593918 -585986 -581903 -574627 -566026 -552471 -541947 -523901 -508175 -489706 -463398 -443410 -412514 -377361 -399532 -290783 -128086 -14204.4 78943.4 102643 71469.6 65379.6 19204.7 5651.01 -4855.13 -24830.7 -9185.73 -7922.73 -28203 -27712.5 -17132.1 -17302.9 -32858.6 4838.61 -8389.47 5087.4 40638.4 54215.2 91577.2 130528 153140 178128 218221 319807 304474 238080 216218 105884 75333.9 -26168.9 -103058 -187399 -262833 -327317 -356000 -362801 -360676 -314948 -256117 -147272 -5734.01 123330 197949 244031 258863 272609 275830 263986 245367 186274 134434 94387.8 93119 37413.3 35750.4 22059.9 8585.21 -37053.9 37713.9 70422.6 181555 213315 161516 134700 110609 81381.1 75992.1 50173.2 60992.8 52764 61855.3 92224.5 75567.2 97914.4 111982 135136 158932 197801 183685 203587 217734 251787 244429 248068 240638 219665 229786 294420 211781 519934 564665 607137 555575 503374 419846 411220 253312 235667 153390 156776 108708 148876 149772 175273 178221 307852 333939 394060 412698 446199 443783 492314 470517 593627 594733 811135 881343 908564 890181 885054 795176 858302 810042 899415 421692 -111125 -132916 71107.8 229222 186079 176978 92931.8 87750 83639.8 70997.2 47391.8 21146.9 381122 376981 324675 208246 138662 121221 98239.8 90358.9 118563 106811 94791.7 96965.6 59943.8 39417.8 42164.8 56971.7 103716 123399 230600 82337.2 61960.1 57446.6 56836.8 57058.6 95458.6 119877 205903 246967 306202 321744 327137 274017 267286 160825 195320 99812 127480 25417.9 -44349.2 -165679 -279693 -381880 -461091 -501712 -498487 -452378 -377140 -324176 -302818 -297564 -297328 -292918 -283571 -256602 -204417 -157947 -122827 -103325 -105409 -110906 -122246 -142910 -161610 -185653 -202180 -228540 -245720 -235656 -233385 -227427 -212646 -193896 -198973 -162245 -158408 -124656 -113614 -139716 -177092 -218374 -253206 -279746 -293164 -306189 -322382 -317970 -319389 -310415 -351482 -357859 -214641 -131040 -163871 -165509 -156441 -160193 -161110 -176991 -168548 -187949 -212850 -236105 -237136 -256567 -257184 -268367 -270331 -276816 -281287 -284424 -286766 -287642 -283998 -282380 -274260 -267460 -254453 -243566 -211930 -193409 -150590 -28072.7 -794.264 -13868.5 -87289.1 -95862.2 -118272 -115750 -141759 -153312 -168296 -163785 -186140 -197036 -227626 -241234 -278525 -296245 -280682 -271552 -287988 -225645 -218046 -102560 -91220.6 -62793.6 -75863.6 -103121 -149228 -174915 -207450 -238752 -237139 -188481 -127034 -62165.3 -61020.3 -111023 -263659 -320718 -338588 -335852 -321701 -313816 -294827 -283797 -274852 -262558 -275772 -275825 -281616 -288520 -291404 -292556 -294466 -297661 -297217 -297974 -295646 -291013 -284124 -277230 -269398 -262231 -252812 -245085 -236161 -223240 -206360 -178707 -145830 -53516.4 -39113.9 123730 282106 355490 303924 349942 385492 444521 433247 409739 346739 323826 310550 272348 209192 118767 8442.31 -134009 -297307 -373676 -408802 -441395 -460590 -477362 -480089 -476553 -466257 -452791 -427700 -403964 -377985 -354442 -332944 -316449 -305919 -301850 -303704 -308960 -310581 -293972 -177113 -143682 -246602 -291608 -339993 -372448 -392655 -413526 -415335 -424917 -427702 -429722 -429301 -425668 -423661 -412719 -407410 -391668 -381257 -361569 -344886 -320300 -300139 -284791 -234074 -236424 -125103 23423 91003.8 152518 117288 41970.1 -54883.5 -142468 -175983 -209502 -184410 -188428 -186430 -167374 -163785 -141578 -126657 -91869.6 -82719.4 -44252.2 -8791.99 4193.81 24835 62729.7 68214 53652.4 83999.3 145952 165656 82610.3 66443.9 -37687.7 -99076.2 -167971 -215950 -291083 -373765 -478390 -510829 -497271 -424261 -373791 -314073 -261204 -132642 -45067.6 35351.3 98922.9 135273 182308 187407 229492 218651 181819 179853 71260.4 117690 24157.1 67262.9 16112.1 -3003.11 711.773 -32572.2 14458.9 -18720.1 129999 185227 168475 135614 99962.9 40066.3 41266.1 21727 -19876.3 -891.461 21657.1 12229.1 57964 68278 55095 109327 88351.5 112449 114098 187722 185270 232718 215896 215249 171790 218441 128519 267757 116573 420160 488676 560400 500111 436590 362555 321560 277418 170327 190389 92718 118479 77450 70180.3 53105.7 174666 133354 216876 263986 328213 373060 428822 397676 475739 423202 585795 585459 656884 620923 625241 464538 602161 420416 556161 284570 55416 -237396 -117364 35919.1 179028 251300 164274 137908 112059 95160 100142 75298.3 53505.5 506358 500455 499402 495696 460747 456336 393280 339635 203062 73072.4 -145297 -331876 -449141 -515075 -125255 -33973.8 58750.1 116257 135684 134634 94805.5 79186.9 26586.1 44090.3 -4286.57 13646.8 -7474.38 -3233.53 -1488.25 8280.28 -3176.49 46438.9 50765.6 87460 75517.7 9889.51 -34486 -123799 -198120 -279990 -344556 -394778 -466358 -528997 43651.1 149801 147479 109006 78159.9 65152.8 70717.3 69640.9 100767 120156 130041 156693 148895 161910 112997 115112 74201.2 36085.8 34132.8 -434.153 -18018.7 -13253.6 -40909.1 -38845.9 -34978.1 -137869 -205321 -241004 -233416 -284583 -237942 -238038 -257223 -243355 -232723 -212847 -221874 -227872 -229220 -228122 -226812 -223658 -210568 -203453 -196624 -182269 -178501 -157259 -129122 -137393 -176906 -207172 -229717 -248204 -267998 -282071 -313711 -330486 -318087 -292918 -413555 -415577 -419940 -425742 -422945 -414505 -395217 -382499 -362188 -350388 -338794 -330613 -332901 -340353 -353991 -373066 -394089 -412278 -430627 -379292 -339916 -279239 -234189 -251856 -299226 -305766 -273899 -239700 -337266 -458674 -363190 -298186 -278683 -301083 -365818 -179112 38845.3 245717 260546 199265 110644 -121732 -121491 -274116 -229636 -279682 -265804 -273709 -273585 -271657 -278791 -280992 -286162 -303438 -355062 -428774 -474467 -487620 -477728 -444009 -576603 -568487 -556881 -544994 -511619 -473911 -433830 -402858 -393589 -393762 -417851 -513015 -558865 -533188 -476245 -472683 -487171 -496826 -516464 -521296 -540937 -527282 -548309 -545331 -578858 -640997 -700230 -723876 -550388 -383686 -601926 -603364 -595906 -576920 -565996 -469153 -429016 -379226 -333832 -285728 -276480 -353219 -421450 -386049 -303313 -235896 -169478 -96363.8 -40523.9 16747.9 56185.4 73347.2 70829.2 61675.7 35594.9 47984.3 9911.16 11453.8 -22648 -8055.12 28821.4 11799.2 19344.9 9364.03 33206.1 29744.6 79436.5 176029 162434 178829 178099 236909 289938 312135 296276 312476 238988 250168 161545 150750 110476 63081.4 37076.5 -5266.17 -12912.9 -41263.3 -43546.8 -68436.5 -74338.9 -86710.8 -169631 -93840.9 -17121.4 1511.8 -14745.9 -42924.6 -41681.5 6880.53 10006.5 -24401.8 -25739.6 -128861 -191968 -184723 -159554 -132299 -89971.9 -108934 -106708 -131757 -120757 -128805 -124335 -141617 -149305 -178297 -220175 -248852 -274113 -292822 -565023 -496003 -444522 -451713 -409896 -401649 -343162 -263946 -163486 -115759 -69056.3 -62266.4 -64520.4 -59439.1 -81020.7 -79233.6 -78745.7 -73122.4 -74435.1 -78187.5 -86902.5 -90073.1 -105689 -115325 -122497 -126586 -125784 -136760 -131736 -120779 -610833 -547148 -514294 -515927 -504774 -510037 -461396 -475148 -356393 -243718 -213545 -185129 -205940 -215778 -263267 -262907 -277916 -263526 -258105 -230411 -204942 -151005 -136994 -140917 -119723 -134695 -68351.9 -38746.2 314889 747383 -580766 -591867 -523633 -485001 -510195 -499190 -527946 -511676 -551027 -512283 -538085 -526419 -535177 -528321 -524515 -531268 -507401 -524467 -485198 -499328 -437238 -485051 -354744 -170739 175905 685715 563347 606269 381827 455952 572091 581774 537994 540163 496639 493806 438522 403573 298525 193016 -13515.8 -238079 -395901 -506120 8128.73 153155 213536 224818 214615 179508 135688 105405 64061.4 62084.9 28041.5 31227.2 30036.3 32317.5 40340.2 61352 36459.7 75101.9 92264 83165 110970 36270.5 -7901.5 -102960 -178908 -266890 -331602 -375452 -430619 -510770 39467.6 127483 64952.3 -12195.8 -46461.5 -62863.5 -62245.9 -33195.8 -11997.5 26055.3 84010.6 124323 169665 170661 185743 153186 164230 112327 118050 86777.6 75831.8 80499.3 39621.4 57117.9 7088.54 -84742.3 -171222 -233872 -235454 -293627 -227624 -230157 -197055 -171361 -190287 -232806 -252702 -258909 -256846 -254702 -252311 -239367 -243553 -232005 -225125 -206757 -194938 -166215 -144002 -142818 -154262 -182900 -207877 -229708 -248141 -262571 -291350 -320036 -325586 -295949 -420224 -419022 -410593 -398703 -375881 -348886 -319752 -302293 -286462 -268966 -263789 -255853 -258850 -270647 -288881 -314353 -345254 -365928 -361651 -350221 -316978 -272283 -265939 -267666 -301771 -316283 -284548 -258091 -291177 -387083 -358680 -265279 -299625 -266268 -106980 229223 378899 440505 412352 417869 249927 101927 34508.4 -112574 -115635 -168873 -188923 -215640 -235286 -250754 -261220 -275496 -276273 -284368 -328455 -400866 -460826 -479760 -465598 -441236 -536579 -530610 -522105 -503017 -483886 -446542 -416054 -394410 -392947 -408040 -457816 -537442 -544483 -501602 -468441 -466859 -473387 -478479 -483244 -476447 -476114 -459371 -457084 -475601 -524239 -622479 -695196 -722379 -581885 -403118 -582901 -562486 -533963 -499772 -437368 -418238 -422517 -381119 -361046 -308783 -307895 -381612 -428386 -382865 -302652 -214310 -126256 -56421 -4122.39 14441.2 4934.82 -26906.5 -81521.4 -105921 -136676 -92937.7 -101839 -17271.3 -37170.6 2785.89 11407.7 -2760.13 -3436.84 22866.6 26744.3 92517.4 115315 183631 226676 215134 236277 254748 296515 302881 306742 275133 257463 223125 203532 190817 187793 194722 165216 139721 106297 68183.3 31924.3 -9136.11 -31192.8 -55525.2 -162817 -60901.2 40160.7 51329.9 37337.7 3194.43 33862.7 65942.9 96388.6 78904.7 19922.8 -25754.8 -143173 -124381 -106108 -68244.1 -64808.4 -37371.3 -65980.8 -48008 -59856.2 -33381.2 -27156.6 -30836.9 -50513.6 -125275 -157945 -228378 -292831 -333168 -558869 -487063 -421247 -407280 -321917 -318162 -231157 -152460 -56580.5 23621.2 80089.8 110651 93539.5 103481 81258.8 56198.3 17958.6 -12817 -40768.3 -54203.3 -59768.4 -62517.4 -61618.9 -61715 -64007.6 -73596.7 -87248.5 -109070 -128544 -111086 -596720 -542114 -490006 -483392 -462270 -443637 -381013 -337513 -209612 -121285 -61795.9 -46892 -24283 -52716.9 -58724.4 -91993.3 -96262.5 -138588 -162584 -211617 -186872 -152105 -123351 -78784.7 -79200.1 -33871.2 36987.1 170617 438145 910960 -603861 -505390 -482669 -437865 -395401 -428674 -371923 -428396 -403980 -463457 -452677 -479177 -478347 -481505 -467234 -469857 -449415 -444296 -409367 -403073 -349049 -362739 -231336 -175636 360021 614889 721591 590250 523118 490955 575052 588064 566656 554732 536205 517624 481999 452073 371983 291511 122998 -82423.7 -292918 -483031 178156 224691 239049 253649 241824 213612 161198 117292 63623.6 51926.3 26276.2 25316.7 22415.7 39359.1 54229.8 80419.8 84629.2 103164 128023 113558 131133 57268.8 4782.38 -103082 -192821 -281256 -340275 -379861 -420945 -490072 33779.4 92888.8 12266.7 -43888.9 -85223.9 -100187 -85218.5 -69294.9 -39789.4 -9609.71 8767.21 55054.5 94350 141470 159196 151908 178015 132230 158067 135363 130536 156523 107960 130460 57400.9 -49405.1 -148711 -229045 -241353 -310985 -194606 -168433 -163594 -213965 -268472 -274749 -262576 -257328 -260856 -260989 -267293 -273669 -269977 -279886 -277968 -277956 -263238 -227884 -186230 -148540 -151313 -162254 -189260 -217095 -236583 -240149 -267522 -303347 -320913 -288028 -421068 -414372 -393216 -357643 -319076 -292712 -276213 -260176 -255909 -247394 -237714 -236082 -235416 -238571 -257128 -275780 -283115 -281637 -289674 -294372 -294188 -275401 -270041 -286561 -303810 -296426 -285087 -248823 -271979 -295985 -328650 -259352 -246435 -82932.8 224048 381135 387401 431176 457922 446268 410620 158037 159696 -12029.7 4201.8 -71916.7 -87137 -133748 -172698 -212194 -245741 -265783 -275559 -277520 -304815 -378662 -446396 -465129 -448611 -436791 -469382 -472051 -462102 -466791 -444398 -426000 -402108 -391955 -401366 -451800 -517627 -535125 -506431 -475888 -466258 -467050 -463603 -462204 -449646 -443961 -407172 -389997 -371660 -385725 -439374 -572081 -663297 -699581 -598145 -493462 -543573 -501820 -444085 -395931 -402052 -413135 -409638 -415644 -365991 -329258 -331604 -420631 -477389 -435278 -346669 -242399 -151696 -102330 -127516 -199146 -256153 -248660 -222517 -214569 -218336 -241851 -284992 -287060 -190312 4561.98 -24175.9 -69105.2 -64149.7 -7560.81 26962.8 44074.6 139264 186639 230343 239502 226998 224051 188202 152868 83242.5 45051.4 -16969.9 -50519.5 -95057 -105541 -76992.9 -23122.9 62141.2 138712 170492 184896 145153 88550 27110.6 -1192.51 -129503 -25435.9 48426.6 71216.9 77075.9 90282 101060 169168 159149 162532 55207.9 -37507.9 -123809 -161141 -153023 -151804 -137660 -153417 -153842 -156345 -127455 -98514.2 -52409.5 -16445.3 -5383.19 3446.47 -20476.9 -124788 -201530 -242204 -532645 -455435 -368909 -331017 -230693 -196524 -108257 -15368.4 91780.4 111987 89195.3 70958.9 63241.4 48310.7 57383.6 66897.6 82038.8 84916.8 76354.1 55914.4 36380.9 29735 12669.5 19453.6 16703.6 19747 18043.2 -14206.5 -57257.4 -70286.5 -569531 -489594 -448154 -420680 -399409 -367546 -293481 -203138 -91927.6 43681.6 17768.1 74338.3 54266 70621.5 42212.3 73179.4 66832.9 35323.8 -3295.24 -34849.7 -26193.2 12323.2 45991.5 63190.7 113918 113397 235765 447955 700836 1.06234e+06 -441068 -429152 -337931 -300509 -233273 -237241 -160335 -145764 -92252.5 -110495 -213652 -330456 -356910 -370519 -331878 -333452 -295016 -284936 -243044 -224003 -179931 -171900 -19527.1 -78408.4 246961 862251 1.04198e+06 1.26258e+06 1.00042e+06 1.17006e+06 543232 497821 473850 459683 461059 461755 459355 453566 423688 372489 244373 62058.3 -180247 -435262 212612 222468 298849 372795 410089 367833 284001 193475 115022 64687.5 41152 24825.6 28044.1 25542.5 47828.4 78817 112741 123570 171810 139344 157295 64818 8363.66 -104153 -197967 -286614 -348022 -379133 -409678 -458643 4975.43 51710.5 9564.34 -55064.8 -103527 -107204 -89415.3 -36818.8 12705.5 18863.8 25577.2 16829.7 43733.7 66666.2 107483 119057 146924 118870 139289 150558 141946 170327 150471 142645 116709 -35124.3 -140405 -227802 -251264 -333758 -180954 -150006 -199146 -263595 -261431 -239499 -229302 -245829 -260435 -278806 -303526 -311220 -329239 -340388 -346606 -344851 -321049 -281488 -223729 -187686 -153525 -163800 -183857 -218326 -224831 -231007 -264380 -303418 -306747 -271582 -428855 -419061 -370775 -308931 -271730 -274838 -281810 -295321 -290249 -284387 -275479 -269678 -259263 -259978 -251610 -237233 -214204 -220460 -247062 -269312 -274534 -289339 -276636 -284227 -303164 -307593 -283762 -273992 -259806 -279872 -334505 -239237 -134397 178466 338585 368325 376286 436883 423614 471190 318695 109840 83484.1 -30521.4 -30158 -63136 -55164.9 -101376 -127905 -189691 -241006 -270431 -271377 -274014 -293116 -356333 -428476 -448444 -437183 -435831 -445611 -442803 -444079 -436667 -429404 -411009 -393287 -393784 -437654 -507170 -528265 -509957 -485220 -478304 -481797 -478504 -470196 -460518 -443779 -439534 -402580 -374029 -339705 -337121 -374080 -506547 -607283 -670067 -623112 -590229 -357460 -350575 -342612 -377938 -409113 -427089 -434189 -422331 -393507 -351231 -366533 -474094 -548320 -511334 -414726 -310197 -250876 -263291 -322857 -280715 -205899 -147596 -118166 -96293.7 -87754.6 -105058 -211525 -299199 -358638 -150663 -129766 -162161 -146893 -81484.5 -9982.22 72848.9 83019.4 214671 210046 189129 130762 26625.7 -36192.4 -49227.7 -55327.2 -81851.2 -95567.6 -140333 -161019 -185483 -208418 -223742 -223649 -208633 -83018.1 66938.3 131998 153458 110118 66806 -91574.4 16551.1 86864.8 113093 114841 128434 181045 208524 197926 174683 34813.7 -107230 -187751 -162378 -184392 -156550 -183298 -195471 -214874 -206416 -228365 -237632 -193657 -121152 -31797.4 7947.16 15294.6 2916.99 -72684.1 -95055.2 -498266 -410227 -305452 -254988 -147198 -105291 -10413.1 32750.3 53960.8 116839 151232 155140 137149 125549 104177 65072.6 23187.6 -22491.9 -11117.9 51877 83526.8 84770.6 74152.7 67705.4 70931.9 74648.2 78428.7 73484 29398.7 30172.6 -535343 -447601 -390275 -342087 -309730 -293952 -201387 -134463 -372.53 68772.3 142258 74579.5 64980.1 27014.6 47970.7 70135.9 106485 127972 94217.8 111385 102267 129805 129884 167461 176103 280977 390549 674672 739533 952136 -276955 -241332 -216701 -166976 -171372 -140647 -96628 -30361.7 75607.5 160889 223585 66656.4 -152373 -253365 -234818 -210098 -163437 -152028 -94259.9 -108861 -27782.8 -76996.5 90894.3 89848.2 222399 656930 1.31945e+06 1.59261e+06 1.75553e+06 1.86953e+06 433345 394515 373390 373602 391522 402516 415201 426498 413223 412971 349319 196037 -29830.4 -347003 150706 212446 338563 508347 585709 518786 402426 267299 167773 87809.2 46913.8 39312.2 24315.9 27559.9 38053.4 81622.3 130216 155344 211120 160315 171475 64066.3 -5599.63 -110563 -201497 -290320 -348046 -380228 -397857 -433556 -10859.9 -1372.89 -39539.6 -97908.1 -134534 -120962 -62425.8 10721.2 50894.1 71891.4 47588.4 35116.6 20760.4 34605.2 62303.7 78331.9 123361 117731 126609 147924 138784 150394 166019 131803 106679 -22024 -146986 -233033 -265183 -354512 -146095 -168311 -242055 -255876 -204313 -200754 -231808 -250414 -275940 -290561 -316100 -342025 -356564 -369231 -379152 -369779 -336366 -273581 -234768 -193488 -201890 -196109 -212946 -214771 -212458 -222486 -272670 -302990 -290271 -252769 -425700 -376753 -286695 -261659 -292676 -320283 -328186 -316001 -310548 -296847 -291223 -293080 -292687 -270684 -243597 -196300 -184417 -210559 -244924 -265595 -274966 -266102 -295953 -304371 -311340 -319394 -317489 -295806 -291267 -264898 -281256 -195891 38395.4 270064 343543 290145 315483 319574 347445 262610 76874.9 -113073 -143241 -226987 -209223 -188098 -154159 -123903 -151515 -200665 -249003 -277857 -274279 -269586 -284689 -347610 -412961 -432850 -429204 -436937 -441111 -448685 -446851 -443436 -427221 -408936 -396796 -431523 -485495 -524850 -513418 -496661 -494059 -506321 -506756 -498454 -482814 -473561 -452361 -445629 -416842 -402419 -363408 -333807 -333455 -443213 -539060 -625438 -635968 -640577 -209283 -256760 -326836 -388145 -413938 -434036 -443673 -430285 -399333 -375568 -386320 -520089 -607537 -572680 -472006 -382374 -353779 -352068 -275190 -192217 -125463 -114803 -110356 -79768.9 -44289 -34194.4 -75858.1 -215743 -348404 -363603 -192560 -276255 -271279 -211035 -137134 -43982.2 44489.9 74202.2 156661 64506 -66577.4 -99272.1 -129869 -130693 -146631 -148172 -171631 -187583 -217069 -241398 -260210 -263049 -271226 -268757 -269939 -269248 -198224 10381.3 146554 93251.2 -31506.9 22031.8 62524.9 88181 127866 163108 203111 216724 164130 114403 60325 44256.5 -149571 -106604 -138556 -152130 -154463 -173701 -169936 -195482 -192932 -190896 -196140 -203414 -182650 -81354.1 61681.4 106503 92658.9 -7152.99 -437176 -354243 -247726 -184090 -98617.9 -54740.6 19695.3 38840.8 109524 179080 158035 181875 174514 127665 84065 82440.9 61141.1 45246.9 4881.4 -36315.1 -76779.2 -927.197 52754.4 70450.4 78089.9 83134.6 91606.8 94618.5 94609.9 102340 -430019 -341535 -307967 -276892 -277071 -222219 -144824 -50153.8 64587.6 95364.7 111475 144236 141426 112968 116446 75482.1 31829.7 80524.9 126411 109089 142298 125445 165599 153002 269285 280526 512641 632840 656547 565725 -64848.7 -134018 -125899 -126665 -121834 -111552 -110589 -42462.3 -10217.6 156596 302377 428825 309594 16996.8 -154893 -138521 -137742 -78517.7 -86382.1 -31476.5 -63859.7 55303 3613.59 274326 322025 542731 1.04974e+06 1.53069e+06 1.90369e+06 2.49058e+06 394265 337838 318488 323393 343939 365527 378526 402917 396853 404494 393322 326766 111147 -270962 103903 173179 331218 548529 641226 565140 399879 286654 181346 105173 47596.3 29826.5 23696.1 15329.1 45278.3 91743.3 157408 192879 244184 179246 150759 38230.6 -35057.7 -130758 -206147 -274427 -331620 -364625 -385173 -421410 -32748.4 -62581.9 -122056 -171259 -163305 -121488 -63196.5 -18408.7 50303.3 58217.7 69500.5 49198.5 40174.9 50328 83228.2 122137 139386 155614 146860 126581 113208 125401 105708 119773 52724.9 -35432 -148290 -237121 -275264 -370012 -145703 -205672 -236077 -177003 -168594 -205994 -215417 -246174 -261971 -309127 -327614 -363938 -374014 -391817 -386013 -370652 -307253 -256809 -229402 -243753 -229760 -245285 -221158 -220611 -217847 -259272 -299698 -299033 -265594 -251186 -415820 -331906 -255895 -282788 -326320 -332074 -323347 -317429 -296966 -295681 -291915 -288035 -266012 -239977 -186409 -172884 -194634 -228199 -251475 -264802 -275856 -300722 -316058 -343101 -350341 -342560 -333398 -331159 -295790 -271550 -291713 -115462 137538 323126 290439 310681 269572 270561 191450 36527.5 -166262 -270685 -342723 -360897 -364549 -355430 -307501 -213720 -150711 -175096 -239103 -269684 -272466 -260780 -273240 -337366 -398769 -416616 -423120 -431574 -475869 -480251 -475578 -455112 -433696 -405986 -412257 -453086 -519596 -518999 -509253 -510763 -531502 -536214 -534398 -508080 -484613 -462894 -438860 -425706 -403938 -403919 -383819 -344735 -321573 -379787 -474945 -561653 -622363 -646981 -199464 -277353 -342226 -381975 -418390 -417018 -432764 -430247 -396426 -382022 -429473 -557847 -635267 -622305 -523729 -452550 -396638 -299575 -192640 -146518 -143495 -165145 -154458 -120818 -57898.2 -24063.3 -43260.8 -143344 -296804 -416128 -249791 -397400 -409626 -342169 -202981 -145479 -67190.3 -38180 -78076.6 -93927.1 -145941 -185723 -189694 -203173 -215056 -250459 -272861 -310673 -339639 -360388 -363860 -357708 -333296 -311602 -295917 -275656 -280460 -281866 -10891.2 201697 46871.3 82263.8 59034.1 61316.1 84344.2 150166 199233 160402 120777 166588 152930 181197 -95782.8 -90024.3 -92165.8 -162615 -154325 -154933 -171622 -179679 -172537 -194539 -167246 -144656 -141303 -136995 -68112.9 133586 213351 203882 -360628 -272382 -197429 -141787 -84239.1 -44748.4 23164.4 92100.3 103962 141157 118394 72041.8 60193.4 71727.7 68232.6 21494.4 8758.03 17781.1 23993.3 8279.16 -10971.7 -44515.4 -78697.2 11791 40752.8 52678.6 67598.9 88603.9 110118 140590 -353189 -287125 -249401 -223898 -194100 -153702 -107384 -31177.4 33973.1 90197.1 73032.8 105364 106275 141654 133150 143082 119185 113515 83665.7 100254 77751.2 110638 107867 167246 176697 304133 413382 519185 400957 444911 -54019 -85306.5 -84557 -82420.4 -83878.9 -82678.5 -9281.76 -12649.6 65633.3 87429.1 165333 340596 522156 459139 108748 -98962.7 -94833.1 -116014 -73942.8 -76080.8 -44322.6 -19002.9 84635.1 251457 490569 508883 745734 1.11452e+06 1.73332e+06 2.23339e+06 364207 309705 315729 312582 297711 309626 318967 352991 338638 366830 367705 358491 243325 -125310 10584 109890 269132 534206 643370 511832 360254 254284 181943 107988 52386.2 37519.5 19244.1 29845.7 59907.1 113157 201285 235595 256679 156381 84348.6 -35275.9 -103682 -171150 -213748 -258390 -302384 -340025 -374294 -404929 -81458.9 -149315 -208679 -207633 -177865 -148458 -137392 -112391 -76199.3 -15638.1 32777.1 63052.5 75292.8 98589.8 114221 146184 160714 128989 104507 63391.2 33600 40515.4 6900.22 44323.9 2909.92 -54569.7 -147930 -228866 -275749 -364633 -154981 -214725 -173400 -140261 -165453 -175545 -188894 -234009 -276543 -327162 -346870 -367973 -380353 -392040 -380951 -328252 -271686 -249719 -257876 -253705 -264046 -245094 -251876 -239746 -265254 -297962 -304811 -292946 -269838 -260554 -375884 -257731 -244316 -300252 -314004 -318552 -322580 -317798 -313608 -299692 -274411 -241869 -207548 -173008 -167011 -193747 -225451 -249487 -271830 -296320 -327811 -360636 -385901 -391812 -392664 -381783 -360186 -338610 -321187 -271582 -219721 -76589.2 171362 303195 325056 274629 271345 194266 82408.2 -101314 -219287 -330403 -341848 -373078 -385850 -405773 -392770 -364674 -229947 -185566 -200102 -238265 -249502 -234976 -262836 -324719 -369962 -400534 -411732 -421003 -492074 -498284 -486398 -466218 -430313 -416843 -438720 -504662 -524725 -524982 -520879 -554346 -567404 -551816 -525782 -491560 -453082 -421230 -387412 -376477 -371223 -383734 -379193 -353281 -307122 -310474 -412037 -495130 -588256 -633848 -218761 -299673 -349696 -389889 -407166 -420043 -429364 -416486 -392019 -386335 -453899 -600038 -655703 -614434 -521969 -445743 -358290 -253563 -159364 -133851 -170804 -217190 -227432 -173685 -87205.1 -35738.3 -58112.6 -137298 -265374 -390598 -326947 -443214 -458136 -404306 -312900 -241477 -195793 -166165 -211774 -242899 -237033 -243372 -242873 -249122 -301879 -351283 -402350 -438556 -460963 -466078 -459479 -427578 -387784 -358852 -304029 -272776 -246255 -266433 -251010 152614 62939.8 65491.7 13259 37219.3 53920.7 105144 154201 127273 172665 218924 257036 180569 7382.28 -28743 -75975.9 -105747 -83532.5 -83052.4 -98992.8 -94447 -130632 -152077 -183362 -160769 -124987 -67366.3 -28196.1 4501.92 249654 296820 -286950 -206024 -158707 -111273 -49015.8 7091.52 70939.6 64429.1 90389.4 70231.1 45440.4 80847.7 55436.1 13540 -3774.42 20117.7 -18848.3 -43492.8 -31630.1 -14605.2 -5201.77 437.635 -14797.8 -41603.6 -50522.1 3452.85 30223.2 49443.2 80731.8 137919 -302316 -233777 -181731 -143160 -120702 -113915 -82671.7 -75221.4 2652.62 58104 88389 101657 183204 112395 206113 162482 186859 185213 183873 127085 102820 59377.8 82307.7 87743.5 178817 234298 308095 271483 237872 178057 -94082.2 -105039 -59949 -66963 -87850.2 -39519.1 -60800.8 71605.7 48115.7 157353 201359 314456 397724 536856 505002 137512 -120007 -94044 -123448 -79981.9 -95013.3 -1113.27 96142.6 403463 528001 584764 608497 825941 968483 1.72571e+06 342237 298831 295066 276055 263983 272006 277587 281431 239055 207335 208922 303788 312128 -30251.5 -18192.2 60768.5 203250 422186 572468 495370 326128 242614 171519 113118 83856.6 43381.7 40518.7 54081.6 97441.6 170854 254193 255823 207196 40563.3 -44909.5 -144192 -172718 -199379 -211738 -238826 -280367 -332208 -365338 -374469 -195124 -238855 -242778 -222499 -206580 -213535 -214885 -207757 -194970 -165420 -119312 -68375.4 -25275.5 6843.33 39052.1 46961.5 42283.1 19480.2 -35143.5 -73603.8 -89313.8 -87060.2 -91807.8 -61735.7 -44626.1 -82910.5 -148513 -221772 -267008 -347074 -151902 -194765 -124575 -126691 -134002 -135160 -180108 -237837 -287024 -320839 -330318 -353411 -361747 -365062 -333545 -292470 -259155 -254058 -259011 -258971 -263937 -276129 -279781 -311032 -332073 -329708 -304780 -279974 -264288 -265433 -334441 -230476 -263843 -295570 -299250 -306923 -324087 -342545 -334617 -316004 -276888 -236531 -203497 -192897 -218799 -240499 -276270 -305869 -353276 -392852 -416427 -427959 -419434 -410953 -386460 -368011 -347194 -334583 -321223 -280582 -182168 9503.99 206447 292585 259727 299260 254068 176842 29971.1 -111405 -244258 -276745 -291342 -320635 -333089 -363034 -395690 -401196 -369870 -232504 -163069 -181488 -181729 -188148 -213386 -280703 -333041 -382320 -398401 -396708 -500513 -496965 -485573 -455721 -432648 -433181 -484387 -518700 -531631 -533456 -569085 -580894 -567637 -529127 -491865 -442953 -406695 -366931 -340411 -320122 -329382 -344601 -369422 -334738 -305245 -309526 -370631 -430181 -519472 -581646 -209450 -309442 -378656 -392287 -402932 -401261 -413201 -399389 -384124 -391211 -495069 -615371 -646714 -594713 -503448 -420123 -322276 -221433 -166489 -172720 -217306 -255114 -263075 -202207 -109965 -53651.3 -73154.6 -162072 -280161 -379466 -381364 -526751 -510366 -460379 -406077 -354560 -303665 -329034 -352983 -368036 -350564 -305392 -287838 -308446 -360000 -425129 -478561 -501549 -509165 -508327 -452473 -410759 -345570 -299160 -274794 -257570 -221660 -192339 -246359 106158 129082 65194.8 55277.3 98518.7 95021 102373 124976 166639 261594 279550 300785 134180 168028 -4564.39 -50202 -53532.8 -23567.2 -47891.8 -34216.5 -2943.56 -22321.8 -25503.5 -91332.7 -136909 -176130 -83028 7705.97 55214.3 98936.6 322308 -182911 -130170 -86677.2 -33078.7 4749.38 42933.7 50801.8 27474.8 1984.85 31431.4 23766 21329.3 39158.6 9756.93 -24955.8 -23686.9 -43639.4 -54700.1 -56134.6 -50502.1 -26522.2 -12773.4 5575.4 8427.06 -8607.79 -42354.7 -33220.5 15699.4 62180 176505 -241398 -224033 -143109 -101076 -78198.8 -50553.9 -57943.1 -20893.9 -28071.8 60303.5 44292.1 207615 118789 263316 185048 237511 234785 267271 258965 249145 179202 181152 118095 135902 134721 176093 155290 172173 159777 322924 -81984.4 -142544 -33508.8 -64010.7 -16335.7 -44875.8 9974.57 38419.9 139413 142878 273635 327952 432479 492657 574103 498839 167707 -122655 -75729.8 -111498 -35590.7 -43773.6 277397 538639 664211 743181 626394 370795 107406 262140 312156 277402 268743 251970 250990 258586 242289 188893 67991.9 23312.5 35078.7 156677 285790 75724.9 20048.8 -24273.6 12137.1 59380.9 176310 409529 500433 454189 338184 237259 174299 140997 90859 78618.4 77801 111678 174279 246474 267965 166248 37836.3 -114318 -173817 -200030 -189827 -194379 -214528 -262895 -316877 -339610 -326686 -291252 -253984 -234528 -272943 -276551 -256630 -236673 -236091 -232407 -231347 -232922 -235817 -233238 -220235 -187500 -151645 -106663 -80347.6 -66894.6 -99064.9 -141900 -173278 -217234 -209863 -202081 -186561 -149840 -124038 -126637 -163657 -217336 -251948 -259629 -153996 -178597 -141394 -129906 -90262.3 -104985 -98931.7 -114635 -173148 -226628 -272093 -284522 -294972 -312297 -321669 -317416 -299604 -267175 -255729 -257077 -265012 -278177 -292693 -303173 -316978 -311196 -299556 -286299 -285258 -283370 -296805 -333970 -351547 -327698 -253064 -206619 -228677 -227336 -227158 -250602 -291175 -314749 -324124 -323076 -297818 -257429 -251744 -265316 -306694 -343283 -374628 -409155 -438686 -459485 -467489 -461134 -444120 -414480 -389714 -355731 -361823 -371181 -365651 -280012 -374407 -231980 -41676.2 130968 268911 313321 309240 297074 293265 157734 39553.1 -150319 -206743 -245666 -258296 -263775 -281367 -312558 -336102 -367655 -362123 -323015 -211110 -140443 -138174 -122554 -161605 -222718 -295787 -360480 -383563 -381126 -395149 -446257 -488450 -481172 -465381 -444122 -437645 -471789 -510052 -540082 -553095 -584727 -598965 -586634 -540761 -490488 -436923 -387247 -349145 -313187 -306281 -276619 -273786 -304303 -319752 -329363 -301308 -295590 -310993 -315430 -317644 -277198 49857.5 -50200.7 -196709 -355191 -402087 -389852 -374572 -366761 -380438 -377074 -382223 -433465 -549035 -636989 -629567 -560599 -474877 -398973 -308643 -221925 -182796 -182478 -204835 -261042 -285581 -243402 -138315 -60203.8 -114418 -193061 -309560 -377430 -384091 -340419 -433738 -548695 -555439 -514016 -465107 -425455 -412075 -415367 -438657 -424206 -407891 -382025 -358013 -351178 -397405 -453413 -501895 -510432 -508438 -500630 -479380 -406340 -310629 -238236 -141974 -122373 -145803 -163934 -151039 -168782 -165723 19920.9 288428 190677 52135.4 102542 144573 155143 194959 250422 286643 352926 270317 209627 181483 36581.3 51596 54308.8 -15066.6 12288.3 29515.8 39675.5 49951.1 82621 18894.3 -7316.31 -149375 -145037 -82780.8 93481 94783.1 257487 323553 38744.9 -104636 -45528.5 -13984 9215.77 18836.3 40670.4 22184.5 -2022.14 -35374.1 -10067.4 -33435.8 -23610.6 -16285.8 -18449.5 -4288.1 -8329.18 -37502.8 -61580.2 -65509.6 -44230.8 -43301 -30247.2 -13791.5 9028.18 24038.6 15773.5 -11369 -50541.6 -5354.32 124126 113299 79519 -91099.4 -112698 -128362 -110788 -79159.8 -56397 -16154.2 -11015.6 37867.8 41206.1 119392 123149 307138 299893 328667 314337 335922 295002 314622 305093 289637 219627 229079 205273 161759 114120 168460 66423.8 103544 227955 306568 449612 116151 -61937 -14329.6 42774.7 56023.4 190392 134074 210390 140812 262903 262708 412053 426416 555648 558444 630067 541467 270071 -53560.2 5534.22 -77903.8 116724 398641 730841 792670 703476 388943 42878.8 -59836.5 -81397.9 -110087 -138228 303769 264576 256187 244902 255193 239722 229869 104383 -15002 -31741.6 -27442.2 13464.9 174365 154346 112626 73209.2 14854.6 80363.5 150196 331888 480520 443742 359488 270191 219754 161750 141256 139191 167743 217738 253699 254569 150648 -12816.6 -148954 -223008 -242384 -236193 -205345 -208763 -234421 -283982 -312027 -312783 -295192 -284069 -290585 -303687 -302386 -284821 -262960 -239452 -216864 -207030 -209012 -216190 -223051 -226144 -226443 -216150 -189126 -170998 -163112 -174829 -193307 -213086 -218560 -241839 -247797 -245145 -237753 -204108 -180018 -169285 -191212 -215087 -203678 -163235 -155968 -141377 -89909.6 -73505.6 -71882.4 -83430.8 -74726.1 -105780 -144274 -195017 -230301 -252306 -252848 -268057 -273598 -287151 -277058 -270637 -271685 -275520 -283378 -289202 -295280 -300741 -308723 -324796 -334689 -335811 -330767 -329573 -323640 -309096 -283771 -237053 -196474 -192113 -202376 -190814 -201096 -230295 -248186 -280480 -282486 -286399 -276552 -277927 -293228 -326694 -367000 -406078 -442154 -471049 -491561 -498405 -492164 -455069 -412457 -366332 -347721 -348001 -386131 -420331 -421543 -357307 -278663 -114084 35408 142625 286242 314891 333011 320566 283345 207526 -7295 -104501 -203063 -241628 -230956 -247156 -252505 -274024 -306099 -316556 -327725 -309291 -254328 -175313 -113904 -122571 -120170 -182331 -279367 -346506 -366791 -388220 -415091 -452292 -474717 -459362 -450543 -452547 -467701 -500763 -540773 -556228 -587072 -602730 -582654 -517337 -445908 -385910 -347332 -320868 -301312 -285100 -264741 -234280 -227620 -196197 -257659 -295555 -313254 -279368 -262128 -250525 -221774 -168737 -209834 -253188 -369319 -458119 -423543 -376597 -363678 -357492 -373273 -384902 -421760 -504179 -602512 -642499 -615367 -526975 -445549 -388306 -314774 -242281 -209075 -205294 -245959 -298060 -318781 -270442 -152535 -86677.3 -154385 -244991 -344690 -388835 -365247 -370326 -473547 -577328 -578393 -538391 -501199 -474202 -459934 -466337 -475929 -487113 -474640 -463371 -412991 -409537 -412658 -453373 -476744 -498596 -505676 -507555 -491920 -424764 -310030 -202853 -116037 -9023.07 35737.1 -960.014 -55939.4 -99574.6 -134648 -124601 24507.8 253030 264916 131319 161089 216781 239999 288819 359533 324731 263656 320157 160837 161298 94856.4 61582.9 123762 97926.4 137748 130701 122418 114543 89492.6 72515 -16342.4 -128193 -168090 -23265.5 134022 44616.9 291268 269467 -27803.3 54594.8 72021.3 73148.2 55441.9 33984.2 -1229.45 1697.3 -72747.5 -8007.41 -82856.6 -87622.6 -83890.2 -67033.3 -14548.9 -1824.52 -5598.69 -18901.5 -39415.8 -45574.2 -32706.6 -20520.1 -3528.34 12858.4 29932.5 45272.9 44867.2 18155.3 -826.75 45361 157666 155689 157430 110133 107305 86202 86142.8 70300 70129.2 84165.1 95323.7 152035 135236 256115 218905 390270 428265 415644 381523 415568 357972 364852 345743 317634 254788 239650 166392 158598 65729.3 111992 103395 142514 200367 391742 300864 273397 236309 234502 359100 315582 396841 279664 328958 304719 397593 412750 521086 546145 657955 646933 722936 570564 352978 21715.2 4726.43 223671 642508 891969 769073 393517 14588.8 -73363.8 -83224.3 -78823 -82551.4 -121125 291134 247632 247752 286668 307117 297026 226662 102679 -22257.8 -44806.4 -32320.6 -25218.3 66689.1 151969 133062 44324.5 4204.57 73276.2 147566 263606 398167 424107 376227 336316 281608 263876 250428 258198 268632 264197 209905 102201 -49305.9 -189977 -282440 -296697 -268260 -234131 -207152 -210981 -232096 -268885 -290447 -301688 -318231 -327269 -323338 -320946 -306657 -276251 -240420 -203621 -177035 -174301 -182803 -194581 -198897 -204288 -211144 -203036 -196830 -195186 -204626 -221234 -221735 -212523 -214527 -212339 -219895 -226813 -238046 -224595 -206807 -201228 -209943 -192829 -166321 -154987 -152216 -82485.9 -43045.3 -52535.8 -70565.6 -71031 -79852.5 -82535.1 -119569 -144552 -191469 -225387 -235392 -231293 -249594 -254025 -261405 -257874 -259609 -264465 -263967 -279396 -309823 -335930 -362621 -370825 -366314 -351260 -335253 -318966 -303603 -269788 -215197 -181119 -160532 -161284 -138171 -141931 -170552 -178780 -196805 -237438 -234170 -252398 -267813 -295589 -345016 -381332 -420992 -453455 -472952 -488663 -494452 -490420 -466646 -438078 -396897 -377485 -354535 -368831 -391102 -394945 -351194 -266955 -178767 -34888.1 82051.8 159454 350303 310863 359405 348414 296101 155629 34526 -97859.5 -214043 -227744 -239756 -240159 -235647 -252206 -271668 -301835 -301238 -283637 -252064 -199118 -152425 -125977 -154823 -228265 -298992 -344823 -381296 -416562 -436757 -457047 -459874 -453920 -460687 -472722 -500627 -538998 -569864 -598071 -608544 -593767 -531223 -442757 -364086 -312434 -277203 -233738 -228070 -188593 -184809 -183495 -149045 -130545 -209854 -287870 -295334 -243230 -237288 -273979 -279282 -251421 -388549 -425759 -492366 -492483 -450584 -418627 -401525 -403455 -419562 -454883 -509457 -586851 -634935 -632164 -579080 -509488 -447055 -387379 -339584 -283122 -246489 -254507 -280782 -338229 -347135 -301014 -171344 -112894 -200449 -296980 -372967 -388902 -388301 -445390 -546313 -604636 -594376 -562002 -539383 -517610 -507162 -502456 -504946 -506648 -512221 -487486 -483312 -446913 -437793 -433392 -455771 -456108 -499754 -491326 -474225 -388249 -271437 -145238 -45794.7 7178.94 85179.7 108551 82575.6 29248 -23013.3 -76589.5 -87193.7 -67654.5 61162.3 177551 156782 162991 233613 316033 313946 320521 319274 287110 276068 214687 305042 277633 219004 261053 220188 243556 198163 171015 126544 104884 9157.89 -49918.3 -180338 -169504 39771.7 155381 77293.1 182141 183549 63892.9 74641.1 81166.7 84302.8 72368.9 28495.5 -31897.7 -12910.3 -54474 -91552.6 -67502.7 -95556.8 -87708.2 -55445 -36510 25126.4 25416.2 8580.27 -9561.96 -10692.9 -6627.27 9919.32 28187.1 40805.7 56316.1 65591 63364.5 48761.5 69337.7 76058.7 58538.6 52606.6 52504.3 56042.6 59682 70244.9 76582.8 84401.3 91308.2 110904 118508 136869 123856 184651 254781 475370 498038 475487 449517 494808 436016 443476 374791 315293 213641 180162 77331.7 104015 79150 140347 195465 204635 194259 204905 197491 239467 300408 294630 377561 329615 428303 363734 454643 443571 514865 575336 657428 660041 728296 737170 840664 644357 405614 158899 371575 838580 853843 376098 86318.9 -44865.1 -43390.3 -36320.6 -43362.5 -51660.4 -76875.9 308543 262516 275658 307755 325854 316140 248545 155308 -4583.21 -65242.9 -39844.8 -28806 10212.4 76867.1 40484.3 -9313.43 846.819 79192.5 133144 203510 311205 343992 351584 335506 316082 306637 292335 269832 223843 162977 58932.4 -72054.9 -204395 -300631 -324259 -290433 -244952 -215832 -209553 -224901 -258267 -293870 -319289 -330548 -330355 -330679 -326478 -318042 -301770 -269195 -221121 -174258 -153161 -147297 -158688 -169958 -179607 -184463 -188916 -189504 -198963 -216833 -235502 -239010 -216131 -188101 -186795 -195454 -192191 -198772 -206610 -216153 -221031 -211975 -202593 -174844 -161966 -156590 -101976 -45536.1 -36201.7 -61687.1 -68624.8 -75898 -70857.9 -93703.5 -99308.6 -122594 -145813 -197934 -219717 -222745 -222649 -227142 -229558 -238943 -251851 -273804 -301355 -333882 -354060 -365654 -361963 -355846 -346562 -332386 -310935 -280289 -240431 -195421 -171478 -153410 -147208 -155194 -159635 -157237 -136197 -151518 -163519 -191811 -180746 -187100 -223607 -265327 -322091 -364814 -395573 -419060 -431941 -437477 -450525 -461884 -469779 -452289 -417329 -376683 -369623 -369704 -359637 -314542 -239040 -184776 -95629.8 -21561.2 144593 228116 337489 365764 358453 313726 285325 142567 45141.1 -92313.2 -197041 -243068 -259372 -241982 -237400 -232246 -251946 -270551 -297126 -296780 -271176 -242495 -218713 -218751 -250754 -299503 -351233 -390779 -417565 -439633 -458591 -459610 -464466 -473473 -492002 -516346 -548163 -576477 -596108 -603407 -592569 -527900 -422355 -327659 -263983 -234813 -214635 -199817 -162524 -114180 -111327 -52397.8 -4790.25 21425.2 -49056.4 -183743 -258247 -234454 -254657 -342507 -376395 -409430 -476375 -504038 -531921 -535832 -515121 -525962 -489343 -511319 -530540 -557412 -599414 -625486 -627061 -601554 -541690 -481388 -442119 -409016 -372992 -329345 -306366 -301393 -342649 -375302 -363464 -313740 -185380 -127548 -245667 -346500 -418491 -444403 -471053 -536896 -599583 -622299 -605354 -584891 -569526 -551092 -541185 -533606 -527701 -523511 -520067 -511696 -492535 -477617 -457981 -430245 -447682 -433619 -487365 -477843 -429696 -323591 -191243 -78821.9 9877.7 73922.6 81941.5 127819 128502 99549.8 67101.3 27350.7 -28468.1 -56924.7 -81500.4 -53080.7 -3747.08 53339.9 116590 160502 243369 310801 298611 330188 300313 395989 372649 422434 343842 299101 313967 267641 245388 174208 127635 76225.9 17417.8 -69679.3 -161038 -234101 -149367 83994.8 177144 125947 112554 152887 127675 113170 78172.9 85442.9 56009.8 34938.3 -29196.4 -33870.3 -62752.4 -89167.1 -67685.6 -80285.9 -58984.8 -67927.2 -4844.18 66017.5 66315.1 45443.8 34638 34293.4 39745.4 47476.5 61834.7 66571.1 70149.6 70472.7 77779.9 94420.9 102136 129929 130031 131775 128164 135663 142813 145673 135282 147942 155698 172342 157657 207231 140126 233666 338372 585327 529182 514144 503751 510296 482625 484194 308242 274889 92659.3 142196 57032.8 109750 111060 206319 257658 274440 281902 221477 311230 283375 348849 336097 448115 428952 534459 505051 601202 628938 711027 738036 774614 737379 832295 895605 989116 713335 479686 519845 713698 479074 208894 539.352 -19225.1 -7282.51 -19549.4 -4199.43 -18271.6 -72448.8 313130 275814 303714 291203 265159 284630 261465 207719 65801.7 -34880.5 -62595.3 -60899.7 -37802.4 -16366.2 -37515 -31825.4 15418.5 81837 124501 144200 225325 243105 240197 225791 212025 203286 186918 158593 121114 48173.2 -43042 -165805 -267204 -327554 -339325 -329636 -310958 -291908 -288400 -299489 -318545 -329749 -329149 -323802 -321628 -320202 -320622 -316098 -292334 -254323 -212522 -169277 -132461 -115775 -110724 -119159 -126510 -140835 -155161 -177028 -198757 -231750 -248035 -245386 -223563 -195718 -179651 -185486 -176935 -184846 -188313 -190225 -204598 -213552 -203847 -186274 -175906 -142231 -85806.1 -55964.5 -69923.5 -96705.2 -101050 -111500 -119721 -119182 -125710 -117523 -134084 -154325 -203324 -231383 -233303 -231075 -237507 -257296 -282545 -301938 -326079 -333161 -322256 -320071 -298155 -287375 -276421 -256928 -238275 -212191 -182249 -162444 -150379 -153506 -142151 -135439 -141252 -144458 -149579 -147154 -131887 -135502 -120009 -106235 -136863 -179023 -233309 -271931 -312800 -328970 -342571 -361753 -380914 -420505 -445699 -460174 -450894 -414650 -382489 -366985 -322886 -265477 -204068 -128305 -50919.4 86743.8 183753 297012 414347 403240 330592 299986 244909 88794.6 -14786.8 -71982.8 -155123 -252429 -276710 -275372 -255219 -239586 -233943 -250537 -276071 -306106 -319337 -317499 -312422 -324367 -346215 -379044 -404970 -429761 -452242 -472201 -481064 -487843 -501550 -521261 -541191 -563879 -582267 -589610 -590826 -578658 -520964 -435049 -338713 -273860 -238618 -214522 -196763 -161032 -100053 -54489.2 38222.9 119706 110126 117494 27128.8 -109314 -201462 -226107 -270485 -319131 -378983 -444797 -502181 -533948 -559427 -570241 -583601 -610072 -585374 -590309 -603459 -608570 -602056 -593712 -571012 -538301 -494993 -458225 -434826 -414584 -402610 -382858 -369121 -374928 -387018 -385004 -361346 -319213 -191052 -143339 -274015 -391675 -468632 -522013 -560380 -602935 -628354 -633574 -623014 -610990 -599534 -584394 -576274 -563653 -555078 -547194 -536292 -528733 -513767 -507448 -490588 -467626 -476354 -431073 -467668 -444408 -340755 -206785 -85497.8 6226.77 58572.4 86653 109786 85855.3 113529 114713 89573.6 69599.1 44990.4 -1264.22 -16475 -38655.7 -70379.3 -48689.5 -50488.1 3659.31 75921.2 125194 208706 292853 287690 289833 466277 408773 419148 340881 284481 256420 178673 119322 53350.6 5873.64 -53575.1 -122698 -214682 -260774 -255221 -107522 83147.6 183705 192563 137003 107365 139507 155582 120297 101390 55886.6 19761.3 -37270.2 -33054.6 -46684.9 -44595.4 -35484.6 -44528.7 -56056.2 -19726.6 73610.4 130650 101291 93172.9 97940.3 84895.5 72740.4 77605.5 76595.9 72711.2 77229.7 79398.4 93958.3 109666 141293 149614 166573 178002 185841 200498 218832 214323 206198 209073 213543 220047 208944 244088 187015 266331 471486 619034 563157 567866 587545 515970 461037 381388 262138 100752 160210 76117.7 73885.7 147530 155854 248873 339830 330491 406264 351185 395301 352806 433387 392307 550810 523599 683032 706141 811081 835443 877070 845026 876977 863949 1.01092e+06 1.08012e+06 1.06459e+06 553017 358625 321748 215986 106210 53876.6 33675.6 -4408.59 -2185.26 10525.3 -8385.32 -23372.8 345656 311575 303315 230376 205819 217227 242468 244539 142663 84086.7 -4373.69 -57150.5 -69977 -74491.8 -67527.1 -47096.8 26428.4 97888.3 145648 104109 143715 152717 132065 115166 95500.9 100770 91502.8 90970.5 76323.7 36400.8 -51633.8 -153064 -238258 -288323 -323055 -363078 -396266 -405252 -401379 -387911 -370010 -352540 -335462 -322750 -317325 -317345 -313026 -308785 -294970 -267331 -232875 -192854 -149083 -103572 -74069.1 -58892.3 -62859.1 -71475.7 -96482.1 -127108 -166359 -206027 -231751 -243518 -235709 -220168 -200283 -188954 -178672 -177662 -183789 -190528 -190253 -204939 -201953 -208197 -182815 -165556 -145693 -158308 -186831 -188011 -204419 -203696 -214450 -226697 -218691 -197166 -153595 -138410 -160175 -199768 -236853 -258667 -273450 -287539 -292664 -296979 -302445 -300496 -269239 -262581 -238609 -225813 -212503 -198961 -186878 -172576 -164595 -159616 -157607 -152478 -173418 -180884 -185254 -183760 -171666 -155712 -138851 -100210 -83274.6 -45851.2 -63132.3 -90380.7 -142374 -175774 -210859 -234262 -248269 -264123 -289015 -320585 -377312 -421238 -441629 -444816 -416426 -366411 -329283 -270863 -201058 -135559 -1280.67 113403 249992 380949 425759 367519 312181 236204 130723 -1296.1 -108308 -65560.5 -113827 -193535 -268258 -289048 -295882 -277987 -259909 -236725 -239128 -260844 -295647 -325840 -352353 -367517 -386436 -401918 -420571 -436615 -453545 -465331 -476568 -489698 -505791 -520360 -535711 -546081 -548399 -540338 -512599 -457792 -396172 -318328 -264048 -230500 -213538 -205863 -187124 -126689 -91138 20907.5 178447 233377 240435 218596 209892 100876 -41241.3 -151095 -173596 -194177 -230356 -307087 -407518 -495311 -539537 -569393 -605872 -633954 -623013 -614742 -618053 -594962 -564881 -526274 -489227 -453032 -431701 -400542 -396493 -386353 -381605 -374597 -368728 -364683 -364250 -354054 -343062 -312827 -192839 -151776 -286414 -403788 -490442 -552767 -601202 -625289 -634397 -634638 -630272 -628038 -617219 -612306 -599196 -591833 -577808 -567456 -553393 -537882 -525662 -500751 -486661 -467447 -476297 -424106 -440353 -330462 -187187 -57085.6 21577.5 51395.6 83074.3 77970.4 74556.5 91256.5 64835.9 78214.9 80436.5 40410.3 31588.3 45486.3 4814.27 -12916 1210.1 -35780.1 -29698.3 -25600.6 -11398 48404.5 64870.3 168506 208671 281195 342461 379339 295349 323175 231750 171400 87246.4 7500.67 -52890.1 -116493 -168957 -221599 -276509 -318986 -291238 -218345 -79087.7 100613 214930 247356 256439 237965 222739 224488 194260 158587 111815 73036.6 30436.9 19615.4 31388.9 -5588.19 3405.38 -30399.3 22326.1 14174.4 147170 137355 151265 116516 114605 107536 86367.7 81050.1 78525.2 69915 85388.5 78918.4 115287 107979 136857 175926 168949 186393 203625 208117 237253 193373 231286 229120 221253 251465 198863 300376 180331 467645 480607 573544 618015 598278 541611 438620 343793 325090 171299 174974 89437.5 126154 117503 196126 224166 276744 394536 371883 440642 394941 445762 413031 507025 468951 640615 660731 879951 891820 962820 926407 930407 863536 946689 981737 1.08511e+06 869002 359695 -53461 160126 166293 150570 109420 46348.9 60377.9 62792.2 32434.5 16215.2 -21684.1 363447 341794 301671 205952 164936 159142 188667 210978 164344 158216 88115.5 20118.1 -23488.1 -56840.1 -55153.6 -18502.8 39921.6 118382 189743 88505.4 89333.4 85837 68533.8 63639.8 58450.8 84031.8 102614 136552 156512 139222 76079.4 3544.21 -42417 -67826.2 -98415.5 -163107 -274167 -362247 -425699 -441976 -444119 -437795 -405617 -370862 -345527 -324697 -314527 -306554 -299970 -287167 -272776 -244094 -209233 -160860 -104476 -67910.9 -45213.3 -34997 -42664.4 -66731.3 -99071.2 -138817 -177120 -211085 -230760 -235834 -223172 -214433 -193247 -188016 -184150 -183345 -194521 -178009 -182794 -156289 -151171 -155218 -187943 -221629 -259046 -270525 -299611 -312280 -328358 -329749 -323271 -303932 -271416 -203905 -147652 -150999 -186883 -208750 -233827 -241548 -247899 -252819 -262504 -263477 -249541 -256129 -240786 -229104 -225766 -210641 -206579 -204011 -202533 -204485 -210088 -219671 -223175 -232763 -232937 -244210 -239929 -221119 -199304 -145843 -60680.8 -24389.1 -14595.3 -42451.5 -86235.8 -113515 -135316 -152916 -165826 -179024 -193306 -221397 -252077 -321654 -367879 -408491 -410037 -394283 -360480 -317804 -289289 -189415 -124204 11322 126681 232853 252220 236099 142824 68133.8 -45612.6 -139660 -194607 -135839 -83929.6 -100990 -175471 -236386 -305836 -317264 -319150 -292812 -265423 -244844 -235031 -234707 -261633 -289761 -305313 -322079 -334465 -348998 -355331 -369555 -374683 -389680 -392378 -400586 -409256 -401011 -390974 -368647 -337769 -305894 -270802 -248043 -231062 -221480 -213158 -194511 -163987 -120906 -16571.6 94164.9 239471 339461 270616 289761 302691 316714 226317 125300 52287 71779.7 61011.7 -10093.2 -123849 -251785 -377502 -454931 -539613 -582801 -598426 -603115 -604268 -593810 -571975 -540607 -502996 -459876 -433445 -400052 -375837 -355996 -346335 -339673 -332743 -329587 -326025 -326282 -321546 -298078 -189771 -148662 -268717 -371596 -452056 -522918 -562586 -586444 -596315 -597396 -598579 -590431 -587943 -582068 -574661 -564323 -555032 -538889 -526603 -508938 -490214 -472450 -446848 -413842 -410590 -359162 -279444 -147947 -12357.7 80014.9 96436.4 86457.6 50660.5 38682.5 -3830.01 -20663.4 -6684.52 -19169.7 -19420.7 -2046.66 -17872.8 -37151.5 -39651.6 -10793.4 -27094.8 12813.2 24893.8 33219.5 70354.4 87918.4 105679 156119 209117 217019 344085 291290 258521 167931 154270 49890.8 -4855.48 -100326 -183704 -257548 -308228 -346126 -360350 -343988 -322935 -249963 -137815 -6468.47 117600 202397 232404 262417 274410 277272 270927 234246 192611 145640 102406 50802.2 68650.7 27153.5 6911.84 5839.39 24029.6 -28410.6 86043.3 158473 157220 172690 141256 110034 94151.7 61813 63637.6 45798.1 58878.6 68458.3 70220 114545 119713 148619 173934 176751 164171 199096 211483 234602 236597 245883 235327 230910 243591 231359 174347 368253 406604 629472 595542 562655 505597 444729 288329 325798 219582 187777 116817 147296 110401 122975 145032 259401 263099 365597 382674 416955 422055 461840 445825 527510 512370 697851 767038 881105 919262 904223 807830 838131 757425 896190 747951 541136 -96523.1 -162789 129409 171289 215924 128546 116666 75995.2 67760 68519.5 50173.3 23638.6 391917 367873 322578 197740 140450 107671 113240 123258 91485.5 108257 116197 84186.4 62929.7 42559.7 36476.7 64383.7 69989.3 149900 208454 91225 61961.4 61087.6 50631.8 68328 81592.1 138765 176166 269941 302136 331303 315244 298720 215986 232237 123883 160863 68955 68915.1 -60821 -159951 -278105 -382841 -460135 -502403 -500657 -451791 -379508 -321592 -304285 -299107 -295401 -295524 -283720 -252486 -209210 -155921 -120897 -108879 -101460 -108867 -125362 -140854 -163343 -182660 -209060 -225309 -236132 -252600 -239795 -222117 -212688 -205877 -176943 -184659 -146179 -131802 -119169 -129062 -177031 -223705 -254166 -273923 -295500 -310886 -315341 -325777 -311400 -316383 -346864 -359731 -207213 -136120 -148313 -157648 -157128 -165357 -163387 -153513 -178554 -192267 -211557 -225452 -250130 -249801 -262008 -263280 -272700 -276473 -281463 -284525 -286332 -286501 -287143 -280808 -276783 -266617 -256793 -235026 -227592 -189483 -116686 -66766.7 10270.9 -30751.8 -74651 -114992 -101090 -123817 -137905 -159190 -153088 -171989 -180509 -209233 -211505 -257747 -268680 -278897 -298196 -300166 -270050 -265725 -157933 -140771 -80179.5 -75549.8 -68649.3 -106324 -146052 -174124 -212099 -234837 -234937 -196143 -120973 -65901.6 -50619.6 -124330 -250927 -330051 -338939 -331976 -326314 -309508 -299961 -281917 -268517 -273396 -266777 -279364 -284464 -286415 -290322 -293178 -294775 -296490 -299863 -297684 -294824 -290433 -285410 -277911 -269850 -260966 -252915 -246150 -236384 -224995 -206509 -182132 -134176 -103030 40529.5 117296 286661 315128 344377 339015 392014 417136 449733 393284 350330 325152 312538 274122 199146 126663 20642.4 -155698 -290450 -365652 -413629 -439106 -464297 -475793 -480775 -475947 -467561 -449365 -430193 -404439 -379109 -354826 -333971 -317984 -304703 -302128 -307429 -311973 -317009 -286960 -192437 -134769 -240467 -302474 -329204 -370171 -401722 -408343 -422334 -422664 -426821 -429585 -428143 -427282 -420212 -416866 -403016 -395021 -377098 -363526 -342528 -324147 -300121 -272028 -266045 -199604 -69670.1 8182.15 93466 152681 109089 47654.4 -41211 -143241 -194138 -184132 -206526 -194133 -183544 -185188 -167656 -158365 -127636 -113514 -68428.9 -50935.1 -26559 15813.1 42233.6 40868.6 67291.5 135936 126104 141476 150991 123009 15179.9 -4226.48 -59114.4 -121295 -204012 -267607 -369240 -441871 -492417 -469358 -431548 -367952 -323483 -235652 -161157 -50349.7 35160.5 88380.6 134820 154657 202789 192927 214855 211483 124024 155214 44217.2 87613.1 5995.75 18279.9 4269.99 -14654.6 5103.29 -72750.8 -195.999 89721.6 201798 180671 128576 73455.5 66442.9 21977.6 4102.77 15100.1 -3470.66 -739.406 44040.1 23915.8 46523.4 89893.3 71699.2 117377 117740 166121 138377 194649 200568 215423 199807 221503 162158 242290 106608 274604 275088 587993 527490 502834 423749 382762 314652 237805 237931 122550 151821 81171.5 94301.8 87606.9 100499 47120.8 173454 206058 280798 327589 374428 386072 450317 396622 517283 475319 652652 658339 676691 569232 665371 462975 576189 362167 380628 19318.9 -190315 -202900 136182 242720 203058 178414 108806 96326 100945 89594.2 76117.6 50340.9 ) ; boundaryField { wand { type calculated; value nonuniform List<scalar> 2048 ( 509839 574115 612544 538066 424443 388074 374636 341013 319181 295715 302237 297446 324567 337385 369551 381068 506331 571985 574947 543091 433246 394089 363973 341968 311757 303333 290710 308144 312933 345588 363443 391882 381068 391882 376752 367722 324433 322374 208102 197635 138502 140370 121006 107302 97875.4 112718 89333.7 123069 118318 90711.5 106294 107417 93064.7 115211 96203.7 83193 59830.8 62727.3 39100.3 42317.1 40434.6 34455.8 53671 60350.7 99794.7 67077.8 122170 148782 230325 208288 79899.7 88536.9 54542.3 54911.4 44937.5 48827.7 39672.4 32016.7 32268.3 44784.5 67574.2 53205.5 91558.9 110199 178714 149991 223486 245878 285535 282242 305819 314911 314043 301880 261072 287676 255417 201256 144161 216781 175989 104686 77577.4 138531 102735 44884.4 479.282 43322.7 -69382.5 -85702.7 -189396 -183825 -301707 -299614 -401236 -402431 -478743 -477620 -517056 -518823 -513083 -514951 -465497 -465024 -389293 -391576 -335632 -332896 -313857 -315467 -308790 -310103 -309088 -307437 -306924 -309170 -300370 -300670 -277783 -273150 -228995 -234532 -186424 -184301 -153882 -151221 -133456 -139380 -132525 -129168 -133667 -131177 -138638 -141990 -153734 -151390 -167944 -169801 -190248 -187479 -207880 -213722 -236456 -235208 -262567 -252699 -263941 -275524 -264581 -273075 -259152 -255389 -240912 -239634 -213118 -225816 -211825 -189266 -170868 -194343 -169020 -156237 -139492 -146311 -135689 -139087 -164664 -153594 -199198 -201603 -238896 -242218 -267560 -269338 -288795 -284009 -298814 -300607 -308977 -313953 -324044 -316872 -318902 -326632 -320037 -312248 -311814 -317508 -354614 -350100 -366107 -367878 -235997 -226399 -173654 -178723 -234065 -221513 -256185 -247833 -245952 -252315 -245604 -247280 -234532 -234222 -233952 -215410 -219299 -233716 -253207 -241290 -271320 -289136 -317375 -295110 -310420 -325530 -321720 -318388 -315201 -316313 -310958 -308566 -301988 -303893 -297090 -296621 -292651 -292802 -289642 -289825 -288510 -288065 -287898 -286735 -284118 -287212 -283040 -281568 -275877 -278356 -269744 -269070 -256921 -259286 -245936 -237614 -214436 -229695 -195113 -190764 -150713 -116828 -29972.2 -70532.3 -11422.1 651.07 -31779.2 -48704.8 -111186 -97472.6 -125729 -143965 -151304 -135733 -153446 -162712 -187014 -179796 -202243 -210562 -227803 -211829 -232682 -246800 -272615 -266441 -301361 -303604 -330783 -314651 -337003 -350125 -386886 -372748 -413567 -441023 -448514 -465429 -474192 -453212 -452255 -451131 -394092 -428958 -368915 -315034 -237840 -274391 -186570 -173204 -113242 -124370 -92548.1 -85774 -104310 -107374 -150847 -147478 -180423 -181077 -216033 -218038 -242286 -240510 -239956 -236567 -189454 -197696 -128285 -121956 -63386.7 -67285.3 -62320.3 -51759.1 -111599 -125233 -264723 -251571 -324760 -333609 -348147 -348350 -350021 -347868 -341256 -345492 -335733 -331774 -319245 -323499 -309698 -307984 -302690 -298027 -295022 -303921 -309130 -300450 -308045 -312466 -312162 -312021 -311655 -311983 -310939 -309286 -306524 -307604 -303985 -304061 -302638 -301521 -298936 -301582 -298092 -297799 -296388 -295581 -295044 -294502 -294530 -295796 -296498 -297576 -299066 -299141 -301517 -299495 -297916 -298915 -294885 -295553 -288651 -288710 -277594 -279204 -260617 -260757 -231612 -235273 -191645 -183734 -96864.2 -138017 -65726.9 13975.5 121253 109968 276645 277887 332707 291602 276457 317307 327197 315848 365905 371959 422288 395721 404870 422538 378987 362133 317689 320803 298630 299957 290599 291823 258653 260220 201511 192000 115978 124050 7698.43 19401.4 -137064 -156957 -306329 -303088 -392449 -385810 -427975 -430687 -454391 -453307 -468829 -472263 -481056 -479277 -480956 -481615 -476949 -476380 -468817 -470048 -460096 -456814 -443012 -445443 -430586 -431075 -419211 -420149 -412217 -412270 -406900 -408219 -406588 -408344 -409498 -407688 -410353 -409895 -403502 -408416 -384940 -387914 -352655 -359297 -309600 -302519 -179888 -195901 -144081 -135279 -257132 -246491 -312945 -324508 -367429 -357952 -397806 -394781 -409227 -419794 -423742 -418218 -420039 -427269 -426627 -424379 -427944 -427114 -429831 -429729 -430587 -429274 -429232 -431072 -431595 -427855 -426185 -430495 -428505 -424155 -422274 -425312 -422359 -418684 -415913 -416793 -411571 -410946 -406406 -403979 -390542 -406321 -393391 -383876 -397126 -365954 -305906 -292565 -145264 -90522.3 21888.5 1758.69 90321.8 92627.1 148367 149644 110731 103802 35449 42092.7 -60146.7 -47198.8 -148279 -147951 -179798 -198112 -210990 -185922 -184552 -206694 -189131 -194527 -189723 -187242 -177573 -195024 -184021 -188701 -177498 -194262 -183929 -183946 -174398 -196203 -195306 -182571 -192256 -199704 -195646 -212780 -224553 -214525 -251109 -232328 -264607 -292154 -319125 -321365 -382602 -337414 -403584 -344551 -410069 -369358 -209164 -207251 -338021 -294800 -417013 -469374 -555096 -479165 -549884 -567680 -597155 -543836 -545414 -549716 -525844 -523803 -543389 -554847 -618186 -586900 -639764 -617978 -616062 -590664 -558083 -539107 -492660 -490851 -417425 -451967 -368000 -320289 -209512 -248680 -130385 -138255 -62300.4 -67451.8 -12946.9 -26984.5 3903.93 2797.62 34880.8 9038.31 31624.9 52343.5 75037.9 42456.5 68571.4 66894.8 29547.2 61347.2 13989.8 -38672 -110638 -23883 -67970.6 -160938 -188832 -107994 -146160 -201521 -179798 -199489 -215853 -180895 -171249 -216339 -200459 -160082 -134955 -205531 -158412 -71040.5 98166.1 43588.9 154107 186119 139210 161309 100004 98621.3 51592.8 28509.5 -22492.4 4877.8 -32973.2 -57331.7 -66046.4 -87277.1 -128526 -88835.1 -126864 -127844 -123857 -149358 -164929 -125696 -144041 -172639 -155839 -176934 -196577 -160226 -159123 -195524 -193667 -164392 -141579 -240633 -251349 -115490 -85946.8 -259541 -211782 -71876.1 -68228.3 -77847 -92602.1 -78330.5 -91099.1 -108161 -135307 -81254 -65810.8 -147816 -167630 -27251.7 27409.8 -163563 -159137 98265.2 343707 121801 435077 553677 519404 495167 448406 453138 361302 344379 259010 276612 203600 187293 152023 115160 47379.9 120710 77305.5 -4134.14 -34223.2 32335.3 -16666.9 -51765.8 -73636.1 -58055.5 -109899 -82885.1 -128197 -133151 -95400.3 -165382 -172186 -57446.1 -48229.4 -159346 -129060 -58784 -53330.8 -130600 -127629 -58626.7 -42978.1 -141382 -153376 -24362.7 14178.3 -168975 -153895 80763.2 128644 -110322 -31285.4 177292 193429 57554.4 88079.1 234581 252523 78692.4 47431.5 320794 289591 74121.9 39109.7 278705 247782 7152.24 -41587.2 113052 -90668.1 -180108 -289526 -216860 -137235 -217722 -100822 31792.2 46005.1 104655 140967 88317.6 80115.7 99993.5 80935.6 56400.9 76417.7 59348.6 72627.1 78900.8 88966.7 77328.1 71035.5 71435.2 52990.3 49743.8 -143512 -116864 -102811 -53683.2 -47932.5 3868.32 20554.4 52990.3 -143843 -128542 -82641.2 -76722.9 -26244.9 -22495.9 22738.5 49743.8 509839 506331 516274 500087 505548 498036 482836 492915 484315 457138 434447 451362 406821 388585 312028 335078 220595 199219 30912.9 70649.8 -157832 -146674 -369937 -332260 -491872 -449259 -510195 -515101 -120872 -125428 -33884 -34517.3 61358.4 57937.8 119483 115508 138862 135115 120547 134268 104992 93683.4 58695 76147.5 57428.6 22682.9 47.8786 37868.8 19219.5 -12719 -18586.9 4936.49 -2882.11 -17794 -5357 -11952.3 1793.32 -7652.44 -2897.58 4535.4 18545.3 -4467.98 14650.9 46374.1 82965.3 49905.8 76603.3 83935 54158.6 71119.4 27260.5 4655.97 -55304.3 -39468.9 -115053 -128340 -204743 -201698 -278422 -282614 -336956 -346530 -390618 -395747 -447992 -466830 -520209 -529086 45045.6 43441.9 149896 149427 145596 147048 107989 108880 80429 77585.3 62428 62317.3 53487.9 63123.3 71210.9 55776.9 72170.5 81439.6 91625.4 96590.2 118347 104804 119750 132996 142098 126732 118278 143942 133474 96308.9 75047.7 103766 59801.9 64674.5 47772.5 28501.3 6164.48 28143.7 5677.35 -6922.1 -8617.2 -22409.5 -34552.8 -17827.7 -23005.1 -43639.1 -31707.8 -39736.9 -72786.6 -35233.5 -101792 -138065 -210957 -205607 -239124 -241256 -240564 -233510 -290155 -284647 -233222 -239650 -254309 -240024 -261597 -259525 -235925 -245164 -206766 -233599 -209902 -213500 -221666 -224527 -234560 -234923 -245300 -243668 -255581 -252212 -261661 -263142 -267481 -272180 -279801 -271685 -277255 -280323 -280272 -273746 -269669 -264822 -241166 -266633 -233062 -221418 -187520 -191121 -196098 -190109 -211038 -220435 -231396 -236596 -235798 -239269 -255366 -250982 -267406 -268275 -286064 -282286 -300104 -313740 -331079 -330715 -316205 -318242 -301088 -292933 -413451 -413640 -415375 -416053 -422166 -421419 -428471 -429423 -431611 -431033 -426724 -429715 -426556 -420084 -416285 -421830 -418555 -414991 -417481 -415690 -414971 -418938 -419372 -417151 -422341 -419986 -422348 -425042 -426392 -426070 -432106 -429287 -438954 -438010 -445778 -445575 -434401 -450623 -435127 -390228 -348902 -346843 -268796 -280395 -241418 -235902 -257201 -252271 -293304 -299352 -318346 -305900 -264216 -274155 -255464 -240022 -356173 -337398 -461915 -458884 -377259 -363847 -327680 -298564 -288480 -280756 -297967 -303101 -337469 -367414 -257905 -179768 101938 37332.2 178504 237645 250832 237930 181143 173081 16252 78124.7 -40801 -154821 -252097 -137630 -201793 -301100 -311337 -247945 -279960 -312705 -317043 -298752 -311099 -321024 -323057 -317445 -318454 -319868 -314736 -312293 -307419 -306146 -299583 -301886 -303565 -311968 -359040 -359203 -435148 -430939 -479400 -475400 -484125 -488219 -464472 -478031 -459717 -444397 -574846 -577032 -574566 -568745 -566343 -557612 -542224 -545738 -517536 -513316 -474485 -476206 -432775 -435865 -406350 -405445 -393452 -395797 -399341 -396001 -427123 -419632 -506832 -514424 -560222 -559499 -527990 -533369 -485567 -476973 -477310 -475401 -486673 -490541 -504878 -499511 -510320 -517800 -526756 -522119 -526231 -541717 -553755 -528579 -534192 -555877 -564919 -553752 -594764 -588086 -644940 -647703 -708781 -704328 -735224 -726105 -584070 -551398 -383132 -384012 -579568 -602215 -583989 -604186 -596744 -600498 -599282 -585409 -540353 -590687 -529208 -497858 -454713 -463452 -401867 -418113 -356977 -362766 -307404 -308692 -291715 -298119 -373104 -376694 -463898 -449373 -446053 -417990 -363460 -335621 -279389 -266224 -198692 -198236 -130990 -123282 -60734.4 -64530.6 -10184 -5255.48 30996.7 37273.2 50596.6 57576.9 59460.3 58365.3 52352.7 54539.8 59261.8 31695.2 26155.5 47459 28930.5 9471.39 -13278.3 11403.6 -3461.79 -22849.9 -30465.9 -8318 27920.8 28707.8 15727.8 11557 2500.82 18935.9 15933.1 8720.56 8487.13 31600.2 47292.5 24920.3 88837.6 61774.7 91756.6 141751 128219 109167 83227.4 114832 98743.4 101621 113584 137104 149924 160671 136876 148419 118685 87672 37236 99699.5 72706.1 23918.1 5388.53 55726.1 30036.3 4594.07 212.947 17349.7 -3832.39 7760.67 1800.72 -15089 -17727.2 -20731.6 -19397 -46346.8 -42900.9 -40183.5 -36690.9 -58834.2 -55878.6 -53854.3 -55953.4 -73364 -71637.5 -75916.4 -74603.7 -86847.4 -138300 -169707 -44815.2 -94157.8 3484.22 -17992.1 -112.411 -464.518 -23571.9 -17589.8 -34560.3 -46255.1 -28972.3 -46663.6 -38469.2 627.292 1744.58 3019.4 29239.8 -31011.3 -76127.5 -26342.7 -148391 -135644 -197694 -208107 -203918 -208146 -194152 -180736 -156122 -147064 -131861 -99566.5 -99148.5 -118827 -137288 -117448 -138106 -143093 -154063 -129945 -137767 -132533 -135097 -125142 -135040 -142986 -162949 -153001 -186256 -183135 -209379 -226184 -250399 -251785 -288558 -274785 -318035 -293331 -575573 -565155 -494875 -496503 -468199 -444710 -434403 -452014 -430424 -410067 -386703 -402951 -392596 -369861 -382065 -376944 -375759 -366897 -357335 -345628 -339099 -320492 -322086 -311006 -312072 -296700 -303723 -263941 -264856 -252738 -238802 -217784 -203332 -184568 -175036 -152782 -151253 -133540 -134564 -121244 -122541 -118652 -121570 -114308 -115465 -122820 -116841 -127932 -119231 -131858 -124464 -132860 -134513 -129245 -132327 -138004 -136538 -131935 -127139 -120817 -600291 -611089 -554198 -547763 -533699 -516445 -523220 -519504 -525940 -509273 -498267 -518645 -527890 -470905 -447359 -502474 -412740 -426745 -381241 -329358 -297558 -318018 -282571 -272770 -263062 -276469 -275477 -269507 -270663 -304010 -293265 -289628 -286559 -293639 -293081 -275005 -265001 -267544 -221683 -236563 -191010 -206827 -198900 -152919 -170512 -143082 -157081 -153497 -182100 -143663 -185061 -172508 -223481 -114673 73355.3 -65554.5 263282 312923 815410 745026 -651879 -580823 -554075 -592955 -515292 -525085 -519766 -486829 -501205 -516277 -538298 -506228 -512801 -531062 -549022 -513221 -514067 -551099 -542976 -513107 -518655 -538335 -540581 -526975 -531199 -535483 -533944 -530458 -530063 -525130 -512952 -531951 -528974 -507937 -513997 -524621 -526364 -485861 -475060 -499637 -493104 -439321 -400112 -487115 -458494 -358410 -215192 -176243 331478 63529.4 340435 556804 621960 425587 353803 535318 392630 345379 361575 446510 -510195 -120872 -520209 45045.6 -290155 -233222 -301088 -413451 -461915 -377259 -459717 -574846 -383132 -579568 -30465.9 27920.8 -74603.7 -138300 -318035 -575573 -127139 -600291 815410 -651879 361575 -514774 -3079.54 -505566 43097.7 -291291 -219210 -292133 -416487 -378672 -358799 -456131 -534531 -421273 -548545 -39763.1 -2336.31 -49537 -142254 -263724 -564994 -152424 -598782 842442 -553295 663400 -487512 174944 -471547 25368.1 -307454 -214696 -285520 -427142 -318032 -357464 -456207 -484430 -516836 -527251 -27577.1 -65675.6 8190.8 -139029 -259088 -543281 -75250.9 -579191 1.0731e+06 -491037 953322 -437911 215345 -449769 6904.99 -335589 -168162 -275593 -428553 -269926 -331640 -454524 -432593 -609289 -411380 -108263 -99911.4 59861.4 -93670.1 -193734 -482574 14318.2 -503617 835394 -230740 1.78484e+06 -376880 164323 -430839 -14154.1 -361463 -153512 -261624 -433160 -283436 -368354 -454292 -451034 -660997 -354617 -324799 -189373 147028 -24550.3 29798.4 -419571 88803.9 -441796 588047 -90762.5 2.17016e+06 -273388 63011.1 -414387 -28078.2 -371026 -141284 -260636 -419653 -294201 -342385 -447569 -468498 -674271 -323689 -408290 -281185 137787 12901.9 141382 -360568 114774 -349365 227643 -52981.8 1.9327e+06 -153699 27574 -408377 -96188 -373533 -161723 -268620 -395542 -313439 -365704 -431506 -497622 -662780 -297480 -404710 -332016 179586 74333.6 260085 -285635 111083 -285729 343988 -52186 1.08224e+06 -46376.3 11996.4 -20397.7 -14191 -382331 -255708 -185076 -246307 -352220 -154438 -166054 -188445 -292775 -362189 -372626 -338378 -314064 -401080 -414893 -276026 -395987 -403415 -498922 -438023 -600676 40964.3 -303281 -61998.6 -361792 -382392 -379793 -358070 108543 -159907 122673 86930.8 297602 333295 -218452 57336.2 69931.7 25319.2 -269241 64839 284439 167496 -125264 464697 144705 -152890 -143512 -515101 -125428 -529086 43441.9 -284647 -239650 -292933 -413640 -458884 -363847 -444397 -577032 -384012 -602215 -8318 28707.8 -86847.4 -169707 -293331 -565155 -120817 -611089 745026 -580823 446510 -506127 7451.37 -511034 37978.5 -294209 -229193 -296284 -420511 -389095 -361939 -444246 -537094 -403712 -583742 1869.24 10219.1 -55847.5 -163290 -334470 -560645 -111611 -597059 906688 -604764 475104 -483160 177508 -490792 30970.5 -312585 -196717 -290495 -422064 -300233 -337397 -443915 -469811 -495510 -546575 2692.35 -25941.4 -1571.3 -131087 -249838 -539250 -71938.4 -570768 1.04428e+06 -444123 1.13086e+06 -435875 212035 -459818 2156.6 -336697 -183600 -277960 -431143 -287773 -354875 -445878 -446593 -597287 -457253 -153254 -131311 65730.2 -94848.1 -107929 -509544 26654.9 -535485 922939 -295298 1.70087e+06 -348643 150264 -434987 -12992.3 -359315 -148172 -263769 -429963 -276924 -320668 -448448 -441979 -657872 -326616 -366605 -194241 92033.1 -35901.3 -35474.6 -451036 95205.6 -430107 519364 -100145 2.15043e+06 -274714 101897 -423425 -33483 -375665 -146218 -265147 -425732 -289293 -368845 -442863 -477091 -676550 -311018 -419688 -249900 201392 41615.2 176787 -377824 125828 -353672 432704 -56688.2 1.74558e+06 -133589 5336.14 -406785 -81586.6 -370090 -157993 -270217 -395990 -301824 -354830 -428061 -493137 -669721 -308228 -393016 -327605 152593 53708.1 278557 -305887 105038 -303059 176237 -99834.1 1.26234e+06 -43876.1 18752.2 -32361.1 -24836.6 -376956 -260731 -195166 -238824 -350603 -157288 -163000 -195503 -270345 -353769 -374728 -350071 -340577 -410348 -400620 -272601 -400947 -395239 -500880 -446354 -593513 47448.4 -302899 -60676.4 -380092 -384862 -383038 -343786 105728 -167752 113641 19034.3 310844 323232 -201756 38658.3 106447 66326.5 -245977 78516.8 311177 279013 -101395 436183 239962 -151007 -143843 ) ; } frontAndBack { type empty; } } // ************************************************************************* //
d7259f207a778cefe29a09e1207b73d0e14f34ec
b572d3d2d84304499d0b3deb45f0cc7a2af68d8e
/player.cc
767ec3d567dc692c5efbf0103abbfd158abdd011
[]
no_license
CSUF-CPSC121-2021S01/siligame-05-andylasso25
9c52ceb931748f6e61038dfdaf7e1891ed452983
8a0c55662bb04c92e6ac7a846a6894533ecb3eb1
refs/heads/main
2023-05-03T12:26:16.978089
2021-05-28T01:59:16
2021-05-28T01:59:16
367,206,617
0
0
null
null
null
null
UTF-8
C++
false
false
5,026
cc
player.cc
#include "player.h" #include "cpputils/graphics/image.h" #include "game_element.h" #include "opponent.h" graphics::Color Pblack(0, 0, 0); graphics::Color Pred(255, 0, 0); graphics::Color Pblue(0, 0, 255); graphics::Color Pgreen(0, 255, 0); graphics::Color Pyellow(255, 255, 0); graphics::Color Pcyan(0, 255, 255); graphics::Color Pmagenta(255, 0, 255); void Player::Draw(graphics::Image &player) { // player.DrawRectangle(11, 11, 26, 25, Pyellow); // player.DrawRectangle(14, 8, 6, 2, Pblue); // player.DrawRectangle(27, 8, 6, 2, Pblue); // player.DrawRectangle(15, 17, 18, 0, Pcyan); // player.SaveImageBmp("player.bmp"); graphics::Image play; play.Load("player.bmp"); for (int i = 0; i < GetWidth(); i++) { for (int j = 0; j < GetHeight(); j++) { player.SetColor(GetX() + i, GetY() + j, play.GetColor(i, j)); } } } void PlayerProjectile::Draw(graphics::Image &player_proj) { player_proj.DrawRectangle(0, 0, 5, 5, Pblue); player_proj.DrawRectangle(3, 0, 2, 3, Pblue); player_proj.SaveImageBmp("playerProjectile.bmp"); // graphics::Image play_proj; // play_proj.Load("playerProjectile.bmp"); // for (int i = 0; i < GetWidth(); i++) { // for (int j = 0; j < GetHeight(); j++) { // player_proj.SetColor(GetX() + i, GetY() + j, play_proj.GetColor(i, j)); // } // } } void PlayerShield::Draw(graphics::Image &player_shield) { player_shield.DrawRectangle(15, 15, 20, 20, Pblue); player_shield.DrawRectangle(30, 13, 0, 15, Pgreen); player_shield.SaveImageBmp("playerShield.bmp"); // graphics::Image play; // play.Load("playerShield.bmp"); // for (int i = 0; i < GetWidth(); i++) { // for (int j = 0; j < GetHeight(); j++) { // player.SetColor(GetX() + i, GetY() + j, play.GetColor(i, j)); // } // } } void Player::Move(const graphics::Image &image) {} void PlayerProjectile::Move(const graphics::Image &image) { SetY(GetY() - 2); if (IsOutOfBounds(image)) { SetIsActive(false); } else { SetIsActive(true); } } // for (int i = 0; i < kHeight_; i++) { // for (int j = 0; j < kWidth_; j++) { // image.SetColor(x_ + j, y_ + i, play.GetColor(i, j)); //} //} // bool Player::IntersectsWith(Opponent &opponent) { // int x = opponent.GetX(); // int y = opponent.GetY(); // int width = opponent.GetWidth(); // int height = opponent.GetHeight(); // if (GetX() >= x && GetY() <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if (GetX() >= x && GetX() <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else { // return false; // } // } // bool Player::IntersectsWith(OpponentProjectile &projectile) { // int x = projectile.GetX(); // int y = projectile.GetY(); // int width = projectile.GetWidth(); // int height = projectile.GetHeight(); // if (GetX() >= x && GetY() <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if (GetX() >= x && GetX() <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else { // return false; // } // } // bool PlayerProjectile::IntersectsWith(Opponent &opponent) { // int x = opponent.GetX(); // int y = opponent.GetY(); // int width = opponent.GetWidth(); // int height = opponent.GetHeight(); // if (GetX() >= x && GetY() <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && GetY() >= y && // GetY() <= (y + height)) { // return true; // } else if (GetX() >= x && GetX() <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else if ((GetX() + GetWidth()) >= x && // (GetX() + GetWidth()) <= (x + width) && // (GetY() + GetHeight()) >= y && // (GetY() + GetHeight()) <= (y + height)) { // return true; // } else { // return false; // } // }
62b4ddc96529d56aecf720af2f18f463d3f168b2
2fc297f92fcb372da7192d353bf1c557c3a8ace5
/Intermediate/Build/Win64/UE4Editor/Inc/Building_Escape/GrabberComponent.gen.cpp
c446901b3b8e3ac53b8df486381fb9109b7be014
[]
no_license
neonzz1/Building_escape
c7d2176a885dab724f0f4e793157c5f35369e21c
7b9f4c17d6c86f35768732601b652f89b5e3fa8d
refs/heads/master
2023-01-12T08:56:35.225786
2020-11-12T15:59:43
2020-11-12T15:59:43
311,379,608
0
0
null
null
null
null
UTF-8
C++
false
false
4,733
cpp
GrabberComponent.gen.cpp
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "Building_Escape/Public/GrabberComponent.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeGrabberComponent() {} // Cross Module References BUILDING_ESCAPE_API UClass* Z_Construct_UClass_UGrabberComponent_NoRegister(); BUILDING_ESCAPE_API UClass* Z_Construct_UClass_UGrabberComponent(); ENGINE_API UClass* Z_Construct_UClass_UActorComponent(); UPackage* Z_Construct_UPackage__Script_Building_Escape(); // End Cross Module References void UGrabberComponent::StaticRegisterNativesUGrabberComponent() { } UClass* Z_Construct_UClass_UGrabberComponent_NoRegister() { return UGrabberComponent::StaticClass(); } struct Z_Construct_UClass_UGrabberComponent_Statics { static UObject* (*const DependentSingletons[])(); #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_Reach_MetaData[]; #endif static const UE4CodeGen_Private::FFloatPropertyParams NewProp_Reach; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_UGrabberComponent_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_UActorComponent, (UObject* (*)())Z_Construct_UPackage__Script_Building_Escape, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrabberComponent_Statics::Class_MetaDataParams[] = { { "BlueprintSpawnableComponent", "" }, { "ClassGroupNames", "Custom" }, { "IncludePath", "GrabberComponent.h" }, { "ModuleRelativePath", "Public/GrabberComponent.h" }, }; #endif #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrabberComponent_Statics::NewProp_Reach_MetaData[] = { { "Category", "GrabberComponent" }, { "ModuleRelativePath", "Public/GrabberComponent.h" }, }; #endif const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UClass_UGrabberComponent_Statics::NewProp_Reach = { "Reach", nullptr, (EPropertyFlags)0x0040000000000001, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UGrabberComponent, Reach), METADATA_PARAMS(Z_Construct_UClass_UGrabberComponent_Statics::NewProp_Reach_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UGrabberComponent_Statics::NewProp_Reach_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_UGrabberComponent_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrabberComponent_Statics::NewProp_Reach, }; const FCppClassTypeInfoStatic Z_Construct_UClass_UGrabberComponent_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<UGrabberComponent>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_UGrabberComponent_Statics::ClassParams = { &UGrabberComponent::StaticClass, "Engine", &StaticCppClassTypeInfo, DependentSingletons, nullptr, Z_Construct_UClass_UGrabberComponent_Statics::PropPointers, nullptr, UE_ARRAY_COUNT(DependentSingletons), 0, UE_ARRAY_COUNT(Z_Construct_UClass_UGrabberComponent_Statics::PropPointers), 0, 0x00B000A4u, METADATA_PARAMS(Z_Construct_UClass_UGrabberComponent_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_UGrabberComponent_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_UGrabberComponent() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_UGrabberComponent_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(UGrabberComponent, 2105621359); template<> BUILDING_ESCAPE_API UClass* StaticClass<UGrabberComponent>() { return UGrabberComponent::StaticClass(); } static FCompiledInDefer Z_CompiledInDefer_UClass_UGrabberComponent(Z_Construct_UClass_UGrabberComponent, &UGrabberComponent::StaticClass, TEXT("/Script/Building_Escape"), TEXT("UGrabberComponent"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(UGrabberComponent); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
e889af0f1f0fb538e01708fb3b45bbe28a897e8a
cda4fd3a160a5ee54ac0e4c07cb2761fb2bbc560
/Simple2D/s2Base/sClock/SHighPrecClock.cpp
5f18e6c141f48c678d838745673f88061d77bf88
[]
no_license
cnscj/Simple2D
8b1ef2bcb4b543e45c7b6e22a93143c66fba63b8
2d3525071da84def66f57efd6d72586aed99b7df
refs/heads/master
2020-03-18T18:44:17.487513
2018-05-28T05:53:54
2018-05-28T05:53:54
135,111,726
1
1
null
null
null
null
UTF-8
C++
false
false
1,096
cpp
SHighPrecClock.cpp
#include "SHighPrecClock.h" double SHighPrecClock::GetClockTick() { tp now = hrc::now(); return (double)now.time_since_epoch().count(); } SHighPrecClock::SHighPrecClock() :m_fTimeScale(1.0f) { Reset(); } SHighPrecClock::~SHighPrecClock() { } double SHighPrecClock::GetElpased() { tp time; dd span; if (m_begin >= m_end) { time = hrc::now(); } else { time = m_end; } span = time - m_begin - m_fixTime; return span.count() * m_fTimeScale; } void SHighPrecClock::Start() { m_begin = hrc::now(); } void SHighPrecClock::Stop() { m_end = hrc::now(); } void SHighPrecClock::Reset() { m_end = m_begin = hrc::now(); m_fixTime = dd(0); } void SHighPrecClock::Pause() { m_fixStart = hrc::now(); } void SHighPrecClock::Resume() { tp end = hrc::now(); m_fixTime += std::chrono::duration_cast<dd>(end - m_fixStart); } //获取设置时间缩放率 float SHighPrecClock::GetTimeScale(void) { return m_fTimeScale; } void SHighPrecClock::SetTimeScale(float fTimeScale) { m_fTimeScale = fTimeScale; }
07988210b4eeee563620507e72cc5ac1791a5f22
97e1fe77e42a2fa60f1511d69a2fd39e0ca37a1e
/Serial/serialRecieveAnalogOutLed/serialRecieveAnalogOutLed.ino
33f13c69083528aed15ed6f314d979ff3253ff93
[]
no_license
rparitosh/arduino
30daae90de6a436034d83401a6924a0c9790ca13
80399d570f7924f05c47ba0d1b74784116f72f41
refs/heads/master
2021-01-11T16:56:40.745514
2017-01-22T11:20:26
2017-01-22T11:20:26
79,699,800
0
0
null
null
null
null
UTF-8
C++
false
false
326
ino
serialRecieveAnalogOutLed.ino
int potPin = 0; int ledPin = 9; void setup() { // put your setup code here, to run once: pinMode(potPin,INPUT); pinMode(ledPin, OUTPUT); } void loop() { // put your main code here, to run repeatedly: int val = analogRead(potPin); int ledVal = map(val,500,1023,255,0); analogWrite(ledPin,ledVal); delay(5); }
c42562f5e50bfb3744ecd9d1599a2b3eddd9489b
2cadafa97dd43e104bf80a353e65b299f7678720
/gameboard.cpp
293522f6d490d3381df6ebdd78582943d3f3a673
[]
no_license
BookCatCSIE/NCKU-Project2
54397eba88203b40f8a3ef2535ca72a5fa776aa1
35afb58f7969a2714ee148885d38d81d75a99f4c
refs/heads/master
2020-03-23T17:40:24.295539
2018-05-13T15:56:23
2018-05-13T15:56:23
141,869,771
0
0
null
null
null
null
UTF-8
C++
false
false
3,260
cpp
gameboard.cpp
#include "gameboard.h" #include "sudokuboard.h" #include <QGroupBox> #include <QPushButton> #include <QLayout> #include <QMessageBox> #include <QComboBox> #include <QLabel> GameBoard::GameBoard(QWidget *parent) :QWidget(parent) { setup(); } void GameBoard::setup() { initCheckBox(); QVBoxLayout *switchLayout = new QVBoxLayout; switchLayout->addWidget(_switchCheckBox); QGroupBox *switchGroup = new QGroupBox; switchGroup->setTitle("switch"); switchGroup->setLayout(switchLayout); _sudoku_board = new SudokuBoard(); _resetGameButton = new QPushButton(tr("reset")); _submitButon = new QPushButton("finish"); _clearAnswerButton = new QPushButton("clear"); _finish_fillButton = new QPushButton("finish_fill"); _show_ansButton = new QPushButton("show_answer"); _show_filled_ansButton = new QPushButton("show_filled_answer"); connect(_resetGameButton, SIGNAL(clicked()), _sudoku_board, SLOT(resetData())); connect(_submitButon, SIGNAL(clicked()), this, SLOT(finished())); connect(_clearAnswerButton, SIGNAL(clicked()), this, SLOT(clearAnswer())); connect(_finish_fillButton, SIGNAL(clicked()), this, SLOT(finish_fill())); connect(_show_ansButton, SIGNAL(clicked()), this, SLOT(showAnswer())); connect(_show_filled_ansButton, SIGNAL(clicked()), this, SLOT(showFilledAnswer())); QHBoxLayout *mainLayout = new QHBoxLayout; QGroupBox *buttonsBox = new QGroupBox; buttonsBox->setTitle("button"); QGridLayout *buttonsLayout = new QGridLayout; buttonsLayout->setContentsMargins(0, 0, 0, 0); buttonsLayout->addWidget(_clearAnswerButton, 0, 1); buttonsLayout->addWidget(_submitButon, 1, 1); buttonsLayout->addWidget(_resetGameButton, 3, 1); buttonsLayout->addWidget(_finish_fillButton, 4, 1); buttonsLayout->addWidget(_show_ansButton, 2, 1); buttonsLayout->addWidget(_show_filled_ansButton, 5, 1); buttonsBox->setLayout(buttonsLayout); QVBoxLayout *rightLayout = new QVBoxLayout; rightLayout->addWidget(switchGroup); rightLayout->addWidget(buttonsBox); mainLayout->addWidget(_sudoku_board, Qt::AlignJustify); mainLayout->addLayout(rightLayout, Qt::AlignRight); setLayout(mainLayout); } void GameBoard::initCheckBox() { _switchCheckBox = new QComboBox(); _switchCheckBox->addItems(QStringList() << "sudoku" << "fill_by_yourself"); connect(_switchCheckBox, SIGNAL(currentIndexChanged(int)), this, SLOT(switchCondition())); } void GameBoard::finished() { if (_sudoku_board->checkAnswer()) { QMessageBox::information(this, " ", "Successful!", QMessageBox::Ok); } else { QMessageBox::information(this, " ", "Failed", QMessageBox::Ok); } } void GameBoard::clearAnswer() { _sudoku_board->clearAnswer(); } void GameBoard::switchCondition() { int index = _switchCheckBox->currentIndex(); switch(index) { case 0: _sudoku_board->setCondition(SudokuBoard::sudoku); break; case 1: _sudoku_board->setCondition(SudokuBoard::fill_by_yourself); break; default: break; } } void GameBoard:: finish_fill(){ _sudoku_board->lockfilled(); } void GameBoard:: showAnswer(){ _sudoku_board->showAnswer(); } void GameBoard:: showFilledAnswer(){ _sudoku_board->show_filled_answer(); }
511c10ed36832361005b04c17a6a27698f381395
1dbf007249acad6038d2aaa1751cbde7e7842c53
/cbr/src/v1/model/BillingUpdate.cpp
360d8b585580314a352a181e695401af164fab17
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
2,248
cpp
BillingUpdate.cpp
#include "huaweicloud/cbr/v1/model/BillingUpdate.h" namespace HuaweiCloud { namespace Sdk { namespace Cbr { namespace V1 { namespace Model { BillingUpdate::BillingUpdate() { consistentLevel_ = ""; consistentLevelIsSet_ = false; size_ = 0; sizeIsSet_ = false; } BillingUpdate::~BillingUpdate() = default; void BillingUpdate::validate() { } web::json::value BillingUpdate::toJson() const { web::json::value val = web::json::value::object(); if(consistentLevelIsSet_) { val[utility::conversions::to_string_t("consistent_level")] = ModelBase::toJson(consistentLevel_); } if(sizeIsSet_) { val[utility::conversions::to_string_t("size")] = ModelBase::toJson(size_); } return val; } bool BillingUpdate::fromJson(const web::json::value& val) { bool ok = true; if(val.has_field(utility::conversions::to_string_t("consistent_level"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("consistent_level")); if(!fieldValue.is_null()) { std::string refVal; ok &= ModelBase::fromJson(fieldValue, refVal); setConsistentLevel(refVal); } } if(val.has_field(utility::conversions::to_string_t("size"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("size")); if(!fieldValue.is_null()) { int32_t refVal; ok &= ModelBase::fromJson(fieldValue, refVal); setSize(refVal); } } return ok; } std::string BillingUpdate::getConsistentLevel() const { return consistentLevel_; } void BillingUpdate::setConsistentLevel(const std::string& value) { consistentLevel_ = value; consistentLevelIsSet_ = true; } bool BillingUpdate::consistentLevelIsSet() const { return consistentLevelIsSet_; } void BillingUpdate::unsetconsistentLevel() { consistentLevelIsSet_ = false; } int32_t BillingUpdate::getSize() const { return size_; } void BillingUpdate::setSize(int32_t value) { size_ = value; sizeIsSet_ = true; } bool BillingUpdate::sizeIsSet() const { return sizeIsSet_; } void BillingUpdate::unsetsize() { sizeIsSet_ = false; } } } } } }
0c6afa653ded80205b12f466c4da68d0672143eb
005e5b80ff893952de1b1538fe79e1c45a5b0ea8
/include/GameOverState.hpp
08f544e7ec03191f09d0a5869fa69cb1103330d9
[]
no_license
eyosyaswd/collision
115b623b06a5c222d161d4b0c44a8b29c37066b3
04c7756a52809b978b406bce429b047dbe54a089
refs/heads/master
2020-03-30T14:32:02.819224
2018-12-07T00:39:59
2018-12-07T00:39:59
151,322,505
2
0
null
2018-11-08T01:41:31
2018-10-02T20:57:50
C++
UTF-8
C++
false
false
1,022
hpp
GameOverState.hpp
/** * Filename: GameOverState.hpp * * This is the screen that shows up when you lose the game. **/ #ifndef LOSESTATE_HPP #define LOSESTATE_HPP #include <SFML/Graphics.hpp> #include "GameApp.hpp" #include "State.hpp" #define MAX_NUMBER_OF_ITEMS 3 class GameOverState : public State { public: GameOverState(GameDataRef data); GameOverState(GameDataRef data, int score); void init(); void handleEvents(); void update(float dt); void draw(float dt); void moveUp(); void moveDown(); int getPressedItem() { return selectedItem; } private: GameDataRef gameData; std::string scorestring; int finalscoreint; sf::Text finalscore; sf::Text finaltext; sf::Texture backgroundTexture; sf::Sprite backgroundSprite; int selectedItem; sf::Font font; sf::Text menu[MAX_NUMBER_OF_ITEMS]; sf::SoundBuffer defeat_Theme; sf::SoundBuffer switch_Buffer; sf::SoundBuffer select_Buffer; sf::Sound defeatTheme; sf::Sound select; sf::Sound menuSwitch; }; #endif
a38c994b489bc17e12bcad99ac84a1b600daf140
6feff1e66ba5a3c61eafc38ec312fdddfd9491e7
/lab 3/main.cpp
a7bb891fbbf742b2bf3605d3c9fcc80db2e47fbf
[]
no_license
baterra/CharCheck
916063f6c3533b45fee2fcf7f508b57b2b856bef
328e7450a378dfbafce47d70209fe28f297a5a9d
refs/heads/master
2022-12-24T04:49:55.110263
2022-12-15T06:05:16
2022-12-15T06:05:16
249,150,352
0
0
null
null
null
null
UTF-8
C++
false
false
1,654
cpp
main.cpp
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { char oneChar; int alpha = 0; int digits = 0; int alnum = 0; int punct = 0; int space = 0; int print = 0; int up = 0; int low = 0; string str = ""; int r = 0; bool run = true; while (run){ // your code should be here cout << "Do you want to continue to check a char? y/n "<<endl; getline(cin,str); if(str == "y") { cout << "Enter a char: "<<endl; getline(cin,str); oneChar = str.at(0); if(isalpha(oneChar)){ alpha++; cout << oneChar << " is an alphabet "<<endl; } if(isdigit(oneChar)){ digits++; cout <<oneChar << " is a digit "<<endl; } if(isspace(oneChar)){ space++; cout << oneChar <<" is a space "<<endl; } if(ispunct(oneChar)){ punct++; cout << oneChar <<" is a punctuation "<<endl; } if(isalnum(oneChar)){ alnum++; cout << oneChar <<" is an alphanumeric "<<endl; } if(isupper(oneChar)){ up++; cout << oneChar <<" is in uppercase "<<endl; } if(islower(oneChar) ){ low++; cout << oneChar <<" is in lowercase "<<endl; } if(isprint(oneChar) ){ print++; cout << oneChar <<" is printable"<<endl; } } else { run = false; } }// end of the while loop //Output the counts cout << "Total of: " << endl; cout << "alphabets: " << alpha << endl; cout << "digits: " << digits << endl; cout << "alphanumeric: " << alnum << endl; cout << "punctuation: " << punct << endl; cout << "space: " <<space << endl; cout << "printables: " <<print << endl; cout << "lowercase: " << low << endl; cout << "uppercase: " << up << endl; }
4066009a912e342eb21774f093f33b6e6f231669
31d7717e3aa8da831e439ced3b061933c0ce0988
/OpenHome/Net/Bindings/Cpp/ControlPoint/Proxies/CpAvOpenhomeOrgWebDeviceConfig1Std.cpp
f8464a6247652aec357ae9f5b9f07350843f3276
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
imateev/Lightning-ohNet
586f5d7b1e29c6c61269a064085ca11078ed5092
bd8ea0ef4f5237820f445951574818f6e7dfff9c
refs/heads/master
2021-12-25T23:07:13.914882
2018-01-02T01:11:27
2018-01-02T01:11:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,891
cpp
CpAvOpenhomeOrgWebDeviceConfig1Std.cpp
#include "CpAvOpenhomeOrgWebDeviceConfig1.h" #include <OpenHome/Net/Core/CpProxy.h> #include <OpenHome/Net/Private/CpiService.h> #include <OpenHome/Private/Thread.h> #include <OpenHome/Net/Private/AsyncPrivate.h> #include <OpenHome/Buffer.h> #include <OpenHome/Net/Cpp/CpDevice.h> #include <OpenHome/Net/Private/CpiDevice.h> #include <string> using namespace OpenHome; using namespace OpenHome::Net; class SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp : public SyncProxyAction { public: SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aDeviceConfig); virtual void CompleteRequest(IAsync& aAsync); virtual ~SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp() {} private: CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& iService; std::string& iDeviceConfig; }; SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aDeviceConfig) : iService(aProxy) , iDeviceConfig(aDeviceConfig) { } void SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp::CompleteRequest(IAsync& aAsync) { iService.EndGetDeviceConfig(aAsync, iDeviceConfig); } class SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp : public SyncProxyAction { public: SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy); virtual void CompleteRequest(IAsync& aAsync); virtual ~SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp() {} private: CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& iService; }; SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp::SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy) : iService(aProxy) { } void SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp::CompleteRequest(IAsync& aAsync) { iService.EndSetDeviceConfig(aAsync); } class SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp : public SyncProxyAction { public: SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aWiFiList); virtual void CompleteRequest(IAsync& aAsync); virtual ~SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp() {} private: CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& iService; std::string& iWiFiList; }; SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aWiFiList) : iService(aProxy) , iWiFiList(aWiFiList) { } void SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp::CompleteRequest(IAsync& aAsync) { iService.EndGetWiFiList(aAsync, iWiFiList); } class SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp : public SyncProxyAction { public: SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy); virtual void CompleteRequest(IAsync& aAsync); virtual ~SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp() {} private: CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& iService; }; SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp::SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy) : iService(aProxy) { } void SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp::CompleteRequest(IAsync& aAsync) { iService.EndSetTimeZone(aAsync); } class SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp : public SyncProxyAction { public: SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aServiceLoaction); virtual void CompleteRequest(IAsync& aAsync); virtual ~SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp() {} private: CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& iService; std::string& iServiceLoaction; }; SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp(CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp& aProxy, std::string& aServiceLoaction) : iService(aProxy) , iServiceLoaction(aServiceLoaction) { } void SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp::CompleteRequest(IAsync& aAsync) { iService.EndGetServiceLocation(aAsync, iServiceLoaction); } CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp(CpDeviceCpp& aDevice) : CpProxy("av-openhome-org", "WebDeviceConfig", 1, aDevice.Device()) { OpenHome::Net::Parameter* param; iActionGetDeviceConfig = new Action("GetDeviceConfig"); param = new OpenHome::Net::ParameterString("DeviceConfig"); iActionGetDeviceConfig->AddOutputParameter(param); iActionSetDeviceConfig = new Action("SetDeviceConfig"); param = new OpenHome::Net::ParameterString("DeviceConfig"); iActionSetDeviceConfig->AddInputParameter(param); iActionGetWiFiList = new Action("GetWiFiList"); param = new OpenHome::Net::ParameterString("WiFiList"); iActionGetWiFiList->AddOutputParameter(param); iActionSetTimeZone = new Action("SetTimeZone"); param = new OpenHome::Net::ParameterString("TimeZone"); iActionSetTimeZone->AddInputParameter(param); param = new OpenHome::Net::ParameterString("CurrentTime"); iActionSetTimeZone->AddInputParameter(param); param = new OpenHome::Net::ParameterString("TimeStamp"); iActionSetTimeZone->AddInputParameter(param); iActionGetServiceLocation = new Action("GetServiceLocation"); param = new OpenHome::Net::ParameterString("ServiceLoaction"); iActionGetServiceLocation->AddOutputParameter(param); Functor functor; functor = MakeFunctor(*this, &CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::AlivePropertyChanged); iAlive = new PropertyBool("Alive", functor); AddProperty(iAlive); functor = MakeFunctor(*this, &CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::DeviceConfigPropertyChanged); iDeviceConfig = new PropertyString("DeviceConfig", functor); AddProperty(iDeviceConfig); functor = MakeFunctor(*this, &CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::CurrentActionPropertyChanged); iCurrentAction = new PropertyUint("CurrentAction", functor); AddProperty(iCurrentAction); } CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::~CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp() { DestroyService(); delete iActionGetDeviceConfig; delete iActionSetDeviceConfig; delete iActionGetWiFiList; delete iActionSetTimeZone; delete iActionGetServiceLocation; } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetDeviceConfig(std::string& aDeviceConfig) { SyncGetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp sync(*this, aDeviceConfig); BeginGetDeviceConfig(sync.Functor()); sync.Wait(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::BeginGetDeviceConfig(FunctorAsync& aFunctor) { Invocation* invocation = iService->Invocation(*iActionGetDeviceConfig, aFunctor); TUint outIndex = 0; const Action::VectorParameters& outParams = iActionGetDeviceConfig->OutputParameters(); invocation->AddOutput(new ArgumentString(*outParams[outIndex++])); iInvocable.InvokeAction(*invocation); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::EndGetDeviceConfig(IAsync& aAsync, std::string& aDeviceConfig) { ASSERT(((Async&)aAsync).Type() == Async::eInvocation); Invocation& invocation = (Invocation&)aAsync; ASSERT(invocation.Action().Name() == Brn("GetDeviceConfig")); Error::ELevel level; TUint code; const TChar* ignore; if (invocation.Error(level, code, ignore)) { THROW_PROXYERROR(level, code); } TUint index = 0; { const Brx& val = ((ArgumentString*)invocation.OutputArguments()[index++])->Value(); aDeviceConfig.assign((const char*)val.Ptr(), val.Bytes()); } } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SyncSetDeviceConfig(const std::string& aDeviceConfig) { SyncSetDeviceConfigAvOpenhomeOrgWebDeviceConfig1Cpp sync(*this); BeginSetDeviceConfig(aDeviceConfig, sync.Functor()); sync.Wait(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::BeginSetDeviceConfig(const std::string& aDeviceConfig, FunctorAsync& aFunctor) { Invocation* invocation = iService->Invocation(*iActionSetDeviceConfig, aFunctor); TUint inIndex = 0; const Action::VectorParameters& inParams = iActionSetDeviceConfig->InputParameters(); { Brn buf((const TByte*)aDeviceConfig.c_str(), (TUint)aDeviceConfig.length()); invocation->AddInput(new ArgumentString(*inParams[inIndex++], buf)); } iInvocable.InvokeAction(*invocation); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::EndSetDeviceConfig(IAsync& aAsync) { ASSERT(((Async&)aAsync).Type() == Async::eInvocation); Invocation& invocation = (Invocation&)aAsync; ASSERT(invocation.Action().Name() == Brn("SetDeviceConfig")); Error::ELevel level; TUint code; const TChar* ignore; if (invocation.Error(level, code, ignore)) { THROW_PROXYERROR(level, code); } } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetWiFiList(std::string& aWiFiList) { SyncGetWiFiListAvOpenhomeOrgWebDeviceConfig1Cpp sync(*this, aWiFiList); BeginGetWiFiList(sync.Functor()); sync.Wait(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::BeginGetWiFiList(FunctorAsync& aFunctor) { Invocation* invocation = iService->Invocation(*iActionGetWiFiList, aFunctor); TUint outIndex = 0; const Action::VectorParameters& outParams = iActionGetWiFiList->OutputParameters(); invocation->AddOutput(new ArgumentString(*outParams[outIndex++])); iInvocable.InvokeAction(*invocation); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::EndGetWiFiList(IAsync& aAsync, std::string& aWiFiList) { ASSERT(((Async&)aAsync).Type() == Async::eInvocation); Invocation& invocation = (Invocation&)aAsync; ASSERT(invocation.Action().Name() == Brn("GetWiFiList")); Error::ELevel level; TUint code; const TChar* ignore; if (invocation.Error(level, code, ignore)) { THROW_PROXYERROR(level, code); } TUint index = 0; { const Brx& val = ((ArgumentString*)invocation.OutputArguments()[index++])->Value(); aWiFiList.assign((const char*)val.Ptr(), val.Bytes()); } } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SyncSetTimeZone(const std::string& aTimeZone, const std::string& aCurrentTime, const std::string& aTimeStamp) { SyncSetTimeZoneAvOpenhomeOrgWebDeviceConfig1Cpp sync(*this); BeginSetTimeZone(aTimeZone, aCurrentTime, aTimeStamp, sync.Functor()); sync.Wait(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::BeginSetTimeZone(const std::string& aTimeZone, const std::string& aCurrentTime, const std::string& aTimeStamp, FunctorAsync& aFunctor) { Invocation* invocation = iService->Invocation(*iActionSetTimeZone, aFunctor); TUint inIndex = 0; const Action::VectorParameters& inParams = iActionSetTimeZone->InputParameters(); { Brn buf((const TByte*)aTimeZone.c_str(), (TUint)aTimeZone.length()); invocation->AddInput(new ArgumentString(*inParams[inIndex++], buf)); } { Brn buf((const TByte*)aCurrentTime.c_str(), (TUint)aCurrentTime.length()); invocation->AddInput(new ArgumentString(*inParams[inIndex++], buf)); } { Brn buf((const TByte*)aTimeStamp.c_str(), (TUint)aTimeStamp.length()); invocation->AddInput(new ArgumentString(*inParams[inIndex++], buf)); } iInvocable.InvokeAction(*invocation); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::EndSetTimeZone(IAsync& aAsync) { ASSERT(((Async&)aAsync).Type() == Async::eInvocation); Invocation& invocation = (Invocation&)aAsync; ASSERT(invocation.Action().Name() == Brn("SetTimeZone")); Error::ELevel level; TUint code; const TChar* ignore; if (invocation.Error(level, code, ignore)) { THROW_PROXYERROR(level, code); } } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SyncGetServiceLocation(std::string& aServiceLoaction) { SyncGetServiceLocationAvOpenhomeOrgWebDeviceConfig1Cpp sync(*this, aServiceLoaction); BeginGetServiceLocation(sync.Functor()); sync.Wait(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::BeginGetServiceLocation(FunctorAsync& aFunctor) { Invocation* invocation = iService->Invocation(*iActionGetServiceLocation, aFunctor); TUint outIndex = 0; const Action::VectorParameters& outParams = iActionGetServiceLocation->OutputParameters(); invocation->AddOutput(new ArgumentString(*outParams[outIndex++])); iInvocable.InvokeAction(*invocation); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::EndGetServiceLocation(IAsync& aAsync, std::string& aServiceLoaction) { ASSERT(((Async&)aAsync).Type() == Async::eInvocation); Invocation& invocation = (Invocation&)aAsync; ASSERT(invocation.Action().Name() == Brn("GetServiceLocation")); Error::ELevel level; TUint code; const TChar* ignore; if (invocation.Error(level, code, ignore)) { THROW_PROXYERROR(level, code); } TUint index = 0; { const Brx& val = ((ArgumentString*)invocation.OutputArguments()[index++])->Value(); aServiceLoaction.assign((const char*)val.Ptr(), val.Bytes()); } } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SetPropertyAliveChanged(Functor& aFunctor) { iLock->Wait(); iAliveChanged = aFunctor; iLock->Signal(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SetPropertyDeviceConfigChanged(Functor& aFunctor) { iLock->Wait(); iDeviceConfigChanged = aFunctor; iLock->Signal(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::SetPropertyCurrentActionChanged(Functor& aFunctor) { iLock->Wait(); iCurrentActionChanged = aFunctor; iLock->Signal(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::PropertyAlive(bool& aAlive) const { AutoMutex a(PropertyReadLock()); ASSERT(iCpSubscriptionStatus == CpProxy::eSubscribed); aAlive = iAlive->Value(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::PropertyDeviceConfig(std::string& aDeviceConfig) const { AutoMutex a(PropertyReadLock()); ASSERT(iCpSubscriptionStatus == CpProxy::eSubscribed); const Brx& val = iDeviceConfig->Value(); aDeviceConfig.assign((const char*)val.Ptr(), val.Bytes()); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::PropertyCurrentAction(uint32_t& aCurrentAction) const { AutoMutex a(PropertyReadLock()); ASSERT(iCpSubscriptionStatus == CpProxy::eSubscribed); aCurrentAction = iCurrentAction->Value(); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::AlivePropertyChanged() { ReportEvent(iAliveChanged); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::DeviceConfigPropertyChanged() { ReportEvent(iDeviceConfigChanged); } void CpProxyAvOpenhomeOrgWebDeviceConfig1Cpp::CurrentActionPropertyChanged() { ReportEvent(iCurrentActionChanged); }
cf8db966f8c639d1aefa92e73aea264e3fca60f0
840948dd381a075e959a01061dfd85be0af65c96
/source/CalcEfficiency/src/TagAndProbeMT.cxx
c24e56f5970ee2b5f8ff9b0ea92bb0d32c904763
[]
no_license
ktaniguc/AODAnalysisTool
8395b7b45f66f3f02eb1f183fab49175660dbc0a
055b2eb1cc5d6db762d4941fc522adc13116114e
refs/heads/master
2023-03-10T08:58:02.928408
2021-02-23T06:08:55
2021-02-23T06:08:55
341,447,848
0
0
null
null
null
null
UTF-8
C++
false
false
20,369
cxx
TagAndProbeMT.cxx
#include <iostream> #include <fstream> #include <vector> #include "TrigConfxAOD/xAODConfigTool.h" #include "xAODTrigMuon/L2StandAloneMuon.h" #include "xAODTrigMuon/L2StandAloneMuonContainer.h" #include "xAODTrigMuon/L2CombinedMuon.h" #include "xAODTrigMuon/L2CombinedMuonContainer.h" #include "xAODTrigger/MuonRoIContainer.h" #include "xAODTracking/TrackParticleContainer.h" #include "AsgTools/AsgTool.h" #include "CalcEfficiency/TagAndProbeMT.h" #include "TMath.h" #include "TObjArray.h" #include "TObjString.h" #include "TVector3.h" TagAndProbeMT::TagAndProbeMT(){ } int TagAndProbeMT::initialize( const int& message, const bool& useExt, const TString method, MuonExtUtils ext, ToolHandle<Trig::TrigDecisionTool> tdt, const std::string dataType ) { /// This function depends on message, useExt, method, ext vft, tdt, dataType. /// vecTrigEvent, m_trigEvent, ... is push_backed for each method. /// m_tapType is ALL, L2 or EFF. std::cout << "== tag and probe execute" << std::endl; // m_message : 0 -> INFO, 1 -> DEBUG, 2 -> WARNING m_message = message; m_method = method; m_trigDecTool = tdt; m_ext = ext; m_useExt = useExt; //still not implement --> always use this -> dataType = dataType; m_matchToolMT.initialize(tdt, ext); if(m_method=="Jpsi"){ m_l1chainList.push_back("L1_MU20"); m_hltchainList.push_back("HLT_mu20_L1MU20"); // m_trigchainList.push_back("HLT_mu6"); m_trigchainList.push_back("HLT_mu20_2mu2noL1_JpsimumuFS"); m_isPassed.push_back(false); m_reqdR = true; m_isnoL1 = true; m_massMin.push_back(2700.); m_massMax.push_back(3500.); std::string tsSATE = ""; // getSATEName( "HLT_mu20", tsSATE ); m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; // getCBTEName( "HLT_mu20", tsCBTE ); m_trigTagCBTEName.push_back( tsCBTE ); } else if(m_method=="JpsiMC"){ m_l1chainList.push_back("L1_MU6"); m_hltchainList.push_back("HLT_mu6_L1MU6"); // m_trigchainList.push_back("HLT_mu6"); m_trigchainList.push_back("HLT_mu6_L1MU6"); m_isPassed.push_back(false); m_reqdR = true; m_isnoL1 = true; m_massMin.push_back(2700.); m_massMax.push_back(3500.); std::string tsSATE = ""; // getSATEName( "HLT_mu20", tsSATE ); m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; // getCBTEName( "HLT_mu20", tsCBTE ); m_trigTagCBTEName.push_back( tsCBTE ); } else if(m_method=="Ztap"){ m_l1chainList.push_back("L1_MU20"); m_hltchainList.push_back("HLT_mu26_ivarmedium_L1MU20"); m_trigchainList.push_back("HLT_mu26_ivarmedium_L1MU20"); m_isPassed.push_back(false); m_reqdR = true; m_massMin.push_back(90000.-10000.); m_massMax.push_back(90000.+10000.); std::string tsSATE = ""; // getSATEName( "HLT_mu26_ivarmedium", tsSATE ); m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; // getCBTEName( "HLT_mu26_ivarmedium", tsCBTE ); m_trigTagCBTEName.push_back( tsCBTE ); } else if(m_method=="NoMass"){ m_l1chainList.push_back("L1_MU20"); m_hltchainList.push_back("HLT_mu26_ivarmedium_L1MU20"); m_trigchainList.push_back("HLT_mu26_ivarmedium_L1MU20"); // m_l1chainList.push_back("L1_MU6"); // m_hltchainList.push_back("HLT_mu6_L1MU6"); // m_trigchainList.push_back("HLT_mu6_L1MU6"); m_isPassed.push_back(false); m_reqdR = false; m_ignoreMassreq = true; m_massMin.push_back(0); m_massMax.push_back(0); std::string tsSATE = ""; // getSATEName( "HLT_mu6", tsSATE ); m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; // getCBTEName( "HLT_mu6", tsCBTE ); m_trigTagCBTEName.push_back( tsCBTE ); } else if(m_method=="NoTag"){ m_l1chainList.push_back("dummy"); m_hltchainList.push_back("dummy"); m_trigchainList.push_back("dummy"); m_isPassed.push_back(true); m_reqdR = false; m_ignoreMassreq = true; m_massMin.push_back(0); m_massMax.push_back(0); std::string tsSATE = ""; // getSATEName( "HLT_mu6", tsSATE ); m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; // getCBTEName( "HLT_mu6", tsCBTE ); m_trigTagCBTEName.push_back( tsCBTE ); } else if(m_method=="NoTagJpsi"){ m_l1chainList.push_back("dummy"); m_hltchainList.push_back("dummy"); m_trigchainList.push_back("dummy"); m_isPassed.push_back(true); m_reqdR = false; m_ignoreMassreq = false; m_massMin.push_back(2700.); m_massMax.push_back(3500.); std::string tsSATE = ""; m_trigTagSATEName.push_back( tsSATE ); std::string tsCBTE = ""; m_trigTagCBTEName.push_back( tsCBTE ); } m_nChain = m_trigchainList.size(); return 0; } //---------------------------------------------------------// //---------------------------------------------------------// void TagAndProbeMT::addMesChain( const string& L1trig, const string& HLTtrig ) { if(HLTtrig.find("b") != std::string::npos) std::cout << "WARNING this chain maybe 'nomucomb' trigger. if so, isPassedCB are not correct" << std::endl; m_L1trigmesName.push_back(L1trig); m_HLTtrigmesName.push_back(HLTtrig); m_nmesChain = m_HLTtrigmesName.size(); } //---------------------------------------------------------// //---------------------------------------------------------// void TagAndProbeMT::checkMesChain() { m_passTrigmes.clear(); for(size_t i=0; i<m_HLTtrigmesName.size(); i++) { m_passTrigmes.push_back( m_trigDecTool->isPassed( m_HLTtrigmesName.at(i), TrigDefs::eventAccepted ) ); } } //---------------------------------------------------------// //---------------------------------------------------------// void TagAndProbeMT::clear() { m_tappairs.clear(); m_tag.clear(); m_probe.clear(); m_requirements_tag.clear(); m_L1objects_tag.clear(); m_SAobjects_tag.clear(); m_CBobjects_tag.clear(); m_EFobjects_tag.clear(); m_requirements_probe.clear(); m_vL1objects_probe.clear(); m_vSAobjects_probe.clear(); m_vCBobjects_probe.clear(); m_vEFobjects_probe.clear(); m_passTrigmes.clear(); m_tag_L1_pass.clear(); m_tag_L1_roiNum.clear(); m_tag_SA_pass.clear(); m_tag_CB_pass.clear(); m_tag_EF_pass.clear(); } //---------------------------------------------------------// //---------------------------------------------------------// bool TagAndProbeMT::isPassedTrigger() { std::cout << "TagAndProbeMT::isPassedTrigger =====" << std::endl; bool isTriggered = false; if(m_method.Contains("NoTag")){ return true; } for(int i = 0; i < m_nChain; i++){ if(m_trigDecTool->isPassed( m_trigchainList.at(i), TrigDefs::eventAccepted )){ std::cout << m_trigchainList.at(i) << " is passed" << std::endl; m_isPassed.at(i) = true; isTriggered = true; } } return isTriggered; } //---------------------------------------------------------// //---------------------------------------------------------// //when dRl1tag-probe is 0.12 ? --> m_method is "NoMass" bool TagAndProbeMT::setProbes( SG::ReadHandle<xAOD::MuonContainer> &muons, SG::ReadHandle<xAOD::MuonRoIContainer> &rois ) { for(const xAOD::Muon* tag : *muons){ for(const xAOD::Muon* probe : *muons){ if(tag==probe) continue; // tag offline -- trigger matching start for(int ichain = 0; ichain < m_nChain; ichain++){ if(m_isPassed.at(ichain) == false) continue; std::cout << ">>================================<<" << std::endl; Requirement req; if(!passDimuSelection(tag, probe, ichain, req)) continue; req.reqdRl1 = m_reqdR ? dRl1bypt( tag->pt() ) : 0.12; req.EFmatchingdR = m_reqdR ? 0.01 : 0.05; L1Object l1obj; l1obj.dRl1 = m_reqdR ? dRl1bypt( tag->pt() ) : 0.12; SAObject saobj; CBObject cbobj; EFObject efobj; efobj.dRef = m_reqdR ? 0.01 : 0.05; // start matching for tag if( m_matchToolMT.matchL1( rois, tag, l1obj, m_l1chainList.at(ichain), m_hltchainList.at(ichain) ) ) std::cout << "--> matched L1 roiNum/eta/phi/dR(mu-roi) = " << l1obj.roiNum << "/" << l1obj.eta << "/" << l1obj.phi << "/" << l1obj.dRl1 << std::endl; if( m_matchToolMT.matchSA( m_hltchainList.at(ichain), l1obj, saobj ) ) std::cout << "--> matched SA pt/eta/phi = " << saobj.pt << "/" << saobj.eta << "/" << saobj.phi << std::endl; if( m_matchToolMT.matchCB( m_hltchainList.at(ichain), saobj, cbobj ) ) std::cout << "--> matched CB pt/eta/phi = " << cbobj.pt << "/" << cbobj.eta << "/" << cbobj.phi << std::endl; if( m_matchToolMT.matchEF( m_hltchainList.at(ichain), tag, efobj ) ) std::cout << "--> matched EF pt/eta/phi = " << efobj.pt << "/" << efobj.eta << "/" << efobj.phi << std::endl; // check if tag passes trigger if(m_method.Contains("NoTag") || (l1obj.isPassed == 1 && saobj.isPassed == 1 && cbobj.isPassed == 1 && efobj.isPassed == 1)) std::cout << ">> ACCEPT AS TAG MUON <<" << std::endl; else continue; std::pair<const xAOD::Muon*, const xAOD::Muon*> tappair = make_pair( tag, probe ); //push_back infos of tag m_tappairs.push_back(tappair); m_requirements_tag.push_back(req); m_L1objects_tag.push_back(l1obj); m_SAobjects_tag.push_back(saobj); m_CBobjects_tag.push_back(cbobj); m_EFobjects_tag.push_back(efobj); } } } return true; } //---------------------------------------------------------// //---------------------------------------------------------// void TagAndProbeMT::doProbeMatching( SG::ReadHandle<xAOD::MuonRoIContainer> &rois ) { std::cout << "=====> doProbeMatching <=====" << std::endl; for(int ipair = 0; ipair < (int)m_tappairs.size(); ipair++){ const xAOD::Muon* tag = m_tappairs.at(ipair).first; const xAOD::Muon* probe = m_tappairs.at(ipair).second; const xAOD::TrackParticle* tagtrk = tag->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); pair< double, double > tagextEtaAndPhi = m_ext.extTrack( tagtrk ); const double tagExtEta = tagextEtaAndPhi.first; const double tagExtPhi = tagextEtaAndPhi.second; const xAOD::TrackParticle* probetrk = probe->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); pair< double, double > probeextEtaAndPhi = m_ext.extTrack( probetrk ); const double probeExtEta = probeextEtaAndPhi.first; const double probeExtPhi = probeextEtaAndPhi.second; const double dRext = m_utils.deltaR( tagExtEta, tagExtPhi, probeExtEta, probeExtPhi ); OfflineObject probeobj, tagobj; probeobj.pt = probe->pt(); probeobj.eta = probe->eta(); probeobj.phi = probe->phi(); probeobj.extEta = probeExtEta; probeobj.extPhi = probeExtPhi; probeobj.tpextdR = dRext; probeobj.d0 = (probetrk)? probetrk->d0() : -99999; probeobj.z0 = (probetrk)? probetrk->z0() : -99999; probeobj.segmentN = probe->nMuonSegments(); std::cout << "# of MuonSegment = " << probeobj.segmentN << std::endl; for(int i_seg = 0; i_seg < probeobj.segmentN; i_seg++){ const xAOD::MuonSegment* segment = probe->muonSegment(i_seg); if(!segment) continue; probeobj.segmentX[i_seg] = segment->x(); probeobj.segmentY[i_seg] = segment->y(); probeobj.segmentZ[i_seg] = segment->z(); probeobj.segmentPx[i_seg] = segment->px(); probeobj.segmentPy[i_seg] = segment->py(); probeobj.segmentPz[i_seg] = segment->pz(); probeobj.segmentChiSquared[i_seg] = segment->chiSquared(); probeobj.segmentNumberDoF[i_seg] = segment->numberDoF(); probeobj.segmentSector[i_seg] = segment->sector(); probeobj.segmentChamberIndex[i_seg] = segment->chamberIndex(); probeobj.segmentEtaIndex[i_seg] = segment->etaIndex(); probeobj.segmentNPrecisionHits[i_seg] = segment->nPrecisionHits(); probeobj.segmentNPhiLayers[i_seg] = segment->nPhiLayers(); probeobj.segmentNTrigEtaLayers[i_seg] = segment->nTrigEtaLayers(); } m_probe.push_back(probeobj); tagobj.pt = tag->pt(); tagobj.eta = tag->eta(); tagobj.phi = tag->phi(); tagobj.extEta = tagExtEta; tagobj.extPhi = tagExtPhi; tagobj.tpextdR = dRext; tagobj.d0 = (tagtrk)? tagtrk->d0() : -99999; tagobj.z0 = (tagtrk)? tagtrk->z0() : -99999; m_tag.push_back(tagobj); std::cout << "#tag-probe extdR : " << dRext << "<<=======" << std::endl; Requirement req; req.reqdRl1 = m_reqdR ? dRl1bypt( probe->pt() ) : 0.12; req.EFmatchingdR = m_reqdR ? 0.01 : 0.05; m_requirements_probe.push_back(req); L1Objects L1objects; SAObjects SAobjects; CBObjects CBobjects; EFObjects EFobjects; for(int ichain = 0; ichain < m_nmesChain; ichain++){ L1Object l1obj; l1obj.dRl1 = m_reqdR ? dRl1bypt( probe->pt() ) : 0.12; SAObject saobj; CBObject cbobj; EFObject efobj; efobj.dRef = m_reqdR ? 0.01 : 0.05; std::cout << "##Trigger chain --> " << "L1: " << m_L1trigmesName.at(ichain) << "/ HLT: " << m_HLTtrigmesName.at(ichain) << "<<=======" << std::endl; m_matchToolMT.matchL1( rois, probe, l1obj, m_L1trigmesName.at(ichain), m_HLTtrigmesName.at(ichain) ); std::cout << "--> matched L1 roiNum/eta/phi/dR(mu-roi) = " << l1obj.roiNum << "/" << l1obj.eta << "/" << l1obj.phi << "/" << l1obj.dRl1 << std::endl; m_matchToolMT.matchSA( m_HLTtrigmesName.at(ichain), l1obj, saobj ); std::cout << "--> matched SA pt/eta/phi = " << saobj.pt << "/" << saobj.eta << "/" << saobj.phi << std::endl; m_matchToolMT.matchCB( m_HLTtrigmesName.at(ichain), saobj, cbobj ); std::cout << "--> matched CB pt/eta/phi = " << cbobj.pt << "/" << cbobj.eta << "/" << cbobj.phi << std::endl; m_matchToolMT.matchEF( m_HLTtrigmesName.at(ichain), probe, efobj ); std::cout << "--> matched EF pt/eta/phi = " << efobj.pt << "/" << efobj.eta << "/" << efobj.phi << std::endl; std::cout << "Trigger status : " << "L1 --> " << l1obj.isPassed << std::endl; std::cout << " " << "SA --> " << saobj.isPassed << std::endl; std::cout << " " << "CB --> " << cbobj.isPassed << std::endl; std::cout << " " << "EF --> " << efobj.isPassed << std::endl; L1objects.push_back(l1obj); SAobjects.push_back(saobj); CBobjects.push_back(cbobj); EFobjects.push_back(efobj); } // ichain loop end m_vL1objects_probe.push_back(L1objects); m_vSAobjects_probe.push_back(SAobjects); m_vCBobjects_probe.push_back(CBobjects); m_vEFobjects_probe.push_back(EFobjects); } // muon pair loop end } //---------------------------------------------------------// //---------------------------------------------------------// void TagAndProbeMT::doTagMatching( SG::ReadHandle<xAOD::MuonRoIContainer> &rois ) { std::cout << "=====> doTagMatching <=====" << std::endl; if(m_tappairs.size() == 0) return; const xAOD::Muon* tag = m_tappairs.at(0).first; for(int ichain = 0; ichain < m_nmesChain; ichain++){ L1Object l1obj; l1obj.dRl1 = m_reqdR ? dRl1bypt( tag->pt() ) : 0.12; SAObject saobj; CBObject cbobj; EFObject efobj; efobj.dRef = m_reqdR ? 0.01 : 0.05; std::cout << "TagMatching ##Trigger chain --> " << "L1: " << m_L1trigmesName.at(ichain) << "/ HLT: " << m_HLTtrigmesName.at(ichain) << "<<=======" << std::endl; m_matchToolMT.matchL1( rois, tag, l1obj, m_L1trigmesName.at(ichain), m_HLTtrigmesName.at(ichain) ); std::cout << "TagMatching --> matched L1 roiNum/eta/phi/dR(mu-roi) = " << l1obj.roiNum << "/" << l1obj.eta << "/" << l1obj.phi << "/" << l1obj.dRl1 << std::endl; m_matchToolMT.matchSA( m_HLTtrigmesName.at(ichain), l1obj, saobj ); std::cout << "TagMatching --> matched SA pt/eta/phi = " << saobj.pt << "/" << saobj.eta << "/" << saobj.phi << std::endl; m_matchToolMT.matchCB( m_HLTtrigmesName.at(ichain), saobj, cbobj ); std::cout << "TagMatching --> matched CB pt/eta/phi = " << cbobj.pt << "/" << cbobj.eta << "/" << cbobj.phi << std::endl; m_matchToolMT.matchEF( m_HLTtrigmesName.at(ichain), tag, efobj ); std::cout << "TagMatching --> matched EF pt/eta/phi = " << efobj.pt << "/" << efobj.eta << "/" << efobj.phi << std::endl; std::cout << " " << "L1 --> " << saobj.isPassed << std::endl; std::cout << " " << "SA --> " << saobj.isPassed << std::endl; std::cout << " " << "CB --> " << cbobj.isPassed << std::endl; std::cout << " " << "EF --> " << efobj.isPassed << std::endl; m_tag_L1_pass.push_back(l1obj.isPassed); m_tag_L1_roiNum.push_back(l1obj.roiNum); m_tag_SA_pass.push_back(saobj.isPassed); m_tag_CB_pass.push_back(cbobj.isPassed); m_tag_EF_pass.push_back(efobj.isPassed); } // ichain loop end } //---------------------------------------------------------// //---------------------------------------------------------// double TagAndProbeMT::dRl1bypt( double mupt ) const { double dR = 0.08; if( mupt < 10000. ) { dR = -0.00001*mupt + 0.18; } return dR; } //---------------------------------------------------------// //---------------------------------------------------------// bool TagAndProbeMT::passDimuSelection( const xAOD::Muon* tag, const xAOD::Muon* probe, int chain, Requirement& req ) { std::cout << "start dimuon selection" << std::endl; bool passMassreq = false; bool passdphireq = false; bool passdRreq = false; bool passOSreq = false; bool passMuqual = false; bool passchi2req = false; float chi2tag = 20.; float chi2probe = 20.; tag->parameter(chi2tag, xAOD::Muon::msInnerMatchChi2); probe->parameter(chi2probe, xAOD::Muon::msInnerMatchChi2); if( (chi2tag < m_chi2cut) && (chi2probe < m_chi2cut) ) passchi2req = true; if(m_run3evtSelection){ if(tag->quality() == xAOD::Muon::Tight) passMuqual = true; } else { if(m_pst.getQualityOfTrack( tag ) == 0) passMuqual = true; } if(m_run3evtSelection){ if(probe->quality() == xAOD::Muon::Medium || probe->quality() == xAOD::Muon::Tight) passMuqual = true; } else { if(m_pst.getQualityOfTrack( probe ) == 0) passMuqual = true; } // extrapolate the muon's (eta, phi) to MS const xAOD::TrackParticle* tagtrk = tag->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); if( !tagtrk ) return false; pair< double, double > tagextEtaAndPhi = m_ext.extTrack( tagtrk ); const double tagExtEta = tagextEtaAndPhi.first; const double tagExtPhi = tagextEtaAndPhi.second; const xAOD::TrackParticle* probetrk = probe->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); if( !probetrk ) return false; pair< double, double > probeextEtaAndPhi = m_ext.extTrack( probetrk ); const double probeExtEta = probeextEtaAndPhi.first; const double probeExtPhi = probeextEtaAndPhi.second; const double dRext = m_utils.deltaR( tagExtEta, tagExtPhi, probeExtEta, probeExtPhi ); std::cout << "... tag-probe extdR : " << dRext << std::endl; if(dRext > 0.2 || m_method.Contains("NoTag")) passdRreq = true; if(tag->charge()*probe->charge() < 0) passOSreq = true; TLorentzVector lvtag, lvprobe; lvtag.SetPhi( tag->phi() ); lvprobe.SetPhi( probe->phi() ); double dphi = TVector2::Phi_mpi_pi( tag->phi() - probe->phi() ); double mass = (tag->p4() + probe->p4()).M(); std::cout << "... dimuon mass : " << mass << std::endl; std::cout << "... tag-probe dphi : " << dphi << std::endl; req.tpdPhi = dphi; req.invMass = mass; if( (mass > m_massMin.at(chain) && mass < m_massMax.at(chain)) || m_ignoreMassreq ) passMassreq = true; if(std::fabs(dphi) < 3.0 || m_method.Contains("NoTag")) passdphireq = true; if(passchi2req && passMuqual && passMassreq && passdphireq && passOSreq && passdRreq) return true; return false; } //---------------------------------------------------------// //---------------------------------------------------------//
c011da3d3a19982dcba29e2780454d2ddb1b616f
d9f008b2681eb4261dec9139b4ef6e48ac666503
/loadedDie.hpp
9d08c9fd7be1fd796b04adfeb5a251d97162c420
[]
no_license
DRot88/Lab3_Dice_War
da5d6acd3c03c86817166ed43d5f6699b7c3d049
b80679e8c6e4a01c7629a72c57c2cf85f6611691
refs/heads/master
2021-03-16T08:29:32.413459
2017-07-15T17:53:54
2017-07-15T17:53:54
97,076,978
0
0
null
null
null
null
UTF-8
C++
false
false
240
hpp
loadedDie.hpp
#include "die.hpp" #ifndef LOADEDDIE_HPP #define LOADEDDIE_HPP class LoadedDie : public Die { private: public: // Loaded Die constructor LoadedDie(int n); // Derived class roll function virtual int roll(); }; #endif
7cf40aebdbca6192730f61501c7451237d6ee71b
2de766db3b23b1ae845396fbb30615c01cc1604e
/zoj/02/1122.cpp
51808e63c48402fbfe8117f65bb1d409a48e62d7
[]
no_license
delta4d/AlgoSolution
313c5d0ff72673927ad3862ee7b8fb432943b346
5f6f89578d5aa37247a99b2d289d638f76c71281
refs/heads/master
2020-04-21T01:28:35.690529
2015-01-29T13:38:54
2015-01-29T13:38:54
8,221,423
1
0
null
2013-04-09T15:10:20
2013-02-15T16:09:33
C++
UTF-8
C++
false
false
1,327
cpp
1122.cpp
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct time_tt { int h; int m; time_tt(int _h=0, int _m=0):h(_h), m(_m) {} bool input() { return 2 == scanf("%d %d", &h, &m); } bool below(const time_tt &a) { if (h < a.h) return true; if (h > a.h) return false; return m <= a.m; } int interval(const time_tt &a) { if (below(a)) return (a.h - h) * 60 + (a.m - m); return (a.h + 12 - h) * 60 + (a.m - m); } double get_hp() { return h == 12 ? m * 0.5 : h * 30 + m * 0.5; } double get_mp() { return m * 6.0; } int meet(const time_tt &a) { double t0, T, tot; double q, hp, mp; hp = get_hp(), mp = get_mp(); if (hp > mp) q = hp - mp; else q = hp + 360 - mp; t0 = q * 2.0 / 11.0; tot = interval(a); if (t0 > tot) return 0; else return int((tot-t0)*11.0/720.0) + 1; } void output(const time_tt &a) { printf(" "); printf("%02d:%02d", h, m); printf(" "); printf("%02d:%02d", a.h, a.m); printf("%8d\n", meet(a)); } }; int main() { time_tt x, y; int i, j, k; //freopen("f:\\in.txt", "r", stdin); puts("Program 3 by team X"); puts("Initial time Final time Passes"); while (x.input()) { y.input(); x.output(y); } puts("End of program 3 by team X"); return 0; }