blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
7
license_type
stringclasses
2 values
repo_name
stringlengths
6
79
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
4 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.07k
426M
star_events_count
int64
0
27
fork_events_count
int64
0
12
gha_license_id
stringclasses
3 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
6 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
20
6.28M
extension
stringclasses
20 values
content
stringlengths
20
6.28M
authors
sequencelengths
1
16
author_lines
sequencelengths
1
16
34617c56d131d5abaaa15d380111fa31e6e0941b
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/regex/test/regress/test_locale.cpp
7e86167aabfb4b63795fcd4329bb1b32c656d3f9
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
8,221
cpp
/* * * Copyright (c) 2004 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ #include "test.hpp" #include <clocale> #if defined(BOOST_WINDOWS) && !defined(BOOST_DISABLE_WIN32) #include <boost/scoped_array.hpp> #include <windows.h> #endif #ifdef BOOST_MSVC #pragma warning(disable:4127) #endif #ifdef BOOST_NO_STDC_NAMESPACE namespace std{ using ::setlocale; } #endif test_locale::test_locale(const char* c_name, boost::uint32_t lcid) { // store the name: m_old_name = m_name; m_name = c_name; // back up C locale and then set it's new name: const char* pl = std::setlocale(LC_ALL, 0); m_old_c_locale = pl ? pl : ""; m_old_c_state = s_c_locale; if(std::setlocale(LC_ALL, c_name)) { s_c_locale = test_with_locale; std::cout << "Testing the global C locale: " << c_name << std::endl; } else { s_c_locale = no_test; std::cout << "The global C locale: " << c_name << " is not available and will not be tested." << std::endl; } #ifndef BOOST_NO_STD_LOCALE // back up the C++ locale and create the new one: m_old_cpp_locale = s_cpp_locale_inst; m_old_cpp_state = s_cpp_locale; try{ s_cpp_locale_inst = std::locale(c_name); s_cpp_locale = test_with_locale; std::cout << "Testing the C++ locale: " << c_name << std::endl; }catch(std::runtime_error const &) { s_cpp_locale = no_test; std::cout << "The C++ locale: " << c_name << " is not available and will not be tested." << std::endl; } #else s_cpp_locale = no_test; #endif // back up win locale and create the new one: m_old_win_locale = s_win_locale_inst; m_old_win_state = s_win_locale; s_win_locale_inst = lcid; #if defined(BOOST_WINDOWS) && !defined(BOOST_DISABLE_WIN32) // // Start by geting the printable name of the locale. // We use this for debugging purposes only: // boost::scoped_array<char> p; int r = ::GetLocaleInfoA( lcid, // locale identifier LOCALE_SCOUNTRY, // information type 0, // information buffer 0 // size of buffer ); p.reset(new char[r+1]); r = ::GetLocaleInfoA( lcid, // locale identifier LOCALE_SCOUNTRY, // information type p.get(), // information buffer r+1 // size of buffer ); // // now see if locale is installed and behave accordingly: // if(::IsValidLocale(lcid, LCID_INSTALLED)) { s_win_locale = test_with_locale; std::cout << "Testing the Win32 locale: \"" << p.get() << "\" (0x" << std::hex << lcid << ")" << std::endl; } else { s_win_locale = no_test; std::cout << "The Win32 locale: \"" << p.get() << "\" (0x" << std::hex << lcid << ") is not available and will not be tested." << std::endl; } #else s_win_locale = no_test; #endif } test_locale::~test_locale() { // restore to previous state: std::setlocale(LC_ALL, m_old_c_locale.c_str()); s_c_locale = m_old_c_state; #ifndef BOOST_NO_STD_LOCALE s_cpp_locale_inst = m_old_cpp_locale; #endif s_cpp_locale = m_old_cpp_state; s_win_locale_inst = m_old_win_locale; s_win_locale = m_old_win_state; m_name = m_old_name; } int test_locale::s_c_locale = test_no_locale; int test_locale::s_cpp_locale = test_no_locale; int test_locale::s_win_locale = test_no_locale; #ifndef BOOST_NO_STD_LOCALE std::locale test_locale::s_cpp_locale_inst; #endif boost::uint32_t test_locale::s_win_locale_inst = 0; std::string test_locale::m_name; void test_en_locale(const char* name, boost::uint32_t lcid) { using namespace boost::regex_constants; errors_as_warnings w; test_locale l(name, lcid); TEST_REGEX_SEARCH_L("[[:lower:]]+", perl, "\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xf7", match_default, make_array(1, 32, -2, -2)); TEST_REGEX_SEARCH_L("[[:upper:]]+", perl, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", match_default, make_array(1, 31, -2, -2)); // TEST_REGEX_SEARCH_L("[[:punct:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0", match_default, make_array(0, 31, -2, -2)); TEST_REGEX_SEARCH_L("[[:print:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 93, -2, -2)); TEST_REGEX_SEARCH_L("[[:graph:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 93, -2, -2)); TEST_REGEX_SEARCH_L("[[:word:]]+", perl, "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 61, -2, -2)); // collation sensitive ranges: #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) // these tests are disabled for Borland C++: a bug in std::collate<wchar_t> // causes these tests to crash (pointer overrun in std::collate<wchar_t>::do_transform). TEST_REGEX_SEARCH_L("[a-z]+", perl|::boost::regex_constants::collate, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc", match_default, make_array(0, 28, -2, -2)); TEST_REGEX_SEARCH_L("[a-z]+", perl|::boost::regex_constants::collate, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc", match_default, make_array(1, 28, -2, -2)); // and equivalence classes: TEST_REGEX_SEARCH_L("[[=a=]]+", perl, "aA\xe0\xe1\xe2\xe3\xe4\xe5\xc0\xc1\xc2\xc3\xc4\xc5", match_default, make_array(0, 14, -2, -2)); // case mapping: TEST_REGEX_SEARCH_L("[A-Z]+", perl|icase|::boost::regex_constants::collate, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc", match_default, make_array(0, 28, -2, -2)); TEST_REGEX_SEARCH_L("[a-z]+", perl|icase|::boost::regex_constants::collate, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc", match_default, make_array(1, 28, -2, -2)); TEST_REGEX_SEARCH_L("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd", perl|icase, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(1, 30, -2, -2)); #endif } void test_en_locale() { // VC6 seems to have problems with std::setlocale, I've never // gotten to the bottem of this as the program runs fine under the // debugger, but hangs when run from bjam: #if !BOOST_WORKAROUND(BOOST_MSVC, <1300) && !(defined(__ICL) && defined(_MSC_VER) && (_MSC_VER == 1200)) test_en_locale("en_US", 0x09 | 0x01 << 10); test_en_locale("en_UK", 0x09 | 0x02 << 10); test_en_locale("en", 0x09); #endif }
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 166 ] ] ]
80bddd8e01b52127a5501ada31d815d33621518b
9dad473629c94d45041d51ae6c21ca2b477bd913
/sources/diff.cpp
57a59cd91e447d97c506419677088212c4911a54
[]
no_license
Mefteg/cheshire-csg
26ed5682277beb6993f60da1604ddfe298f8caae
b12daf345c22065f5b30247d4b6c3395372849fb
refs/heads/master
2021-01-10T20:13:34.474876
2011-10-03T21:57:49
2011-10-03T21:57:49
32,360,524
0
0
null
null
null
null
UTF-8
C++
false
false
1,863
cpp
#include "diff.h" Diff::Diff(void) { } Diff::Diff(Node * left, Node * right) : OpBin(left, right) { } Diff::~Diff(void) { } int Diff::Intersect(const Ray& ray, Intersection& t) { Intersection tl1,tl2, tr1,tr2; int retLeft = this->left->Intersect(ray,tl1,tl2); int retRight = this->right->Intersect(ray,tr1,tr2); //if no collision if( !(retLeft || retRight)) return 0; //or collision only to the right if(!retLeft && retRight) return 0; //if collision on the left node only if(retLeft && !retRight){ t = tl1; t.obj = this->left; return 1; } //else it's a collision between the two objects //right intersect in the left obj if( (tl1>tr1) && (tl1<tr2) ){ //right intersect 2 outside the left obj if(tl2>tr2){ t = tr2; t.normal = -t.normal; t.obj = this->left; return 1; } } return 0; } int Diff::Intersect(const Ray& ray, Intersection& t1, Intersection& t2) { Intersection tl1,tl2, tr1,tr2; tl1.obj = this; tl2.obj = this; tr1.obj = this; tr2.obj = this; //s'il y a une collision avec left if ( this->left->Intersect(ray, tl1, tl2) ) { //si l'intersection n'est pas dans right if ( !this->right->PMC(tl1.pos) ) { t1 = tl1; t2 = tl2; } //sinon else { if ( this->right->Intersect(ray, tr1, tr2) ) { t1 = tr2; //on inverse la normale t1.normal = t1.normal * -1; //on change l'obj pour avoir la bonne couleur t1.obj = tl2.obj; t2 = tl2; } } return 1; } //sinon else { return 0; } } int Diff::PMC(const Vector& u) { return (this->left->PMC(u) && !(this->right->PMC(u))); }
[ "[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d", "[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d" ]
[ [ [ 1, 19 ], [ 22, 24 ], [ 26, 45 ], [ 47, 48 ], [ 76, 76 ], [ 83, 83 ] ], [ [ 20, 21 ], [ 25, 25 ], [ 46, 46 ], [ 49, 75 ], [ 77, 82 ], [ 84, 87 ] ] ]
63e54bd585d9951827bcc1b81dba705e3bdc5a91
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/apps/mermaid2/main.cpp
024022cad7edc6470022c316d67ef2875510ea88
[]
no_license
dtbinh/rush
4294f84de1b6e6cc286aaa1dd48cf12b12a467d0
ad75072777438c564ccaa29af43e2a9fd2c51266
refs/heads/master
2021-01-15T17:14:48.417847
2011-06-16T17:41:20
2011-06-16T17:41:20
41,476,633
1
0
null
2015-08-27T09:03:44
2015-08-27T09:03:44
null
UTF-8
C++
false
false
1,804
cpp
#include "stdafx.h" #include "JCore.h" #include "JWindowServer.h" #include "JDialog.h" #include "ISoundServer.h" #include "direct.h" #include "JDialog.h" #include "path.h" #include "fstream.h" #include "ifileserver.h" #include "IPersistServer.h" void AddModuleMediaPath() { // set current working directory to the same where we are located char path[_MAX_PATH]; GetModuleFileName( GetModuleHandle( NULL ), path, _MAX_PATH ); Path mediaPath( path ); mediaPath.SetFileExt( "" ); mediaPath.DirAppend( "media" ); if (mediaPath.Exists()) { g_pFileServer->AddMediaPath( mediaPath.GetFullPath() ); } chdir( path ); } int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { import( rb_core ); JCore* pCore = new JCore(); pCore->SetName( "core" ); if (pCore != JCore::s_pInstance) { return 1; } import( rb_ui ); import( rb_scene ); import( rb_logic ); link_class(Autorun); link_class(DrawServerGDI); pCore->Init(); AddModuleMediaPath(); pCore->AddServer( "windowserver" ); pCore->AddServer( "drawservergdi" ); pCore->InitTree(); JObject* pRoot = g_pPersistServer->LoadObject( "rboot" ); if (!pRoot) { return 1; } JString objPath; pRoot->GetPath( objPath ); pCore->SetRootObject( objPath.c_str() ); JWindowServer::s_pInstance->AddChild( pRoot, 0 ); pRoot->InitTree(); JDialog* pRootDlg = obj_cast<JDialog>( pRoot ); if (pRootDlg) { pRootDlg->Show(); } int res = JWindowServer::s_pInstance->RunApplicationLoop(); pCore->Release(); return res; }
[ [ [ 1, 79 ] ] ]
9a44a264eb07b2c0b7c1ce328f4e6e7470756d2d
27d5670a7739a866c3ad97a71c0fc9334f6875f2
/CPP/Targets/SupportWFLib/symbian/BTGPS/BtSocketsPeer.h
1162977f2b6ce82adb60319dc51e0bc332b96db8
[ "BSD-3-Clause" ]
permissive
ravustaja/Wayfinder-S60-Navigator
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
14d1b729b2cea52f726874687e78f17492949585
refs/heads/master
2021-01-16T20:53:37.630909
2010-06-28T09:51:10
2010-06-28T09:51:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,347
h
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BT_SOCKETS_PEER_H #define BT_SOCKETS_PEER_H enum TBtSocketsErrors { EBtSocketsReadError, EBtSocketsReadHardwareFail, EBtSocketsWriteTimeout, EBtSocketsWriteError, }; class MBtSocketsPeer { public: /** @name Connection related. */ //@{ virtual void ConnectionCancelled() = 0; /** * Called when the connection to the remote device was lost. * @param aReconnect a hint to the receiver whether an attempt to * reconnect should be made. Defaults to true. */ virtual void ConnectionLost(TBool aReconnect = ETrue) = 0; //@} virtual void ReceiveMessageL(const class TDesC8& aData) = 0; /** Error reporting.*/ virtual void ErrorNotify(enum TBtSocketsErrors aError, TInt aStatus) = 0; }; #endif
[ [ [ 1, 43 ] ] ]
02bf31101b01f014eb2dcac796eb74a1d14c3c16
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
/terralib/src/terralib/drivers/qt/TeWaitCursor.h
8072287469b1390787661d9bed8c43c8b4831f4c
[]
no_license
radtek/terra-printer
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
959241e52562128d196ccb806b51fda17d7342ae
refs/heads/master
2020-06-11T01:49:15.043478
2011-12-12T13:31:19
2011-12-12T13:31:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,971
h
/************************************************************************************ TerraLib - a library for developing GIS applications. Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio. This code is part of the TerraLib library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. You should have received a copy of the GNU Lesser General Public License along with this library. The authors reassure the license terms regarding the warranties. They specifically disclaim any warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The library provided hereunder is on an "as is" basis, and the authors have no obligation to provide maintenance, support, updates, enhancements, or modifications. In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct, indirect, special, incidental, or consequential damages arising out of the use of this library and its documentation. *************************************************************************************/ /*! \file TeWaitCursor.h \brief This file supports the definition of a waiting cursor using the Qt toolkit */ #ifndef __TERRALIB_INTERNAL_WAITCURSOR_H #define __TERRALIB_INTERNAL_WAITCURSOR_H #include <TeAppUtilsDefines.h> #include <qcursor.h> /** @defgroup QtDriver Interfaces to Qt Toolkit @ingroup Drivers TerraLib routines build on top of Qt Toolkit @{ */ //! A waiting cursor class TLAPPUTILS_DLL TeWaitCursor : public QCursor { public: //! Constructor TeWaitCursor(); //! Destructor ~TeWaitCursor(); //! Instantiate a waiting cursor void setWaitCursor(); //! Reset the waiting cursor void resetWaitCursor(); }; /** @} */ #endif
[ "[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec" ]
[ [ [ 1, 54 ] ] ]
c8028c896ff99c70cb2cdf9ab0e703045344d402
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
e32aefa8b5e19b786e3f4a04f431594a93e653ee
[]
no_license
azrul2202/WebKit-Smartphone
0aab1ff641d74f15c0623f00c56806dbc9b59fc1
023d6fe819445369134dee793b69de36748e71d7
refs/heads/master
2021-01-15T09:24:31.288774
2011-07-11T11:12:44
2011-07-11T11:12:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,765
cpp
/* * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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. */ #include "config.h" #include "TextInputControllerQt.h" #include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include <QApplication> #include <QInputMethodEvent> #include <QKeyEvent> TextInputController::TextInputController(QWebPage* parent) : QObject(parent) { } void TextInputController::doCommand(const QString& command) { Qt::KeyboardModifiers modifiers = Qt::NoModifier; int keycode = 0; if (command == "moveBackwardAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Left; } else if (command =="moveDown:") { keycode = Qt::Key_Down; } else if (command =="moveDownAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Down; } else if (command =="moveForward:") { keycode = Qt::Key_Right; } else if (command =="moveForwardAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Right; } else if (command =="moveLeft:") { keycode = Qt::Key_Left; } else if (command =="moveLeftAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Left; } else if (command =="moveRight:") { keycode = Qt::Key_Right; } else if (command =="moveRightAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Right; } else if (command =="moveToBeginningOfDocument:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Home; } else if (command =="moveToBeginningOfLine:") { keycode = Qt::Key_Home; // } else if (command =="moveToBeginningOfParagraph:") { } else if (command =="moveToEndOfDocument:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_End; } else if (command =="moveToEndOfLine:") { keycode = Qt::Key_End; // } else if (command =="moveToEndOfParagraph:") { } else if (command =="moveUp:") { keycode = Qt::Key_Up; } else if (command =="moveUpAndModifySelection:") { modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Up; } else if (command =="moveWordBackward:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Up; } else if (command =="moveWordBackwardAndModifySelection:") { modifiers |= Qt::ShiftModifier; modifiers |= Qt::ControlModifier; keycode = Qt::Key_Left; } else if (command =="moveWordForward:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Right; } else if (command =="moveWordForwardAndModifySelection:") { modifiers |= Qt::ControlModifier; modifiers |= Qt::ShiftModifier; keycode = Qt::Key_Right; } else if (command =="moveWordLeft:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Left; } else if (command =="moveWordRight:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Left; } else if (command =="moveWordRightAndModifySelection:") { modifiers |= Qt::ShiftModifier; modifiers |= Qt::ControlModifier; keycode = Qt::Key_Right; } else if (command =="moveWordLeftAndModifySelection:") { modifiers |= Qt::ShiftModifier; modifiers |= Qt::ControlModifier; keycode = Qt::Key_Left; } else if (command =="pageDown:") { keycode = Qt::Key_PageDown; } else if (command =="pageUp:") { keycode = Qt::Key_PageUp; } else if (command == "deleteWordBackward:") { modifiers |= Qt::ControlModifier; keycode = Qt::Key_Backspace; } else if (command == "deleteBackward:") { keycode = Qt::Key_Backspace; } else if (command == "deleteForward:") { keycode = Qt::Key_Delete; } QKeyEvent event(QEvent::KeyPress, keycode, modifiers); QApplication::sendEvent(parent(), &event); QKeyEvent event2(QEvent::KeyRelease, keycode, modifiers); QApplication::sendEvent(parent(), &event2); } void TextInputController::setMarkedText(const QString& string, int start, int end) { QList<QInputMethodEvent::Attribute> attributes; #if QT_VERSION >= 0x040600 QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, start, end, QVariant()); attributes << selection; #endif QInputMethodEvent event(string, attributes); QApplication::sendEvent(parent(), &event); } void TextInputController::insertText(const QString& string) { QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(string, attributes); event.setCommitString(string); QApplication::sendEvent(parent(), &event); } QVariantList TextInputController::selectedRange() { return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent())); } QVariantList TextInputController::firstRectForCharacterRange(int location, int length) { return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent()), location, length); }
[ [ [ 1, 160 ] ] ]
a730c3518cf7f367824be3ad89e347dcf0521aec
6dac9369d44799e368d866638433fbd17873dcf7
/a.i.wars/src/trunk/ServerBot.cpp
1e6233236d2ea1e40df66cb6c8ded4b121366ece
[]
no_license
christhomas/fusionengine
286b33f2c6a7df785398ffbe7eea1c367e512b8d
95422685027bb19986ba64c612049faa5899690e
refs/heads/master
2020-04-05T22:52:07.491706
2006-10-24T11:21:28
2006-10-24T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,527
cpp
#include "Bot.h" #include <vector> #include "aiwars.h" ServerBot::ServerBot(int key) { m_key = key; m_entity = NULL; m_energy = 100; m_tb_energy = NULL; m_tb_name = NULL; m_active = true; } ServerBot::~ServerBot() { } bool ServerBot::GetActive(void) { return m_active; } void ServerBot::SetActive(bool active) { m_active = active; m_entity->SetActive(active); m_tb_name->SetActive(active); m_tb_energy->SetActive(active); } int ServerBot::GetKey(void) { return m_key; } void ServerBot::CreateEntity(void) { char *tex = m_client->GetBotTexture(); Maths::Vector s = m_client->GetBotSize(); Maths::Vector a = m_client->GetBotAxis(); ITexture *t = fusion->Graphics->CreateTexture(tex); Overlay *o = fusion->Mesh->CreateOverlay(t); int width,height; t->GetDimensions(width,height); o->AddFrame(new Rect(0,0,width,height)); m_entity = fusion->Mesh->CreateEntity(o); m_entity->SetScale(s); m_entity->SetAxis(a); m_entity->SetActive(true); GameScene->AddEntity(m_entity); } void ServerBot::CreateWeapons(void) { char *tex = m_client->GetWeaponTexture(); m_weaponsystem.Initialise(tex); GameScene->AddEntity(m_weaponsystem.GetEntity()); } void ServerBot::Initialise(void) { // Create a position // Create a rotation for the body m_bodyangle = 0; // Create a forward vector // Create a backward vector // NOTE: you create them by "initialising" a zero angle rotation RotateBody(0); // Create a rotation for the turret // Create a bounding box // Setup collision system GameScene->CollisionSystem->AddEntity(0,m_entity); } void ServerBot::SetClient(ClientBot *cb) { m_client = cb; } void ServerBot::SetPosition(Maths::Vector position) { m_position = position; m_position.z = 0; m_entity->InitTranslate(m_position); } void ServerBot::MoveForward(int distance) { float *elements = m_bodyvector.GetElements(); Maths::Vector t(elements[1],-elements[5],0); m_position += (t*distance); m_distance = distance; // Check position against world boundaries and clip them accordingly // NOTE: This is such a shit method of hacking the CD to work AdjustMovement(); m_entity->SetTranslate(TRANSLATE_ABS,m_position); } void ServerBot::MoveBackward(int distance) { float *elements = m_bodyvector.GetElements(); Maths::Vector t(-elements[1],elements[5],0); m_position += (t*distance); m_distance = -distance; // Check position against world boundaries and clip them accordingly // NOTE: This is such a shit method of hacking the CD to work AdjustMovement(); m_entity->SetTranslate(TRANSLATE_ABS,m_position); } void ServerBot::RotateBody(int angle) { // Determine if you have the energy and clip it if you do not // Manipulate the energy for the rotation m_bodyangle += angle; m_bodyangle%=360; m_bodyquat.LoadIdentity(); m_bodyquat.Rotate(0,0,m_bodyangle); m_bodyvector = m_bodyquat; m_lastangle = angle; m_entity->SetRotate(m_bodyangle,0,0,1); } void ServerBot::RotateLimb(int angle) { // m_turretangle += angle; // m_turretquat.LoadIdentity(); // m_turretquat.Rotate(0,0,m_turretangle); // m_turretview = m_turretquat; // m_entity->Rotate(angle,0,0,1); } bool ServerBot::FireOffence(int power) { float *e = m_bodyvector.GetElements(); Maths::Vector v(e[1],-e[5],0); return m_weaponsystem.Fire(WeaponSystem::OFFENCE,power,m_position,v); } void ServerBot::Collision(void) { m_client->m_collision = true; } void ServerBot::Damage(void) { m_energy-=1; if(m_energy < 0){ SetActive(false); gameserver.Death(this); } } void ServerBot::AdjustMovement(void) { bool collision = false; if(m_position.x < 0) { m_position.x = 0; collision = true; } if(m_position.x > SCREENWIDTH-32) { m_position.x = SCREENWIDTH-32; collision = true; } if(m_position.y < 0) { m_position.y = 0; collision = true; } if(m_position.y > SCREENHEIGHT-32) { m_position.y = SCREENHEIGHT-32; collision = true; } if(collision==true) m_client->m_collision = true; } void ServerBot::SetDisplay(Textbox *e, Textbox *n) { m_tb_energy = e; m_tb_name = n; } bool ServerBot::Update(void) { //m_energy += 1; //if(m_energy > 100) m_energy = 100;] if(GetActive() == false) return false; char str[256]; // Update onscreen output sprintf(str,"%s:",m_client->GetName()); m_tb_name->UpdateString(str); m_tb_name->SetPosition(m_position.x,m_position.y-20,1); sprintf(str,"%d",m_energy); m_tb_energy->UpdateString(str); m_tb_energy->SetPosition(m_position.x,m_position.y-10,1); m_weaponsystem.Update(); return m_client->Update(); } bool ServerBot::OwnWeapon(Entity *e) { if(e == m_weaponsystem.GetEntity()) return true; return false; } ServerBot * ServerBot::Find(int key) { for(int a=0;a<serverbot.size();a++){ if(key == serverbot[a]->GetKey()) return serverbot[a]; } return NULL; } ServerBot * ServerBot::Find(Entity *e) { for(int a=0;a<serverbot.size();a++){ if(e == serverbot[a]->m_entity){ return serverbot[a]; } } return NULL; } ServerBot * ServerBot::Find(Entity *e1,Entity *e2) { ServerBot *sb = NULL; for(int a=0;a<serverbot.size();a++){ if(e1 == serverbot[a]->m_entity){ sb = serverbot[a]; if(sb->OwnWeapon(e2) == true){ return NULL; } } } return sb; }
[ "chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7" ]
[ [ [ 1, 294 ] ] ]
679ce0ddcb88fa003bedc061c00762fd3581126e
3856c39683bdecc34190b30c6ad7d93f50dce728
/LastProject/Source/Cube24Vertex.cpp
efd4be0e14a5b5881f66a080c69f04e63121dbc7
[]
no_license
yoonhada/nlinelast
7ddcc28f0b60897271e4d869f92368b22a80dd48
5df3b6cec296ce09e35ff0ccd166a6937ddb2157
refs/heads/master
2021-01-20T09:07:11.577111
2011-12-21T22:12:36
2011-12-21T22:12:36
34,231,967
0
0
null
null
null
null
UHC
C++
false
false
8,495
cpp
/** @file Cube.cpp @date 2011/09/17 @author 백경훈 @brief 큐브 클래스 */ #include "stdafx.h" #include "Cube24Vertex.h" #ifdef _24CUBE CCube::CCube() { Clear(); } CCube::~CCube() { Release(); } VOID CCube::Clear() { m_pD3dDevice = NULL ; m_pTexture = NULL; m_iStartVB = 0; m_iStartIB = 0; m_fCubeSize = 0.0f; } HRESULT CCube::Create( LPDIRECT3DDEVICE9 a_pD3dDevice, LPDIRECT3DVERTEXBUFFER9 &a_pVB, LPDIRECT3DINDEXBUFFER9 &a_pIB, INT a_iStartVB, INT a_iStartIB, FLOAT a_fCubeSize ) { m_pD3dDevice = a_pD3dDevice; m_iStartVB = a_iStartVB; m_iStartIB = a_iStartIB; m_fCubeSize = a_fCubeSize; _InitVB( a_pVB ); _InitIB( a_pIB ); return S_OK; } HRESULT CCube::Release() { /*if(m_pVB != NULL) { m_pVB->Release(); m_pVB=NULL; } if(m_pIB != NULL) { m_pIB->Release(); m_pIB=NULL; }*/ if(m_pTexture != NULL) { m_pTexture->Release(); m_pTexture=NULL; } return S_OK; } HRESULT CCube::InitTexture( DWORD a_Color, DWORD a_OutLineColor ) { /*if( FAILED( D3DXCreateTextureFromFile( GD3D9DEVICE, L"Media/TerrainTexture/test.bmp", &m_pTexture ) ) ) { return E_FAIL; }*/ m_Mtrl.Diffuse = D3DXCOLOR( a_Color ); m_Mtrl.Ambient = D3DXCOLOR( a_Color ); m_Mtrl.Power = 1.0f; m_Mtrl.Emissive = D3DXCOLOR( 0.0f, 0.0f, 0.0f, 0.0f ); m_Mtrl.Specular = D3DXCOLOR( a_Color ); //LPBYTE pData; //LPDWORD pDWord; //D3DLOCKED_RECT Texture_Locked; //INT TextureSize = 8; //if( m_pTexture != NULL ) //{ // m_pTexture->Release(); // m_pTexture=NULL; //} //if( FAILED( m_pD3dDevice->CreateTexture( TextureSize, TextureSize, 1, 0, D3DFMT_A8R8G8B8, // D3DPOOL_MANAGED, &m_pTexture, NULL ) ) ) //{ // return E_FAIL; //} //memset( &Texture_Locked, 0, sizeof(D3DLOCKED_RECT) ); //if( FAILED(m_pTexture->LockRect(0, &Texture_Locked, NULL, 0)) ) //{ // return E_FAIL; //} //pData = (LPBYTE)Texture_Locked.pBits; //for(INT iLoopY=0; iLoopY<TextureSize; ++iLoopY) //{ // pDWord = LPDWORD(pData + iLoopY * Texture_Locked.Pitch); // for(INT iLoopX=0; iLoopX<TextureSize; ++iLoopX) // { // //외곽선 처리 // if( iLoopX == 0 || iLoopX == TextureSize-1 || iLoopY == 0 || iLoopY == TextureSize-1 ) // { // *(pDWord + iLoopX) = a_OutLineColor; // } // else // { // *(pDWord + iLoopX) = a_Color; // } // } //} //if( FAILED(m_pTexture->UnlockRect(0)) ) //{ // return E_FAIL; //} return S_OK; } HRESULT CCube::_InitVB( LPDIRECT3DVERTEXBUFFER9 &a_pVB ) { //InitTexture( a_Color ); /*if( FAILED( GD3D9DEVICE->CreateVertexBuffer( CUBEVERTEX::VertexNum * sizeof( CUBEVERTEX ), 0, CUBEVERTEX::FVF, D3DPOOL_MANAGED, &m_pVB, NULL ) ) ) { CleanUp(); return E_FAIL; }*/ // v0----- v1 // /| /| // v3------v2| // | | | | // | |v4---|-|v5 // |/ |/ // v7------v6 FLOAT fSize = m_fCubeSize; D3DXVECTOR3 v0 = D3DXVECTOR3( -fSize, fSize, fSize ); D3DXVECTOR3 v1 = D3DXVECTOR3( fSize, fSize, fSize ); D3DXVECTOR3 v2 = D3DXVECTOR3( fSize, fSize, -fSize ); D3DXVECTOR3 v3 = D3DXVECTOR3( -fSize, fSize, -fSize ); D3DXVECTOR3 v4 = D3DXVECTOR3( -fSize, -fSize, fSize ); D3DXVECTOR3 v5 = D3DXVECTOR3( fSize, -fSize, fSize ); D3DXVECTOR3 v6 = D3DXVECTOR3( fSize, -fSize, -fSize ); D3DXVECTOR3 v7 = D3DXVECTOR3( -fSize, -fSize, -fSize ); FLOAT fNom = 1.0f; D3DXVECTOR3 nTop = D3DXVECTOR3( 0.0f, fNom, 0.0f ); D3DXVECTOR3 nBottom = D3DXVECTOR3( 0.0f, -fNom, 0.0f ); D3DXVECTOR3 nFront = D3DXVECTOR3( 0.0f, 0.0f, -fNom ); D3DXVECTOR3 nBack = D3DXVECTOR3( 0.0f, 0.0f, fNom ); D3DXVECTOR3 nLeft = D3DXVECTOR3( -fNom, 0.0f, 0.0f ); D3DXVECTOR3 nRight = D3DXVECTOR3( fNom, 0.0f, 0.0f ); D3DXVECTOR2 tTL = D3DXVECTOR2( 0.0f, 0.0f ); D3DXVECTOR2 tTR = D3DXVECTOR2( 1.0f, 0.0f ); D3DXVECTOR2 tBL = D3DXVECTOR2( 1.0f, 1.0f ); D3DXVECTOR2 tBR = D3DXVECTOR2( 0.0f, 1.0f ); CUBEVERTEX* pVertices = NULL; if( FAILED( a_pVB->Lock( m_iStartVB * sizeof( CUBEVERTEX ), CUBEVERTEX::VertexNum * sizeof( CUBEVERTEX ), (VOID**)&pVertices, 0 ) ) ) { Release(); return E_FAIL; } CUBEVERTEX vertices[CUBEVERTEX::VertexNum] = { //Top------------------------------------------------------ // 0 { v0, //a_Color, nTop, tTL }, // 1 { v1, // a_Color, nTop, tTR }, // 2 { v2, //a_Color, nTop, tBL }, // 3 { v3, //a_Color, nTop, tBR }, //Bottom------------------------------------------------------ // 4 { v4, //a_Color, nBottom, tTL }, // 5 { v5, //a_Color, nBottom, tTR }, // 6 { v6, //a_Color, nBottom, tBL }, // 7 { v7, //a_Color, nBottom, tBR }, //Front------------------------------------------------------ // 8 { v3, //a_Color, nFront, tTL }, // 9 { v2, //a_Color, nFront, tTR }, // 10 { v6, //a_Color, nFront, tBL }, // 11 { v7, //a_Color, nFront, tBR }, //Back------------------------------------------------------ // 12 { v0, //a_Color, nBack, tTL }, // 13 { v1, //a_Color, nBack, tTR }, // 14 { v4, //a_Color, nBack, tBR }, // 15 { v5, //a_Color, nBack, tBL }, //Left------------------------------------------------------ // 16 { v0, //a_Color, nLeft, tTL }, // 17 { v3, //a_Color, nLeft, tTR }, // 18 { v7, //a_Color, nLeft, tBL }, // 19 { v4, //a_Color, nLeft, tBR }, //Right------------------------------------------------------ // 20 { v2, //a_Color, nRight, tTL }, // 21 { v1, //a_Color, nRight, tTR }, // 22 { v5, //a_Color, nRight, tBL }, // 23 { v6, //a_Color, nRight, tBR } }; memcpy( pVertices, vertices, CUBEVERTEX::VertexNum * sizeof( CUBEVERTEX ) ); a_pVB->Unlock(); return S_OK; } HRESULT CCube::_InitIB( LPDIRECT3DINDEXBUFFER9 &a_pIB ) { /*if( FAILED( GD3D9DEVICE->CreateIndexBuffer( 12 * sizeof( CUBEINDEX ), 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_pIB, NULL ) ) ) { CleanUp(); return E_FAIL; }*/ VOID* pIndices = NULL; if( FAILED( a_pIB->Lock( m_iStartIB, 12 * sizeof( CUBEINDEX ), (VOID**)&pIndices, 0 ) ) ) { Release(); return E_FAIL; } CUBEINDEX i[12] = { //TOP { 0, 1, 3 }, { 1, 2, 3 }, //BOTTOM { 7, 5, 4 }, { 7, 6, 5 }, //FRONT { 8, 9, 11 }, { 9, 10, 11 }, //BACK { 13, 14, 15 }, { 13, 12, 14 }, //LEFT { 16, 17, 19 }, { 17, 18, 19 }, //RIGHT { 20, 21, 23 }, { 21, 22, 23 } }; memcpy( pIndices, i, 12 * sizeof( CUBEINDEX ) ); a_pIB->Unlock(); return S_OK; } VOID CCube::Update() { } VOID CCube::Render() { m_pD3dDevice->SetMaterial( &m_Mtrl ); //m_pD3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE); //m_pD3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); //m_pD3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); //m_pD3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW); //m_pD3dDevice->SetTexture( 0, m_pTexture ); //m_pD3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 ); //m_pD3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); //m_pD3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); //m_pD3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); //m_pD3dDevice->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL); //m_pD3dDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1); //m_pD3dDevice->SetRenderState(D3DRS_COLORVERTEX, TRUE); //m_pD3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof( CUBEVERTEX ) ); //m_pD3dDevice->SetFVF( CUBEVERTEX::FVF ); //m_pD3dDevice->SetIndices( m_pIB ); m_pD3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, m_iStartVB, 0, CUBEVERTEX::VertexNum, 0, 12 ); //m_pD3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE); //m_pD3dDevice->SetTexture( 0, NULL ); } #endif
[ "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0" ]
[ [ [ 1, 450 ] ] ]
9e05e4bbfe5322a7422d0d1abca18a125426613c
fac8de123987842827a68da1b580f1361926ab67
/inc/physics/Common/Serialize/Serialize/hkObjectReader.h
fffb21ce627886b733a95bb4df93c830cf2c44c5
[]
no_license
blockspacer/transporter-game
23496e1651b3c19f6727712a5652f8e49c45c076
083ae2ee48fcab2c7d8a68670a71be4d09954428
refs/heads/master
2021-05-31T04:06:07.101459
2009-02-19T20:59:59
2009-02-19T20:59:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,267
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_SERIALIZE_OBJECT_READER_H #define HK_SERIALIZE_OBJECT_READER_H class hkRelocationInfo; class hkStreamReader; /// Interface to read a single object from a stream. /// Objects read consist of two parts - a relocatable buffer and /// a relocation info which describes the pointers within the buffer. /// After the relocations have been applied, the buffer is no longer /// relocatable. class hkObjectReader : public hkReferencedObject { public: HK_DECLARE_CLASS_ALLOCATOR(HK_MEMORY_CLASS_SERIALIZE); /// Read an object into the supplied buffer. /// The buffer must be large enough to hold the object /// This method may fail if the buffer size is too small, /// there is a read error or parse error. /// Returns the size of the buffer used or -1 on error. virtual int readObject( hkStreamReader* reader, void* buf, int bufLen, const hkClass& klass, hkRelocationInfo& reloc ) = 0; /// Read a raw binary chunk. virtual hkResult readRaw( hkStreamReader* reader, void* buf, int bufLen ) = 0; }; #endif //HK_SERIALIZE_OBJECT_READER_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529) * * Confidential Information of Havok. (C) Copyright 1999-2008 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at * www.havok.com/tryhavok * */
[ "uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4" ]
[ [ [ 1, 52 ] ] ]
5115bf0382ad711b4eb2d41a9da8486b01d11442
a02276848c2bea89526819874c016ff17fc36104
/AddObjectEvent.h
895e39e231805dc30f519c34b48bd4f44ab3fab3
[]
no_license
AnupGupta/geometrywarsreloaded
ec85ddc07ffd687d5d53c1c9abd4138f7ffcc141
f6a615c05423c66433e8a85d3497e8386b618d0d
refs/heads/master
2016-09-01T11:12:37.197796
2008-06-04T14:17:44
2008-06-04T14:17:44
44,064,867
0
0
null
null
null
null
UTF-8
C++
false
false
252
h
#ifndef ADDOBJECTEVENT_H #define ADDOBJECTEVENT_H #include "Event.h" class GameObject; class AddObjectEvent : public Event { public: AddObjectEvent(GameObject* object); ~AddObjectEvent(); GameObject* m_pGameObject; }; #endif
[ "vkalpias@ff6a4cd7-4e4d-0410-b3e6-9b514b4d81ca" ]
[ [ [ 1, 19 ] ] ]
45903ead00d9e48895d43d9d24e36f363689fbcd
1775576281b8c24b5ce36b8685bc2c6919b35770
/tags/release_1.0/info_bar.cpp
7c06e287337dc1e33657a5b427c932075209c7da
[]
no_license
BackupTheBerlios/gtkslade-svn
933a1268545eaa62087f387c057548e03497b412
03890e3ba1735efbcccaf7ea7609d393670699c1
refs/heads/master
2016-09-06T18:35:25.336234
2006-01-01T11:05:50
2006-01-01T11:05:50
40,615,146
0
0
null
null
null
null
UTF-8
C++
false
false
1,299
cpp
#include "main.h" #include "info_bar.h" #include "misc.h" GtkWidget *infobar; extern int edit_mode; GtkWidget *get_info_bar() { GtkWidget *temp = NULL; infobar = gtk_notebook_new(); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(infobar), false); // Lines temp = gtk_label_new("Line info"); gtk_notebook_append_page(GTK_NOTEBOOK(infobar), get_line_info_bar(), NULL); // Vertices temp = gtk_label_new("Vertex info"); gtk_notebook_append_page(GTK_NOTEBOOK(infobar), get_vertex_info_bar(), NULL); // Sectors temp = gtk_label_new("Sector info"); gtk_notebook_append_page(GTK_NOTEBOOK(infobar), get_sector_info_bar(), NULL); // Things temp = gtk_label_new("Thing info"); gtk_notebook_append_page(GTK_NOTEBOOK(infobar), get_thing_info_bar(), NULL); return infobar; } void change_infobar_page() { int mode; // Swap line and vertex mode numbers (so that the infobar page can default to lines) if (edit_mode == 0) mode = 1; else if (edit_mode == 1) mode = 0; else mode = edit_mode; gtk_notebook_set_current_page(GTK_NOTEBOOK(infobar), mode); } void setup_label(GtkWidget **label, char* text) { *label = gtk_label_new(text); gtk_misc_set_alignment(GTK_MISC(*label), 0.0, 0.5); widget_set_font(*label, "Sans", 8); }
[ "veilofsorrow@0f6d0948-3201-0410-bbe6-95a89488c5be" ]
[ [ [ 1, 56 ] ] ]
30ceee10b4d07106c8cadc90235401f1fc0a3c5c
6ee200c9dba87a5d622c2bd525b50680e92b8dab
/Walkyrie Dx9/DoomeRX/Scenes/MyScenario.h
c6f3c8439aca70b4360614cf0b214f1a975d8a63
[]
no_license
Ishoa/bizon
4dbcbbe94d1b380f213115251e1caac5e3139f4d
d7820563ab6831d19e973a9ded259d9649e20e27
refs/heads/master
2016-09-05T11:44:00.831438
2010-03-10T23:14:22
2010-03-10T23:14:22
32,632,823
0
0
null
null
null
null
UTF-8
C++
false
false
677
h
#include "..\..\Valkyrie\Moteur\Scenario.h" class CMyScenario : public CScenario { public: enum EScene { e_Scene_Basique = 0, e_Scene_Test, e_Scene_MipMapping, e_Scene_TeapotAndTracball, e_Scene_MultipleVertexBuffers, e_Scene_NormalMapping, e_Scene_Shader, e_Scene_SystemeSolaire, e_Scene_Laby, e_Scene_Terrain3D, e_Scene_ShadowVolume, e_Scene_ParticleSystem, e_Scene_EffectDX, e_Scene_Cinematique, }; protected: EScene m_eCurrentScene; public: CMyScenario(); ~CMyScenario(); bool InitScene(EScene eScene); void SetScene(EScene eScene){m_eCurrentScene = eScene;} bool Init(); bool Reset(); };
[ "Colas.Vincent@ab19582e-f48f-11de-8f43-4547254af6c6" ]
[ [ [ 1, 39 ] ] ]
ed2e1ff683d7c44521c8e6e56b8bbd6b52907352
2643a033a379ea2041a9fbbf2d8ed7b916ba59b4
/DLR_Main/Test/DlrComLibrary/Properties.cpp
667f5364eba2ef75f94115dea15f5d198426686a
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
mdavid/dlr
67349a5ae1ee54c41a0163beea55de14d4cb7e08
773f9ae89b08c92023e8c1b929e97a938c941fa0
refs/heads/master
2021-01-10T20:50:39.162502
2010-08-15T19:39:52
2010-08-15T19:39:52
859,539
1
0
null
null
null
null
UTF-8
C++
false
false
4,008
cpp
// Properties.cpp : Implementation of CProperties #include "stdafx.h" #include "Properties.h" int CProperties::s_cConstructed; int CProperties::s_cReleased; // CProperties STDMETHODIMP CProperties::get_pBstr(BSTR* pVal) { *pVal = m_pBstr; return S_OK; } STDMETHODIMP CProperties::put_pBstr(BSTR newVal) { if(m_pBstr != NULL) { SysFreeString(m_pBstr); } if(newVal == NULL) { m_pBstr = newVal; } else { m_pBstr = SysAllocString(newVal); } return S_OK; } STDMETHODIMP CProperties::get_pVariant(VARIANT* pVal) { return VariantCopy(pVal, &m_variantVal); } STDMETHODIMP CProperties::put_pVariant(VARIANT newVal) { if (newVal.vt != VARENUM::VT_DISPATCH){ return VariantCopy(&m_variantVal, &newVal); } } STDMETHODIMP CProperties::putref_pVariant(VARIANT* newVal) { return VariantCopy(&m_variantVal, newVal); } STDMETHODIMP CProperties::get_pDate(DATE* pVal) { *pVal = m_dateVal; return S_OK; } STDMETHODIMP CProperties::put_pDate(DATE newVal) { m_dateVal = newVal; return S_OK; } STDMETHODIMP CProperties::get_pLong(LONG* pVal) { *pVal = m_longVal; return S_OK; } STDMETHODIMP CProperties::put_pLong(LONG newVal) { m_longVal = newVal; return S_OK; } STDMETHODIMP CProperties::get_RefProperty(IDispatch** pVal) { if(pVal == NULL) return E_POINTER; *pVal = m_dispVal; if (m_dispVal != NULL) { m_dispVal->AddRef(); } return S_OK; } STDMETHODIMP CProperties::putref_RefProperty(IDispatch* newVal) { // if we're setting to the same value avoid Release/AddRef which // could drop to zero and then come back to life. if (m_dispVal != newVal) { if (newVal == this) { // avoid the circular reference... m_dispVal = this; } else { // release if we already have a value if (m_dispVal != NULL && m_dispVal != this) { m_dispVal->Release(); } // install the new value m_dispVal = *&newVal; if (newVal !=NULL) { newVal->AddRef(); } } } return S_OK; } STDMETHODIMP CProperties::get_PutAndPutRefProperty(DOUBLE* pVal) { *pVal = m_dblVal; return S_OK; } STDMETHODIMP CProperties::put_PutAndPutRefProperty(DOUBLE newVal) { m_dblVal = newVal; return S_OK; } STDMETHODIMP CProperties::putref_PutAndPutRefProperty(DOUBLE* newVal) { if(newVal != NULL) m_dblVal = *newVal * 2; return S_OK; } STDMETHODIMP CProperties::get_PropertyWithParam(DOUBLE a, DOUBLE* pVal) { *pVal = m_propertyWithParam - a; return S_OK; } STDMETHODIMP CProperties::put_PropertyWithParam(DOUBLE a, DOUBLE newVal) { m_propertyWithParam = a + newVal; return S_OK; } STDMETHODIMP CProperties::get_ReadOnlyProperty(CHAR* pVal) { *pVal = 'c'; return S_OK; } STDMETHODIMP CProperties::put_WriteOnlyProperty(DATE newVal) { //Do nothing return S_OK; } STDMETHODIMP CProperties::get_PropertyWithOutParam(BSTR* a, BSTR* pVal) { *a = *pVal = m_outParamVal; return S_OK; } STDMETHODIMP CProperties::put_PropertyWithOutParam(BSTR* a, BSTR newVal) { if(m_outParamVal != NULL) { SysFreeString(m_outParamVal); } if(newVal == NULL) { m_outParamVal = newVal; } else { m_outParamVal = SysAllocString(newVal); } return S_OK; } STDMETHODIMP CProperties::get_PropertyWithTwoParams(DOUBLE a, DOUBLE b, DOUBLE* pVal) { *pVal = m_twoParamsVal - a - b; return S_OK; } STDMETHODIMP CProperties::put_PropertyWithTwoParams(DOUBLE a, DOUBLE b, DOUBLE newVal) { m_twoParamsVal = newVal + a + b; return S_OK; } STDMETHODIMP CProperties::get_DefaultProperty(SHORT a, VARIANT_BOOL* pVal) { *pVal = m_defaultVal; return S_OK; } STDMETHODIMP CProperties::put_DefaultProperty(SHORT a, VARIANT_BOOL newVal) { m_defaultVal = newVal; return S_OK; }
[ "SND\\Sesh_cp@9b283d60-5439-405e-af05-b73fd8c4d996" ]
[ [ [ 1, 204 ] ] ]
854e0d7dc05daf43798174d988d5f5f749ec92d7
d3a2448eba5536e71cf9a18989acf5941c47a93d
/guests/dictionary.inc
db2d2b107cef2c33495b7632ad413f3ac4442be7
[]
no_license
wd5/virpl
f4ab905586fa696836c4dba3d2e8fd6b8b5714bc
64459a6072645b86e52c6fcfeb38435b07a6502a
refs/heads/master
2021-01-16T20:30:50.985970
2009-12-09T04:46:57
2009-12-09T04:46:57
null
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
59
inc
мудак падла гад fuck bitch сука fool
[ [ [ 1, 7 ] ] ]
57ed370e69a01aa53ff4179fbb9c98d69d6d2610
7745a8d148e55e22dca4955f7ca4e83199495c17
/test/test_driver.cpp
7fc4f7e47fe3b550baebe3c9b019b5a51bc48aaa
[]
no_license
yak1ex/packrat_qi
e6c8058e39a77d8f6c1559c292b52cdb14b8608f
423d08e48abf1c06fd5f2acd812295ec6e1b3d11
refs/heads/master
2020-06-05T02:57:45.157294
2011-06-28T17:24:46
2011-06-28T17:24:46
1,967,192
0
0
null
null
null
null
UTF-8
C++
false
false
118
cpp
#define BOOST_AUTO_TEST_MAIN #include <boost/test/included/unit_test.hpp> #include <boost/test/auto_unit_test.hpp>
[ [ [ 1, 3 ] ] ]
a7103bcf6a4b10e570cb8a1a38cb215ba06c6d46
a0bc9908be9d42d58af7a1a8f8398c2f7dcfa561
/SlonEngine/src/Script/Detail/ScriptManager.cpp
20058b1d1370fd79942b7c146432cba155aa6a7d
[]
no_license
BackupTheBerlios/slon
e0ca1137a84e8415798b5323bc7fd8f71fe1a9c6
dc10b00c8499b5b3966492e3d2260fa658fee2f3
refs/heads/master
2016-08-05T09:45:23.467442
2011-10-28T16:19:31
2011-10-28T16:19:31
39,895,039
0
0
null
null
null
null
UTF-8
C++
false
false
535
cpp
#include "stdafx.h" #include "Script/Detail/ScriptManager.h" #ifdef SLON_ENGINE_USE_PYTHON # include <Python.h> #endif namespace slon { namespace script { namespace detail { ScriptManager::ScriptManager() { #ifdef SLON_ENGINE_USE_PYTHON Py_Initialize(); #endif } ScriptManager::~ScriptManager() { #ifdef SLON_ENGINE_USE_PYTHON Py_Finalize(); #endif } void ScriptManager::exec(const char* scriptFile, const char* cmdLine) { } } // namespace detail } // namespace script } // namespace slon
[ "devnull@localhost" ]
[ [ [ 1, 31 ] ] ]
a94bdcacd74876201da90c2c517e3033083b8bf9
8a223ca4416c60f4ad302bc045a182af8b07c2a5
/Orders-ListeningFakeProblem-Cpp/Orders-Untouchable-Cpp/include/CactusClientImpl.h
efa5c44ac8e180f624fd49fdd8195d01fc03317c
[]
no_license
sinojelly/sinojelly
8a773afd0fcbae73b1552a217ed9cee68fc48624
ee40852647c6a474a7add8efb22eb763a3be12ff
refs/heads/master
2016-09-06T18:13:28.796998
2010-03-06T13:22:12
2010-03-06T13:22:12
33,052,404
0
0
null
null
null
null
UTF-8
C++
false
false
1,079
h
/// *************************************************************************** /// Copyright (c) 2009, Industrial Logic, Inc., All Rights Reserved. /// /// This code is the exclusive property of Industrial Logic, Inc. It may ONLY be /// used by students during Industrial Logic's workshops or by individuals /// who are being coached by Industrial Logic on a project. /// /// This code may NOT be copied or used for any other purpose without the prior /// written consent of Industrial Logic, Inc. /// **************************************************************************** #ifndef CACTUS_CLIENT_IMPL_H_ #define CACTUS_CLIENT_IMPL_H_ #include "Money.h" #include "CactusClient.h" #include <string> class CactusClientImpl : public CactusClient { public: virtual bool startSession(const std::string& merchantId); virtual void stopSession(); virtual bool hasSufficientFundsFor(const Money& totalAmount); virtual void process(const TransactionInfo& transaction); virtual void setHolderInfo(const HolderInfo& clientInfo); }; #endif
[ "chenguodong@localhost" ]
[ [ [ 1, 33 ] ] ]
168c4c59494123f55721aff61cbf2d09b277dc17
23b2ab84309de65b42333c87e0de088503e2cb36
/src/gui/classmgmtdlg.cpp
b8c36ce7d2b6bb1e1879840fda9ec8963b90fbdd
[]
no_license
fyrestone/simple-pms
74a771d83979690eac231a82f1c457d7b6c55f41
1917d5c4e14bf7829707bacb9cc2452b49d6cc2b
refs/heads/master
2021-01-10T20:36:39.403902
2011-04-16T15:38:12
2011-04-16T15:38:12
32,192,134
0
0
null
null
null
null
UTF-8
C++
false
false
975
cpp
#include "classmgmtdlg.h" #include "classmgmtdlg_p.h" #include "ui_classmgmtdlg.h" #include "studentmgmtframe.h" ClassMgmtDlgPrivate::ClassMgmtDlgPrivate(ClassMgmtDlg *parent, int gradeNum, int classNum) : task(DataEngine::Task::instance()), q(parent), gradeNum(gradeNum), classNum(classNum) { } void ClassMgmtDlgPrivate::initializeMember() { q->ui->tabWidget->addTab(new StudentMgmtFrame(gradeNum, classNum, q), tr("学生信息")); } void ClassMgmtDlgPrivate::connectSignalsAndSlots() { } void ClassMgmtDlgPrivate::completeConstruct() { } ClassMgmtDlg::ClassMgmtDlg(int gradeNum, int classNum, QWidget *parent) : QDialog(parent), ui(new Ui::ClassMgmtDlg), d(new ClassMgmtDlgPrivate(this, gradeNum, classNum)) { ui->setupUi(this); d->initializeMember(); d->connectSignalsAndSlots(); d->completeConstruct(); } ClassMgmtDlg::~ClassMgmtDlg() { delete ui; delete d; }
[ "[email protected]@95127988-2b6b-df20-625d-5ecc0e46e2bb" ]
[ [ [ 1, 45 ] ] ]
23db647b36dfd212fea90375f0535e6f41270383
25281ba3fc17716aaca69186a6f115e914c8ecf8
/src/layout.h
0a8425fd60507b4ae31b9a161e1fe60f3bb783b5
[]
no_license
rehno-lindeque/osi-glgui
97b2c6f771d2dd646e023366bcf05f7f68a5e2cc
0b9e939e17fdb62fd089985cb6e67ac7aa11d1e6
refs/heads/master
2020-03-30T20:12:48.683127
2011-01-29T09:57:45
2011-01-29T09:57:45
1,303,874
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
636
h
#ifndef __GLGUI_LAYOUT_H__ #define __GLGUI_LAYOUT_H__ ////////////////////////////////////////////////////////////////////////////// // // LAYOUT.H // // Copyright © 2007, Rehno Lindeque. All rights reserved. // ////////////////////////////////////////////////////////////////////////////// /* DOCUMENTATION */ /* DESCRIPTION: GLGUI layout class. */ namespace GLGUI { /* CLASSES */ class Layout : public Base::Object { public: OSobject frame; }; } #endif
[ [ [ 1, 26 ] ] ]
cea78242bfca4f99fd9e6e3a847e2a69643e4747
8fd82049c092a6b80f63f402aca243096eb7b3c8
/MFCMailClient/MFCMailClient/DAL.h
10aeba5635ad4c0382f27001df34ea92d21b5d14
[]
no_license
phucnh/laptrinhmang-k52
47965acb82750b600b543cc5c43d00f59ce5bc54
b27a8a02f9ec8bf953b617402dce37293413bb0f
refs/heads/master
2021-01-18T22:22:24.692192
2010-12-09T02:00:10
2010-12-09T02:00:10
32,262,504
0
0
null
null
null
null
UTF-8
C++
false
false
649
h
#pragma once // CDAL command target class CDAL : public CDatabase { private: HINSTANCE hInst; CString sCatID, sCategory; CString sDriver; CString sDsn; CString sFile; CString sExePath; CString sDbPath; TCHAR szFullPath[_MAX_PATH]; TCHAR szDir[_MAX_DIR]; TCHAR szDrive[_MAX_DRIVE]; public: CDAL(); virtual ~CDAL(); //CString ConnectionString() const { return _connectionString; } //void ConnectionString(CString val) { _connectionString = val; } CDatabase *pDb; CRecordset *pRecordSet; void Initialize(); BOOL ExecuteSQL(CString sql); CRecordset* GetRecordSet(CString sql); };
[ "danglv.hut@e1f3f65c-33eb-5b6a-8ef2-7789ca584060", "nguyenhongphuc.hut@e1f3f65c-33eb-5b6a-8ef2-7789ca584060" ]
[ [ [ 1, 1 ] ], [ [ 2, 39 ] ] ]
323c76a1fbaf72410003d5d032490da72db046be
ed6160a977f169c8bd60e8775703942b0d79f73a
/prog1/prog1.cpp
93b2d51bc38214c3792ba7088d7ce119976424a7
[]
no_license
johntalton/cs220redux
073c672ba4eb57fe649a98d2fdc329212b62325a
f0d08478875a6c9d4ef8a4e56d73f0b81d81d246
refs/heads/master
2021-06-21T07:56:26.817427
1998-05-20T02:59:00
2017-08-15T23:33:36
100,427,071
0
0
null
null
null
null
UTF-8
C++
false
false
6,732
cpp
// John Talton // CS220 Prog1.cpp #include <iostream.h> #include <fstream.h> #include <math.h> /*****************************************************/ #if defined(__MSDOS__) #endif #if defined(_WIN32) #endif #if !defined(__MSDOS__) && !defined(_WIN32) #error Can not compile - Incorect platform #endif /*****************************************************/ #define MaxTerms 100 class Polynomial; char compare(int a,int b); ostream& operator<<(ostream& os,Polynomial& p); ///////////////////////////////////////////////// /* Class Term: this class holds a term (coef)x^(exp) ///////////////////////////////////////////////*/ class term { friend Polynomial; private: float coef; int exp; }; ///////////////////////////////////////////////// /* Class Polynomial: this class is the constructor and destructor. also it contains all member function for mimipulation of polynomials public: Polynomial(); constructor ~Polynomial(); destructor void polyout(ostream& o); print out the polynomial int operator!(); if exits return 1 else 0 float Coef(int e); returns the coef of x^e int LeadExp(); returns the larges exponent Polynomial Add(Polynomial poly); adds a polynomial (poly) to this Polynomial Mult(Polynomial poly); multiplys polynomial (poly) to this float Eval(float f); evaluats this at f int PolyFromfile(); reads a polynomial for a file void NewTerm(float c,int e); creats new terms in the polynomial private: Polynomial TermMult(term t); multiplys this with a term (t) term termArray[MaxTerms]; holds the actuall polynomial int Terms; number of terms in the polynomial ///////////////////////////////////////////////*/ class Polynomial { public: Polynomial(); ~Polynomial(); void polyout(ostream& o); int operator!(); float Coef(int e); int LeadExp(); Polynomial Add(Polynomial poly); Polynomial Mult(Polynomial poly); float Eval(float f); int PolyFromfile(); void NewTerm(float c,int e); private: Polynomial TermMult(term t); term termArray[MaxTerms]; int Terms; }; Polynomial::Polynomial() { Terms = 0;} Polynomial::~Polynomial() { } void Polynomial::polyout(ostream& o) { int a = 0; if(Terms == 0) { o << '0'; return; } while(a < Terms) { if((termArray[a].coef == 1) && (termArray[a].exp != 0)) {} else { o << termArray[a].coef; } if(termArray[a].exp == 0) {} else { if(termArray[a].coef == 0) {} else { o << 'x'; if(termArray[a].exp == 1) {} else { o << '^'; o << termArray[a].exp; } } } if (a < Terms - 1) o << " + "; a++; } } int Polynomial::operator!() { int flag = 1; for(int i = 0; i < Terms; i++) if(termArray[i].coef != 0) flag = 0; return flag; } float Polynomial::Coef(int e) { int a = 0; while ((e != termArray[a].exp) && (a < Terms)) { a++; } if(a == Terms) { return 0; } return termArray[a].coef; } int Polynomial::LeadExp() { return termArray[0].exp; } Polynomial Polynomial::Add(Polynomial poly) { Polynomial C; int a = 0; int b = 0; float x; int termcount = 0; while ((a < Terms) && (b < poly.Terms)) { switch (compare(termArray[a].exp, poly.termArray[b].exp)) { case '=': x = termArray[a].coef + poly.termArray[b].coef; if (x) { C.NewTerm(x,termArray[a].exp); termcount++; } a++; b++; break; case '<': C.NewTerm(poly.termArray[b].coef,poly.termArray[b].exp); b++; termcount++; break; case '>': C.NewTerm(termArray[a].coef, termArray[a].exp); a++; termcount++; break; } } for(;a < Terms; a++) { C.NewTerm(termArray[a].coef, termArray[a].exp); termcount++; } for(;b < poly.Terms; b++) { C.NewTerm(poly.termArray[b].coef, poly.termArray[b].exp); termcount++; } C.Terms = termcount; return C; } Polynomial Polynomial::Mult(Polynomial poly) { int i = 0; Polynomial sum; while(i < poly.Terms) { //if((poly.termArray[i].coef == 0)) {} if(!poly) {} else { sum = sum.Add(TermMult(poly.termArray[i])); } i++; } return sum; } float Polynomial::Eval(float f) { float sum = 0; for(int i = 0; i < Terms; i++) { sum += (float)((pow(f,termArray[i].exp)) * termArray[i].coef); } return sum; } int Polynomial::PolyFromfile() { int num; int m; float n; static ifstream mystream("multiply.dat", ios::nocreate); if(!mystream) { cerr << "File not found\nAbort, Retry, Fail?"; return 0; } mystream >> num; if (!num) { mystream.close(); return 0; } Terms = num; for(int i = 0; i < num; i++) { mystream >> n; mystream >> m; termArray[i].coef = n; termArray[i].exp = m; } return 1; } void Polynomial::NewTerm(float c,int e) { if(Terms != MaxTerms) { termArray[Terms].coef = c; termArray[Terms].exp = e; Terms++; } else { cout << "An overflow error has occured at " << this << ": Too many terms: "; return; } } Polynomial Polynomial::TermMult(term t) { Polynomial p; int a; for(a = 0; a <= Terms; a++) { p.NewTerm(termArray[a].coef * t.coef,termArray[a].exp + t.exp); } p.Terms = Terms; return p; } char compare(int a,int b) { if (a == b) return '='; else if (a > b) return '>'; else return '<'; } ///////////////////////////////////////////////// /* overloads the output and prints the polynomial ///////////////////////////////////////////////*/ ostream& operator<< (ostream& os,Polynomial& p) { p.polyout(os); return os; } ///////////////////////////////////////////////// /* MAIN ///////////////////////////////////////////////*/ void main() { Polynomial X; Polynomial Y; while(X.PolyFromfile() && Y.PolyFromfile()) { cout << '(' << X << ") * (" << Y << ") = " << X.Mult(Y) << endl; } }
[ [ [ 1, 272 ] ], [ [ 273, 273 ] ] ]
533bf56056159fa9cc59e758782710fe2c5a32e5
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Physics/Collide/Agent/CompoundAgent/BvTree/hkpBvTreeAgent.h
b6ad25954155b95e1f96b6770b695c5b92ba5d8b
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
7,564
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_COLLIDE2_BV_TREE_SHAPE_AGENT_H #define HK_COLLIDE2_BV_TREE_SHAPE_AGENT_H #include <Physics/Collide/Agent/hkpCollisionAgent.h> #include <Common/Base/Types/Geometry/Aabb/hkAabb.h> #include <Physics/Collide/Shape/Compound/Collection/hkpShapeCollection.h> class hkpCollisionDispatcher; /// This agent deals with collisions between hkBvTreeShapes and other shapes. It traverses the bounding volume tree and dispatches /// collision agents for those child shapes that are found to be collision candidates with the other shape. /// It assumes that bodyB is the bvtree shape class hkpBvTreeAgent : public hkpCollisionAgent { public: /// Registers this agent with the collision dispatcher. static void HK_CALL registerAgent(hkpCollisionDispatcher* dispatcher); // hkpCollisionAgent interface implementation. virtual void getPenetrations( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpCdBodyPairCollector& collector ); // hkpCollisionAgent interface implementation. static void HK_CALL staticGetPenetrations( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpCdBodyPairCollector& collector ); // hkpCollisionAgent interface implementation. virtual void getClosestPoints( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpCdPointCollector& collector ) ; // hkpCollisionAgent interface implementation. static void HK_CALL staticGetClosestPoints( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpCdPointCollector& collector ) ; // hkpCollisionAgent interface implementation. virtual void linearCast( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpLinearCastCollisionInput& input, hkpCdPointCollector& collector, hkpCdPointCollector* startCollector ); // hkpCollisionAgent interface implementation. static void HK_CALL staticLinearCast( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpLinearCastCollisionInput& input, hkpCdPointCollector& collector, hkpCdPointCollector* startCollector ); // hkpCollisionAgent interface implementation. virtual void processCollision(const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpProcessCollisionInput& input, hkpProcessCollisionOutput& result); // hkpCollisionAgent interface implementation. virtual void cleanup(hkCollisionConstraintOwner& info); /// Aabb caching will skip queries to the hkpShapeCollection if the aabb's between the two colliding bodies has not changed /// You need to disable this if your hkpShapeCollection has changed, i.e. elements have been added or removed static void HK_CALL setUseAabbCaching( hkBool useIt ); /// Aabb caching will skip queries to the hkpShapeCollection if the aabb's between the two colliding bodies has not changed static hkBool HK_CALL getUseAabbCaching(); public: static hkBool m_useFastUpdate; virtual void updateShapeCollectionFilter( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkCollisionConstraintOwner& constraintOwner ); // hkpCollisionAgent interface implementation. virtual void invalidateTim( const hkpCollisionInput& input); // hkpCollisionAgent interface implementation. virtual void warpTime(hkTime oldTime, hkTime newTime, const hkpCollisionInput& input); HK_FORCE_INLINE static hkResult HK_CALL calcAabbAndQueryTree( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkTransform& bTa, const hkVector4& linearTimInfo, const hkpProcessCollisionInput& input, hkAabb* cachedAabb, hkArray<hkpShapeKey>& hitListOut ); public: /// Constructor, called by the agent creation function. hkpBvTreeAgent( hkpContactMgr* mgr ); protected: void calcContentStatistics( hkStatisticsCollector* collector, const hkClass* cls) const; static hkpCollisionAgent* HK_CALL defaultAgentCreate( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& env, hkpContactMgr* mgr ); // interal method void prepareCollisionPartners ( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkCollisionConstraintOwner& constraintOwner); HK_FORCE_INLINE void prepareCollisionPartnersProcess ( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpProcessCollisionInput& input, hkCollisionConstraintOwner& constraintOwner); //void prepareCollisionPartnersLinearCast( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpLinearCastCollisionInput& input, hkCollisionConstraintOwner& constraintOwner); static void HK_CALL calcAabbLinearCast(const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpLinearCastCollisionInput& input, hkAabb& aabbOut); static void HK_CALL staticCalcAabb(const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkAabb& aabbOut); ///Destructor, called by cleanup(). ~hkpBvTreeAgent(){} struct hkpBvAgentEntryInfo { HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_COLLIDE, hkpBvTreeAgent::hkpBvAgentEntryInfo ); hkpShapeKey m_key; hkInt32 m_userInfo; hkpCollisionAgent* m_collisionAgent; hkpShapeKey& getKey() { return m_key; } void setKey( hkpShapeKey& key) { m_key = key; } }; hkArray<hkpBvAgentEntryInfo> m_collisionPartners; hkAabb m_cachedAabb; /// you'll need to set this to false if you want changes to your ShapeCollection, which do not alter the aabb, to be reflected /// in the collision detection. static hkBool m_useAabbCaching; /// Agent creation function used by the hkpCollisionDispatcher. static hkpCollisionAgent* HK_CALL createShapeBvAgent( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpContactMgr* mgr ); /// Agent creation function used by the hkpCollisionDispatcher. static hkpCollisionAgent* HK_CALL createBvTreeShapeAgent( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpContactMgr* mgr ); /// Agent creation function used by the hkpCollisionDispatcher. static hkpCollisionAgent* HK_CALL createBvBvAgent( const hkpCdBody& bodyA, const hkpCdBody& bodyB, const hkpCollisionInput& input, hkpContactMgr* mgr ); }; #endif // HK_COLLIDE2_BV_TREE_SHAPE_AGENT_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
[ [ [ 1, 149 ] ] ]
64173f6c4938cd8cce8a66894f5ccab4200e92d0
eae3fc654f3a8063c819ee2844bba6b5cafba06f
/mybitmap.h
4e3e20d3c87a8d4e0e409deefe03d52bb038a37c
[]
no_license
DanielSkalski/majographix
f7c037448142465e1bd9483caf208c8bae371728
7ca30edd0b7eb138b342cb13cd39a84ed2a2280f
refs/heads/master
2021-01-10T17:58:11.874374
2010-03-10T14:06:00
2010-03-10T14:06:00
36,719,665
0
0
null
null
null
null
UTF-8
C++
false
false
1,338
h
#ifndef MYBITMAP_H #define MYBITMAP_H #include <QtGui/QWidget> #include <QtGui/QImage> #include <QtGui/QPaintEvent> #include <QtGui/QMouseEvent> #include "figure.h" #include "line.h" #include "circle.h" #include "bezier.h" #include "bspline.h" #include "triangle.h" class MyBitmap : public QWidget { Q_OBJECT public: QImage * bitmap; QImage * tempBitmap; MyBitmap(); void drawGradient(); protected: QPoint firstPoint; bool draw; bool drawMeLine; bool drawMeAALine; bool drawMeCircle; bool drawMeFullCircle; bool drawMeBezier; bool drawMeBspline; bool drawMeTriangle; bool drawMeGradTri; bool hand; bool grabbed; unsigned int grabbedFigure; unsigned int grabbedPoint; std::vector< Figure* > obiekty; void paintEvent( QPaintEvent * event ); void mouseMoveEvent ( QMouseEvent * event ); void mousePressEvent ( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); void false2all(); public slots: void setDrawLine(); void setDrawAALine(); void setDrawCircle(); void setDrawFullCircle(); void setDrawBezier(); void setDrawBspline(); void setDrawTriangle(); void setDrawGradTri(); void setHand(); }; #endif // MYBITMAP_H
[ [ [ 1, 62 ] ] ]
7c79af932fa3026331b118654fdac9985b224a38
463c3b62132d215e245a097a921859ecb498f723
/lib/dlib/entropy_decoder_model/entropy_decoder_model_kernel_6.h
4a4aaec4e13e1e4809ff307a2c0f2c3ea15b98c8
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
athulan/cppagent
58f078cee55b68c08297acdf04a5424c2308cfdc
9027ec4e32647e10c38276e12bcfed526a7e27dd
refs/heads/master
2021-01-18T23:34:34.691846
2009-05-05T00:19:54
2009-05-05T00:19:54
197,038
4
1
null
null
null
null
UTF-8
C++
false
false
3,815
h
// Copyright (C) 2005 Davis E. King ([email protected]) // License: Boost Software License See LICENSE.txt for the full license. #ifndef DLIB_ENTROPY_DECODER_MODEL_KERNEl_6_ #define DLIB_ENTROPY_DECODER_MODEL_KERNEl_6_ #include "../algs.h" #include "entropy_decoder_model_kernel_abstract.h" #include "../assert.h" namespace dlib { template < unsigned long alphabet_size, typename entropy_decoder > class entropy_decoder_model_kernel_6 { /*! INITIAL VALUE This object has no state CONVENTION &get_entropy_decoder() == coder This is an order-(-1) model. So it doesn't really do anything. Every symbol has the same probability. !*/ public: typedef entropy_decoder entropy_decoder_type; entropy_decoder_model_kernel_6 ( entropy_decoder& coder ); virtual ~entropy_decoder_model_kernel_6 ( ); inline void clear( ); inline void decode ( unsigned long& symbol ); entropy_decoder& get_entropy_decoder ( ) { return coder; } static unsigned long get_alphabet_size ( ) { return alphabet_size; } private: entropy_decoder& coder; // restricted functions entropy_decoder_model_kernel_6(entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>&); // copy constructor entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>& operator=(entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>&); // assignment operator }; // ---------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------- // member function definitions // ---------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------- template < unsigned long alphabet_size, typename entropy_decoder > entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>:: entropy_decoder_model_kernel_6 ( entropy_decoder& coder_ ) : coder(coder_) { COMPILE_TIME_ASSERT( 1 < alphabet_size && alphabet_size < 65535 ); } // ---------------------------------------------------------------------------------------- template < unsigned long alphabet_size, typename entropy_decoder > entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>:: ~entropy_decoder_model_kernel_6 ( ) { } // ---------------------------------------------------------------------------------------- template < unsigned long alphabet_size, typename entropy_decoder > void entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>:: clear( ) { } // ---------------------------------------------------------------------------------------- template < unsigned long alphabet_size, typename entropy_decoder > void entropy_decoder_model_kernel_6<alphabet_size,entropy_decoder>:: decode ( unsigned long& symbol ) { unsigned long target; target = coder.get_target(alphabet_size); coder.decode(target,target+1); symbol = target; } // ---------------------------------------------------------------------------------------- } #endif // DLIB_ENTROPY_DECODER_MODEL_KERNEl_6_
[ "jimmy@DGJ3X3B1.(none)" ]
[ [ [ 1, 131 ] ] ]
8ef0c777a2debc885dc78504e03a0aefb299d65c
4be39d7d266a00f543cf89bcf5af111344783205
/subprojects/CodeBlocksTest4/CodeBlocksTest4Main.cpp
b635e6b6dd9b32102179a11f3926381b1c7bde21
[]
no_license
nkzxw/lastigen-haustiere
6316bb56b9c065a52d7c7edb26131633423b162a
bdf6219725176ae811c1063dd2b79c2d51b4bb6a
refs/heads/master
2021-01-10T05:42:05.591510
2011-02-03T14:59:11
2011-02-03T14:59:11
47,530,529
1
0
null
null
null
null
UTF-8
C++
false
false
3,788
cpp
/*************************************************************** * Name: CodeBlocksTest4Main.cpp * Purpose: Code for Application Frame * Author: () * Created: 2009-09-18 * Copyright: () * License: **************************************************************/ #include "CodeBlocksTest4Main.h" #include <wx/msgdlg.h> //(*InternalHeaders(CodeBlocksTest4Dialog) #include <wx/settings.h> #include <wx/font.h> #include <wx/intl.h> #include <wx/string.h> //*) //helper functions enum wxbuildinfoformat { short_f, long_f }; wxString wxbuildinfo(wxbuildinfoformat format) { wxString wxbuild(wxVERSION_STRING); if (format == long_f ) { #if defined(__WXMSW__) wxbuild << _T("-Windows"); #elif defined(__UNIX__) wxbuild << _T("-Linux"); #endif #if wxUSE_UNICODE wxbuild << _T("-Unicode build"); #else wxbuild << _T("-ANSI build"); #endif // wxUSE_UNICODE } return wxbuild; } //(*IdInit(CodeBlocksTest4Dialog) const long CodeBlocksTest4Dialog::ID_STATICTEXT1 = wxNewId(); const long CodeBlocksTest4Dialog::ID_BUTTON1 = wxNewId(); const long CodeBlocksTest4Dialog::ID_STATICLINE1 = wxNewId(); const long CodeBlocksTest4Dialog::ID_BUTTON2 = wxNewId(); //*) BEGIN_EVENT_TABLE(CodeBlocksTest4Dialog,wxDialog) //(*EventTable(CodeBlocksTest4Dialog) //*) END_EVENT_TABLE() CodeBlocksTest4Dialog::CodeBlocksTest4Dialog(wxWindow* parent,wxWindowID id) { //(*Initialize(CodeBlocksTest4Dialog) Create(parent, id, _("wxWidgets app"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Welcome to\nwxWidgets"), wxDefaultPosition, wxSize(154,78), 0, _T("ID_STATICTEXT1")); wxFont StaticText1Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); if ( !StaticText1Font.Ok() ) StaticText1Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); StaticText1Font.SetPointSize(20); StaticText1->SetFont(StaticText1Font); BoxSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10); BoxSizer2 = new wxBoxSizer(wxVERTICAL); Button1 = new wxButton(this, ID_BUTTON1, _("About"), wxDefaultPosition, wxSize(100,23), 0, wxDefaultValidator, _T("ID_BUTTON1")); BoxSizer2->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4); StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1")); BoxSizer2->Add(StaticLine1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4); Button2 = new wxButton(this, ID_BUTTON2, _("Quit"), wxDefaultPosition, wxSize(100,23), 0, wxDefaultValidator, _T("ID_BUTTON2")); BoxSizer2->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4); BoxSizer1->Add(BoxSizer2, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4); BoxSizer1->Add(164,18,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); BoxSizer1->Fit(this); BoxSizer1->SetSizeHints(this); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CodeBlocksTest4Dialog::OnAbout); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CodeBlocksTest4Dialog::OnQuit); //*) } CodeBlocksTest4Dialog::~CodeBlocksTest4Dialog() { //(*Destroy(CodeBlocksTest4Dialog) //*) } void CodeBlocksTest4Dialog::OnQuit(wxCommandEvent& event) { Close(); } void CodeBlocksTest4Dialog::OnAbout(wxCommandEvent& event) { wxString msg = wxbuildinfo(long_f); wxMessageBox(msg, _("Welcome to...")); }
[ "fpelliccioni@c29dda52-a065-11de-a33f-1de61d9b9616" ]
[ [ [ 1, 102 ] ] ]
7365b9666c3af25c203ddbd9f608f3992bd732a1
3bfc30f7a07ce0f6eabcd526e39ba1030d84c1f3
/BlobbyWarriors/Source/BlobbyWarriors/Main.cpp
f9370ce073b4ec6ce0f60c740bddf2fda079d7ea
[]
no_license
visusnet/Blobby-Warriors
b0b70a0b4769b60d96424b55ad7c47b256e60061
adec63056786e4e8dfcb1ed7f7fe8b09ce05399d
refs/heads/master
2021-01-19T14:09:32.522480
2011-11-29T21:53:25
2011-11-29T21:53:25
2,850,563
0
0
null
null
null
null
UTF-8
C++
false
false
1,573
cpp
#include "Main.h" int main(int argc, char **argv) { new Main(argc, argv); return 0; } Main::Main(int argc, char **argv) { this->accumulator = 0; this->previousTicks = glutGet(GLUT_ELAPSED_TIME); this->simulator = 0; this->isLoading = false; KeyboardHandler::getInstance()->subscribe(this); this->graphicsEngine = GraphicsEngine::getInstance(); this->graphicsEngine->initialize(argc, argv); this->graphicsEngine->subscribe(this); this->graphicsEngine->start(); } void Main::update(Publisher *who, UpdateData *what) { KeyEventArgs *keyEventArgs = dynamic_cast<KeyEventArgs*>(what); if (keyEventArgs != 0) { this->handleKeyEvent(keyEventArgs); } if (this->simulator != 0) { int currentTicks = glutGet(GLUT_ELAPSED_TIME); int deltaTime = min(max(currentTicks - this->previousTicks, 0), 1000); this->accumulator += deltaTime / 1000.0f; float timeStep = 1.0f / 60.5f; while (this->accumulator > timeStep) { this->simulator->step(timeStep); this->accumulator -= timeStep; } Drawer::getInstance()->drawSimulation(); this->previousTicks = currentTicks; } else if (this->isLoading) { Drawer::getInstance()->drawLoadScreen(); } else { Drawer::getInstance()->drawMenu(); } } void Main::handleKeyEvent(KeyEventArgs *eventArgs) { if (this->simulator == 0) { this->isLoading = true; // TODO: Put this into another thread, so we can wait // until the simulator is initialized. this->simulator = new Simulator(new Level()); this->isLoading = false; } }
[ [ [ 1, 60 ] ] ]
4690cca329ca6069d06bef63cc1a37ef9d22ebbe
6bdb3508ed5a220c0d11193df174d8c215eb1fce
/Codes/Halak.Samples/String.cpp
277b5a8559e041194009ebbb48b1998d2bb118c5
[]
no_license
halak/halak-plusplus
d09ba78640c36c42c30343fb10572c37197cfa46
fea02a5ae52c09ff9da1a491059082a34191cd64
refs/heads/master
2020-07-14T09:57:49.519431
2011-07-09T14:48:07
2011-07-09T14:48:07
66,716,624
0
0
null
null
null
null
UTF-8
C++
false
false
624
cpp
#include <Halak.Samples/Samples.h> #include <Halak/String.h> #include <iostream> using Halak::String; void Halak::Samples::StringSample(const std::vector<const char*>& /*args*/) { String a; String b = ""; String c = "HelloWorld"; String d = a; String e = c; //c[2] = 'L'; //std::cout << e[2]; //c += e; std::cout << std::boolalpha; std::cout << c.Contains(String("elloW")) << std::endl; std::cout << c.ContainsIgnoreCase("ellowe") << std::endl; std::cout << c.EndsWithIgnoreCase("erld") << std::endl; String q = c + e; c.Insert(2, e); }
[ [ [ 1, 27 ] ] ]
1d4f6c7da68ff144b39b8805c794134cd6f6fc47
6dac9369d44799e368d866638433fbd17873dcf7
/src/branches/26042005/vfs/VFSPlugin_TXT.cpp
63dd3a2dcd25acadd89069956bac74786f09bba2
[]
no_license
christhomas/fusionengine
286b33f2c6a7df785398ffbe7eea1c367e512b8d
95422685027bb19986ba64c612049faa5899690e
refs/heads/master
2020-04-05T22:52:07.491706
2006-10-24T11:21:28
2006-10-24T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,663
cpp
#include <VFSPlugin_TXT.h> /** Function to build all the appropiate plugins associated with this file type * @ingroup VFSPlugin_TXT_Group * * @param f A pointer to the Fusion Core object, so if required, access to Fusion resources is possible * * @returns A pointer to the plugin created by calling this method * * It's worth noting that some File formats will require multiple filters to be applied to the data it holds. * A format could be a simple text file, but it could be encrypted, or compressed, or both * So filters to decrypt, decompress might be required to read the contents of the file correctly. */ VFSPlugin * CreateTextPlugin(Fusion *f) { static int counter = 0; if(counter == 0){ counter++; return new VFSPlugin_TXT(); } return NULL; } /** Text file format Plugin Constructor */ VFSPlugin_TXT::VFSPlugin_TXT() { m_type = "txt;text"; m_offset = 0; m_length = 0; m_fileinfo = NULL; m_buffer = NULL; } /** Text file format Plugin Deconstructor */ VFSPlugin_TXT::~VFSPlugin_TXT(){} /** Adds a Data filter * * @param filter The filter to add to the plugin * */ void VFSPlugin_TXT::AddFilter(VFSFilter *filter) { if(filter != NULL) m_filters.push_back(filter); } /** Retrieves a plugin Identifier * * @returns The plugin Identifier string */ char * VFSPlugin_TXT::Type(void) { return m_type; } /** Decodes the file contents into a structured format * * @param buffer A bytestream containing the files contents * @param length The length of the bytestream * * @returns A FileInfo structure containing the file's contents */ FileInfo * VFSPlugin_TXT::Read(unsigned char *buffer, unsigned int length) { unsigned int offset = 0; for(unsigned int a=0;a<m_filters.size();a++){ buffer = m_filters[a]->Decode(buffer,length); } while(offset < length){ // Chop the data into lines, store them in the file information block char *token = strtok((char *)&buffer[offset],"\n\0"); offset+=(unsigned int)strlen(token)+1; char *copy = new char[strlen(token)+1]; strcpy(copy,token); m_fileinfo = new TextFileInfo(); m_fileinfo->lines.push_back(copy); } delete[] buffer; return m_fileinfo; } /** Writes the contents of a FileInfo structure to a bytestream * * @param data A FileInfo structure containing the data to write to the bytestream * @param length The length of the bytestream created * * @returns A Bytestream containing the data to write to the file */ char * VFSPlugin_TXT::Write(FileInfo *data, unsigned int &length) { // Not Implemented length = 0; return NULL; }
[ "chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7" ]
[ [ [ 1, 101 ] ] ]
36790f76ae625c33e0b0e17fa8b39599c2767d36
555ce7f1e44349316e240485dca6f7cd4496ea9c
/DirectShowFilters/TsReader/source/MediaSeeking.cpp
44c3c0f12aa0727a7b875e90f0c1faf22f8a3b0e
[]
no_license
Yura80/MediaPortal-1
c71ce5abf68c70852d261bed300302718ae2e0f3
5aae402f5aa19c9c3091c6d4442b457916a89053
refs/heads/master
2021-04-15T09:01:37.267793
2011-11-25T20:02:53
2011-11-25T20:11:02
2,851,405
2
0
null
null
null
null
UTF-8
C++
false
false
6,123
cpp
#include <afx.h> #include <afxwin.h> #include <winsock2.h> #include <ws2tcpip.h> #include <streams.h> #include "mediaseeking.h" // For more details for memory leak detection see the alloctracing.h header #include "..\..\alloctracing.h" extern void LogDebug(const char *fmt, ...) ; // -- CMediaSeeking implementation ------------ CMediaSeeking::CMediaSeeking( const TCHAR * pName, LPUNKNOWN pUnk, HRESULT* phr, CCritSec * pLock) : CUnknown(pName, pUnk), m_pLock(pLock), m_rtStart((long)0) { m_rtStop = _I64_MAX / 2; m_rtDuration = m_rtStop; m_dRateSeeking = 1.0; m_dwSeekingCaps = AM_SEEKING_CanSeekForwards | AM_SEEKING_CanSeekBackwards | AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanGetStopPos | AM_SEEKING_CanGetDuration; } HRESULT CMediaSeeking::NonDelegatingQueryInterface(REFIID riid, void **ppv) { if(riid == IID_IMediaSeeking) { CheckPointer(ppv, E_POINTER); return GetInterface(static_cast<IMediaSeeking *>(this), ppv); } else { return CUnknown::NonDelegatingQueryInterface(riid, ppv); } } HRESULT CMediaSeeking::IsFormatSupported(const GUID * pFormat) { CheckPointer(pFormat, E_POINTER); // only seeking in time (REFERENCE_TIME units) is supported return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; } HRESULT CMediaSeeking::QueryPreferredFormat(GUID *pFormat) { CheckPointer(pFormat, E_POINTER); *pFormat = TIME_FORMAT_MEDIA_TIME; return S_OK; } HRESULT CMediaSeeking::SetTimeFormat(const GUID * pFormat) { CheckPointer(pFormat, E_POINTER); // nothing to set; just check that it's TIME_FORMAT_TIME return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : E_INVALIDARG; } HRESULT CMediaSeeking::IsUsingTimeFormat(const GUID * pFormat) { CheckPointer(pFormat, E_POINTER); return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; } HRESULT CMediaSeeking::GetTimeFormat(GUID *pFormat) { CheckPointer(pFormat, E_POINTER); *pFormat = TIME_FORMAT_MEDIA_TIME; return S_OK; } HRESULT CMediaSeeking::GetDuration(LONGLONG *pDuration) { CheckPointer(pDuration, E_POINTER); //CAutoLock lock(m_pLock); *pDuration = m_rtDuration; return S_OK; } HRESULT CMediaSeeking::GetStopPosition(LONGLONG *pStop) { CheckPointer(pStop, E_POINTER); //CAutoLock lock(m_pLock); *pStop = m_rtStop; return S_OK; } HRESULT CMediaSeeking::GetCurrentPosition(LONGLONG *pCurrent) { // GetCurrentPosition is typically supported only in renderers and // not in source filters. return E_NOTIMPL; } HRESULT CMediaSeeking::GetCapabilities( DWORD * pCapabilities ) { CheckPointer(pCapabilities, E_POINTER); *pCapabilities = m_dwSeekingCaps; return S_OK; } HRESULT CMediaSeeking::CheckCapabilities( DWORD * pCapabilities ) { CheckPointer(pCapabilities, E_POINTER); // make sure all requested capabilities are in our mask return (~m_dwSeekingCaps & *pCapabilities) ? S_FALSE : S_OK; } HRESULT CMediaSeeking::ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat ) { CheckPointer(pTarget, E_POINTER); // format guids can be null to indicate current format // since we only support TIME_FORMAT_MEDIA_TIME, we don't really // offer any conversions. if(pTargetFormat == 0 || *pTargetFormat == TIME_FORMAT_MEDIA_TIME) { if(pSourceFormat == 0 || *pSourceFormat == TIME_FORMAT_MEDIA_TIME) { *pTarget = Source; return S_OK; } } return E_INVALIDARG; } HRESULT CMediaSeeking::SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags , LONGLONG * pStop, DWORD StopFlags ) { LogDebug("CMediaSeeking::SetPositions"); DWORD StopPosBits = StopFlags & AM_SEEKING_PositioningBitsMask; DWORD StartPosBits = CurrentFlags & AM_SEEKING_PositioningBitsMask; if(StopFlags) { CheckPointer(pStop, E_POINTER); // accept only relative, incremental, or absolute positioning if(StopPosBits != StopFlags) { return E_INVALIDARG; } } if(CurrentFlags) { CheckPointer(pCurrent, E_POINTER); if(StartPosBits != AM_SEEKING_AbsolutePositioning && StartPosBits != AM_SEEKING_RelativePositioning) { return E_INVALIDARG; } } // scope for autolock { //CAutoLock lock(m_pLock); // set start position if(StartPosBits == AM_SEEKING_AbsolutePositioning) { m_rtStart = *pCurrent; } else if(StartPosBits == AM_SEEKING_RelativePositioning) { m_rtStart += *pCurrent; } // set stop position if(StopPosBits == AM_SEEKING_AbsolutePositioning) { m_rtStop = *pStop; } else if(StopPosBits == AM_SEEKING_IncrementalPositioning) { m_rtStop = m_rtStart + *pStop; } else if(StopPosBits == AM_SEEKING_RelativePositioning) { m_rtStop = m_rtStop + *pStop; } } HRESULT hr = S_OK; if(SUCCEEDED(hr) && StopPosBits) { hr = ChangeStop(); } if(StartPosBits) { hr = ChangeStart(); } return hr; } HRESULT CMediaSeeking::GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ) { if(pCurrent) { *pCurrent = m_rtStart; } if(pStop) { *pStop = m_rtStop; } return S_OK; } HRESULT CMediaSeeking::GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest ) { if(pEarliest) { *pEarliest = 0; } if(pLatest) { //CAutoLock lock(m_pLock); *pLatest = m_rtDuration; } return S_OK; } HRESULT CMediaSeeking::SetRate( double dRate) { { //CAutoLock lock(m_pLock); m_dRateSeeking = dRate; } return ChangeRate(); } HRESULT CMediaSeeking::GetRate( double * pdRate) { CheckPointer(pdRate, E_POINTER); //CAutoLock lock(m_pLock); *pdRate = m_dRateSeeking; return S_OK; } HRESULT CMediaSeeking::GetPreroll(LONGLONG *pPreroll) { CheckPointer(pPreroll, E_POINTER); *pPreroll = 0; return S_OK; }
[ [ [ 1, 3 ], [ 9, 11 ], [ 16, 22 ], [ 24, 26 ], [ 28, 32 ], [ 37, 45 ], [ 51, 53 ], [ 58, 60 ], [ 65, 65 ], [ 67, 68 ], [ 73, 74 ], [ 79, 81 ], [ 86, 89 ], [ 94, 97 ], [ 102, 104 ], [ 109, 111 ], [ 116, 116 ], [ 118, 119 ], [ 125, 126 ], [ 128, 132 ], [ 134, 135 ], [ 137, 138 ], [ 146, 147 ], [ 149, 151 ], [ 153, 156 ], [ 158, 158 ], [ 160, 166 ], [ 168, 169 ], [ 171, 173 ], [ 175, 176 ], [ 178, 182 ], [ 185, 188 ], [ 190, 192 ], [ 194, 198 ], [ 200, 209 ], [ 215, 223 ], [ 229, 238 ], [ 243, 247 ], [ 252, 255 ], [ 260, 262 ] ], [ [ 4, 5 ] ], [ [ 6, 8 ], [ 12, 15 ], [ 23, 23 ], [ 27, 27 ], [ 33, 36 ], [ 46, 50 ], [ 54, 57 ], [ 61, 64 ], [ 66, 66 ], [ 69, 72 ], [ 75, 78 ], [ 82, 85 ], [ 90, 93 ], [ 98, 101 ], [ 105, 108 ], [ 112, 115 ], [ 117, 117 ], [ 120, 124 ], [ 127, 127 ], [ 133, 133 ], [ 136, 136 ], [ 139, 145 ], [ 148, 148 ], [ 152, 152 ], [ 157, 157 ], [ 159, 159 ], [ 167, 167 ], [ 170, 170 ], [ 174, 174 ], [ 177, 177 ], [ 183, 184 ], [ 189, 189 ], [ 193, 193 ], [ 199, 199 ], [ 210, 214 ], [ 224, 228 ], [ 239, 242 ], [ 248, 251 ], [ 256, 259 ], [ 263, 263 ] ] ]
63dacf7263578f9a73ad50e3ec8894a0e7935817
00c36cc82b03bbf1af30606706891373d01b8dca
/OpenGUI/OpenGUI_TextureManager.cpp
f53c8a319f4812e8ea2a974d0d4be0df02f6e50e
[ "BSD-3-Clause" ]
permissive
VB6Hobbyst7/opengui
8fb84206b419399153e03223e59625757180702f
640be732a25129a1709873bd528866787476fa1a
refs/heads/master
2021-12-24T01:29:10.296596
2007-01-22T08:00:22
2007-01-22T08:00:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,627
cpp
// OpenGUI (http://opengui.sourceforge.net) // This source code is released under the BSD License // See LICENSE.TXT for details #include "OpenGUI_TextureManager.h" #include "OpenGUI_Renderer.h" #include "OpenGUI_Exception.h" #include "OpenGUI_LogSystem.h" namespace OpenGUI { //############################################################################ template<> TextureManager* Singleton<TextureManager>::mptr_Singleton = 0; //############################################################################ TextureManager& TextureManager::getSingleton( void ) { assert( mptr_Singleton ); return ( *mptr_Singleton ); } //############################################################################ TextureManager* TextureManager::getSingletonPtr( void ) { return mptr_Singleton; } //############################################################################ //############################################################################ //############################################################################ TextureManager::TextureManager( Renderer* renderer ) { LogManager::SlogMsg( "INIT", OGLL_INFO2 ) << "Creating TextureManager" << Log::endlog; mRenderer = renderer; mRTTavail = mRenderer->supportsRenderToTexture(); } //############################################################################ TextureManager::~TextureManager() { LogManager::SlogMsg( "SHUTDOWN", OGLL_INFO2 ) << "Destroying TextureManager" << Log::endlog; destroyAllTextures(); } //############################################################################ TexturePtr TextureManager::createTextureFromFile( const String& filename ) { LogManager::SlogMsg( "TextureManager", OGLL_INFO2 ) << "Create Texture from File: " << filename << Log::endlog; Texture* tex = mRenderer->createTextureFromFile( filename ); mTextureCPtrList.push_front( tex ); return TexturePtr( tex ); } //############################################################################ TexturePtr TextureManager::createTextureFromTextureData( const String& name, TextureData* textureData ) { LogManager::SlogMsg( "TextureManager", OGLL_INFO2 ) << "Create Texture from TextureData: " << name << " (" << ( size_t ) textureData << ")" << Log::endlog; Texture* tex = mRenderer->createTextureFromTextureData( textureData ); tex->_setName( name ); mTextureCPtrList.push_front( tex ); return TexturePtr( tex ); } //############################################################################ void TextureManager::updateTextureFromTextureData( TexturePtr texturePtr, TextureData* textureData ) { LogManager::SlogMsg( "TextureManager", OGLL_INFO2 ) << "Update Texture from TextureData: " << texturePtr->getName() << " (" << ( size_t ) textureData << ")" << Log::endlog; Texture* tex; tex = texturePtr.get(); mRenderer->updateTextureFromTextureData( tex, textureData ); } //############################################################################ void TextureManager::destroyTexture( Texture* texturePtr ) { LogManager::SlogMsg( "TextureManager", OGLL_INFO2 ) << "DestroyTexture: " << texturePtr->getName() << " " << texturePtr << Log::endlog; mTextureCPtrList.remove( texturePtr ); mRenderer->destroyTexture( texturePtr ); } //############################################################################ void TextureManager::destroyAllTextures() { LogManager::SlogMsg( "TextureManager", OGLL_INFO2 ) << "DestroyAllTextures..." << Log::endlog; Texture* tex; while ( mTextureCPtrList.size() > 0 ) { tex = mTextureCPtrList.front(); mTextureCPtrList.pop_front(); mRenderer->destroyTexture( tex ); } } //############################################################################ RenderTexturePtr TextureManager::createRenderTexture( const IVector2& size ) { if ( !mRTTavail ) OG_THROW( Exception::ERR_INTERNAL_ERROR, "Cannot create RenderTexture when Renderer does not support this feature", __FUNCTION__ ); RenderTexture* tex = mRenderer->createRenderTexture( size ); return RenderTexturePtr( tex ); } //############################################################################ void TextureManager::destroyRenderTexture( RenderTexture* texturePtr ) { if ( !mRTTavail ) OG_THROW( Exception::ERR_INTERNAL_ERROR, "Cannot destroy RenderTexture when Renderer does not support this feature", __FUNCTION__ ); mRenderer->destroyRenderTexture( texturePtr ); } //############################################################################ }//namespace OpenGUI{
[ "zeroskill@2828181b-9a0d-0410-a8fe-e25cbdd05f59" ]
[ [ [ 1, 94 ] ] ]
6149bfd4bf1ec06fdfa3115e1160105a00ca2449
d6a28d9d845a20463704afe8ebe644a241dc1a46
/tests/anti-aliasing.cpp
0be53e4883b630b4f643f00cd96d30a2cac5bf67
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-other-permissive", "Zlib" ]
permissive
marky0720/irrlicht-android
6932058563bf4150cd7090d1dc09466132df5448
86512d871eeb55dfaae2d2bf327299348cc5202c
refs/heads/master
2021-04-30T08:19:25.297407
2010-10-08T08:27:33
2010-10-08T08:27:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,635
cpp
#include "testUtils.h" using namespace irr; static bool testLineRendering(video::E_DRIVER_TYPE type) { SIrrlichtCreationParameters params; params.AntiAlias = 2; params.Bits = 16; params.WindowSize = core::dimension2d<u32>(160, 120); params.DriverType = type; IrrlichtDevice *device = createDeviceEx(params); if (!device) return true; // in case the driver type does not exist video::IVideoDriver* driver = device->getVideoDriver(); scene::ISceneManager* smgr = device->getSceneManager(); scene::IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2"); if (!mesh) { device->drop(); return false; } scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); if (node) { node->setMaterialFlag(video::EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture( 0, driver->getTexture("../media/sydney.bmp") ); } smgr->addCameraSceneNode(0, core::vector3df(0,30,-40), core::vector3df(0,5,0)); driver->beginScene(true, true, video::SColor(255,100,101,140)); smgr->drawAll(); driver->draw3DBox(node->getBoundingBox(), video::SColor(0,255,0,0)); driver->draw2DLine(core::position2di(10,10), core::position2di(100,100), video::SColor(255,0,0,0)); driver->endScene(); bool result = takeScreenshotAndCompareAgainstReference(driver, "-lineAntiAliasing.png", 99.5f ); device->closeDevice(); device->run(); device->drop(); return result; } bool antiAliasing() { bool result = testLineRendering(video::EDT_OPENGL); result &= testLineRendering(video::EDT_DIRECT3D9); return result; }
[ "hybrid@dfc29bdd-3216-0410-991c-e03cc46cb475" ]
[ [ [ 1, 57 ] ] ]
19c4a2158a8c3b9c02544a2fe53633d61ab7bf02
4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61
/CleanProject/Include/DebugText.h
9b0b90eecb10f52ac36e58e87c316236989daba5
[]
no_license
bahao247/apeengine2
56560dbf6d262364fbc0f9f96ba4231e5e4ed301
f2617b2a42bdf2907c6d56e334c0d027fb62062d
refs/heads/master
2021-01-10T14:04:02.319337
2009-08-26T08:23:33
2009-08-26T08:23:33
45,979,392
0
1
null
null
null
null
ISO-8859-10
C++
false
false
1,313
h
/*! @file @author Pablo Nuņez @date 13/2009 @module *//* This file is part of the Nebula Engine. Nebula Engine is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Nebula Engine 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Nebula Engine. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _DebugText_H #define _DebugText_H #include "EnginePrerequisites.h" namespace Nebula { using namespace Ogre; using namespace std; class DebugText { public: DebugText(SceneManager* sm,RenderWindow* window); ~DebugText(); void updateStats(Ogre::String text); void addText(String text); void printText(); void toggleFPSWindow(); protected: SceneManager* mSceneMgr; RenderWindow* mWindow; std::list<String>* mDebugLines; Overlay* mDebugOverlay; }; } //end namespace #endif
[ "pablosn@06488772-1f9a-11de-8b5c-13accb87f508" ]
[ [ [ 1, 56 ] ] ]
58804ea4c33072cef34af54b903a4fa5d347af21
08661334cb7b35999154e054d7c250bd971724a8
/Tess/tessnet2.cpp
c90ebc40f2c8d80628e30d0baa2060d2ca5e6a3a
[]
no_license
chanchai/botker
35728ccb0c6274738a40879cdb50d811362bb228
04dac18b7f653e5031fd58a7abd21331f0a93384
refs/heads/master
2021-01-10T13:31:42.400219
2008-09-04T15:46:17
2008-09-04T15:46:17
36,402,449
0
0
null
null
null
null
UTF-8
C++
false
false
15,370
cpp
/////////////////////////////////////////////////////////////////////// // File: tessnet2.cpp // Description: .NET Assembly for Tesseract. // Author: Remi THOMAS // Created: 21JUN08 // Version: 2.03.3 // // (C) Copyright 2008, Pixel Technology. // 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. // /////////////////////////////////////////////////////////////////////// // tessnet2.h : The assembly implementation // #include "stdafx.h" #include "tessnet2.h" #include "varable.h" #include "tordvars.h" #include "callcpp.h" #include "variables.h" #include "metrics.h" #include "chop.h" #include "djmenus.h" #include "tessinit.h" #include "mfvars.h" #include "tessedit.h" #include "tessvars.h" #include "baseline.h" #include "adaptmatch.h" #include "mfoutline.h" #include "normmatch.h" #include "intmatcher.h" #include "speckle.h" #include "permute.h" #include "baseapi.h" using namespace System::Runtime::InteropServices; extern ESHM_INFO shm; // Interesting API are protected, do a wrapper to have access to them class MyTessBaseAPI : public TessBaseAPI { public: void CopyImageToTesseract(const unsigned char* imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height) { TessBaseAPI::CopyImageToTesseract(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height); } void CopyBinaryRect(const unsigned char* imagedata, int bytes_per_line, int left, int top, int width, int height) { TessBaseAPI::CopyBinaryRect(imagedata, bytes_per_line, left, top, width, height); } void FindLines(BLOCK_LIST* block_list) { TessBaseAPI::FindLines(block_list); } PAGE_RES* Recognize(BLOCK_LIST* block_list, struct ETEXT_STRUCT* monitor) { return TessBaseAPI::Recognize(block_list, monitor); } char* TesseractToText(PAGE_RES* page_res) { return TessBaseAPI::TesseractToText(page_res); } }; tessnet2::Tesseract::Tesseract() { m_myTessBaseAPIInstance = NULL; m_pageRes = NULL; } tessnet2::Tesseract::~Tesseract() { Clear(); } int tessnet2::Tesseract::Init(String^ lang, bool numericMode) { Clear(); m_myTessBaseAPIInstance = new MyTessBaseAPI; // IntPtr _dataPath = Marshal::StringToHGlobalAnsi(dataPath); IntPtr _lang = Marshal::StringToHGlobalAnsi(lang); int result = m_myTessBaseAPIInstance->InitWithLanguage(NULL, NULL, (char *)_lang.ToPointer(), NULL, numericMode, 0, NULL); SetVariable("tessedit_write_ratings", true); //SetVariable("tessedit_zero_rejection", true); Marshal::FreeHGlobal(_lang); // Marshal::FreeHGlobal(_dataPath); return result; } void tessnet2::Tesseract::Clear () { page_image.destroy(); if (m_pageRes) delete m_pageRes; m_pageRes = NULL; if (m_myTessBaseAPIInstance) { m_myTessBaseAPIInstance->End(); delete m_myTessBaseAPIInstance; } m_myTessBaseAPIInstance = NULL; } bool tessnet2::Tesseract::SetVariable(String^ name, Object^ val) { IntPtr _name = Marshal::StringToHGlobalAnsi(name); char *__name = (char *)_name.ToPointer(); INT_VARIABLE_C_IT int_it(INT_VARIABLE::get_head()); BOOL_VARIABLE_C_IT bool_it(BOOL_VARIABLE::get_head()); STRING_VARIABLE_C_IT str_it(STRING_VARIABLE::get_head()); double_VARIABLE_C_IT dbl_it(double_VARIABLE::get_head()); bool bFound = false; for (int_it.mark_cycle_pt(); !int_it.cycled_list(); int_it.forward()) { if (!strcmp(int_it.data()->name_str(), __name)) { int_it.data()->set_value(Convert::ToInt32(val)); bFound=true; break; } } if (!bFound) { for (bool_it.mark_cycle_pt(); !bool_it.cycled_list(); bool_it.forward()) { if (!strcmp(bool_it.data()->name_str(), __name)) { bool_it.data()->set_value(Convert::ToByte(val)); bFound=true; break; } } } if (!bFound) { for (str_it.mark_cycle_pt(); !str_it.cycled_list(); str_it.forward()) { if (!strcmp(str_it.data()->name_str(), __name)) { IntPtr _val = Marshal::StringToHGlobalAnsi(val->ToString()); str_it.data()->set_value(STRING((const char *)_val.ToPointer())); Marshal::FreeHGlobal(_val); bFound=true; break; } } } if (!bFound) { for (dbl_it.mark_cycle_pt(); !dbl_it.cycled_list(); dbl_it.forward()) { if (!strcmp(dbl_it.data()->name_str(), __name)) { dbl_it.data()->set_value(Convert::ToDouble(val)); bFound=true; break; } } } Marshal::FreeHGlobal(_name); return bFound; } Object^ tessnet2::Tesseract::GetVariable (String^ name) { Object^ result = nullptr; IntPtr _name = Marshal::StringToHGlobalAnsi(name); char *__name = (char *)_name.ToPointer(); INT_VARIABLE_C_IT int_it(INT_VARIABLE::get_head()); BOOL_VARIABLE_C_IT bool_it(BOOL_VARIABLE::get_head()); STRING_VARIABLE_C_IT str_it(STRING_VARIABLE::get_head()); double_VARIABLE_C_IT dbl_it(double_VARIABLE::get_head()); for (int_it.mark_cycle_pt(); !int_it.cycled_list(); int_it.forward()) { if (!strcmp(int_it.data()->name_str(), __name)) { int tmp = *int_it.data(); result = tmp; break; } } if (result==nullptr) { for (bool_it.mark_cycle_pt(); !bool_it.cycled_list(); bool_it.forward()) { if (!strcmp(bool_it.data()->name_str(), __name)) { System::Byte tmp = *bool_it.data(); result = tmp; break; } } } if (result==nullptr) { for (str_it.mark_cycle_pt(); !str_it.cycled_list(); str_it.forward()) { if (!strcmp(str_it.data()->name_str(), __name)) { STRING tmp = *str_it.data(); result = gcnew String(tmp.string()); break; } } } if (result==nullptr) { for (dbl_it.mark_cycle_pt(); !dbl_it.cycled_list(); dbl_it.forward()) { if (!strcmp(dbl_it.data()->name_str(), __name)) { double tmp = *dbl_it.data(); result = tmp; break; } } } Marshal::FreeHGlobal(_name); return result; } Dictionary<String ^, Type^>^ tessnet2::Tesseract::GetVariableList() { Dictionary<String ^, Type^>^ result = gcnew Dictionary<String ^, Type^>(); INT_VARIABLE_C_IT int_it(INT_VARIABLE::get_head()); BOOL_VARIABLE_C_IT bool_it(BOOL_VARIABLE::get_head()); STRING_VARIABLE_C_IT str_it(STRING_VARIABLE::get_head()); double_VARIABLE_C_IT dbl_it(double_VARIABLE::get_head()); for (int_it.mark_cycle_pt(); !int_it.cycled_list(); int_it.forward()) result->Add(gcnew String(int_it.data()->name_str()), System::Int32::typeid); for (bool_it.mark_cycle_pt(); !bool_it.cycled_list(); bool_it.forward()) result->Add(gcnew String(bool_it.data()->name_str()), System::Byte::typeid); for (str_it.mark_cycle_pt(); !str_it.cycled_list(); str_it.forward()) result->Add(gcnew String(str_it.data()->name_str()), System::String::typeid); for (dbl_it.mark_cycle_pt(); !dbl_it.cycled_list(); dbl_it.forward()) result->Add(gcnew String(dbl_it.data()->name_str()), System::Double::typeid); return result; } List<tessnet2::Word ^>^ tessnet2::Tesseract::DoOCR(System::Drawing::Bitmap^ bitmap, System::Drawing::Rectangle rect) { init_metrics(); set_tess_tweak_vars(); init_baseline(); init_bestfirst_vars(); init_splitter_vars(); init_associate_vars(); init_chop(); init_textord_vars(); init_permute_vars(); // init_dj_debug(); InitAdaptiveClassifierVars(); InitMFOutlineVars(); InitNormProtoVars(); InitIntProtoVars(); InitIntegerMatcherVars(); InitSpeckleVars(); InitStopperVars(); program_variables(); mfeature_variables(); program_init(); mfeature_init(); init_permute(); // setup_cp_maps(); List<Word ^>^ result=nullptr; // If empty rectangle then full page if (rect == System::Drawing::Rectangle::Empty) rect = System::Drawing::Rectangle(0, 0, bitmap->Width, bitmap->Height); System::Drawing::Bitmap^ tmp = bitmap; // Image with tranparency are transformed in 24bpp (Julien Benoit) if (Image::IsAlphaPixelFormat(bitmap->PixelFormat)) { tmp = gcnew System::Drawing::Bitmap(bitmap->Width, bitmap->Height, Imaging::PixelFormat::Format24bppRgb); tmp->SetResolution(bitmap->HorizontalResolution, bitmap->VerticalResolution); System::Drawing::Graphics^ gr = System::Drawing::Graphics::FromImage(tmp); gr->DrawImageUnscaled(bitmap, 0, 0); delete gr; } int bpp=-1; if (tmp->PixelFormat == Imaging::PixelFormat::Format1bppIndexed) bpp = 0; else if (tmp->PixelFormat == Imaging::PixelFormat::Format8bppIndexed) bpp = 1; else if (tmp->PixelFormat == Imaging::PixelFormat::Format24bppRgb) bpp = 3; if (bpp>-1) { // Copy image and do threshold, using only the interessting part of the image Imaging::BitmapData ^data = tmp->LockBits(rect, Imaging::ImageLockMode::ReadOnly, tmp->PixelFormat); if (bpp==0) m_myTessBaseAPIInstance->CopyBinaryRect((BYTE *)data->Scan0.ToPointer(), data->Stride, 0, 0, rect.Width, rect.Height); else // Convert image to 1 bit format doing threshold m_myTessBaseAPIInstance->CopyImageToTesseract((BYTE *)data->Scan0.ToPointer(), bpp, data->Stride, 0, 0, rect.Width, rect.Height); tmp->UnlockBits(data); shm.shm_size = sizeof (ETEXT_DESC)+32000L*sizeof (EANYCODE_CHAR); shm.shm_mem = new BYTE[shm.shm_size]; ZeroMemory(shm.shm_mem, shm.shm_size); m_monitor = ocr_setup_monitor(); // Now run the main recognition. if (OcrDone==nullptr) { doOCR(); result = BuildPage(); free_variables(); } else { m_callbackThread = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(this, &tessnet2::Tesseract::doCallback)); m_callbackThread->Start(); } } // Release tmp bitmap only if created here if (tmp!=bitmap) delete tmp; return result; } void tessnet2::Tesseract::doOCR() { BLOCK_LIST block_list; m_myTessBaseAPIInstance->FindLines(&block_list); m_pageRes = m_myTessBaseAPIInstance->Recognize(&block_list, m_monitor); PAGE_RES_IT res_it(m_pageRes); /* for (res_it.restart_page(); res_it.word () != NULL; res_it.forward()) { WERD_RES *word = res_it.word(); WERD_CHOICE* choice = word->best_choice; String^ tmp = gcnew String(choice->string().string()); Console::WriteLine("{0}:{1}:{2}", tmp, 100 + 5*choice->certainty(), choice->rating()); } */ //char *text = m_myTessBaseAPIInstance->TesseractToText(page_res); delete[] shm.shm_mem; } void tessnet2::Tesseract::doCallback() { m_ocrThread = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(this, &tessnet2::Tesseract::doOCR)); m_ocrThread->Priority = System::Threading::ThreadPriority::BelowNormal; m_ocrThread->Start(); while (!m_ocrThread->Join(100)) ProgressEvent(m_monitor->progress); OcrDone(BuildPage()); free_variables(); } List<tessnet2::Word^>^ tessnet2::Tesseract::BuildPage() { List<Word ^>^ result = gcnew List<Word ^>(); Word^ currentWord = nullptr; int j=0; int lineIndex=0; char unistr[8] = {}; int confidenceTotal; int confidenceCount; for (int i=0; i<m_monitor->count; i=j) { EANYCODE_CHAR* ch = &m_monitor->text[i]; if (currentWord==nullptr || ch->blanks>0 || (currentWord!=nullptr && (ch->left<currentWord->Left))) { if (currentWord!=nullptr && ch->left<currentWord->Left) lineIndex++; currentWord = gcnew Word(); currentWord->CharList = gcnew List<Character ^>(); confidenceTotal = 0; confidenceCount = 0; currentWord->LineIndex = lineIndex; currentWord->Blanks = ch->blanks; currentWord->Left = ch->left; currentWord->Top = ch->top; currentWord->Right = ch->right; currentWord->Bottom = ch->bottom; for (j = i; j < m_monitor->count; j++) { EANYCODE_CHAR* unich = &m_monitor->text[j]; if (ch->left != unich->left || ch->right != unich->right || ch->top != unich->top || ch->bottom != unich->bottom) break; unistr[j - i] = static_cast<unsigned char>(unich->char_code); // confidenceTotal += (int)((-unich->confidence*0.035)*5.0+100); confidenceTotal += unich->confidence; // Every characters of a word have the same value, useless but I leave it confidenceCount++; } unistr[j - i] = 0; String^ tmp = gcnew String(unistr, 0, j-i, System::Text::Encoding::UTF8); currentWord->CharList->Add(gcnew Character(tmp[0], ch->left, ch->top, ch->right, ch->bottom)); currentWord->Text = tmp; currentWord->Confidence = (Double)confidenceTotal / (Double)confidenceCount; currentWord->FontIndex = ch->font_index; currentWord->PointSize = ch->point_size; currentWord->Formating = ch->formatting; result->Add(currentWord); } else { if (currentWord!=nullptr) { for (j = i; j < m_monitor->count; j++) { EANYCODE_CHAR* unich = &m_monitor->text[j]; if (ch->left != unich->left || ch->right != unich->right || ch->top != unich->top || ch->bottom != unich->bottom) break; unistr[j - i] = static_cast<unsigned char>(unich->char_code); // confidenceTotal += (int)((-unich->confidence*0.035)*5.0+100); confidenceTotal += unich->confidence; // Every characters of a word have the same value, useless but I leave it confidenceCount++; } unistr[j - i] = 0; String^ tmp = gcnew String(unistr, 0, j-i, System::Text::Encoding::UTF8); currentWord->CharList->Add(gcnew Character(tmp[0], ch->left, ch->top, ch->right, ch->bottom)); currentWord->Text += tmp; currentWord->Confidence = (Double)confidenceTotal / (Double)confidenceCount; currentWord->Left = Math::Min(currentWord->Left, (int)ch->left); currentWord->Top = Math::Min(currentWord->Top, (int)ch->top); currentWord->Right = Math::Max(currentWord->Right, (int)ch->right); currentWord->Bottom = Math::Max(currentWord->Bottom, (int)ch->bottom); } else j++; } } return result; } int tessnet2::Tesseract::LineCount (List<Word ^>^ words) { Dictionary<int, int>^ lines = gcnew Dictionary<int, int>(); for each (Word^ word in words) { if (!lines->ContainsKey(word->LineIndex)) lines->Add(word->LineIndex, 1); } return lines->Count; } List<tessnet2::Word ^>^ tessnet2::Tesseract::GetLineWords(List<tessnet2::Word ^>^ words, int lineIndex) { List<Word ^>^ result = gcnew List<Word ^>(); for each (Word^ word in words) { if (word->LineIndex==lineIndex) result->Add(word); } return result; } String^ tessnet2::Tesseract::GetLineText (List<tessnet2::Word ^>^ words, int lineIndex) { List<Word ^>^ line = GetLineWords(words, lineIndex); System::Text::StringBuilder^ sb = gcnew System::Text::StringBuilder(); String^ sep = String::Empty; for each (Word^ word in line) { sb->Append(sep); sb->Append(word->Text); sep = " "; } return sb->ToString(); }
[ [ [ 1, 509 ] ] ]
b630c540af256896352e958e46cf1fc55f70c8c5
d411188fd286604be7670b61a3c4c373345f1013
/zomgame/ZGame/attribute_factory.cpp
e32dc7480debccad2d1496bf5ab47d0a82dbd099
[]
no_license
kjchiu/zomgame
5af3e45caea6128e6ac41a7e3774584e0ca7a10f
1f62e569da4c01ecab21a709a4a3f335dff18f74
refs/heads/master
2021-01-13T13:16:58.843499
2008-09-13T05:11:16
2008-09-13T05:11:16
1,560,000
0
1
null
null
null
null
UTF-8
C++
false
false
657
cpp
#include "attribute_factory.h" Attribute* AttributeFactory::getStrength() { return new Attribute("Strength", STRENGTH, 10, 10); } Attribute* AttributeFactory::getHealth() { return AttributeFactory::getHealth(10); } Attribute* AttributeFactory::getHealth(int health) { return new Attribute("Health", HEALTH, health, health); } Attribute* AttributeFactory::getStamina() { return new Attribute("Stamina", STAMINA, 1000, 1000); } Attribute* AttributeFactory::getHunger() { return new Attribute("Hunger", HUNGER, 1000, 1000); } Attribute* AttributeFactory::getThirst() { return new Attribute("Thirst", THIRST, 1000, 1000); }
[ "krypes@9b66597e-bb4a-0410-bce4-15c857dd0990", "nicholasbale@9b66597e-bb4a-0410-bce4-15c857dd0990" ]
[ [ [ 1, 4 ], [ 6, 16 ], [ 26, 26 ] ], [ [ 5, 5 ], [ 17, 25 ] ] ]
b03bcdde804152358aaef2be3ae3645d41aabaf7
fac8de123987842827a68da1b580f1361926ab67
/inc/physics/Physics/Dynamics/World/Util/hkpNullAction.h
bd1f390ac3d5680f1de5b82cbb5a6eabbac982a5
[]
no_license
blockspacer/transporter-game
23496e1651b3c19f6727712a5652f8e49c45c076
083ae2ee48fcab2c7d8a68670a71be4d09954428
refs/heads/master
2021-05-31T04:06:07.101459
2009-02-19T20:59:59
2009-02-19T20:59:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,415
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_DYNAMICS2_NULL_ACTION_H #define HK_DYNAMICS2_NULL_ACTION_H #include <Common/Base/hkBase.h> #include <Common/Base/Types/Physics/hkStepInfo.h> #include <Physics/Dynamics/Entity/hkpEntityListener.h> #include <Physics/Dynamics/Action/hkpAction.h> //#include <hkdynamics/action/hkNullActionCinfo.h> class hkpEntity; class hkpPhantom; class hkpSimulationIsland; class hkStepInfo; class hkpWorld; /// This is the base class from which user actions (or controllers) are derived. Actions /// are the interface between user controllable behavior of the physical simulation and the Havok core. class hkpNullAction : public hkpAction { public: HK_DECLARE_CLASS_ALLOCATOR(HK_MEMORY_CLASS_ACTION); inline hkpNullAction() : hkpAction(0) {} virtual void applyAction( const hkStepInfo& stepInfo ) {} virtual void getEntities( hkArray<hkpEntity*>& entitiesOut ) {} virtual void entityRemovedCallback(hkpEntity* entity) {} virtual hkpAction* clone( const hkArray<hkpEntity*>& entitiesIn, const hkArray<hkpPhantom*>& newPhantoms ) const { return HK_NULL; } static inline hkpNullAction* HK_CALL getNullAction(){ return HK_NULL; } }; #endif // HK_DYNAMICS2_NULL_ACTION_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529) * * Confidential Information of Havok. (C) Copyright 1999-2008 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at * www.havok.com/tryhavok * */
[ "uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4" ]
[ [ [ 1, 63 ] ] ]
7afea328e6a9d590f2267d114993ea7bd9fed7e7
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Distance/Wm4DistRay2Segment2.h
6fc55586404ebd02ea039079807a421de9bf0b53
[]
no_license
daleaddink/flagship3d
4835c223fe1b6429c12e325770c14679c42ae3c6
6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a
refs/heads/master
2021-01-15T16:29:12.196094
2009-11-01T10:18:11
2009-11-01T10:18:11
37,734,654
1
0
null
null
null
null
UTF-8
C++
false
false
1,632
h
// Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // The Wild Magic Version 4 Foundation Library source code is supplied // under the terms of the license agreement // http://www.geometrictools.com/License/Wm4FoundationLicense.pdf // and may not be copied or disclosed except in accordance with the terms // of that agreement. #ifndef WM4DISTRAY2SEGMENT2_H #define WM4DISTRAY2SEGMENT2_H #include "Wm4FoundationLIB.h" #include "Wm4Distance.h" #include "Wm4Ray2.h" #include "Wm4Segment2.h" namespace Wm4 { template <class Real> class WM4_FOUNDATION_ITEM DistRay2Segment2 : public Distance<Real,Vector2<Real> > { public: DistRay2Segment2 (const Ray2<Real>& rkRay, const Segment2<Real>& rkSegment); // object access const Ray2<Real>& GetRay () const; const Segment2<Real>& GetSegment () const; // static distance queries virtual Real Get (); virtual Real GetSquared (); // function calculations for dynamic distance queries virtual Real Get (Real fT, const Vector2<Real>& rkVelocity0, const Vector2<Real>& rkVelocity1); virtual Real GetSquared (Real fT, const Vector2<Real>& rkVelocity0, const Vector2<Real>& rkVelocity1); private: using Distance<Real,Vector2<Real> >::m_kClosestPoint0; using Distance<Real,Vector2<Real> >::m_kClosestPoint1; const Ray2<Real>& m_rkRay; const Segment2<Real>& m_rkSegment; }; typedef DistRay2Segment2<float> DistRay2Segment2f; typedef DistRay2Segment2<double> DistRay2Segment2d; } #endif
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 57 ] ] ]
06feff2f053b110c4c6c8ea79c2637ad47d784d2
62874cd4e97b2cfa74f4e507b798f6d5c7022d81
/buildenv/templates/SingletonName.cpp
74bde5a223cbc478126bbab965805b743bf98f1a
[]
no_license
rjaramih/midi-me
6a4047e5f390a5ec851cbdc1b7495b7fe80a4158
6dd6a1a0111645199871f9951f841e74de0fe438
refs/heads/master
2021-03-12T21:31:17.689628
2011-07-31T22:42:05
2011-07-31T22:42:05
36,944,802
0
0
null
null
null
null
UTF-8
C++
false
false
695
cpp
// Includes #include "ClassName.h" using namespace MidiMe; /*! Get the instance of this singleton class. You need to use this function to access the class, as the constructor is private. */ ClassName &ClassName::getInstance() { static ClassName instance; return instance; } /****************************** * Constructors and destructor * ******************************/ ClassName::ClassName() { } ClassName::~ClassName() { } /************************ * Get and set functions * ************************/ /****************** * Other functions * ******************/ /********************** * Protected functions * **********************/
[ "Jeroen.Dierckx@d8a2fbcc-2753-0410-82a0-8bc2cd85795f" ]
[ [ [ 1, 43 ] ] ]
2cf811ae9ea495c13780e64d3fdf20e977f04bd8
9eb4d50f6f499d091c036b5745dd17173693b8bf
/src/wii/common/wii_filesystem.cpp
65443e91b0bb79f263bd38894aa97dee5dca1fd4
[]
no_license
MathewWi/wiirtual-boy
53efab60de238134c43e00502186c1cfe39245ec
4f4a2b75a721e42e036a91956ca32a549ec0a8ff
refs/heads/master
2021-01-01T17:00:37.708274
2011-06-27T15:22:53
2011-06-27T15:22:53
32,204,974
1
1
null
null
null
null
UTF-8
C++
false
false
1,606
cpp
//Stolen from http://code.google.com/p/dop-mii #include <cstdio> #include <cstdarg> #include <string.h> #include <malloc.h> #include <sys/dir.h> #include <unistd.h> #include <sdcard/wiisd_io.h> #include <fat.h> #include <ogcsys.h> #include "wii_usbstorage.h" #include "wii_filesystem.h" #define CACHE 32 #define SECTORS 64 #define SECTORS_SD 32 namespace IO { void SD::Unmount() { fatUnmount("sd:/"); __io_wiisd.shutdown(); } bool SD::Mount() { SD::Unmount(); return fatMountSimple("sd", &__io_wiisd); } bool USB::isMounted = false; void USB::Unmount() { fatUnmount("usb:/"); isMounted = false; } bool USB::Mount() { if (isMounted) return true; //gprintf("Mounting USB Drive \n"); USB::Unmount(); // To Hopefully Wake Up The Drive fatMountSimple("usb", &__io_usbstorage); bool isInserted = __io_usbstorage.isInserted(); //gprintf("USB::IsInserted = %d\n", isInserted); if (!isInserted) return false; // USB Drive may be "sleeeeping". // We need to try Mounting a few times to wake it up int retry = 10; while (retry) { isMounted = fatMountSimple("usb", &__io_usbstorage); if (isMounted) break; sleep(1); retry--; } //if (isMounted) gprintf("USB Drive Is Mounted\n"); return isMounted; } void USB::Startup() { USB::Unmount(); // To Hopefully Wake Up The Drive isMounted = fatMountSimple("usb", &__io_usbstorage); } void USB::Shutdown() { if (!isMounted) return; fatUnmount("usb:/"); isMounted = false; } }
[ "[email protected]@00a74ce0-9458-8d50-ee98-3d1c5c732d48" ]
[ [ [ 1, 83 ] ] ]
f00f8d21f6d9bcba200e607cbb38a8f68da35283
ef23e388061a637f82b815d32f7af8cb60c5bb1f
/src/mame/includes/deadang.h
a57c22931d0c66f1d7549dc2e7e4f832921e226b
[]
no_license
marcellodash/psmame
76fd877a210d50d34f23e50d338e65a17deff066
09f52313bd3b06311b910ed67a0e7c70c2dd2535
refs/heads/master
2021-05-29T23:57:23.333706
2011-06-23T20:11:22
2011-06-23T20:11:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
672
h
class deadang_state : public driver_device { public: deadang_state(running_machine &machine, const driver_device_config_base &config) : driver_device(machine, config) { } UINT16 *m_videoram; UINT16 *m_video_data; UINT16 *m_scroll_ram; tilemap_t *m_pf3_layer; tilemap_t *m_pf2_layer; tilemap_t *m_pf1_layer; tilemap_t *m_text_layer; int m_deadangle_tilebank; int m_deadangle_oldtilebank; UINT16 *m_spriteram; }; /*----------- defined in video/deadang.c -----------*/ WRITE16_HANDLER( deadang_foreground_w ); WRITE16_HANDLER( deadang_text_w ); WRITE16_HANDLER( deadang_bank_w ); VIDEO_START( deadang ); SCREEN_UPDATE( deadang );
[ "Mike@localhost" ]
[ [ [ 1, 27 ] ] ]
ad69297f940897942ccdaf02468049c363f70c66
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/devicesrv/SysLibs/ecom/TestPlugin/Src/TestEComInterface1.cpp
77d2aa58dbd755663721c535390f6e1dab495366
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
1,892
cpp
/* * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ #include "TestEComInterface1.h" CTestEComInterface1* CTestEComInterface1::NewL() // Intended Usage : Safe construction which leaves nothing upon the cleanup stack // Error Condition : Will leave with an appropriate error code // Dependencies : CBase // @param " " // @return CTestEComInterface1* a pointer to the fully instantiated CTestEComInterface1 object // @pre None // @post The object has been fully instantiated // Static member { CTestEComInterface1* self=new(ELeave) CTestEComInterface1(); // calls constructor CleanupStack::PushL(self); // Make the construction safe by using the cleanup stack self->ConstructL(); // Complete the 'construction'. CleanupStack::Pop(self); return self; } CTestEComInterface1::~CTestEComInterface1() // Default virtual d'tor { } CTestEComInterface1::CTestEComInterface1() : CTestEComInterface() , iDoMethodL1Calls(0) { } void CTestEComInterface1::ConstructL() // Intended Usage : Safely complete the initialization of the constructed object // Error Condition : Will leave with an appropriate error code // Dependencies : CBase // @return void // @pre CTestEComInterface1 has been constructed // @post The CTestEComInterface1 object has been fully instantiated // { } void CTestEComInterface1::DoMethod1L() { ++iDoMethodL1Calls; } TInt CTestEComInterface1::DoMethod2L() { return iDoMethodL1Calls; }
[ "none@none" ]
[ [ [ 1, 68 ] ] ]
ff49202747154eee89800bbfa67a1342bf0ab8ee
203f8465075e098f69912a6bbfa3498c36ce2a60
/motion_planning/planning_research/sbpl_arm_planner/src/discrete_space_information/environment.h
63dc5684aa8bb38ac826ec182d588ae2581a6f89
[]
no_license
robcn/personalrobots-pkg
a4899ff2db9aef00a99274d70cb60644124713c9
4dcf3ca1142d3c3cb85f6d42f7afa33c59e2240a
refs/heads/master
2021-06-20T16:28:29.549716
2009-09-04T23:56:10
2009-09-04T23:56:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,634
h
/* * Copyright (c) 2008, Maxim Likhachev * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the University of Pennsylvania nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef __ENVIRONMENT_H_ #define __ENVIRONMENT_H_ class DiscreteSpaceInformation { public: //data vector<int*> StateID2IndexMapping; virtual bool InitializeEnv(const char* sEnvFile) = 0; virtual bool InitializeMDPCfg(MDPConfig *MDPCfg) = 0; virtual int GetFromToHeuristic(int FromStateID, int ToStateID) = 0; virtual int GetGoalHeuristic(int stateID) = 0; virtual int GetStartHeuristic(int stateID) = 0; virtual void SetAllActionsandAllOutcomes(CMDPSTATE* state) = 0; virtual void SetAllPreds(CMDPSTATE* state) = 0; virtual void GetSuccs(int SourceStateID, vector<int>* SuccIDV, vector<int>* CostV) = 0; virtual void GetPreds(int TargetStateID, vector<int>* PredIDV, vector<int>* CostV) = 0; virtual int SizeofCreatedEnv() = 0; virtual void PrintState(int stateID, bool bVerbose, FILE* fOut=NULL) = 0; virtual void PrintEnv_Config(FILE* fOut) = 0; //destructor virtual ~DiscreteSpaceInformation(){}; }; #endif
[ "bcohen1@f5854215-dd47-0410-b2c4-cdd35faa7885" ]
[ [ [ 1, 66 ] ] ]
d381f7b14fb6fa8b4cca04f902a4a704fe69cb23
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/SMDK/TransCritical/TTechWOR/wordata.cpp
7576566705c2636cdc944ebdd080e2003bc60456
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,818
cpp
enum PrecipMethod {GRM_Fixed, GRM_White, GRM_CAR_QAL, GRM_TTTest}; enum CoolType{COOL_dQ, COOL_dT, COOL_Hx}; enum EvapType{EVAP_NONE, EVAP_FIXED, EVAP_dT}; enum ICool{COOL_NONE, COOL_INTERNAL, COOL_EXTERNAL}; enum ClassifierMethod {CM_Molerus, CM_Lynch, CM_Plitt }; enum ThermalHeatLossMethods {THL_None, THL_TempDrop, THL_FixedHeatFlow, THL_Ambient, THL_FixedTemp}; void CPrecipitator::BuildDataFields() { static MDDValueLst DDB1[]={ {GRM_AAEq, "A - Aeq" }, {GRM_sigma, "sigma"}, {0}}; static MDDValueLst DDB2[]={ {0, "Mass" }, {1, "Fraction"}, {2, "Number"}, {0}}; static MDDValueLst DDB3[]={ {THL_None, "None" }, {THL_TempDrop, "TempDrop"}, {THL_FixedHeatFlow, "FixedLoss"}, {THL_Ambient, "Ambient"}, {THL_FixedTemp, "FixedTemp"}, {0}}; static MDDValueLst DDB5[]={ { COOL_dQ, "Fixed.dQ"}, { COOL_dT, "Fixed.dT" }, { COOL_Hx, "HeatExchange"}, {0}}; static MDDValueLst DDB6[]={ { EVAP_NONE, "None"}, { EVAP_FIXED, "Fixed"}, { EVAP_dT, "Ambient" }, {0}}; static MDDValueLst DDB7[]={ { COOL_NONE, "None"}, { COOL_INTERNAL, "Internal"}, { COOL_EXTERNAL, "External" }, {0}}; static MDDValueLst DDB8[] = { {0, "Quasi Timestep" }, {1, "Direct"}, {0}}; static MDDValueLst DDB13[]={ {0, "A/C - A/Ceq" }, {1, "Growth Rate"}, {0}}; static MDDValueLst DDB14[]={ {0, "Growth" }, {1, "Aggl (N/s/m^3)"}, {2, "deltaN"}, {3, "oldN"}, {4, "newN"}, {0}}; static MDDValueLst DDB15[]={ {CM_Molerus, "Molerus" }, {CM_Lynch, "Lynch"}, {CM_Plitt, "Plitt"}, {0}}; DD.Text (""); #ifdef TTDEBUG DD.CheckBox("TTDBG", "", &bTTDebug, MF_PARAMETER); #endif DD.CheckBox("On", "", &bOnLine, MF_PARAMETER|MF_SET_ON_CHANGE); DD.CheckBox("Use.Saved.Tank", "", &bTest, MF_PARAMETER|MF_SET_ON_CHANGE); DD.CheckBox("Verbose", "", &bVerbose, MF_PARAMETER|MF_SET_ON_CHANGE|MF_INIT_HIDDEN); DD.Text(""); DD.CheckBox("Growth.On", "", &bGrowthOn, MF_PARAMETER|MF_SET_ON_CHANGE); DD.CheckBox("Agglom.On", "", &bAgglomOn, MF_PARAMETER|MF_SET_ON_CHANGE); DD.CheckBox("Nucleation.On", "", &bNuclOn, MF_PARAMETER|MF_SET_ON_CHANGE); DD.CheckBox("Classif.On", "", &bClassOn, MF_PARAMETER|MF_SET_ON_CHANGE); DD.Text(""); DD.Text ("Requirements"); DD.Double("TankVol", "", &dTankVol ,MF_PARAMETER, MC_Vol("m^3")); DD.Double("UFValve", "", &m_dUFrac ,MF_PARAMETER, MC_Frac("%")); DD.Double("ShortCircuit", "", &m_dShort_Circ ,MF_PARAMETER, MC_Frac("%")); DD.Long ("ThermalLossMethod", "",&iThermalLossMethod, MF_PARAMETER|MF_SET_ON_CHANGE, DDB3); DD.Show(iThermalLossMethod==THL_TempDrop); DD.Double("Temp_Drop", "", &dTempDropRqd ,MF_PARAMETER, MC_dT("C")); DD.Show(iThermalLossMethod==THL_FixedTemp); DD.Double("FixedTemp", "", &dFixedTempRqd ,MF_PARAMETER, MC_T("C")); DD.Show(iThermalLossMethod==THL_FixedHeatFlow); DD.Double("ThermalLossRqd", "", &dThermalLossRqd ,MF_PARAMETER, MC_Pwr("kW")); DD.Show(iThermalLossMethod==THL_Ambient); DD.Double("ThermalLossAmbient", "", &dThermalLossAmbient ,MF_PARAMETER, MC_UA); DD.Show(); DD.Long ("Evaporation", "", &iEvapMethod , MF_PARAMETER|MF_SET_ON_CHANGE, DDB6); DD.Show(iEvapMethod!=EVAP_NONE); DD.Double("Evap.Rate", "", &m_dEvapRate ,iEvapMethod==EVAP_FIXED?MF_PARAMETER:MF_RESULT, MC_Qm("kg/s")); DD.Show(iEvapMethod==EVAP_dT); DD.Double("Evap.Per.degK", "", &m_dEvapRateK ,MF_PARAMETER, MC_Qm("kg/s")); DD.Show(); DD.Long ("Cooling", "", &iCoolType, MF_PARAMETER|MF_SET_ON_CHANGE, DDB7); DD.Text(""); DD.Text (""); DD.Text ("Results Tank"); DD.Double("ResidenceTime", "", &dResidenceTime ,MF_RESULT, MC_Time("h")); DD.Double("SuperSat", "", &m_dSSat, MF_RESULT, MC_); DD.Double("BrahmaSuperSat", "", &m_dBSSat, MF_RESULT, MC_); DD.Double("SSA", "", &dSSA, MF_RESULT, MC_SurfAreaM); DD.Double("Yield", "", &dYield ,MF_RESULT, MC_Conc("kg/m^3")); DD.Double("THA.Precip", "", &dTHAPrecip ,MF_RESULT, MC_Qm("kg/s")); DD.Double("AluminaPrecip", "", &dAlPrecip ,MF_RESULT, MC_Qm("kg/s")); DD.Double("Solids.Precip", "", &dSolPrecip ,MF_RESULT, MC_Qm("kg/s")); DD.Double("Solids.Conc", "", &dSolConc ,MF_RESULT, MC_Conc("kg/m^3")); DD.Text ("Results"); DD.Show(); DD.Double("Vol_FlowIn", "", &dQvin ,MF_RESULT, MC_Qv("L/s")); DD.Double("Vol_FlowOut", "", &dQvout ,MF_RESULT, MC_Qv("L/s")); DD.Double("MassFlowIn", "", &dQmin ,MF_RESULT, MC_Qm("t/d")); DD.Double("MassFlowOut", "", &dQmout ,MF_RESULT, MC_Qm("t/d")); DD.Double("ACin", "", &dACin ,MF_RESULT, MC_); DD.Double("ACout", "", &dACout ,MF_RESULT, MC_); DD.Double("ACequil", "", &m_dACeq ,MF_RESULT, MC_); DD.Double("TempIn", "", &dTin ,MF_RESULT, MC_T("C")); DD.Double("TempOut", "", &dTout ,MF_RESULT, MC_T("C")); DD.Double("GrowthRate", "", &m_dGrowth ,MF_RESULT, MC_Ldt("um/h")); DD.Double("NuclRate", "", &m_dNucleation ,MF_RESULT, MC_); DD.Double("NuclNum", "", &m_dNuclN ,MF_RESULT, MC_); DD.Double("AgglNum", "", &m_dAgglomN ,MF_RESULT, MC_); DD.Double("AgglMin", "", &agmin, MF_RESULT, MC_); DD.Double("BoundSoda", "", &dSoda, MF_RESULT, MC_); DD.Text(""); DD.Page("Precip"); DD.Double("ConvergenceLimit", "", &m_dConvergenceLimit, MF_PARAMETER|MF_INIT_HIDDEN, MC_); DD.Double("Acceleration", "", &m_dAcc, MF_PARAMETER|MF_INIT_HIDDEN, MC_); DD.Double("AggMinLimit", "", &dAggMinLim, MF_PARAMETER|MF_INIT_HIDDEN, MC_); DD.Double("ThermalDamping", "", &m_dDamping, MF_PARAMETER|MF_INIT_HIDDEN, MC_Frac("%")); DD.Double("MassDamping", "", &m_dMassDamping, MF_PARAMETER|MF_INIT_HIDDEN, MC_Frac("%")); DD.Long("Iterations", "", &m_lIterations, MF_RESULT|MF_NO_FILING); DD.Long("IterMax", "", &m_lItermax, MF_PARAMETER); DD.Text(""); DD.Text("Plant Parameters"); DD.Long("MaxAgglClass", "", &m_lMaxAgglomClass, MF_PARAMETER); DD.Double("NuclPlantCorr", "", &m_dNuclPlantCorr, MF_PARAMETER, MC_); DD.Double("AgglomerisationConst", "", &m_dKAgglom, MF_PARAMETER, MC_); DD.Double("SurfaceActivity", "", &m_dSurfaceAct, MF_PARAMETER, MC_); DD.Double("SodaConst", "", &m_dSodaConst, MF_PARAMETER, MC_); DD.Text(""); DD.Text("Linear Growth Rate Equation"); DD.Double("GrowthConst", "", &m_dK_G ,MF_PARAMETER, MC_); DD.Double("GrowthActEnergy", "", &m_dActEGrowth ,MF_PARAMETER, MC_T("K")); DD.Double("GrowthPwr", "", &m_dgamma_g ,MF_PARAMETER, MC_); DD.Long ("GrowthTerm", "", &m_lGrowthTerm, MF_PARAMETER|MF_SET_ON_CHANGE, DDB1); DD.Double("Sigma.Term", "", &m_dsigma ,MF_RESULT|MF_NO_FILING, MC_); DD.Text(""); DD.Text("Nucleation Rate Equation"); DD.Long ("NucleationTerm", "", &m_lNuclTerm, MF_PARAMETER|MF_SET_ON_CHANGE, DDB1); DD.Double("NucleationActEnergy", "", &m_dActENucleation ,MF_PARAMETER, MC_T("K")); DD.Double("NucleationConst", "", &m_dK_N ,MF_PARAMETER, MC_); DD.Double("NucleationPwr", "", &m_dgamma_N ,MF_PARAMETER, MC_); DD.Text(""); DD.Text("Agglomeration Rate Equation"); DD.Double("SolidDenPwr", "", &m_dn_s ,MF_PARAMETER, MC_); DD.Double("GrowthPwrAggl", "", &m_dgamma_2 ,MF_PARAMETER, MC_); DD.Text(""); DD.Text("Soda Incorporation"); DD.Long ("SodaTerm", "", &m_lSodaTerm, MF_PARAMETER|MF_SET_ON_CHANGE, DDB13); DD.Double("SodaPwr", "", &m_dgamma_s, MF_PARAMETER, MC_); DD.Double("SodaActEnergy", "", &m_dActESoda ,MF_PARAMETER, MC_T("K")); DD.Page("PSD"); DD.Double("Feed.N.Tot", "", &dFeedNTot, MF_RESULT, MC_); DD.Double("Prod.N.Tot", "", &dProdNTot, MF_RESULT, MC_); // Classification Stuff DD.Show(bClassOn); DD.Page("Classification"); DD.Long ("ClassMethod", "", &iClassMethod , MF_PARAMETER|MF_SET_ON_CHANGE, DDB15); DD.Double("ExcessBypassUFlow", "", &m_dBypass ,MF_PARAMETER, MC_Frac("%")); DD.Double("MeasureSharpness", "", &m_dSharp_Index ,MF_PARAMETER, MC_); DD.Double("CutSize", "", &m_dCut_Size ,MF_PARAMETER, MC_); DD.Double("LiquorToUFlow", "", &m_dSlurry_split ,MF_PARAMETER, MC_Frac("%")); DD.Double("OverPassOFlow", "", &m_dOverpass ,MF_PARAMETER, MC_Frac("%")); DD.Double("L_0", "", &m_dL0 ,MF_PARAMETER, MC_); DD.Text("Results"); DD.Double("SolidsSplit", "", &m_dxS ,MF_RESULT, MC_Frac("%")); DD.Double("Efficiency", "", &m_dEff ,MF_RESULT, MC_); DD.Show(iCoolType!=0); DD.Page("Cooler"); DD.Show(iCoolType==COOL_INTERNAL); DD.CheckBox("Cooler.On", "", &m_bCoolerOn, MF_PARAMETER); DD.Long ("Cooling.Type", "", (long*)&iCoolMethod, MF_PARAMETER|MF_SET_ON_CHANGE, DDB5); DD.Show(iCoolType==COOL_INTERNAL && (iCoolMethod==COOL_dT)); DD.Double("dT", "", &m_dCooldT, MF_PARAMETER, MC_dT("C")); DD.Show(iCoolType==COOL_INTERNAL && (iCoolMethod==COOL_dQ)); DD.Double("dQ", "", &m_dCooldQ, MF_PARAMETER, MC_Pwr("kW")); DD.Show(iCoolType==COOL_INTERNAL && (iCoolMethod==COOL_Hx)); DD.Double("HX.Area", "", &m_dCoolArea, MF_PARAMETER, MC_Area("m^2")); DD.Double("HX.HTC", "", &m_dCoolHTC, MF_PARAMETER, MC_HTC); DD.Show(iCoolType==COOL_EXTERNAL || (iCoolType==COOL_INTERNAL && (iCoolMethod==COOL_Hx))); DD.CheckBox("By.Vol.Flow", "", &m_bByVolFlow, MF_PARAMETER|MF_SET_ON_CHANGE); DD.Show(iCoolType==COOL_INTERNAL && (iCoolMethod==COOL_Hx)); DD.Double("Cooling.Flow", "", &m_dCoolFlow, m_bByVolFlow ? MF_RESULT : MF_PARAMETER, MC_Qm("kg/s")); // Internal cooling flow DD.Double("Int.Vol.Flow", "", &m_dIntCoolVolFlow, m_bByVolFlow ? MF_PARAMETER : MF_RESULT, MC_Qv("m^3/s")); // By Volume DD.Double("Hx.UA", "", &m_dUA, MF_RESULT, MC_UA); DD.Double("Hx.LMTD", "", &m_dLMTD, MF_RESULT, MC_dT); DD.Double("Water.Flow", "", &m_dCoolWaterFlow, MF_RESULT, MC_Qm("kg/s")); DD.Double("Water.Vol.Flow", "", &m_dCoolWaterFlowVol, MF_RESULT, MC_Qv); DD.Double("Water.Tin", "", &m_dCoolWaterTin, MF_RESULT, MC_T("C")); DD.Double("Water.Tout", "", &m_dCoolWaterTout, MF_RESULT, MC_T("C")); DD.Double("Liquor.Tin", "", &m_dLiquorTin, MF_RESULT, MC_T("C")); DD.Double("Liquor.Tout", "", &m_dLiquorTout, MF_RESULT, MC_T("C")); DD.Show(iCoolType==COOL_EXTERNAL); DD.Double("Ext.Vol.Flow", "", &m_dExtCoolVolFlow, m_bByVolFlow ? MF_PARAMETER : MF_RESULT, MC_Qv("m^3/s")); // Ext Cooling.Flow DD.Double("Ext.Cooling.Flow", "", &m_dExtCoolFlow, m_bByVolFlow ? MF_RESULT : MF_PARAMETER, MC_Qm("kg/s")); // Ext Cooling.Flow DD.Double("Ext.Cooling.Temp", "", &m_dExtCoolTemp, MF_RESULT, MC_T("C")); // Ext Cooling.Temp DD.Double("Ext.Cooling.totHz", "", &m_dCoolOutTotHz , MF_RESULT, MC_Pwr("kW")); // Ext Cooling Rate DD.Show(iCoolType!=0); DD.Double("Cooling.Rate", "", &m_dCoolRate, MF_RESULT, MC_Pwr("kW")); // Ext Cooling Rate DD.Show(); DD.Page("Inlet"); DD.Long("PSD.Display", "", &iPSD, MF_PARAMETER|MF_SET_ON_CHANGE, DDB2); const int NumSpecies = gs_MVDefn.Count(); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i << std::setw(12) << L[i] << " " << Lav[i] ; DD.Double(os.str().c_str(), "", dd[2]+i, MF_RESULT|MF_NO_FILING, MC_None); } /******************* DD.Page("Size In"); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[3]+i, MF_RESULT|MF_NO_FILING, MC_None); }************************/ DD.Page("Size In"); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[4]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Text(""); DD.Double("Number", "", dd[4]+26, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Area", "", dd[4]+27, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Vol", "", dd[4]+28, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Mass", "", dd[4]+29, MF_RESULT|MF_NO_FILING, MC_None); DD.Page("Size Tank"); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[5]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Text(""); DD.Double("Number", "", dd[5]+26, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Area", "", dd[5]+27, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Vol", "", dd[5]+28, MF_RESULT|MF_NO_FILING, MC_None); DD.Double("Mass", "", dd[5]+29, MF_RESULT|MF_NO_FILING, MC_None); DD.Page("Numbers..."); // DD.Page(DDB14[iDType].m_pStr); DD.Long("DType", "", &iDType, MF_PARAMETER|MF_SET_ON_CHANGE, DDB14); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[6]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Object(SavedTank, MDD_RqdPage); #ifdef TTDEBUG DD.Page("Growth..."); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[7]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Page("Aggl..."); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[8]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Page("Nin..."); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[9]+i, MF_RESULT|MF_NO_FILING, MC_None); } DD.Page("Nout..."); for (int i=0; i<=nClasses; i++) { std::stringstream os; os << "Size " << std::setw(3) << i; DD.Double(os.str().c_str(), "", dd[10]+i, MF_RESULT|MF_NO_FILING, MC_None); } #endif } //--------------------------------------------------------------------------- bool CPrecipitator::ValidateDataFields() {//ensure parameters are within expected ranges return true; }
[ [ [ 1, 239 ], [ 241, 281 ], [ 283, 384 ] ], [ [ 240, 240 ], [ 282, 282 ] ] ]
4c3db7c6328c1c9184b05c31242b79a9081cd238
563e71cceb33a518f53326838a595c0f23d9b8f3
/v3/ProcTerrain/ProcTerrain/Shaders/GenerationShader.cpp
97b35b4a644b13094c2cc5d8328b85dd829e732f
[]
no_license
fabio-miranda/procedural
3d937037d63dd16cd6d9e68fe17efde0688b5a0a
e2f4b9d34baa1315e258613fb0ea66d1235a63f0
refs/heads/master
2021-05-28T18:13:57.833985
2009-10-07T21:09:13
2009-10-07T21:09:13
39,636,279
1
1
null
null
null
null
UTF-8
C++
false
false
1,788
cpp
#include "GenerationShader.h" //TODO: calculate the normal of the heightmap on the generation shader (instead of calculating it each frame on the rendering shader) GenerationShader::GenerationShader(float seed, GLuint permTextureID) { LoadFiles("Shaders/terrainGeneration.vert", "Shaders/terrainGeneration.frag"); //m_locSeed = glGetUniformLocationARB(m_shaderProg,"seed"); //m_seed = seed; //m_locPosition = glGetUniformLocationARB(m_shaderProg,"position"); m_locPermTexture = glGetUniformLocationARB(m_shaderProg,"permTexture"); m_permTextureID = permTextureID; m_locOctaves = glGetUniformLocationARB(m_shaderProg,"octaves"); m_locLacunarity = glGetUniformLocationARB(m_shaderProg,"lacunarity"); m_locGain = glGetUniformLocationARB(m_shaderProg,"gain"); m_locOffset = glGetUniformLocationARB(m_shaderProg,"offset"); //m_locPermGradTexture = glGetUniformLocationARB(m_shaderProg,"permGradTexture"); //m_permGradTextureID = permGradTextureID; /* Enable(); glBindTexture(GL_TEXTURE_2D, permTextureID); glUniform1i(m_locPermTexture, 0); glBindTexture(GL_TEXTURE_2D, 0); Disable(); */ } GenerationShader::~GenerationShader(){ Shader::~Shader(); } void GenerationShader::Enable(){ Shader::Enable(); //glUniform2f(m_locPosition, position.GetX(), position.GetY()); glBindTexture(GL_TEXTURE_2D, m_permTextureID); //glBindTexture(GL_TEXTURE_2D, m_permGradTextureID); //TODO: bind only once, when the GenerationShader is instanced //there is no need to do it every frame: http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=530427&reply_id=3450696 //glUniform1i(m_locPermTexture, 0); } void GenerationShader::Disable(){ glBindTexture(GL_TEXTURE_2D, 0); Shader::Disable(); }
[ "fabiom@01b71de8-32d4-11de-96ab-f16d9912eac9" ]
[ [ [ 1, 59 ] ] ]
9a0f22b74edcc89d0b0cf04836ff67a8342bd6e0
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/Dependencies/Xerces/include/xercesc/framework/XMLGrammarPool.hpp
646a4ad0533078ce2630734f0f12dc69f60e146d
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
12,394
hpp
/* * Copyright 1999-2004 The Apache Software Foundation. * * 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. */ /* * $Id: XMLGrammarPool.hpp 191054 2005-06-17 02:56:35Z jberry $ */ #if !defined(XMLGRAMMARPOOL_HPP) #define XMLGRAMMARPOOL_HPP #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/util/RefHashTableOf.hpp> #include <xercesc/util/XMemory.hpp> #include <xercesc/framework/psvi/XSModel.hpp> XERCES_CPP_NAMESPACE_BEGIN class Grammar; class XMLGrammarDescription; class DTDGrammar; class SchemaGrammar; class XMLDTDDescription; class XMLSchemaDescription; class XMLStringPool; class BinInputStream; class BinOutputStream; class XMLPARSER_EXPORT XMLGrammarPool : public XMemory { public : // ----------------------------------------------------------------------- /** @name Virtual destructor for derived classes */ // ----------------------------------------------------------------------- //@{ /** * virtual destructor * */ virtual ~XMLGrammarPool(){}; //@} // ----------------------------------------------------------------------- /** @name The Grammar Pool Interface */ // ----------------------------------------------------------------------- //@{ /** * cacheGrammar * * Provide the grammar pool with an opportunity * to cache the given grammar. If the pool does not choose to do so, * it should return false; otherwise, it should return true, so that * the caller knows whether the grammar has been adopted. * * @param gramToCache the Grammar to be cached in the grammar pool * @return true if the grammar pool has elected to cache the grammar (in which case * it is assumed to have adopted it); false if it does not cache it * */ virtual bool cacheGrammar(Grammar* const gramToCache) = 0; /** * retrieveGrammar * * @param gramDesc the Grammar Description used to search for grammar * cached in the grammar pool * */ virtual Grammar* retrieveGrammar(XMLGrammarDescription* const gramDesc) = 0; /** * orphanGrammar * * grammar removed from the grammar pool and owned by the caller * * @param nameSpaceKey Key used to search for grammar in the grammar pool * @return the grammar that was removed from the pool (0 if none) */ virtual Grammar* orphanGrammar(const XMLCh* const nameSpaceKey) = 0; /** * Get an enumeration of the cached Grammars in the Grammar pool * * @return enumeration of the cached Grammars in Grammar pool */ virtual RefHashTableOfEnumerator<Grammar> getGrammarEnumerator() const = 0; /** * clear * * all grammars are removed from the grammar pool and deleted. * @return true if the grammar pool was cleared. false if it did not. */ virtual bool clear() = 0; /** * lockPool * * When this method is called by the application, the * grammar pool should stop adding new grammars to the cache. * This should result in the grammar pool being sharable * among parsers operating in different threads. * */ virtual void lockPool() = 0; /** * unlockPool * * After this method has been called, the grammar pool implementation * should return to its default behaviour when cacheGrammars(...) is called. * One effect, depending on the underlying implementation, is that the grammar pool * may no longer be thread-safe (even on read operations). * * For PSVI support any previous XSModel that was produced will be deleted. */ virtual void unlockPool() = 0; //@} // ----------------------------------------------------------------------- /** @name Factory interface */ // ----------------------------------------------------------------------- //@{ /** * createDTDGrammar * */ virtual DTDGrammar* createDTDGrammar() = 0; /** * createSchemaGrammar * */ virtual SchemaGrammar* createSchemaGrammar() = 0; /** * createDTDDescription * */ virtual XMLDTDDescription* createDTDDescription(const XMLCh* const systemId) = 0; /** * createSchemaDescription * */ virtual XMLSchemaDescription* createSchemaDescription(const XMLCh* const targetNamespace) = 0; //@} // ----------------------------------------------------------------------- /** @name schema component model support */ // ----------------------------------------------------------------------- //@{ /*** * Return an XSModel derived from the components of all SchemaGrammars * in the grammar pool. If the pool is locked, this should * be a thread-safe operation. It should return null if and only if * the pool is empty. * * Calling getXSModel() on an unlocked grammar pool may result in the * creation of a new XSModel with the old XSModel being deleted. The * function will return a different address for the XSModel if it has * changed. * * @deprecated (shouldn't use address to determine if XSModel changed) */ virtual XSModel *getXSModel() = 0; /*** * Return an XSModel derived from the components of all SchemaGrammars * in the grammar pool. If the pool is locked, this should * be a thread-safe operation. * * NOTE: The function should NEVER return NULL. If there are no grammars in * the pool it should return an XSModel containing the Schema for Schema. * * Calling getXSModel() on an unlocked grammar pool may result in the * creation of a new XSModel with the old XSModel being deleted. * The bool parameter will indicate if the XSModel was changed. * * For source code compatibility, default implementation is to say * XSModelWasChanged. */ virtual XSModel *getXSModel(bool& XSModelWasChanged) { XSModelWasChanged = true; return getXSModel(); } // @} // ----------------------------------------------------------------------- /** @name Getter */ // ----------------------------------------------------------------------- //@{ /** * getMemoryManager * */ inline MemoryManager* getMemoryManager() { return fMemMgr; } /** * Return an XMLStringPool for use by validation routines. * Implementations should not create a string pool on each call to this * method, but should maintain one string pool for all grammars * for which this pool is responsible. */ virtual XMLStringPool *getURIStringPool() = 0; //@} // ----------------------------------------------------------------------- /** serialization and deserialization support */ // ----------------------------------------------------------------------- /*** * * 1. Context: Serialize/Deserialize All Grammars In One Session * * Since it is common that a declaration in one grammar may reference * to definitions in other grammars, it is required to serialize those * related (or interdependent) grammars in to one persistent data store * in one serialization session (storing), and deserialize them from the * persistent data store in one deserialization session (loading) back * to the grammar pool. * * 2. Multiple serializations * * It is acceptable that client application requests more than one * grammar serialization on a particular grammar pool, to track the * different grammars cached, or for whatever reasons that client * application is interested in. * * 3. Multiple deserializations * * Request for grammar deserialization either after the grammar pool has * its own cached grammars, or request for more than one grammar * deserialization, may cause undesired and unpredictable consequence * and therefore client application shall be aware that individual * implementationis may NOT support this. * * However it is strongly recommended that the client application requests * no more than one grammar deserialization even a particular implementation * may allow multiple deserializations. * * 4. Locking * * Both serialization and deserialization requires to lock the grammar pool * before operation and unlock after operation. In the case the grammar pool * is locked by a third party, the request for serialization/deserialization * will NOT be entertained. * * 5. Versioning * * The Persistent data store has a version tag to be verified during * deserialization, thus a grammar pool may decide if it supports * a binary data created by a different release of Xerces. * * 6. Clean up * * The client application shall be aware that in the event of an exception * thrown due to a corrupted data store during deserialization, implementation * may not be able to clean up all resources allocated, and therefore it is * client application's responsibility to clean up those unreleased resources. * * */ virtual void serializeGrammars(BinOutputStream* const) = 0; virtual void deserializeGrammars(BinInputStream* const) = 0; /* * Set/get a flag to not create XSAnnotations when deserializing the grammar. * Defaults to false (create XSAnnotations when deserializing the grammar). */ inline void setIgnoreSerializedAnnotations(const bool flag) { fIgnoreSerializedAnnotations = flag; }; inline bool getIgnoreSerializedAnnotations() const { return fIgnoreSerializedAnnotations; }; protected : // ----------------------------------------------------------------------- /** Hidden Constructors */ // ----------------------------------------------------------------------- //@{ XMLGrammarPool(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager) :fMemMgr(memMgr) ,fIgnoreSerializedAnnotations(false) { }; //@} private : // ----------------------------------------------------------------------- /** name Unimplemented copy constructor and operator= */ // ----------------------------------------------------------------------- //@{ XMLGrammarPool(const XMLGrammarPool& ); XMLGrammarPool& operator=(const XMLGrammarPool& ); //@} // ----------------------------------------------------------------------- // // fMemMgr: plugged-in (or defaulted-in) memory manager // not owned // no reset after initialization // // ----------------------------------------------------------------------- MemoryManager* const fMemMgr; bool fIgnoreSerializedAnnotations; }; XERCES_CPP_NAMESPACE_END #endif
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 342 ] ] ]
d825fe21f62ba9a9d3b52cc6ee13594efd918ffd
1bc2f450f157ce39cbd92d0549e1459368a76e94
/lib/cppunit-1.12.1/include/cppunit/TestCase.h
13b76e5b7b33d0342c3618db0541add3e7858d25
[]
no_license
mirror/odin
168267277386d6c07c006cb196fec3bb208f5e3c
63b4633a87b03a924df612271c2d6310c34834a8
refs/heads/master
2023-09-01T13:28:38.392325
2011-10-09T15:38:02
2011-10-09T15:38:02
9,256,124
5
4
null
null
null
null
UTF-8
C++
false
false
1,179
h
#ifndef CPPUNIT_TESTCASE_H #define CPPUNIT_TESTCASE_H #include <cppunit/Portability.h> #include <cppunit/TestLeaf.h> #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <string> CPPUNIT_NS_BEGIN class TestResult; /*! \brief A single test object. * * This class is used to implement a simple test case: define a subclass * that overrides the runTest method. * * You don't usually need to use that class, but TestFixture and TestCaller instead. * * You are expected to subclass TestCase is you need to write a class similiar * to TestCaller. */ class CPPUNIT_API TestCase : public TestLeaf, public TestFixture { public: TestCase( const std::string &name ); TestCase(); ~TestCase(); virtual void run(TestResult *result); std::string getName() const; //! FIXME: this should probably be pure virtual. virtual void runTest(); private: TestCase( const TestCase &other ); TestCase &operator=( const TestCase &other ); private: const std::string m_name; }; CPPUNIT_NS_END #endif // CPPUNIT_TESTCASE_H
[ "kaltduscher65@b91d169b-bf28-450c-9b59-d70c078a1df8" ]
[ [ [ 1, 55 ] ] ]
816dfd3ed3d584865c103aa250499193afac5ab2
f5a3e2fcfe01bfe95d125a903c0af454c1b9cdd6
/WordEditDlg.h
c8d46a0261262cd1cef1f56fdd53651dc873fe0f
[]
no_license
congchenutd/congchenmywords
11418c97d3d260d35766cdfbb9968a54f569fad7
29fd31f7e7a99b17fe789e9d97879728ea9dbb80
refs/heads/master
2021-01-02T09:08:59.667661
2011-02-21T02:05:05
2011-02-21T02:05:05
32,358,808
0
0
null
null
null
null
UTF-8
C++
false
false
593
h
#ifndef WORDEDITDLG_H #define WORDEDITDLG_H #include <QDialog> #include "ui_WordEditDlg.h" class WordEditDlg : public QDialog { Q_OBJECT public: WordEditDlg(QWidget *parent = 0); QString getWord() const; QString getPhonetic() const; QString getExplanation() const; QString getNote() const; void setWord (const QString& word); void setPhonetic (const QString& phonetic); void setExplanation(const QString& explanation); void setNote (const QString& note); private: Ui::WordEditDlgClass ui; }; #endif // WORDEDITDLG_H
[ "congchenutd@33c296ca-c6a8-bfc7-d74f-b3a1fff04ced" ]
[ [ [ 1, 28 ] ] ]
8aee429ec55b86f1d2ab588418be2549636f1016
c0bd82eb640d8594f2d2b76262566288676b8395
/src/game/AuctionHouse.h
6f3d65b60505007d6c9b4c3d7389619d13837981
[ "FSFUL" ]
permissive
vata/solution
4c6551b9253d8f23ad5e72f4a96fc80e55e583c9
774fca057d12a906128f9231831ae2e10a947da6
refs/heads/master
2021-01-10T02:08:50.032837
2007-11-13T22:01:17
2007-11-13T22:01:17
45,352,930
0
1
null
null
null
null
UTF-8
C++
false
false
3,144
h
// Copyright (C) 2004 WoW Daemon // // 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. #ifndef __AUCTIONHOUSE_H #define __AUCTIONHOUSE_H struct AuctionEntry { uint32 auctionhouse; uint64 item; uint64 owner; uint32 bid; uint32 buyout; time_t time; uint64 bidder; uint32 Id; uint32 deposit; }; /* SMSG_AUCTION_BIDDER_NOTIFICATION uint32 auctionhouse; uint32 auctionID; uint64 bidderguid; uint32 unk; uint32 unk2; uint32 itemid; uint32 unk3 */ struct bidentry { uint32 AHid; uint32 AuctionID; uint32 amt; }; class AuctionSystem: public WowdThread { public: AuctionSystem(); void run(); }; enum AuctionRemoveType { AUCTION_REMOVE_EXPIRED, AUCTION_REMOVE_WON, AUCTION_REMOVE_CANCELLED, }; enum AUCTIONRESULT { AUCTION_CREATE,// = 1 AUCTION_CANCEL,// = 2 AUCTION_BID, AUCTION_BUYOUT, }; enum AuctionMailResult { AUCTION_OUTBID, AUCTION_WON, AUCTION_SOLD, AUCTION_EXPIRED, AUCTION_EXPIRED2, AUCTION_CANCELLED, }; class AuctionHouse { public: AuctionHouse(uint32 aid,uint32 guid, uint32 t, uint32 c); ~AuctionHouse(); uint32 GetAuctioneer() { return auctioneerentry;}; WorldPacket GenerateItemList(WorldPacket & recv_data); WorldPacket GenerateOwnerList(Player *pl); WorldPacket GenerateBidderList(Player *pl); void CancelAuction(WorldPacket & recv_data); std::map<uint32,AuctionEntry*>::iterator GetAuctionsBegin() { return Auctions.begin();}; std::map<uint32,AuctionEntry*>::iterator GetAuctionsEnd() { return Auctions.end();}; WorldPacket AddAuctionToPacket(WorldPacket pkt,AuctionEntry* ac,Item* it); WorldPacket BuildResultPacket(uint32 aid,uint32 result); WorldPacket BuildBidderNotificationPacket(AuctionEntry* ac); void SaveAuction(AuctionEntry* auction); AuctionEntry* GetAuction(uint32 id); void UpdateAuction(uint32 id); void Update(); void RemoveAuction(uint32 id,uint32 reason); void LoadFromDB(); void SellItem(WorldPacket & recv_data, Player *pl); void PlaceBid(WorldPacket & recv_data, Player *pl); uint32 GetId() { return Id;}; uint32 GetMaxId() { return maxId++;}; void LoadMaxId(); private: uint32 maxId; std::map<uint32,AuctionEntry*>Auctions; uint32 Id; uint32 auctioneerentry; uint32 tax; uint32 cut; }; #endif
[ [ [ 1, 120 ] ] ]
a512e7633f18be6dd200b5731aa11e75a2c018fd
6253ab92ce2e85b4db9393aa630bde24655bd9b4
/Common/delphiInterface/DelphiInterface/main.cpp
ab2eac052f3bfeed3d0d0db7190df75469e28919
[]
no_license
Aand1/cornell-urban-challenge
94fd4df18fd4b6cc6e12d30ed8eed280826d4aed
779daae8703fe68e7c6256932883de32a309a119
refs/heads/master
2021-01-18T11:57:48.267384
2008-10-01T06:43:18
2008-10-01T06:43:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
862
cpp
#include <iostream> #include <string> #include "delphiInterface.h" using namespace std; DelphiInterfaceReceiver* delphi; LARGE_INTEGER freq, t1, t2; void DelphiCallback(DelphiRadarScan scan, DelphiInterfaceReceiver* radar, int id , void* args) { for (int i=0; i<20; i++) { if (scan.tracks[i].isValid == true) { float rr = scan.tracks[i].rangeRate; float rru = scan.tracks[i].rangeRateUnfiltered; cout<<"Speed! "<<rr<< " un: "<<rru<<endl; } } /* cout<<"Got Scan! "<<id<<endl; QueryPerformanceCounter (&t2); cout<<"Took: " << (double)(t2.QuadPart - t1.QuadPart)/(double)freq.QuadPart <<endl; t1= t2; //scan. */ } void main() { QueryPerformanceFrequency (&freq); delphi = new DelphiInterfaceReceiver (); delphi->SetDelphiCallback (&DelphiCallback, NULL); while(1) { Sleep(10); } }
[ "anathan@5031bdca-8e6f-11dd-8a4e-8714b3728bc5" ]
[ [ [ 1, 42 ] ] ]
4f8967d7764df4e81d5d653d14123039e6a95ea7
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKit2/UIProcess/API/qt/qwkpage.h
acdd65a2a47578a0c13335da4d2b80a60768bf41
[]
no_license
azrul2202/WebKit-Smartphone
0aab1ff641d74f15c0623f00c56806dbc9b59fc1
023d6fe819445369134dee793b69de36748e71d7
refs/heads/master
2021-01-15T09:24:31.288774
2011-07-11T11:12:44
2011-07-11T11:12:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,904
h
#ifndef qwkpage_h #define qwkpage_h #include "qwebkitglobal.h" #include <QAction> #include <QObject> #include <QPoint> #include <QRect> #include <QSize> #include <QUrl> #include <WebKit2/WKBase.h> #include <WebKit2/WKPage.h> #include <WebKit2/WKPageNamespace.h> class QCursor; class QWKGraphicsWidget; class QWKPagePrivate; class QWEBKIT_EXPORT QWKPage : public QObject { Q_OBJECT Q_PROPERTY(QString title READ title) Q_PROPERTY(QUrl url READ url WRITE setUrl) public: enum WebAction { NoWebAction = - 1, Back, Forward, Stop, Reload, WebActionCount }; QWKPage(WKPageNamespaceRef); virtual ~QWKPage(); WKPageRef pageRef() const; void load(const QUrl& url); void setUrl(const QUrl& url); QUrl url() const; QString title() const; void setViewportSize(const QSize&); QAction* action(WebAction action) const; void triggerAction(WebAction action, bool checked = false); typedef QWKPage* (*CreateNewPageFn)(QWKPage*); void setCreateNewPageFunction(CreateNewPageFn function); public: Q_SIGNAL void statusBarMessage(const QString&); Q_SIGNAL void titleChanged(const QString&); Q_SIGNAL void loadStarted(); Q_SIGNAL void loadFinished(bool ok); Q_SIGNAL void loadProgress(int progress); Q_SIGNAL void initialLayoutCompleted(); Q_SIGNAL void urlChanged(const QUrl&); Q_SIGNAL void contentsSizeChanged(const QSize&); Q_SIGNAL void cursorChanged(const QCursor&); protected: void timerEvent(QTimerEvent*); private: #ifndef QT_NO_ACTION Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)); #endif QWKPagePrivate* d; friend class QGraphicsWKView; friend class QGraphicsWKViewPrivate; friend class QWKPagePrivate; }; #endif /* qwkpage_h */
[ [ [ 1, 80 ] ] ]
6b440ced521a5430dc13596ae15f45ea7ccf6daa
8a88075abf60e213a490840bebee97df01b8827a
/implementation/geometry_tests/algebra/epsilon_tolerance_tests.cpp
9a6e1b920370b6eb36018783bd309e8f373fa145
[]
no_license
DavidGeorge528/minigeolib
e078f1bbc874c09584ae48e1c269f5f90789ebfb
58233609203953acf1c0346cd48950d2212b8922
refs/heads/master
2020-05-20T09:36:53.921996
2009-04-23T16:25:30
2009-04-23T16:25:30
33,925,133
0
1
null
null
null
null
UTF-8
C++
false
false
1,383
cpp
#include "algebra/epsilon_tolerance.hpp" #include "../test_traits.hpp" #include "../tests_common.hpp" namespace { using namespace algebra; typedef boost::mpl::list< float, double> tested_types; BOOST_AUTO_TEST_CASE_TEMPLATE( test_initialization, U, tested_types) { typedef U unit_type; typedef epsilon_tolerance< unit_type> tolerance; unit_type e = 1; tolerance t1( e); tolerance t2; BOOST_CHECK_EQUAL( e, t1.epsilon()); BOOST_CHECK_EQUAL( std::numeric_limits< unit_type>::is_integer ? 0 : std::numeric_limits< unit_type>::min() , t2.epsilon()); } // --------------------------------------------------------------------------------------------------------------------- BOOST_AUTO_TEST_CASE_TEMPLATE( test_equal, U, tested_types) { typedef U unit_type; typedef epsilon_tolerance< unit_type> tolerance; unit_type eps = 2; tolerance t( eps); unit_type v1 = 10, v2 = v1, v3 = v1 + eps/unit_type(2.0), v4 = v1 - eps/unit_type(2.0), v5 = v1 + eps, v6 = v1 - eps, v7 = v1 + eps + unit_type(1.0), v8 = v1 - eps - unit_type(1.0); BOOST_CHECK( t.equals( v1, v2)); BOOST_CHECK( t.equals( v1, v3)); BOOST_CHECK( t.equals( v1, v4)); BOOST_CHECK( t.equals( v1, v5)); BOOST_CHECK( t.equals( v1, v6)); BOOST_CHECK( !t.equals( v1, v7)); BOOST_CHECK( !t.equals( v1, v8)); } } // namespace
[ "cpitis@834bb202-e8be-11dd-9d8c-a70aa0a93a20" ]
[ [ [ 1, 54 ] ] ]
3f013b34e36eac1c3dd5703f97351f1c85fb4fbf
b799c972367cd014a1ffed4288a9deb72f590bec
/hw6/master/mbed-beta/FileLike.h
4905982744f0cc618421a94e4bc278d27173bccf
[]
no_license
intervigilium/csm213a-embedded
647087de8f831e3c69e05d847d09f5fa12b468e6
ae4622be1eef8eb6e4d1677a9b2904921be19a9e
refs/heads/master
2021-01-13T02:22:42.397072
2011-12-11T22:50:37
2011-12-11T22:50:37
2,832,079
2
1
null
null
null
null
UTF-8
C++
false
false
704
h
/* mbed Microcontroller Library - FileLike * Copyright (c) 2008-2009 ARM Limited. All rights reserved. */ #ifndef MBED_FILELIKE_H #define MBED_FILELIKE_H #include "Base.h" #include "FileHandle.h" namespace mbed { /* Class FileLike * A file-like object is one that can be opened with fopen by * fopen("/name", mode). It is intersection of the classes Base and * FileHandle. */ class FileLike : public Base, public FileHandle { public: /* Constructor FileLike * * Variables * name - The name to use to open the file. */ FileLike(const char *name) : Base(name) { } virtual ~FileLike(); }; } // namespace mbed #endif
[ [ [ 1, 33 ] ] ]
ca565c506a359a86cd47fd872a9ea307dacdfd29
b4bff7f61d078e3dddeb760e21174a781ed7f985
/Examples/Tutorial/ParticleSystem/01ParticleSystemDrawers.cpp
db13f773fbe6ba1f0a1249ba55fc6f3cee947ae9
[]
no_license
Langkamp/OpenSGToolbox
8283edb6074dffba477c2c4d632e954c3c73f4e3
5a4230441e68f001cdf3e08e9f97f9c0f3c71015
refs/heads/master
2021-01-16T18:15:50.951223
2010-05-19T20:24:52
2010-05-19T20:24:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,238
cpp
// General OpenSG configuration, needed everywhere #include "OSGConfig.h" // A little helper to simplify scene management and interaction #include "OSGSimpleSceneManager.h" #include "OSGNode.h" #include "OSGGroup.h" #include "OSGViewport.h" #include "OSGWindowUtils.h" // Input #include "OSGKeyListener.h" #include "OSGBlendChunk.h" #include "OSGPointChunk.h" #include "OSGChunkMaterial.h" #include "OSGMaterialChunk.h" #include "OSGParticleSystem.h" #include "OSGParticleSystemCore.h" #include "OSGPointParticleSystemDrawer.h" #include "OSGLineParticleSystemDrawer.h" #include "OSGQuadParticleSystemDrawer.h" #include "OSGDiscParticleSystemDrawer.h" // Activate the OpenSG namespace OSG_USING_NAMESPACE // The SimpleSceneManager to manage simple applications SimpleSceneManager *mgr; WindowEventProducerRefPtr TutorialWindow; // Forward declaration so we can have the interesting stuff upfront void display(void); void reshape(Vec2f Size); //Particle System Drawer ParticleSystemCoreRefPtr ParticleNodeCore; PointParticleSystemDrawerRefPtr ExamplePointParticleSystemDrawer; LineParticleSystemDrawerRefPtr ExampleLineParticleSystemDrawer; QuadParticleSystemDrawerRefPtr ExampleQuadParticleSystemDrawer; DiscParticleSystemDrawerRefPtr ExampleDiscParticleSystemDrawer; bool StatisticsOn(false); // Create a class to allow for the use of the Ctrl+q class TutorialKeyListener : public KeyListener { public: virtual void keyPressed(const KeyEventUnrecPtr e) { if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL) { TutorialWindow->closeWindow(); } } virtual void keyReleased(const KeyEventUnrecPtr e) { } virtual void keyTyped(const KeyEventUnrecPtr e) { switch(e->getKey()) { case KeyEvent::KEY_1: // Use the Point Drawer ParticleNodeCore->setDrawer(ExamplePointParticleSystemDrawer); break; case KeyEvent::KEY_2://Use the Line Drawer for 2 ParticleNodeCore->setDrawer(ExampleLineParticleSystemDrawer); break; case KeyEvent::KEY_3://Use the Quad Drawer for 3 ParticleNodeCore->setDrawer(ExampleQuadParticleSystemDrawer); break; case KeyEvent::KEY_4://Use the Disc Drawer for 4 ParticleNodeCore->setDrawer(ExampleDiscParticleSystemDrawer); break; case KeyEvent::KEY_S://Toggle the statistics StatisticsOn = !StatisticsOn; mgr->setStatistics(StatisticsOn); break; } } }; class TutorialMouseListener : public MouseListener { public: virtual void mouseClicked(const MouseEventUnrecPtr e) { } virtual void mouseEntered(const MouseEventUnrecPtr e) { } virtual void mouseExited(const MouseEventUnrecPtr e) { } virtual void mousePressed(const MouseEventUnrecPtr e) { mgr->mouseButtonPress(e->getButton(), e->getLocation().x(), e->getLocation().y()); } virtual void mouseReleased(const MouseEventUnrecPtr e) { mgr->mouseButtonRelease(e->getButton(), e->getLocation().x(), e->getLocation().y()); } }; class TutorialMouseMotionListener : public MouseMotionListener { public: virtual void mouseMoved(const MouseEventUnrecPtr e) { mgr->mouseMove(e->getLocation().x(), e->getLocation().y()); } virtual void mouseDragged(const MouseEventUnrecPtr e) { mgr->mouseMove(e->getLocation().x(), e->getLocation().y()); } }; int main(int argc, char **argv) { // OSG init osgInit(argc,argv); // Set up Window TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); TutorialWindow->setDisplayCallback(display); TutorialWindow->setReshapeCallback(reshape); //Add Key Listener TutorialKeyListener TheKeyListener; TutorialWindow->addKeyListener(&TheKeyListener); //Add Mouse Listeners TutorialMouseListener TheTutorialMouseListener; TutorialMouseMotionListener TheTutorialMouseMotionListener; TutorialWindow->addMouseListener(&TheTutorialMouseListener); TutorialWindow->addMouseMotionListener(&TheTutorialMouseMotionListener); // Create the SimpleSceneManager helper mgr = new SimpleSceneManager; // Tell the Manager what to manage mgr->setWindow(TutorialWindow); //Particle System Material PointChunkRefPtr PSPointChunk = PointChunk::create(); PSPointChunk->setSize(5.0f); PSPointChunk->setSmooth(true); BlendChunkRefPtr PSBlendChunk = BlendChunk::create(); PSBlendChunk->setSrcFactor(GL_SRC_ALPHA); PSBlendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); MaterialChunkRefPtr PSMaterialChunkChunk = MaterialChunk::create(); PSMaterialChunkChunk->setAmbient(Color4f(0.5f,0.5f,0.5f,0.3f)); PSMaterialChunkChunk->setDiffuse(Color4f(0.8f,0.8f,0.8f,0.3f)); PSMaterialChunkChunk->setSpecular(Color4f(1.0f,1.0f,1.0f,0.3f)); PSMaterialChunkChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ChunkMaterialRefPtr PSMaterial = ChunkMaterial::create(); PSMaterial->addChunk(PSPointChunk); PSMaterial->addChunk(PSMaterialChunkChunk); PSMaterial->addChunk(PSBlendChunk); //Particle System ParticleSystemRefPtr ExampleParticleSystem = ParticleSystem::create(); for(UInt32 i(0) ; i<10 ; ++i) { ExampleParticleSystem->addParticle(Pnt3f(i,i,i), Vec3f(0.0,0.0f,1.0f), Color4f(1.0,0.0,0.0,0.5), Vec3f(1.0,1.0,1.0), -1.0, Vec3f(0.0f,0.0f,0.0f), //Velocity Vec3f(0.0f,0.0f,0.0f) ); } ExampleParticleSystem->attachUpdateListener(TutorialWindow); //Particle System Drawer //Point ExamplePointParticleSystemDrawer = PointParticleSystemDrawer::create(); //ExamplePointParticleSystemDrawer->setForcePerParticleSizing(true); //Line ExampleLineParticleSystemDrawer = LineParticleSystemDrawer::create(); ExampleLineParticleSystemDrawer->setLineDirectionSource(LineParticleSystemDrawer::DIRECTION_NORMAL);//DIRECTION_VELOCITY_CHANGE); ExampleLineParticleSystemDrawer->setLineLengthSource(LineParticleSystemDrawer::LENGTH_SIZE_X); //Quad ExampleQuadParticleSystemDrawer = QuadParticleSystemDrawer::create(); //Disc ExampleDiscParticleSystemDrawer = DiscParticleSystemDrawer::create(); ExampleDiscParticleSystemDrawer->setSegments(16); ExampleDiscParticleSystemDrawer->setCenterAlpha(1.0); ExampleDiscParticleSystemDrawer->setEdgeAlpha(0.0); //Particle System Node ParticleNodeCore = ParticleSystemCore::create(); ParticleNodeCore->setSystem(ExampleParticleSystem); ParticleNodeCore->setDrawer(ExampleLineParticleSystemDrawer); ParticleNodeCore->setMaterial(PSMaterial); NodeRefPtr ParticleNode = Node::create(); ParticleNode->setCore(ParticleNodeCore); // Make Main Scene Node NodeRefPtr scene = Node::create(); scene->setCore(Group::create()); scene->addChild(ParticleNode); mgr->setRoot(scene); // Show the whole Scene mgr->showAll(); //Open Window Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f); Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5); TutorialWindow->openWindow(WinPos, WinSize, "01ParticleSystemDrawers"); commitChanges(); //Enter main Loop TutorialWindow->mainLoop(); osgExit(); return 0; } // Callback functions // Redraw the window void display(void) { mgr->redraw(); } // React to size changes void reshape(Vec2f Size) { mgr->resize(Size.x(), Size.y()); }
[ [ [ 1, 258 ] ] ]
598ec3859093e729bb43515752288fa9ffb1dff4
2de257be8dc9ffc70dd28988e7a9f1b64519b360
/tags/rds-0.8/jet/java/FileHeader.inc
1f9e6a8d676cdf04d9b6e2a118e21e06b910e835
[]
no_license
MichalLeonBorsuk/datascript-svn
f141e5573a1728b006a13a0852a5ebb0495177f8
8a89530c50cdfde43696eb7309767d45979e2f40
refs/heads/master
2020-04-13T03:11:45.133544
2010-04-06T13:04:03
2010-04-06T13:04:03
162,924,533
0
1
null
2018-12-23T21:18:53
2018-12-23T21:18:52
null
UTF-8
C++
false
false
2,245
inc
// Automatically generated // DO NOT EDIT /* BSD License * * Copyright (c) 2006, Harald Wellmann, Harman/Becker Automotive Systems * All rights reserved. * * This software is derived from previous work * Copyright (c) 2003, Godmar Back. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Harman/Becker Automotive Systems or * Godmar Back nor the names of their contributors may be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ <% if (pkg != null) {%> package <%=pkg%>; import datascript.runtime.*; import datascript.runtime.array.*; import datascript.runtime.io.*; import java.io.IOException; import java.math.BigInteger; import java.util.Vector; <% String rootPkg = datascript.ast.Package.getRoot().getPackageName(); %> import <%=rootPkg%>.*; <% } %>
[ "hwellmann@7eccfe4a-4f19-0410-86c7-be9599f3b344" ]
[ [ [ 1, 60 ] ] ]
c19cc4eef9d0558eb968b9ca895f47ce3c52a87b
0660b138f6d145882d49a10d15a59b95084b8d34
/include/lgp/dicebag.hpp
dd2406897250a03baff347562827df18ce072c70
[]
no_license
burlingk/libgamepieces
9d59c3a5be0fcb0e6b19d1fb8f538cac71c331d9
b091a74cb5b92cf1091723147a6f5db3e3df96c2
refs/heads/master
2021-01-25T10:11:44.164016
2011-08-19T02:30:19
2011-08-19T02:30:19
1,541,608
1
0
null
null
null
null
UTF-8
C++
false
false
4,814
hpp
/// \file lgp_dicebag.hpp /// \brief A set of functions to deal with randome numbers. /// \author Kenneth. M. Burling Jr. (a.k.a Emry) /// \version Alpha-0.001 /// /// copyright: Copyright &copy; 2008, 2009, 2010 K. M. Burling Jr.<br> /// All Rights Reserved /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided that /// the following conditions are met: /// /// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. /// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following /// disclaimer in the documentation and/or other materials provided with the distribution. /// * Neither the name of the libgamepieces project team, nor the names of its contributors may be used to endorse or /// promote products derived from this software without specific prior written permission. /// /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, /// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE /// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, /// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR /// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, /// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE /// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /// /// lgp_dicebag.hpp and lgp_dicebag.cpp are part of libegamepieces. They /// contain a handfull of basic functions for dealign with random numbers /// in an RPG related manner. They are designed to simulate a bag of dice. /// /// libgamepieces is a library of tools to help build an RPG that I want to create. /// /// File last updated 13:43 UTC on 13 Jan 2011 #ifndef LGP_DICEBAG_HPP_ #define LGP_DICEBAG_HPP_ #include <lgp/exceptions.hpp> /// \namespace lgp /// \brief The namespace used for holding components of the libgamepieces library. /// /// This namespace will be used to hold the parts of the libgamepieces library. Some /// of these parts will be in the form of functions, and others will be classes. namespace lgp { /// \brief a single generic die roll. /// /// Takes a single integer as the argument representing the number of sides that the die has. /// The return value is a number between 1 and sides, representing the number rolled on the die. /// This function represents a single unmodified die roll, and also serves as the core of the other /// dice related functions. int dX(int sides); /*throw(InvalidValueException)*/ /// \brief Nd100. Number defaults to 1, and mods defaults to 0. If you want to use a modifier /// though, you have to include number, even if it is just 1. /// /// /// example: d100(); returns 1d100 /// d100(2); returns 2d100 /// d100(1,10); returns 1d100 + 10 /// d100(,10); is a syntax error /// The same format is used for the other related functions. int d100(int number, int mods); /// \brief Nd30 int d30(int number, int mods); /// \brief Nd20 int d20(int number, int mods); /// \brief Nd12 int d12(int number, int mods); /// \brief Nd10 int d10(int number, int mods); /// \brief Nd8 int d8(int number, int mods); /// \brief Nd6 int d6(int number, int mods); /// \brief Nd4 int d4(int number, int mods); /// \brief Nd3 int d3(int number, int mods); /// \brief NdF /// /// dF() represents a roll of fudge dice. Each roll of a dF returns a value between -1 and +1 int dF(int dice); /*throw(InvalidValueException)*/ //Following are helper functions to make code more readable. /// \brief If the value is less than 1, it raises an exception. /// /// The parameters are so that the calling function can set it up and not have to manually type every /// line every time. Standard usage would be similar to: /// /// try{lessThanOneExceptionCheck(sides, "sides", "int dX(int)", "lgp_dicebag.cpp");} /// catch(InvalidValueException exception){throw;} /// /// assume sides = -3 /// this would set exception.getMessagbe() to return "Exception: Invalid value (-3) privided for sides in function 'int dX(int)' in file lgp_dicebag.cpp." /// } #endif /* LGP_DICEBAG_HPP_ */
[ [ [ 1, 118 ] ] ]
b08741ec4b013f25dfa2e955ab76736d8c2908f8
e07af5d5401cec17dc0bbf6dea61f6c048f07787
/observer.hpp
31e526de81170b6d329b74cf22340692300d7756
[]
no_license
Mosesofmason/nineo
4189c378026f46441498a021d8571f75579ce55e
c7f774d83a7a1f59fde1ac089fde9aa0b0182d83
refs/heads/master
2016-08-04T16:33:00.101017
2009-12-26T15:25:54
2009-12-26T15:25:54
32,200,899
0
0
null
null
null
null
UTF-8
C++
false
false
943
hpp
#ifndef __NEXT_NINEO_OBSERVER_DEFINE__ #define __NEXT_NINEO_OBSERVER_DEFINE__ #include <wx/wx.h> #include <vector> namespace NiUtils { class ObClient; class ObServer; class ObClient { protected: ObServer* m_server; friend class ObServer; virtual void ObUpdate ( ObServer& server, const int& uid = 0 ) = 0; public: ObClient (); ~ObClient (); }; class ObServer { private: typedef std::vector <ObClient*> ObClientList; ObClientList m_clientlist; bool HasClient ( ObClient* client ); protected: void ObUpdate ( const int& uid = 0 ); public: ObServer (); ~ObServer (); ObServer& operator+= ( ObClient* client ); ObServer& operator-= ( ObClient* client ); }; } #endif //
[ [ [ 1, 40 ] ] ]
fbdc9f0897b13ab503b6167e167af9156f8d0ec6
0b66a94448cb545504692eafa3a32f435cdf92fa
/tags/0.6/cbear.berlios.de/range/arrayz_range.hpp
88dabd7ab450eac64729fcf7b8e2abf99070eb4f
[ "MIT" ]
permissive
BackupTheBerlios/cbear-svn
e6629dfa5175776fbc41510e2f46ff4ff4280f08
0109296039b505d71dc215a0b256f73b1a60b3af
refs/heads/master
2021-03-12T22:51:43.491728
2007-09-28T01:13:48
2007-09-28T01:13:48
40,608,034
0
0
null
null
null
null
UTF-8
C++
false
false
1,542
hpp
/* The MIT License Copyright (c) 2005 C Bear (http://cbear.berlios.de) 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. */ #ifndef CBEAR_BERLIOS_DE_RANGE_ARRAYZ_RANGE_HPP_INCLUDED #define CBEAR_BERLIOS_DE_RANGE_ARRAYZ_RANGE_HPP_INCLUDED #include <cbear.berlios.de/range/iterator_range.hpp> namespace cbear_berlios_de { namespace range { template<class V> iterator_range<V *> make_arrayz_range(V *B) { iterator_range<V *> R(B, B); if(!B) return R; for(; *R.end() != 0; ++R.end()); return R; } } } #endif
[ "sergey_shandar@e6e9985e-9100-0410-869a-e199dc1b6838" ]
[ [ [ 1, 45 ] ] ]
b06dd9338d8dcfdf0db4bc0600b0b16acfc9c20b
611169056d3316b2771b2640af675c762780ff1b
/drv/channel/eventqueue.cpp
27794edb34f70171d102338703e657449d93bca5
[]
no_license
trietptm/accessch
9dea3ea07793febe6ed84302d87ce7b8184e766d
4c4f4f4ba6038ee01811b34dfd5f33003b1080af
refs/heads/master
2021-01-10T01:59:39.303722
2011-08-22T08:09:14
2011-08-22T08:09:14
54,322,896
1
0
null
null
null
null
UTF-8
C++
false
false
3,152
cpp
#include "../inc/commonkrnl.h" #include "../inc/memmgr.h" #include "eventqueue.h" // static block ULONG QueuedItem::m_AllocTag = 'iqSA'; LONG QueuedItem::m_EventId; LIST_ENTRY QueuedItem::m_QueueItems; EX_PUSH_LOCK QueuedItem::m_QueueLock; void QueuedItem::Initialize ( ) { m_EventId = 0; InitializeListHead( &m_QueueItems ); FltInitializePushLock( &m_QueueLock ); }; void QueuedItem::Destroy ( ) { ASSERT( IsListEmpty( &m_QueueItems ) ); } __checkReturn NTSTATUS QueuedItem::Add ( __in PVOID Event, __drv_when(return==0, __deref_out_opt __drv_valueIs(!=0)) QueuedItem **Item ) { ASSERT( ARGUMENT_PRESENT( Event ) ); ASSERT( ARGUMENT_PRESENT( Item ) ); QueuedItem *pItem = (QueuedItem*) ExAllocatePoolWithTag( PagedPool, sizeof( QueuedItem ), m_AllocTag ); if ( !pItem ) { return STATUS_INSUFFICIENT_RESOURCES; } pItem->QueuedItem::QueuedItem( Event ); FltAcquirePushLockExclusive( &m_QueueLock ); InsertTailList( &m_QueueItems, &pItem->m_List ); FltReleasePushLock( &m_QueueLock ); *Item = pItem; return STATUS_SUCCESS; } __checkReturn NTSTATUS QueuedItem::Lookup ( __in ULONG EventId, __drv_when(return==0, __deref_out_opt __drv_valueIs(!=0)) QueuedItem **Item ) { NTSTATUS status = STATUS_NOT_FOUND; QueuedItem *pItem = NULL; ASSERT( ARGUMENT_PRESENT( Item ) ); FltAcquirePushLockShared( &m_QueueLock ); if ( !IsListEmpty( &m_QueueItems ) ) { PLIST_ENTRY Flink; Flink = m_QueueItems.Flink; while ( Flink != &m_QueueItems ) { pItem = CONTAINING_RECORD( Flink, QueuedItem, m_List ); Flink = Flink->Flink; if ( pItem->GetId() == EventId ) { *Item = pItem; status = pItem->Acquire(); break; } } } FltReleasePushLock( &m_QueueLock ); return status; } // end static block QueuedItem::QueuedItem ( __in PVOID Data ) { m_Id = InterlockedIncrement( &m_EventId ); if ( !m_Id ) { m_Id = InterlockedIncrement( &m_EventId ); } ExInitializeRundownProtection( &m_Ref ); m_Data = Data; } QueuedItem::~QueuedItem ( ) { ExRundownCompleted( &m_Ref ); } void QueuedItem::WaitAndDestroy ( ) { FltAcquirePushLockExclusive( &m_QueueLock ); RemoveEntryList( &m_List ); FltReleasePushLock( &m_QueueLock ); WaitForRelease(); PVOID ptr = this; FREE_POOL( ptr ); } ULONG QueuedItem::GetId ( ) { return m_Id; }; NTSTATUS QueuedItem::Acquire ( ) { if ( ExAcquireRundownProtection( &m_Ref ) ) { return STATUS_SUCCESS; } return STATUS_UNSUCCESSFUL; } void QueuedItem::WaitForRelease ( ) { ExWaitForRundownProtectionRelease( &m_Ref ); } void QueuedItem::Release ( ) { ExReleaseRundownProtection( &m_Ref ); }
[ "andrey.sobko@202ed0b6-6a49-11de-80b8-55702d16276a", "Andrey.Sobko@202ed0b6-6a49-11de-80b8-55702d16276a" ]
[ [ [ 1, 2 ], [ 37, 37 ] ], [ [ 3, 36 ], [ 38, 166 ] ] ]
22fa4d70420729d46c16c4b6d5936af1cde7976e
f9774f8f3c727a0e03c170089096d0118198145e
/传奇mod/Mir2ExCode/Mir2/Common/ChatEditBox.h
8ad6ad8427fdd2b885941efc623269f9716ac5c4
[]
no_license
sdfwds4/fjljfatchina
62a3bcf8085f41d632fdf83ab1fc485abd98c445
0503d4aa1907cb9cf47d5d0b5c606df07217c8f6
refs/heads/master
2021-01-10T04:10:34.432964
2010-03-07T09:43:28
2010-03-07T09:43:28
48,106,882
1
1
null
null
null
null
UHC
C++
false
false
1,499
h
/****************************************************************************************************************** 모듈명: 작성자: 작성일: [일자][수정자] : 수정 내용 *******************************************************************************************************************/ #ifndef _CHATEDITBOX_H #define _CHATEDITBOX_H class CChatEdit { //1: Constructor/Destructor public: CChatEdit(); ~CChatEdit(); protected: HWND m_hChatEdit; HWND m_hMainWindow; HFONT m_hFontChatEdit; DWORD m_dwFontColor; WNDPROC m_WndProcChatEdit; public: CHAR m_szInputMsg[MAX_PATH]; __inline HWND GetSafehWnd() { return m_hChatEdit; } BOOL Create(HINSTANCE hInstance, HWND hWndParent, INT nX, INT nY, INT nXsize, INT nYSize); BOOL DestroyDialog(); BOOL SetLimitText(INT nLimitText); __inline VOID SetSelectAll() { SendMessage(m_hChatEdit, EM_SETSEL, 0, (LPARAM)-1); } public: //4: Message Map virtual LRESULT CALLBACK ChatEditProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); public: }; #endif // _CHATEDITBOX
[ "fjljfat@4a88d1ba-22b1-11df-8001-4f4b503b426e" ]
[ [ [ 1, 48 ] ] ]
a3b7a9b7600f1629fb7d04686bac65303334280d
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/branches/persistence2/engine/core/include/LightObject.h
dd5418b78ab2fa85d6e78902ee02ccb5f54a0890
[ "ClArtistic", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
jacmoe/dsa-hl-svn
55b05b6f28b0b8b216eac7b0f9eedf650d116f85
97798e1f54df9d5785fb206c7165cd011c611560
refs/heads/master
2021-04-22T12:07:43.389214
2009-11-27T22:01:03
2009-11-27T22:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,184
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2008 Team Pantheon. http://www.team-pantheon.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the Clarified Artistic License. * * 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 * Clarified Artistic License for more details. * * You should have received a copy of the Clarified Artistic License * along with this program; if not you can get it here * http://www.jpaulmorrison.com/fbp/artistic2.htm. */ #ifndef __LightObject_H__ #define __LightObject_H__ #include "CorePrerequisites.h" #include "ActorControlledObject.h" namespace rl { class _RlCoreExport LightObject : public ActorControlledObject { public: /// Defines the type of light enum LightTypes { LT_POINT, LT_DIRECTIONAL, LT_SPOTLIGHT }; LightObject(const Ogre::String& name, rl::LightObject::LightTypes type); virtual ~LightObject(); /// Wie ActorControlledObject::getMovableObject() /// Nur schon gebrauchsfertig gecastet. Ogre::Light* getLight() const; virtual Ogre::String getObjectType() const; void setAttenuation(Ogre::Real range, Ogre::Real constant, Ogre::Real linear, Ogre::Real quadric); void setDiffuseColour(Ogre::Real red, Ogre::Real green, Ogre::Real blue); void setDiffuseColour(const Ogre::ColourValue& colour); Ogre::ColourValue getDiffuseColour() const; void setSpecularColour(Ogre::Real red, Ogre::Real green, Ogre::Real blue); void setSpecularColour(const Ogre::ColourValue& colour); Ogre::ColourValue getSpecularColour() const; void setDirection(Ogre::Real x, Ogre::Real y, Ogre::Real z); void setDirection(const Ogre::Vector3& direction); void setSpotlightRange(Ogre::Real innerAngle, Ogre::Real outerAngle, Ogre::Real falloff = 1.0); void setCastShadows(bool castShadows); }; } #endif
[ "timm@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 56 ] ] ]
ed9ea2da7610e7ca0790126ef2677f94a99637f3
b816fdbc7bb0da01eb39346b9b787c028791afec
/Project Panda/src/mechanics/eating/Weight.h
346c587715ace367d9bfa9290787124b5456bb68
[]
no_license
martinpinto/Project-Panda
0537feac43574ae3453d0228638fed7015a44116
f1db30b885a7557e59974323035e3a411072f060
refs/heads/master
2021-01-25T12:19:27.325670
2011-11-19T17:54:12
2011-11-19T17:54:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
227
h
/* * Weight.h * * Created on: 24.10.2011 * Author: Martin Pinto-Bazurco * */ #ifndef WEIGHT_H_ #define WEIGHT_H_ class Weight { public: Weight(); virtual ~Weight(); }; #endif /* WEIGHT_H_ */
[ [ [ 1, 20 ] ] ]
53a1a9507ffbfec5dfbaae3df8819dccf783c45e
1eb0e6d7119d33fa76bdad32363483d0c9ace9b2
/PointCloud/trunk/PointCloud/ANN/perf.cpp
3912860d33c7a6fe3bd47706a5d0d53bd597f1f8
[]
no_license
kbdacaa/point-clouds-mesh
90f174a534eddb373a1ac6f5481ee7a80b05f806
73b6bc17aa5c597192ace1a3356bff4880ca062f
refs/heads/master
2016-09-08T00:22:30.593144
2011-06-04T01:54:24
2011-06-04T01:54:24
41,203,780
0
2
null
null
null
null
UTF-8
C++
false
false
5,512
cpp
#include "stdafx.h" //---------------------------------------------------------------------- // File: perf.cpp // Programmer: Sunil Arya and David Mount // Description: Methods for performance stats // Last modified: 01/27/10 (Version 1.1.2) //---------------------------------------------------------------------- // Copyright (c) 1997-2010 University of Maryland and Sunil Arya and // David Mount. All Rights Reserved. // // This software and related documentation is part of the Approximate // Nearest Neighbor Library (ANN). This software is provided under // the provisions of the Lesser GNU Public License (LGPL). See the // file ../ReadMe.txt for further information. // // The University of Maryland (U.M.) and the authors make no // representations about the suitability or fitness of this software for // any purpose. It is provided "as is" without express or implied // warranty. //---------------------------------------------------------------------- // History: // Revision 0.1 03/04/98 // Initial release // Revision 1.0 04/01/05 // Changed names to avoid namespace conflicts. // Added flush after printing performance stats to fix bug // in Microsoft Windows version. // Revision 1.1.2 01/27/10 // Fixed minor compilation bugs for new versions of gcc //---------------------------------------------------------------------- #include "ANN.h" // basic ANN includes #include "ANNperf.h" // performance includes using namespace std; // make std:: available //---------------------------------------------------------------------- // Performance statistics // The following data and routines are used for computing // performance statistics for nearest neighbor searching. // Because these routines can slow the code down, they can be // activated and deactiviated by defining the PERF variable, // by compiling with the option: -DPERF //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Global counters for performance measurement //---------------------------------------------------------------------- int ann_Ndata_pts = 0; // number of data points int ann_Nvisit_lfs = 0; // number of leaf nodes visited int ann_Nvisit_spl = 0; // number of splitting nodes visited int ann_Nvisit_shr = 0; // number of shrinking nodes visited int ann_Nvisit_pts = 0; // visited points for one query int ann_Ncoord_hts = 0; // coordinate hits for one query int ann_Nfloat_ops = 0; // floating ops for one query ANNsampStat ann_visit_lfs; // stats on leaf nodes visits ANNsampStat ann_visit_spl; // stats on splitting nodes visits ANNsampStat ann_visit_shr; // stats on shrinking nodes visits ANNsampStat ann_visit_nds; // stats on total nodes visits ANNsampStat ann_visit_pts; // stats on points visited ANNsampStat ann_coord_hts; // stats on coordinate hits ANNsampStat ann_float_ops; // stats on floating ops // ANNsampStat ann_average_err; // average error ANNsampStat ann_rank_err; // rank error //---------------------------------------------------------------------- // Routines for statistics. //---------------------------------------------------------------------- DLL_API void annResetStats(int data_size) // reset stats for a set of queries { ann_Ndata_pts = data_size; ann_visit_lfs.reset(); ann_visit_spl.reset(); ann_visit_shr.reset(); ann_visit_nds.reset(); ann_visit_pts.reset(); ann_coord_hts.reset(); ann_float_ops.reset(); ann_average_err.reset(); ann_rank_err.reset(); } DLL_API void annResetCounts() // reset counts for one query { ann_Nvisit_lfs = 0; ann_Nvisit_spl = 0; ann_Nvisit_shr = 0; ann_Nvisit_pts = 0; ann_Ncoord_hts = 0; ann_Nfloat_ops = 0; } DLL_API void annUpdateStats() // update stats with current counts { ann_visit_lfs += ann_Nvisit_lfs; ann_visit_nds += ann_Nvisit_spl + ann_Nvisit_lfs; ann_visit_spl += ann_Nvisit_spl; ann_visit_shr += ann_Nvisit_shr; ann_visit_pts += ann_Nvisit_pts; ann_coord_hts += ann_Ncoord_hts; ann_float_ops += ann_Nfloat_ops; } // print a single statistic void print_one_stat(const char* title, ANNsampStat s, double div) { cout << title << "= [ "; cout.width(9); cout << s.mean()/div << " : "; cout.width(9); cout << s.stdDev()/div << " ]<"; cout.width(9); cout << s.min()/div << " , "; cout.width(9); cout << s.max()/div << " >\n"; } DLL_API void annPrintStats( // print statistics for a run ANNbool validate) // true if average errors desired { cout.precision(4); // set floating precision cout << " (Performance stats: " << " [ mean : stddev ]< min , max >\n"; print_one_stat(" leaf_nodes ", ann_visit_lfs, 1); print_one_stat(" splitting_nodes ", ann_visit_spl, 1); print_one_stat(" shrinking_nodes ", ann_visit_shr, 1); print_one_stat(" total_nodes ", ann_visit_nds, 1); print_one_stat(" points_visited ", ann_visit_pts, 1); print_one_stat(" coord_hits/pt ", ann_coord_hts, ann_Ndata_pts); print_one_stat(" floating_ops_(K) ", ann_float_ops, 1000); if (validate) { print_one_stat(" average_error ", ann_average_err, 1); print_one_stat(" rank_error ", ann_rank_err, 1); } cout.precision(0); // restore the default cout << " )\n"; cout.flush(); }
[ "huangchunkuangke@e87e5053-baee-b2b1-302d-3646b6e6cf75" ]
[ [ [ 1, 137 ] ] ]
8ca9cd9b9393fa977213a82b2c99890688d97cda
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Common/Base/Reflection/Registry/hkVtableClassRegistry.h
aecf6460d5d358a3e3a8357ce612a070f05db82b
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
2,902
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_VTABLE_CLASS_REGISTRY_H #define HK_VTABLE_CLASS_REGISTRY_H #include <Common/Base/Container/PointerMap/hkPointerMap.h> #include <Common/Base/Reflection/hkTypeInfo.h> /// Registry of vtables to hkClass instances. class hkVtableClassRegistry : public hkReferencedObject, public hkSingleton<hkVtableClassRegistry> { public: hkVtableClassRegistry() {} /// Associate vtable with the given hkClass. virtual void registerVtable( const void* vtable, const hkClass* klass ) { HK_ASSERT2(0x2e231c83, vtable!=HK_NULL, "Nonvirtual classes should not be registered"); m_map.insert(vtable, klass); } /// Get the class from an object instance which has a vtable. virtual const hkClass* getClassFromVirtualInstance( const void* obj ) const { return m_map.getWithDefault( *reinterpret_cast<const void*const*>(obj), HK_NULL ); } /// Register each vtable from "infos" with the corresponding class from "classes". /// The list is terminated by the first null info or class. void registerList( const hkTypeInfo* const * infos, const hkClass* const * classes); /// Merges all entries from "copyFrom". (potentially overwriting local entries) void merge(const hkVtableClassRegistry& mergeFrom); /// Get array of registered classes, e.g. to iterate through them. virtual void getClasses( hkArray<const hkClass*>& classes ) const { hkPointerMap<const void*, const hkClass*>::Iterator iter = m_map.getIterator(); while (m_map.isValid(iter)) { classes.pushBack(m_map.getValue(iter)); iter = m_map.getNext(iter); } } protected: hkPointerMap<const void*, const hkClass*> m_map; }; #endif // HK_VTABLE_CLASS_REGISTRY_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
[ [ [ 1, 72 ] ] ]
a85521f739991012a936ba99f5924def8feb9955
3c4f5bd6d7ac3878c181fb05ab41c1d755ddf343
/Ext_Math.cpp
f6bc6bba15c87a8aa6f04e5f41f872b77cae1ba3
[]
no_license
imcooder/public
1078df18c1459e67afd1200346dd971ea3b71933
be947923c6e2fbd9c993a41115ace3e32dad74bf
refs/heads/master
2021-05-28T08:43:00.027020
2010-07-24T07:39:51
2010-07-24T07:39:51
32,301,120
2
1
null
null
null
null
GB18030
C++
false
false
11,304
cpp
/******************************************************************** Copyright (c) 2002-2003 汉王科技有限公司. 版权所有. 文件名称: Ext_Math.h 文件内容: 简单的一些常用数学操作 版本历史: 1.0 作者: xuejuntao [email protected] 2008/02/26 *********************************************************************/ #include "stdafx.h" #include "Ext_Math.h" #include <cmath> LONG Mth_GetMinDist(const HWPoint &tPtA, const HWPoint &tPtB, const HWPoint &tPtC, HWPoint &tNearestPt) { HWPoint tPointAToB = HWPoint(tPtB.x - tPtA.x, tPtB.y - tPtA.y); HWPoint tPointAToC = HWPoint(tPtC.x - tPtA.x, tPtC.y - tPtA.y); double dM = tPointAToB.x * tPointAToC.x + tPointAToB.y * tPointAToC.y; double dN = tPointAToB.x * tPointAToB.x + tPointAToB.y * tPointAToB.y; double dDelta = dM / dN; if (dDelta < 0.0) { tNearestPt = tPtA; } else if (dDelta > 1.0) { tNearestPt = tPtB; } else { tNearestPt = tPointAToB; tNearestPt.x *= dDelta; tNearestPt.y *= dDelta; tNearestPt.x += tPtA.x; tNearestPt.y += tPtA.y; } return std::sqrt(1.0 * ( (tNearestPt.x - tPtC.x) * (tNearestPt.x - tPtC.x) + (tNearestPt.y - tPtC.y) * (tNearestPt.y - tPtC.y)) ); } long DivRound( long x, long div ) { return (x + (div >> 1)) / div; } long MulDivRound(long x, long mul, long div) { return (x * mul + (div >> 1)) / div; } //整数开方,没有系统自带的浮点开方快 long XSqrt(const long& n) { long i; long nSqrt = 0; LONG nRoot = n; for ( i = 0x10000000; i != 0; i >>= 2) { long nTemp = nSqrt + i; nSqrt >>= 1; if (nTemp <= nRoot) { nRoot -= nTemp; nSqrt += i; } } return nSqrt; } /*** *qsort.c - quicksort algorithm; qsort() library function for sorting arrays * * Copyright (c) 2003-2006, Hanwang Corporation. All rights reserved. * *Purpose: * To implement the qsort() routine for sorting arrays. * *******************************************************************************/ #define CUTOFF 8 /* testing shows that this is good value */ // variant for quick sort /*** *ZB_SwapIdx(a, b, nIdxWidth) - ZB_SwapIdx two elements * *Purpose: * swaps the two array elements of size nIdxWidth * *Entry: * char *a, *b = pointer to two elements to ZB_SwapIdx * unsigned nIdxWidth = nIdxWidth in bytes of each array element * *Exit: * returns void * *Exceptions: * *******************************************************************************/ void ZB_SwapIdx ( char *a, char *b, unsigned long nIdxWidth ) { char tmp; if ( a != b ) /* Do the ZB_SwapIdx one character at a time to avoid potential alignment problems. */ while ( nIdxWidth-- ) { tmp = *a; *a++ = *b; *b++ = tmp; } } /*** *qsort.c - quicksort algorithm; qsort() library function for sorting arrays * * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. * *Purpose: * To implement the qsort() routine for sorting arrays. * *******************************************************************************/ /*** *ZB_ShortSort(hi, lo, width, comp) - insertion sort for sorting short arrays * *Purpose: * sorts the sub-array of elements between lo and hi (inclusive) * side effects: sorts in place * assumes that lo < hi * *Entry: * char *lo = pointer to low element to sort * char *hi = pointer to high element to sort * unsigned width = width in bytes of each array element * long (*comp)() = pointer to function returning analog of strcmp for * strings, but supplied by user for comparing the array elements. * it accepts 2 pointers to elements and returns neg if 1<2, 0 if * 1=2, pos if 1>2. * *Exit: * returns void * *Exceptions: * *******************************************************************************/ void ZB_ShortSort ( char *lo, char *hi, unsigned long width, long (*comp)(const void *, const void *) ) { char *p, *max; /* Note: in assertions below, i and j are alway inside original bound of array to sort. */ while (hi > lo) { /* A[i] <= A[j] for i <= j, j > hi */ max = lo; for (p = lo+width; p <= hi; p += width) { /* A[i] <= A[max] for lo <= i < p */ if (comp(p, max) > 0) { max = p; } /* A[i] <= A[max] for lo <= i <= p */ } /* A[i] <= A[max] for lo <= i <= hi */ ZB_SwapIdx(max, hi, width); /* A[i] <= A[hi] for i <= hi, so A[i] <= A[j] for i <= j, j >= hi */ hi -= width; /* A[i] <= A[j] for i <= j, j > hi, loop top condition established */ } /* A[i] <= A[j] for i <= j, j > lo, which implies A[i] <= A[j] for i < j, so array is sorted */ } /* this parameter defines the cutoff between using quick sort and insertion sort for arrays; arrays with lengths shorter or equal to the below value use insertion sort */ /*** *qsort(base, num, wid, comp) - quicksort function for sorting arrays * *Purpose: * quicksort the array of elements * side effects: sorts in place * *Entry: * char *base = pointer to base of array * unsigned num = number of elements in the array * unsigned width = width in bytes of each array element * long (*comp)() = pointer to function returning analog of strcmp for * strings, but supplied by user for comparing the array elements. * it accepts 2 pointers to elements and returns neg if 1<2, 0 if * 1=2, pos if 1>2. * *Exit: * returns void * *Exceptions: * *******************************************************************************/ /* sort the array between lo and hi (inclusive) */ void XQsort ( void *base, long num, long width, long *pComp ) { char *lo, *hi; /* ends of sub-array currently sorting */ char *mid; /* points to middle of subarray */ char *loguy, *higuy; /* traveling pointers for partition step */ unsigned long size; /* size of the sub-array */ char *lostk[30], *histk[30]; long stkptr; /* stack for saving sub-array to be processed */ long (*comp)(const void *, const void *); comp = (long (*)(const void *, const void *))pComp; /* Note: the number of stack entries required is no more than 1 + log2(size), so 30 is sufficient for any array */ if (num < 2 || width == 0) return; /* nothing to do */ stkptr = 0; /* initialize stack */ lo = (char*)base; hi = (char *)base + width * (num-1); /* initialize limits */ /* this entry point is for pseudo-recursion calling: setting lo and hi and jumping to here is like recursion, but stkptr is prserved, locals aren't, so we preserve stuff on the stack */ recurse: size = (hi - lo) / width + 1; /* number of el's to sort */ /* below a certain size, it is faster to use a O(n^2) sorting method */ if (size <= CUTOFF) { ZB_ShortSort(lo, hi, width, comp); } else { /* First we pick a partititioning element. The efficiency of the algorithm demands that we find one that is approximately the median of the values, but also that we select one fast. Using the first one produces bad performace if the array is already sorted, so we use the middle one, which would require a very wierdly arranged array for worst case performance. Testing shows that a median-of-three algorithm does not, in general, increase performance. */ mid = lo + (size / 2) * width; /* find middle element */ ZB_SwapIdx(mid, lo, width); /* ZB_SwapIdx it to beginning of array */ /* We now wish to partition the array into three pieces, one consisiting of elements <= partition element, one of elements equal to the parition element, and one of element >= to it. This is done below; comments indicate conditions established at every step. */ loguy = lo; higuy = hi + width; /* Note that higuy decreases and loguy increases on every iteration, so loop must terminate. */ for (;;) { /* lo <= loguy < hi, lo < higuy <= hi + 1, A[i] <= A[lo] for lo <= i <= loguy, A[i] >= A[lo] for higuy <= i <= hi */ do { loguy += width; } while (loguy <= hi && comp(loguy, lo) <= 0); /* lo < loguy <= hi+1, A[i] <= A[lo] for lo <= i < loguy, either loguy > hi or A[loguy] > A[lo] */ do { higuy -= width; } while (higuy > lo && comp(higuy, lo) >= 0); /* lo-1 <= higuy <= hi, A[i] >= A[lo] for higuy < i <= hi, either higuy <= lo or A[higuy] < A[lo] */ if (higuy < loguy) break; /* if loguy > hi or higuy <= lo, then we would have exited, so A[loguy] > A[lo], A[higuy] < A[lo], loguy < hi, highy > lo */ ZB_SwapIdx(loguy, higuy, width); /* A[loguy] < A[lo], A[higuy] > A[lo]; so condition at top of loop is re-established */ } /* A[i] >= A[lo] for higuy < i <= hi, A[i] <= A[lo] for lo <= i < loguy, higuy < loguy, lo <= higuy <= hi implying: A[i] >= A[lo] for loguy <= i <= hi, A[i] <= A[lo] for lo <= i <= higuy, A[i] = A[lo] for higuy < i < loguy */ ZB_SwapIdx(lo, higuy, width); /* put partition element in place */ /* OK, now we have the following: A[i] >= A[higuy] for loguy <= i <= hi, A[i] <= A[higuy] for lo <= i < higuy A[i] = A[lo] for higuy <= i < loguy */ /* We've finished the partition, now we want to sort the subarrays [lo, higuy-1] and [loguy, hi]. We do the smaller one first to minimize stack usage. We only sort arrays of length 2 or more.*/ if ( higuy - 1 - lo >= hi - loguy ) { if (lo + width < higuy) { lostk[stkptr] = lo; histk[stkptr] = higuy - width; ++stkptr; } /* save big recursion for later */ if (loguy < hi) { lo = loguy; goto recurse; /* do small recursion */ } } else { if (loguy < hi) { lostk[stkptr] = loguy; histk[stkptr] = hi; ++stkptr; /* save big recursion for later */ } if (lo + width < higuy) { hi = higuy - width; goto recurse; /* do small recursion */ } } } /* We have sorted the array, except for any pending sorts on the stack. Check if there are any, and do them. */ --stkptr; if (stkptr >= 0) { lo = lostk[stkptr]; hi = histk[stkptr]; goto recurse; /* pop subarray from stack */ } else return; /* all subarrays done */ }
[ "jtxuee@716a2f10-c84c-11dd-bf7c-81814f527a11" ]
[ [ [ 1, 375 ] ] ]
1d47c979f0ed5c6fa48caad5e02ba4ea3976eb2c
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/zombie/zombieentity/src/conjurerentity/conjurerentity.cc
a7d35116a829cadddebe8e4a7fab9f67affe81d1
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
739
cc
#include "precompiled/pchzombieentity.h" //------------------------------------------------------------------------------ /** (C) 2005 Conjurer Services, S.A. */ //------------------------------------------------------------------------------ #pragma warning( disable : 4250 ) //------------------------------------------------------------------------------ #include "entity/nentity.h" #include "conjurerentity/conjurerentity.h" //------------------------------------------------------------------------------ /** Declaration of classes for all entity objects and classes */ #define N_DEFINE_NEBULA_ENTITY #include "conjurerentitylist.cc" #define N_DEFINE_NEBULA_ENTITY #pragma warning( default : 4250 )
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 22 ] ] ]
b48478907b8491eb9992513856c73873c71604a3
097c5aee657c0a538c001d7af10ed466a9d48bce
/miniBenchArm/cparser_sandra.cpp
7d25b20ebbd514b78836bdb412335d610fc67044
[]
no_license
sspeng/miniBench
711380a27c0a93960fb20a7d9ff902c6e40659cd
d37e76188beb9861106baee68d0a7f901b35c710
refs/heads/master
2020-03-20T09:05:52.929763
2011-08-15T05:29:11
2011-08-15T05:29:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,831
cpp
#include "cparser_sandra.h" cParser_Sandra::cParser_Sandra() { cerr << "cParser_Sandra created." << endl; } cParser_Sandra::~cParser_Sandra() { cerr << "cParser_Sandra destroyed." << endl; } QString cParser_Sandra::ParseInputString() { fqstrParsedResult = ""; ExtractProcessorArithmetic(); ExtractProcessorMultiMedia(); ExtractPowerManagement(); ExtractCryptography(); ExtractNetArithmetic(); ExtractNetMultiMedia(); ExtractVideoRendering(); ExtractMemoryBandwidth(); ExtractMemoryLatency(); ExtractCacheAndMemory(); ExtractFileSystems(); return fqstrParsedResult; } bool cParser_Sandra::SkipToTestResults( const QString TEST_LABEL ) { const QString BENCHMARK_RESULTS_LABEL = "< Benchmark Results >"; bool lboolLineFound = true; // initialize text stream: fInputTextStream.setString( &fqstrInputString ); QString lqstrReadLine = fInputTextStream.readLine(); // skip down to the test label: do { lqstrReadLine = fInputTextStream.readLine(); if( fInputTextStream.atEnd() ) { lboolLineFound = false; break; } } while( not lqstrReadLine.contains( TEST_LABEL ) ); if( lboolLineFound ) {// skip down to Benchmark Results: do { lqstrReadLine = fInputTextStream.readLine(); if( fInputTextStream.atEnd() || lqstrReadLine.contains( "<<<" ) ) // at end of file or at start of next test { lboolLineFound = false; break; } } while( not lqstrReadLine.contains( BENCHMARK_RESULTS_LABEL ) ); } return lboolLineFound; } // the following routine pulls in the result line and parses it: void cParser_Sandra::ParseResult(QString aqstrResultLabel, bool aboolLineFound) { QString lqstrStringSplitArray; QString lqstrReadLine; QString lqstrResult; if( aboolLineFound ) { lqstrReadLine = fInputTextStream.readLine(); if( fInputTextStream.atEnd() ) { lqstrResult = "0"; } else { QStringList lqslSplit = lqstrReadLine.split( SANDRA_RESULT_DELIMITER ); lqstrResult = lqslSplit.at(1); // 0-based index; get result } } else { lqstrResult = "0"; } if( fboolLabelResults ) { lqstrResult = aqstrResultLabel + OUTPUT_RESULT_DELIMITER + StripUnits(lqstrResult); } else { lqstrResult = StripUnits(lqstrResult); } cerr << lqstrResult.toStdString() << endl; fqstrParsedResult.append( lqstrResult + "\r\n" ); } void cParser_Sandra::ExtractProcessorArithmetic() { const QString TEST_LABEL = "<<< Processor Arithmetic >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); // Grab Aggregate Arithmetic Performance: ParseResult( "Aggregate Arithmetic (MOPS) ", lboolLineFound ); // Grab Dhrystone: ParseResult( "Dhrystone (MIPS) ", lboolLineFound ); // Grab Whetstone: ParseResult( "Whetstone (MFLOPS) ", lboolLineFound ); } void cParser_Sandra::ExtractProcessorMultiMedia() { const QString TEST_LABEL = "<<< Processor Multi-Media >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); // Grab Aggregate Multimedia Performance: ParseResult( "Aggregate Multi-Media (MOPS) ", lboolLineFound ); // Grab Multi-Media Int x8: ParseResult( "Multi-Media Int x8 (MIPS) ", lboolLineFound ); // Grab Multi-Media Float x4: ParseResult( "Multi-Media Float x4 (MFLOPS) ", lboolLineFound ); // Grab Multi-Media Double x2: ParseResult( "Multi-Media Double x2 (MFLOPS) ", lboolLineFound ); } void cParser_Sandra::ExtractPowerManagement() { const QString TEST_LABEL = "<<< Power Management Efficiency >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); // Grab ALU Power Performance: ParseResult( "ALU Power Performance (MIPS) ", lboolLineFound ); // Grab Power Efficiency: ParseResult( "Power Efficiency ", lboolLineFound ); } void cParser_Sandra::ExtractCryptography() { const QString TEST_LABEL = "<<< Cryptography >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Cryptographic Bandwidth (MB/s) ", lboolLineFound ); ParseResult( "AES256 (MB/s) ", lboolLineFound ); ParseResult( "SHA256 (MB/s) ", lboolLineFound ); } void cParser_Sandra::ExtractNetArithmetic() { const QString TEST_LABEL = "<<< .NET Arithmetic >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Aggregate .NET (MOPS) ", lboolLineFound ); ParseResult( "Dhrystone .NET (MIPS) ", lboolLineFound ); ParseResult( "Whetstone .NET (MFLOPS) ", lboolLineFound ); } void cParser_Sandra::ExtractNetMultiMedia() { const QString TEST_LABEL = "<<< .NET Multi-Media >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Aggregate Multi-Media .NET (MPixel/s) ", lboolLineFound ); ParseResult( "Multi-Media Int x1 .NET (MPixel/s) ", lboolLineFound ); ParseResult( "Multi-Media Float x1 .NET (MPixel/s) ", lboolLineFound ); ParseResult( "Multi-Media Double x1 .NET (MPixel/s) ", lboolLineFound ); } void cParser_Sandra::ExtractVideoRendering() { const QString TEST_LABEL = "<<< Video Rendering >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); if( lboolLineFound ) { lboolLineFound = SkipToTestResults( "Aggregate Shader (MPixel/s) " ); } ParseResult("Aggregate Shader (MPixel/s) ", lboolLineFound ); ParseResult("Dx10.1 (SM4.1) Float Shaders (MPixel/s) ", lboolLineFound ); ParseResult("Dx10.1 (SM4.1) Double Shaders (MPixel/s) ", lboolLineFound ); } void cParser_Sandra::ExtractFileSystems() { const QString TEST_LABEL = "<<< File Systems >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Drive Index (MB/s) ", lboolLineFound ); QString lqstrReadLine = fInputTextStream.readLine(); //skip the next line ParseResult( "Random Access Time", lboolLineFound ); } void cParser_Sandra::ExtractMemoryBandwidth() { const QString TEST_LABEL = "<<< Memory Bandwidth >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Aggregate Memory Performance (GB/s) ", lboolLineFound ); ParseResult( "Int Buffered Memory Bandwidth (GB/s) ", lboolLineFound ); ParseResult( "Float Buffered Memory Bandwidth (GB/s) ", lboolLineFound ); } void cParser_Sandra::ExtractMemoryLatency() { const QString TEST_LABEL = "<<< Memory Latency >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Memory Latency (ns) ", lboolLineFound ); ParseResult( "Speed Factor", lboolLineFound ); } void cParser_Sandra::ExtractCacheAndMemory() { const QString TEST_LABEL = "<<< Cache and Memory >>>"; bool lboolLineFound = SkipToTestResults( TEST_LABEL ); ParseResult( "Cache/Memory Bandwidth (GB/s) ", lboolLineFound ); QString lqstrReadLine = fInputTextStream.readLine(); //skip the next line ParseResult( "Speed Factor", lboolLineFound ); lqstrReadLine = fInputTextStream.readLine(); //skip the next line lqstrReadLine = fInputTextStream.readLine(); //skip the next line lqstrReadLine = fInputTextStream.readLine(); //skip the next line ParseResult( "L1 Data Cache (GB/s) ", lboolLineFound ); ParseResult( "L2 On-board Cache (GB/s) ", lboolLineFound ); } QString cParser_Sandra::StripUnits( QString aqstrFixUnits ) { const int ALL_UNITS = 12; const int BIG_UNITS = 3; // the first n elements need to be converted //const int LITTLE_UNITS = 1; const QString lqstrUnits[ ALL_UNITS ] = { "GOPS", "GIPS", "GFLOPS", "kPixels/s", "MPOS", "MIPS", "MFLOPS", "MPixel/s", "MB/s", "GB/s", "ns", "ms" }; double ldResult = 0.0; QString lqstrResult = "0"; QString lqstrUnitsReplaced = aqstrFixUnits; ldResult = aqstrFixUnits.toDouble(); if( ldResult == 0 ) { for( int i = 0; i < ALL_UNITS; i++ ) { cerr << aqstrFixUnits.toStdString() << endl; aqstrFixUnits.replace( lqstrUnits[ i ], "" ); cerr << aqstrFixUnits.toStdString() << endl; if( lqstrUnitsReplaced != aqstrFixUnits ) { ldResult = aqstrFixUnits.toDouble(); // bad unit was found, multiply by 1,000 if( i < BIG_UNITS ) { ldResult *= 1000; // convert giga to mega } if( i == BIG_UNITS ) { ldResult /= 1000; // convert kilo to mega } break; } } } lqstrResult.setNum( ldResult ); return lqstrResult; }
[ [ [ 1, 266 ] ] ]
f56ecea2ea73b623403a07991acde05a1e91f35e
20bf3095aa164d0d3431b73ead8a268684f14976
/cpp-labs/S2-5.CPP
6b2745091efa3d4998832f157d8210b9ac9e17e0
[]
no_license
collage-lab/mcalab-cpp
eb5518346f5c3b7c1a96627c621a71cc493de76d
c642f1f009154424f243789014c779b9fc938ce4
refs/heads/master
2021-08-31T10:28:59.517333
2006-11-10T23:57:09
2006-11-10T23:57:21
114,954,399
0
0
null
null
null
null
UTF-8
C++
false
false
333
cpp
#include<iostream.h> #include<conio.h> #include<math.h> void main() { int i,n; double sum=0,t; clrscr(); cout<<"\n\nEnter the count:-"; cin>>n; for(i=1;i<=n;i++) { cout<<"Number ["<<i<<"]:-"; cin>>t; sum=sum+pow(t,2); } clrscr(); cout<<"\n\nSum of squares upto "<<n<<" is "<<sum; getch(); }
[ [ [ 1, 22 ] ] ]
1df0b90744216d1ec5aa038f927049d67c1a873d
b8ac0bb1d1731d074b7a3cbebccc283529b750d4
/Code/controllers/Tcleaner/utils/MinimalBoundingRectangle.h
64db09280d2e3ec4f5049b52cbfb884fe41ce3a5
[]
no_license
dh-04/tpf-robotica
5efbac38d59fda0271ac4639ea7b3b4129c28d82
10a7f4113d5a38dc0568996edebba91f672786e9
refs/heads/master
2022-12-10T18:19:22.428435
2010-11-05T02:42:29
2010-11-05T02:42:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
464
h
#ifndef utils_MinimalBoundingRectangle_h #define utils_MinimalBoundingRectangle_h namespace utils{ class MinimalBoundingRectangle { public: int getTopX(); int getTopY(); int getWidth(); int getHeight(); MinimalBoundingRectangle(int x,int y,int height,int width); ~MinimalBoundingRectangle(); private: int x; int y; int height; int width; }; } #endif // utils_MinimalBoundingRectangle_h
[ "guicamest@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a", "nuldiego@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a" ]
[ [ [ 1, 19 ], [ 21, 32 ] ], [ [ 20, 20 ] ] ]
62097fa53a48901cdc39a33ce21603acb8c9951a
6dac9369d44799e368d866638433fbd17873dcf7
/src/branches/01032005/include/vfs/VFSHandle.h
fa7add160d2d316338f31d07150d2e247d96e19e
[]
no_license
christhomas/fusionengine
286b33f2c6a7df785398ffbe7eea1c367e512b8d
95422685027bb19986ba64c612049faa5899690e
refs/heads/master
2020-04-05T22:52:07.491706
2006-10-24T11:21:28
2006-10-24T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,841
h
#ifndef _VFSHANDLE_H_ #define _VFSHANDLE_H_ #include <vfs/VFSPlugin.h> /** @ingroup VFSHandle_Group * @brief The base class for all VFS Handles */ class VFSHandle{ protected: friend class VFSTransport; /** @var std::string *m_filename * @brief The filename the handle has open */ std::string m_filename; /** @var unsigned int m_length * @brief The length of the file */ unsigned int m_length; /** @var VFSPlugin *m_plugin * @brief The plugin this handle will use to decode the file */ VFSPlugin *m_plugin; /** @var FileInfo *m_fileinfo * @brief A structure containing the data read from the file */ FileInfo *m_fileinfo; /** @var VFSTransport *m_transport * @brief The transport which created the file handle */ VFSTransport *m_transport; /** Opens a file * * @param filename The filename to open * @param create Whether to create a non-existant file or return false to say it wasnt opened * * @returns boolean true or false, depending on whether the file was found/opened successfully * * This method is protected so only the VFSTransport * can call it, because handles must not be allowed * to open and close themselves, that would orphan * a ptr in the transport object, causing problems */ virtual bool Open(std::string filename, bool create=false) = 0; /** Opens a location/directory/filesystem * * @param filename The location to open * * This method can be used to open a location without opening a file * It's helpful with applications that read/write many files to a location * without having to specify the location of the files EVERY time * * With network locations, it can open the server, send the username/password and store the directory chosen * then multiple files can be read/written without having to login/read/logout multiple times for each file * * With archive locations, it can open the archive and perform caching of the archive contents * then like network locations, multiple files can be read/written without having to open/read/close * the archive multiple times * * With the local file system, it doesnt have much use, it's mainly of use if you want to create directories and files * but need a local filesystem handle to be able to do such a thing. This is common to all transports, you could want * a transport because you want to do file management, not because you want to read any file data, perhaps clean up temp * directories that were created previously. That sort of thing. */ virtual bool OpenLocation(std::string loc, bool create) = 0; /** Close the file * * @returns boolean true or false, depending on whether the file was open in order to close, or whether a fault occured whilst closing the file * * This method is protected so only the VFSTransport * can call it, because handles must not be allowed * to open and close themselves, that would orphan * a ptr in the transport object, causing problems */ virtual bool Close(void) = 0; public: /** @typedef handle_t * Function pointer to create a handle of a specific type */ typedef VFSHandle * (*handle_t)(VFSTransport *t); /** File Handle Constructor */ VFSHandle(){} /** File Handle Deconstructor */ virtual ~VFSHandle(){} //========================================================= //========================================================= // File Actions (open/close/read/etc) //========================================================= //========================================================= /** Reads the open file * * @returns A FileInfo structure containing the contents of the file */ virtual FileInfo * Read(void) = 0; /** Reads an open files raw data * * @param length The length of the bytestream * * @returns A bytestream containing the raw file data */ virtual unsigned char * Read(unsigned int &length) = 0; /** Writes to the open file * * @param data A FileInfo structure containing the data to write to the file */ virtual void Write(FileInfo *data) = 0; /** Writes raw data (or preformatted data) to the open file * * @param data A Bytestream containing the data to be written * @param length The length of the bytestream */ virtual void Write(char *data, unsigned int length) = 0; //========================================================= //========================================================= // File Information (filename/length) //========================================================= //========================================================= /** Sets the filename for the handle * * @param filename The name of the opened file */ virtual void SetFilename(std::string filename) = 0; /** Retrieves the length of the file * * @returns A Value indiciating the length of the file */ virtual unsigned int Length(void) = 0; /** Retrieves the name of the open file * * @returns A string containing the name of the file */ virtual std::string Filename(void) = 0; /** Sets the handles plugin * * @param plugin A Plugin to use when reading files with this file handle */ virtual void SetPlugin(VFSPlugin *plugin) = 0; //========================================================= //========================================================= // File/Directory manipulation //========================================================= //========================================================= /** Tests whether the filename opened is a file * * @returns boolean true or false, depending on whether the filename was a valid file. * will return false, if the file does not exist */ virtual bool IsFile(std::string filename) = 0; /** Tests whether the filename opened is a directory * * @returns boolean true or false, depending on whether the filename was a valid directory. * will return false, if the directory does not exist */ virtual bool IsDirectory(std::string directory) = 0; /** Retrieves information about a file * * @param filename The name of the file to retrieve information about */ virtual FileInfo * GetFileInfo(std::string filename) = 0; /** Creates a file * * @param filename The name of the file to create * @param recurse Whether to create the path the file resides in * * @returns boolean true or false, depending on whether creating the file was successful. */ virtual bool Createfile(std::string filename, bool recurse=true) = 0; /** Deletes a file * * @param filename The name of the file to delete * * @returns boolean true or false, depending on whether deletion was successful. * will return false if the file does not exist */ virtual bool Deletefile(std::string filename) = 0; /** Copies a file to a new location * * @param src The source path and filename to copy * @param dest The destination path and filename to create * @param createpath Whether it's allowed to create all the directories to store the file if necessary * * @returns boolean true or false, depending on whether the copying was successful */ virtual bool Copyfile(std::string src, std::string dest, bool createpath=true) = 0; /** Moves a file to a new location * * @param src The source path and filename to move * @param dest The destination path and filename to create * @param createpath Whether it's allowed to create all the directories to store the file if necessary * * @returns boolean true of false, depending on whether the copying was successful */ virtual bool Movefile(std::string src, std::string dest, bool createpath=true) = 0; /** Creates a directory * * @param directory The name of the directory to create * * @returns boolean true or false, depending on whether creation of the direction succeeded * Will return false, if the directory already exists */ virtual bool CreateDir(std::string directory) = 0; /** Delete a directory * * @param directory The name of the directory to delete * @param recurse Whether to recurse and delete all subdirectories + files * * @returns boolean true or false, depending on whether deletion was successful. * Will return false if the directory could not be found */ virtual bool DeleteDir(std::string directory, bool recurse=false) = 0; //========================================================= //========================================================= // File Data Manipulation (reading/writing bytes) //========================================================= //========================================================= /** Reads a byte * * @returns A byte of data from the current file position */ virtual unsigned char ReadChar(void) = 0; /** Reads a short int (2 bytes/word) * * @returns A word of data from the current file position */ virtual unsigned short ReadShort(void) = 0; /** Reads an integer (4 bytes/dword) * * @returns A dword of data from the current file position */ virtual unsigned int ReadInt(void) = 0; /** Reads a floating point value (4 bytes/ float) * * @returns A floating point value from the current file position */ virtual float ReadFloat(void) = 0; /** Reads an entire string of data * * @param length The length of data to read * * @returns A block of data from the current file position */ virtual unsigned char * ReadRaw(unsigned int length) = 0; /** Reads a null terminated string * * @param length The length of the string to read * * @returns A null terminated string */ virtual char * ReadString(unsigned int length) = 0; /** Writes a character * * @param c The character to write */ virtual void WriteChar(unsigned char c) = 0; /** Writes a short int (word) * * @param s The short int to write */ virtual void WriteShort(unsigned short s) = 0; /** Writes an integer (dword) * * #param i The integer to write */ virtual void WriteInt(unsigned int i) = 0; /** Writes a floating point value * * @param f The floating point value to write */ virtual void WriteFloat(float f) = 0; /** Writes an entire string of data * * @param s The chunk of data to write * @param length The length of the chunk */ virtual void WriteRaw(unsigned char *s, unsigned int length) = 0; /** Writes a null terminated string * * @param s The string * @param length The length of the string (including null) */ virtual void WriteString(char *s, unsigned int length) = 0; }; #endif // #ifndef _VFSHANDLE_H_
[ "chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7" ]
[ [ [ 1, 324 ] ] ]
0fbfb2924b7ffe47bdcc4e7167bce539b918d30f
ea6b169a24f3584978f159ec7f44184f9e84ead8
/tests/reflect/property_test.cc
37bd114bbab7b24b5b3ebdaa505771977123b73c
[]
no_license
sparecycles/reflect
e2051e5f91a7d72375dd7bfa2635cf1d285d8ef7
bec1b6e6521080ad4d932ee940073d054c8bf57f
refs/heads/master
2020-06-05T08:34:52.453196
2011-08-18T16:33:47
2011-08-18T16:33:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,039
cc
#include <reflect/Persistent.h> #include <reflect/string/String.h> #include <reflect/PersistentClass.hpp> #include <reflect/StructType.hpp> #include <reflect/EnumType.hpp> #include <reflect/PropertyPath.h> #include <reflect/test/Test.h> #include <vector> #include <map> using namespace reflect; class property_tester : public Persistent { DECLARE_REFLECTION(Persistent) public: int value; const int &direct_read() const { return value; } void direct_write(const int &x) { value = x; } void indirect_read(int &x) const { x = value; } void indirect_write(const int &x) { value = x; } int read() const { return value; } void write(int x) { value = x; } void variant_read(Reflector &reflector) const { reflector | value; } void variant_write(Reflector &reflector) { reflector | value; } }; DEFINE_REFLECTION(property_tester, "reflect_test::property_tester") { Properties ("value", &property_tester::value) ("direct", &property_tester::direct_read, &property_tester::direct_write) ("indirect", &property_tester::indirect_read, &property_tester::indirect_write) ("accessor", &property_tester::read, &property_tester::write) ("variant", &property_tester::variant_read, &property_tester::variant_write, Variant) ; } TEST(int_prop) { property_tester test; test.value = 10; CHECK(test.Property("value").Read() == "10"); CHECK(test.Property("direct").Read() == "10"); CHECK(test.Property("indirect").Read() == "10"); CHECK(test.Property("accessor").Read() == "10"); CHECK(test.Property("value").Write("11")); CHECK(test.Property("direct").Read() == "11"); CHECK(test.Property("direct").Write("12")); CHECK(test.Property("indirect").Read() == "12"); CHECK(test.Property("indirect").Write("13")); CHECK(test.Property("accessor").Read() == "13"); CHECK(test.Property("accessor").Write("14")); CHECK(test.Property("variant").Read() == "14"); CHECK(test.Property("variant").Write("15")); CHECK(test.Property("value").Read() == "15"); }
[ [ [ 1, 65 ] ] ]
044db15f9bf0cd1e15fba868d473dd98b525b59a
463c3b62132d215e245a097a921859ecb498f723
/lib/dlib/stl_checked/std_vector_c.h
733c9a054892dbe0e44fae006db2e9a224e1d8d3
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
athulan/cppagent
58f078cee55b68c08297acdf04a5424c2308cfdc
9027ec4e32647e10c38276e12bcfed526a7e27dd
refs/heads/master
2021-01-18T23:34:34.691846
2009-05-05T00:19:54
2009-05-05T00:19:54
197,038
4
1
null
null
null
null
UTF-8
C++
false
false
13,089
h
// Copyright (C) 2008 Davis E. King ([email protected]) // License: Boost Software License See LICENSE.txt for the full license. #ifndef DLIB_STD_VECTOr_C_H_ #define DLIB_STD_VECTOr_C_H_ #include <vector> #include <algorithm> #include "../assert.h" #include "std_vector_c_abstract.h" #include "../serialize.h" #include "../is_kind.h" namespace dlib { template < typename T, typename Allocator = std::allocator<T> > class std_vector_c { typedef typename std::vector<T,Allocator> base_type; base_type impl; public: // types: typedef typename Allocator::reference reference; typedef typename Allocator::const_reference const_reference; typedef typename base_type::iterator iterator; // See 23.1 typedef typename base_type::const_iterator const_iterator; // See 23.1 typedef typename base_type::size_type size_type; // See 23.1 typedef typename base_type::difference_type difference_type;// See 23.1 typedef T value_type; typedef Allocator allocator_type; typedef typename Allocator::pointer pointer; typedef typename Allocator::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.4.1 construct/copy/destroy: explicit std_vector_c(const Allocator& alloc= Allocator()) : impl(alloc) {} explicit std_vector_c(size_type n, const T& value = T(), const Allocator& alloc= Allocator()) : impl(n, value, alloc) {} template <typename InputIterator> std_vector_c(InputIterator first, InputIterator last, const Allocator& alloc= Allocator()) : impl(first,last,alloc) {} std_vector_c(const std_vector_c<T,Allocator>& x) : impl(x.impl) {} std_vector_c<T,Allocator>& operator=(const std_vector_c<T,Allocator>& x) { impl = x.impl; return *this; } template <typename InputIterator> void assign(InputIterator first, InputIterator last) { impl.assign(first,last); } void assign(size_type n, const T& u) { impl.assign(n,u); } allocator_type get_allocator() const { return impl.get_allocator(); } // iterators: iterator begin() { return impl.begin(); } const_iterator begin() const { return impl.begin(); } iterator end() { return impl.end(); } const_iterator end() const { return impl.end(); } reverse_iterator rbegin() { return impl.rbegin(); } const_reverse_iterator rbegin() const { return impl.rbegin(); } reverse_iterator rend() { return impl.rend(); } const_reverse_iterator rend() const { return impl.rend(); } // 23.2.4.2 capacity: size_type size() const { return impl.size(); } size_type max_size() const { return impl.max_size(); } void resize(size_type sz, T c = T()) { impl.resize(sz,c); } size_type capacity() const { return impl.capacity(); } bool empty() const { return impl.empty(); } void reserve(size_type n) { impl.reserve(n); } // element access: const_reference at(size_type n) const { return impl.at(n); } reference at(size_type n) { return impl.at(n); } // 23.2.4.3 modifiers: void push_back(const T& x) { impl.push_back(x); } void swap(std_vector_c<T,Allocator>& x) { impl.swap(x.impl); } void clear() { impl.clear(); } // ------------------------------------------------------ // Things that have preconditions that should be checked. // ------------------------------------------------------ reference operator[]( size_type n ) { DLIB_CASSERT(n < size(), "\treference std_vector_c::operator[](n)" << "\n\tYou have supplied an invalid index" << "\n\tthis: " << this << "\n\tn: " << n << "\n\tsize(): " << size() ); return impl[n]; } // ------------------------------------------------------ const_reference operator[]( size_type n ) const { DLIB_CASSERT(n < size(), "\tconst_reference std_vector_c::operator[](n)" << "\n\tYou have supplied an invalid index" << "\n\tthis: " << this << "\n\tn: " << n << "\n\tsize(): " << size() ); return impl[n]; } // ------------------------------------------------------ reference front( ) { DLIB_CASSERT(size() > 0, "\treference std_vector_c::front()" << "\n\tYou can't call front() on an empty vector" << "\n\tthis: " << this ); return impl.front(); } // ------------------------------------------------------ const_reference front( ) const { DLIB_CASSERT(size() > 0, "\tconst_reference std_vector_c::front()" << "\n\tYou can't call front() on an empty vector" << "\n\tthis: " << this ); return impl.front(); } // ------------------------------------------------------ reference back( ) { DLIB_CASSERT(size() > 0, "\treference std_vector_c::back()" << "\n\tYou can't call back() on an empty vector" << "\n\tthis: " << this ); return impl.back(); } // ------------------------------------------------------ const_reference back( ) const { DLIB_CASSERT(size() > 0, "\tconst_reference std_vector_c::back()" << "\n\tYou can't call back() on an empty vector" << "\n\tthis: " << this ); return impl.back(); } // ------------------------------------------------------ void pop_back( ) { DLIB_CASSERT(size() > 0, "\tconst_reference std_vector_c::pop_back()" << "\n\tYou can't call pop_back() on an empty vector" << "\n\tthis: " << this ); impl.pop_back(); } // ------------------------------------------------------ iterator insert( iterator position, const T& x ) { DLIB_CASSERT( begin() <= position && position <= end(), "\titerator std_vector_c::insert(position,x)" << "\n\tYou have called insert() with an invalid position" << "\n\tthis: " << this ); return impl.insert(position, x); } // ------------------------------------------------------ void insert( iterator position, size_type n, const T& x ) { DLIB_CASSERT( begin() <= position && position <= end(), "\tvoid std_vector_c::insert(position,n,x)" << "\n\tYou have called insert() with an invalid position" << "\n\tthis: " << this ); impl.insert(position, n, x); } // ------------------------------------------------------ template <typename InputIterator> void insert( iterator position, InputIterator first, InputIterator last ) { DLIB_CASSERT( begin() <= position && position <= end(), "\tvoid std_vector_c::insert(position,first,last)" << "\n\tYou have called insert() with an invalid position" << "\n\tthis: " << this ); impl.insert(position, first, last); } // ------------------------------------------------------ iterator erase( iterator position ) { DLIB_CASSERT( begin() <= position && position < end(), "\titerator std_vector_c::erase(position)" << "\n\tYou have called erase() with an invalid position" << "\n\tthis: " << this ); return impl.erase(position); } // ------------------------------------------------------ iterator erase( iterator first, iterator last ) { DLIB_CASSERT( begin() <= first && first <= last && last <= end(), "\titerator std_vector_c::erase(first,last)" << "\n\tYou have called erase() with an invalid range of iterators" << "\n\tthis: " << this ); return impl.erase(first,last); } // ------------------------------------------------------ }; // ---------------------------------------------------------------------------------------- template <typename T, typename Allocator> bool operator==(const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } template <typename T, typename Allocator> bool operator< (const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } template <typename T, typename Allocator> bool operator!=(const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return !(x == y); } template <typename T, typename Allocator> bool operator> (const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return y < x; } template <typename T, typename Allocator> bool operator>=(const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return !(x < y); } template <typename T, typename Allocator> bool operator<=(const std_vector_c<T,Allocator>& x, const std_vector_c<T,Allocator>& y) { return !(y < x); } // specialized algorithms: template <typename T, typename Allocator> void swap(std_vector_c<T,Allocator>& x, std_vector_c<T,Allocator>& y) { x.swap(y); } // ---------------------------------------------------------------------------------------- template <typename T, typename alloc> void serialize ( const std_vector_c<T,alloc>& item, std::ostream& out ) { try { const unsigned long size = static_cast<unsigned long>(item.size()); serialize(size,out); for (unsigned long i = 0; i < item.size(); ++i) serialize(item[i],out); } catch (serialization_error& e) { throw serialization_error(e.info + "\n while serializing object of type std_vector_c"); } } // ---------------------------------------------------------------------------------------- template <typename T, typename alloc> void deserialize ( std_vector_c<T, alloc>& item, std::istream& in ) { try { unsigned long size; deserialize(size,in); item.resize(size); for (unsigned long i = 0; i < size; ++i) deserialize(item[i],in); } catch (serialization_error& e) { throw serialization_error(e.info + "\n while deserializing object of type std_vector_c"); } } // ---------------------------------------------------------------------------------------- template <typename T, typename alloc> struct is_std_vector<std_vector_c<T,alloc> > { const static bool value = true; }; // ---------------------------------------------------------------------------------------- } #endif // DLIB_STD_VECTOr_C_H_
[ "jimmy@DGJ3X3B1.(none)" ]
[ [ [ 1, 352 ] ] ]
3c95e1076b2369dc74ec0a0110e4e28f9d1f25c9
72449e9f77d221deddcc5371901c61303387ef09
/Resources.cpp
4a186273ee3ce56f5dbc06614cfd62d67f90fd32
[]
no_license
dsrbecky/PipeWars
a427f006292033f361260b0075929ade9b3f0c44
109a05e3db35f3725647d917a770332d8badeecc
refs/heads/master
2020-05-20T11:23:05.394233
2010-01-14T08:23:06
2010-01-14T16:00:25
958,353
2
0
null
null
null
null
UTF-8
C++
false
false
19,234
cpp
#include "StdAfx.h" #include "Resources.h" #include "Entities.h" #include "Maths.h" extern Resources resources; const string dataPath = "..\\data\\meshes\\"; const string imagePath = "..\\data\\images\\"; const string pathMaterialName = "Path"; domCOLLADA* Resources::LoadCollada(string filename) { if (loadedColladas.count(filename) > 0) { return loadedColladas[filename]; } else { domCOLLADA* doc = dae.open(filename); if (doc == NULL) { MessageBoxA(NULL, ("Could not open " + filename).c_str(), "COLLADA", MB_OK); exit(1); } loadedColladas[filename] = doc; return doc; } } u_int GetColor(domListOfFloats* src, int offset = 0) { int r = (int)(src->get(4 * offset + 0) * 255); int g = (int)(src->get(4 * offset + 1) * 255); int b = (int)(src->get(4 * offset + 2) * 255); int a = (int)(src->get(4 * offset + 3) * 255); u_int argb = (a << 24) + (r << 16) + (g << 8) + (b); return argb; } D3DCOLORVALUE GetD3DColor(domListOfFloats color) { D3DCOLORVALUE ret; ret.r = (float)color.get(0); ret.g = (float)color.get(1); ret.b = (float)color.get(2); ret.a = (float)color.get(3); return ret; } D3DCOLORVALUE GetD3DColor(daeElement* colorElement, D3DCOLORVALUE def) { domCommon_color_or_texture_type* color = daeSafeCast<domCommon_color_or_texture_type>(colorElement); if (color != NULL && color->getColor() != NULL) { return GetD3DColor(color->getColor()->getValue()); } else { return def; } } void Resources::LoadMaterial(domCOLLADA* doc, string materialName, /* out */ D3DMATERIAL9* material, /* out */ string* textureFilename) { domMaterial* mat = daeSafeCast<domMaterial>(dae.getDatabase()->idLookup(materialName, doc->getDocument())); domEffect* effect = daeSafeCast<domEffect>(mat->getInstance_effect()->getUrl().getElement()); // Get colors D3DCOLORVALUE white = {1, 1, 1, 1}; D3DCOLORVALUE black = {0, 0, 0, 1}; material->Ambient = GetD3DColor(effect->getDescendant("ambient"), black); material->Diffuse = GetD3DColor(effect->getDescendant("diffuse"), white); material->Emissive = GetD3DColor(effect->getDescendant("emission"), black); material->Specular = GetD3DColor(effect->getDescendant("specular"), black); material->Power = 12.5; // Get texture domCommon_color_or_texture_type* diffuse = daeSafeCast<domCommon_color_or_texture_type>(effect->getDescendant("diffuse")); if (diffuse != NULL && diffuse->getTexture() != NULL) { string texName = diffuse->getTexture()->getTexture(); domImage* image = daeSafeCast<domImage>(dae.getDatabase()->idLookup(texName, doc->getDocument())); *textureFilename = image->getInit_from()->getCharData(); material->Diffuse = white; } else { *textureFilename = ""; } } Mesh* Resources::LoadMesh(string filename, string geometryName) { string filenameAndGeometryName = dataPath + "\\" + filename + "\\" + geometryName; // Cached if (loadedMeshes.count(filenameAndGeometryName) > 0) { return loadedMeshes[filenameAndGeometryName]; } domCOLLADA* doc = LoadCollada(dataPath + "\\" + filename); // Look for the geometry domGeometry* geom = NULL; domElement* elem = dae.getDatabase()->idLookup(geometryName, doc->getDocument()); if (elem != NULL && elem->typeID() == domNode::ID()) { // Forward from node name domNode* node = daeSafeCast<domNode>(elem); geom = daeSafeCast<domGeometry>(node->getInstance_geometry_array().get(0)->getUrl().getElement()); } else { geom = daeSafeCast<domGeometry>(elem); } if (geom == NULL) { MessageBoxA(NULL, ("Could not find mesh " + filenameAndGeometryName).c_str(), "COLLADA", MB_OK); exit(1); } domMeshRef meshRef = geom->getMesh(); Mesh* mesh = new Mesh(filename, geometryName); loadedMeshes[filenameAndGeometryName] = mesh; // Cache // Load the <tristrips/> elements // (other types are ignored for now) D3DXVECTOR3 minCorner(0,0,0), maxCorner(0,0,0); bool minMaxSet = false; for(u_int i = 0; i < meshRef->getTristrips_array().getCount(); i++) { domTristripsRef tristripsRef = meshRef->getTristrips_array().get(i); Tristrip ts; ts.fvf = 0; ts.buffer = NULL; // Resolve all data sources int posOffset = -1; domListOfFloats* posSrc; int norOffset = -1; domListOfFloats* norSrc; int colOffset = -1; domListOfFloats* colSrc; int texOffset = -1; domListOfFloats* texSrc; for(u_int j = 0; j < tristripsRef->getInput_array().getCount(); j++) { domInputLocalOffsetRef input = tristripsRef->getInput_array().get(j); daeElementRef source = input->getSource().getElement(); // Defined per vertex - forward if (source->typeID() == domVertices::ID()) { source = daeSafeCast<domVertices>(source)->getInput_array().get(0)->getSource().getElement(); } int offset = (int)input->getOffset(); domListOfFloats* src = &(daeSafeCast<domSource>(source)->getFloat_array()->getValue()); if (input->getSemantic() == string("VERTEX")) { posOffset = offset; posSrc = src; ts.fvf |= D3DFVF_XYZ; } else if (input->getSemantic() == string("NORMAL")) { norOffset = offset; norSrc = src; ts.fvf |= D3DFVF_NORMAL; } else if (input->getSemantic() == string("COLOR")) { colOffset = offset; colSrc = src; ts.fvf |= D3DFVF_DIFFUSE; } else if (input->getSemantic() == string("TEXCOORD")) { texOffset = offset; texSrc = src; ts.fvf |= D3DFVF_TEX2; } } // Load the <P/> elementes int pStride = 0; pStride = max(pStride, posOffset + 1); pStride = max(pStride, norOffset + 1); pStride = max(pStride, colOffset + 1); pStride = max(pStride, texOffset + 1); vector<float>& vb = ts.vb; // Vertex buffer data for(u_int j = 0; j < tristripsRef->getP_array().getCount(); j++) { domListOfUInts p = tristripsRef->getP_array().get(j)->getValue(); ts.vertexCounts.push_back(p.getCount() / pStride); for(u_int k = 0; k < p.getCount(); k += pStride) { if (posOffset != -1) { int index = (int)p.get(k + posOffset); float x = (float)posSrc->get(3 * index + 0); float y = (float)posSrc->get(3 * index + 1); float z = (float)posSrc->get(3 * index + 2); if (!minMaxSet) { minCorner = maxCorner = D3DXVECTOR3(x, y, z); minMaxSet = true; } else { minCorner = min3(minCorner, D3DXVECTOR3(x, y, z)); maxCorner = max3(maxCorner, D3DXVECTOR3(x, y, z)); } vb.push_back(x); vb.push_back(y); vb.push_back(z); } if (norOffset != -1) { int index = (int)p.get(k + norOffset); vb.push_back((float)norSrc->get(3 * index + 0)); vb.push_back((float)norSrc->get(3 * index + 1)); vb.push_back((float)norSrc->get(3 * index + 2)); } if (colOffset != -1) { int index = (int)p.get(k + colOffset); u_int argb = GetColor(colSrc, index); vb.push_back(*((float*)&argb)); } if (texOffset != -1) { int index = (int)p.get(k + texOffset); vb.push_back((float)texSrc->get(2 * index + 0)); vb.push_back(1 - (float)texSrc->get(2 * index + 1)); } // Note vertex buffer stride (bytes) if (j == 0 && k == 0) { ts.vbStride_floats = vb.size(); ts.vbStride_bytes = vb.size() * sizeof(float); } } } // Load the material ts.materialName = tristripsRef->getMaterial(); LoadMaterial(doc, ts.materialName, &ts.material, &ts.textureFilename); // Done with this <tristrips/> mesh->tristrips.push_back(ts); } mesh->boundingBox = BoundingBox(minCorner, maxCorner); return mesh; } IDirect3DTexture9* Resources::LoadTexture(IDirect3DDevice9* dev, string textureFilename) { if (loadedTextures.count(textureFilename) == 0) { IDirect3DTexture9* texture; if (FAILED(D3DXCreateTextureFromFileA(dev, (imagePath + textureFilename).c_str(), &texture))) { if (FAILED(D3DXCreateTextureFromFileA(dev, (dataPath + textureFilename).c_str(), &texture))) { MessageBoxA(NULL, ("Could not find texture " + textureFilename).c_str() , "COLLADA", MB_OK); exit(1); } } loadedTextures[textureFilename] = texture; } return loadedTextures[textureFilename]; } void Mesh::Render(IDirect3DDevice9* dev) { for(int i = 0; i < (int)tristrips.size(); i++) { Tristrip& ts = tristrips[i]; if (ts.material.Diffuse.a != 0.0f) ts.Render(dev); } } void Tristrip::Render(IDirect3DDevice9* dev) { // Create buffer on demand if (buffer == NULL) { dev->CreateVertexBuffer(vb.size() * sizeof(float), 0, fvf, D3DPOOL_DEFAULT, &buffer, NULL); void* vbData; buffer->Lock(0, vb.size() * sizeof(float), &vbData, 0); copy(vb.begin(), vb.end(), (float*)vbData); buffer->Unlock(); } dev->SetStreamSource(0, buffer, 0, vbStride_bytes); dev->SetFVF(fvf); if (textureFilename.size() > 0) { dev->SetTexture(0, resources.LoadTexture(dev, textureFilename)); } else { dev->SetTexture(0, NULL); } dev->SetMaterial(&material); int start = 0; for(int j = 0; j < (int)vertexCounts.size(); j++) { int vertexCount = vertexCounts[j]; dev->DrawPrimitive(D3DPT_TRIANGLESTRIP, start, vertexCount - 2); start += vertexCount; } } bool Mesh::IsOnPath(float x, float z, float* outY) { for(int i = 0; i < (int)tristrips.size(); i++) { Tristrip& ts = tristrips[i]; if (ts.materialName == pathMaterialName) { if (ts.IntersectsYRay(x, z, outY)) return true; } } return false; } bool Tristrip::IntersectsYRay(float x, float z, float* outY) { int index = 0; for(int i = 0; i < (int)vertexCounts.size(); i++) { int vertexCount = vertexCounts[i]; // Test all triangles in set for(int j = 0; j < vertexCount - 2; j++) { // Test tringle at current offset bool isIn = Intersect_YRay_Triangle(x, z, vb[(index + 0) * vbStride_floats + 0], vb[(index + 0) * vbStride_floats + 2], // A vb[(index + 1) * vbStride_floats + 0], vb[(index + 1) * vbStride_floats + 2], // B vb[(index + 2) * vbStride_floats + 0], vb[(index + 2) * vbStride_floats + 2] // C ); if (isIn) { if (outY != NULL) { Intersect_YRay_Plane(x, z, outY, (D3DXVECTOR3*)&vb[(index + 0) * vbStride_floats], (D3DXVECTOR3*)&vb[(index + 1) * vbStride_floats], (D3DXVECTOR3*)&vb[(index + 2) * vbStride_floats] ); } return true; } index++; // Next } index += 2; // Next set } return false; } Mesh* MeshEntity::getMesh() { if (meshPtrCache == NULL) meshPtrCache = resources.LoadMesh(meshFilename, meshGeometryName); return meshPtrCache; } void Resources::LoadTestMap(Database* db) { // Preload meshs LoadMesh("Merman.dae", "Revolver"); LoadMesh("Bullets.dae", "RevolverBullet"); LoadMesh("skull.dae", "Skull"); db->add(4, 0, 6, 180, new MeshEntity("suzanne.dae", "Suzanne")); db->add(-10, 0.5, 8, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(-10, 0.5, 0, 0, new MeshEntity("pipe.dae", "LongStraight")); db->add(-6, 0.5, -2, 180, new MeshEntity("pipe.dae", "UTurn")); db->add(-6, 0.5, 0, 0, new MeshEntity("pipe.dae", "LevelUp")); db->add(-10, 2.5, 8, 0, new MeshEntity("pipe.dae", "UTurn")); db->add(-10, 2.5, 6, 180, new MeshEntity("pipe.dae", "LevelUp")); //db->add(-6, 4.5, -6, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(-8, 4.5, -8, 90, new MeshEntity("tank.dae", "Tank5x5")); db->add(-20, 4.5, -10, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(-16, 4.5, -16, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(-10, 4.5, -12, 180,new MeshEntity("pipe.dae", "LeftTurn")); db->add(-4, 4.5, -6, 270, new MeshEntity("pipe.dae", "LongStraight")); db->add(10, 2.5, -6, 90, new MeshEntity("pipe.dae", "LevelUp")); db->add(12, 2.5, -6, 270, new MeshEntity("pipe.dae", "LeftTurn")); db->add(16, 2.5, -12, 180, new MeshEntity("pipe.dae", "LeftTurn")); db->add(6, 2.5, -12, 270, new MeshEntity("pipe.dae", "STurn2")); db->add(4, 2.5, -12, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(0, 0.5, 0, 180, new MeshEntity("pipe.dae", "LevelUp")); db->add(0, 0.5, 2, 0, new MeshEntity("pipe.dae", "LongStraight")); db->add(-2, 0.5, 12, 270, new MeshEntity("tank.dae", "Tank3x5")); db->add(6, 0.5, 12, 270, new MeshEntity("pipe.dae", "LongStraight")); db->add(16, 0.5, 8, 0, new MeshEntity("tank.dae", "Tank5x7")); db->add(18, -1.5, -2, 0, new MeshEntity("pipe.dae", "LevelUp")); db->add(22, -1.5, -8, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(30, -3.5, -8, 90, new MeshEntity("pipe.dae", "LevelUp")); db->add(32, -3.5, -4, 270, new MeshEntity("pipe.dae", "UTurn")); db->add(30, -3.5, -4, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(22, -3.5, 8, 270, new MeshEntity("tank.dae", "Tank5x7")); db->add(34, -3.5, 6, 270, new MeshEntity("pipe.dae", "STurn2")); db->add(30, -1.5, 12, 90, new MeshEntity("pipe.dae", "LevelUp")); db->add(38, -3.5, 12, 90, new MeshEntity("pipe.dae", "LevelUp")); db->add(40, -3.5, 12, 270, new MeshEntity("pipe.dae", "LeftTurn")); db->add(44, -3.5, 6, 180, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(10, 4.5, 30, 0, new MeshEntity("tank.dae", "Tank3x5")); //db->add(2, 4.5, 28, 0, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(10, 4.5, 20, 0, new MeshEntity("pipe.dae", "LongStraight")); //db->add(0, 4.5, 20, 0, new MeshEntity("pipe.dae", "STurn1")); //db->add(10, 4.5, 18, 180, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(4, 4.5, 14, 90, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(20, 2.5, 32, 90, new MeshEntity("pipe.dae", "LevelUp")); //db->add(22, 2.5, 32, 270, new MeshEntity("pipe.dae", "UTurn")); //db->add(14, 0.5, 28, 270, new MeshEntity("pipe.dae", "LevelUp")); //db->add(12, 0.5, 28, 90, new MeshEntity("pipe.dae", "UTurn")); //db->add(20, -1.5, 32, 90, new MeshEntity("pipe.dae", "LevelUp")); //db->add(22, -1.5, 32, 270, new MeshEntity("pipe.dae", "LongStraight")); //db->add(30, -1.5, 32, 270, new MeshEntity("pipe.dae", "UTurn")); //db->add(22, -3.5, 28, 270, new MeshEntity("pipe.dae", "LevelUp")); //db->add(20, -3.5, 24, 90, new MeshEntity("pipe.dae", "UTurn")); //db->add(26, -3.5, 12, 0, new MeshEntity("pipe.dae", "LongStraight")); //db->add(22, -3.5, 24, 270, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(18, 0.5, 20, 0, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(28, 0.5, 28, 180, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(28, 0.5, 30, 0, new MeshEntity("pipe.dae", "LevelUp")); //db->add(24, 2.5, 42, 270, new MeshEntity("pipe.dae", "LeftTurn")); //db->add(22, 2.5, 42, 90, new MeshEntity("pipe.dae", "LevelUp")); //db->add(10, 4.5, 38, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(18, -1.5, 26, 180, new MeshEntity("pipe.dae", "LevelUp")); db->add(18, -1.5, 28, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(24, -1.5, 32, 270, new MeshEntity("pipe.dae", "LeftTurn")); db->add(28, -1.5, 26, 180, new MeshEntity("pipe.dae", "STurn1")); db->add(26, -3.5, 12, 0, new MeshEntity("pipe.dae", "LevelUp")); db->add(0, 0.5, 16, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(12, -1.5, 20, 90, new MeshEntity("pipe.dae", "LevelUp")); db->add(14, -1.5, 20, 270, new MeshEntity("pipe.dae", "UTurn")); db->add(6, -3.5, 16, 270, new MeshEntity("pipe.dae", "LevelUp")); db->add(0, -3.5, 12, 0, new MeshEntity("pipe.dae", "LeftTurn")); db->add(4, -3.5, 6, 90, new MeshEntity("pipe.dae", "LeftTurn")); db->add(6, -3.5, 6, 270, new MeshEntity("pipe.dae", "LongStraight")); db->add(12, -3.5, 6, 270, new MeshEntity("pipe.dae", "LongStraight")); db->add(0, 0, 8, 0, new PowerUp(Weapon_Revolver, "Weapons.dae", "Revolver")); db->add(44, -4, 8, 0, new PowerUp(Weapon_Revolver, "Weapons.dae", "Revolver")); db->add(21.6, 0, 9.4, 0, new PowerUp(Weapon_Revolver, "Weapons.dae", "Revolver")); db->add(23, -2, 32, 0, new PowerUp(Weapon_Revolver, "Weapons.dae", "Revolver")); db->add(-8, 2, 9, 0, new PowerUp(Weapon_Shotgun, "Weapons.dae", "SawedOff")); db->add(14.5, 0, 17.5, 0, new PowerUp(Weapon_Shotgun, "Weapons.dae", "SawedOff")); db->add(0, 0, 12, 0, new PowerUp(Weapon_AK47, "Weapons.dae", "AK47")); db->add(20, -2, -6.8, 0, new PowerUp(Weapon_AK47, "Weapons.dae", "AK47")); db->add(31.5, -2, 12, 0, new PowerUp(Weapon_Jackhammer, "Weapons.dae", "Jackhammer")); db->add(15, -2, 17.5, 0, new PowerUp(Weapon_Jackhammer, "Weapons.dae", "Jackhammer")); db->add(24, -4, 7, 0, new PowerUp(Weapon_Nailgun, "Weapons.dae", "Nailgun")); db->add(14, 2, -7.2, 0, new PowerUp(Weapon_Nailgun, "Weapons.dae", "Nailgun")); //db->add(25.5, -2.2, 28, 0, new PowerUp(Weapon_Shotgun, "Weapons.dae", "SawedOff")); db->add(new RespawnPoint(5.5, -4, 16)); db->add(new RespawnPoint(33.0, -4, -7.0)); db->add(new RespawnPoint(-8, 0, -3)); db->add(new RespawnPoint(0, 0, 3)); db->add(new RespawnPoint(9, 0, 12)); db->add(new RespawnPoint(40, -4, 12)); db->add(new RespawnPoint(23, -2, -8)); db->add(new RespawnPoint(18, -2, 27)); db->add(new RespawnPoint(0, -4, 12)); db->add(6.0, 0, 20, 0, new PowerUp(HealthPack, "HealthPack.dae", "MediBox")); db->add(16.0, 0, 12, 0, new PowerUp(HealthPack, "HealthPack.dae", "MediBox")); db->add(44.0, -4, 6, 0, new PowerUp(ArmourPack, "HealthPack.dae", "Armour")); db->add(0.0, 4, -6, 0, new PowerUp(Shiny, "Shiny.dae", "Green")); db->add(0.0, 0, 7, 0, new PowerUp(Shiny, "Shiny.dae", "Blue")); db->add(21, -4, 9, 0, new PowerUp(Shiny, "Shiny.dae", "Red")); db->add(-10, 4, -6, 0, new PowerUp(Monkey, "Monkey.dae", "LeChuck")); //db->add(10.0, 4.0, 22, 0, new PowerUp(HealthPack, "HealthPack.dae", "MediBox")); //db->add(4.0, 4.0, 14.0, 0, new PowerUp(ArmourPack, "HealthPack.dae", "Armour")); //db->add(28.0, 1.0, 31, 0, new PowerUp(Shiny, "Shiny.dae", "Red")); //db->add(26.0, -4.0, 14, 0, new PowerUp(Skull, "skull.dae", "Skull")); db->add(31.0, -4, -8, 0, new PowerUp(Ammo_Revolver, "Ammo.dae", "RevolverAmmo")); db->add(18.0, 0, 15, 0, new PowerUp(Ammo_Revolver, "Ammo.dae", "RevolverAmmo")); db->add(26.5, -2, 31, 0, new PowerUp(Ammo_Shotgun, "Ammo.dae", "ShotgunShells")); db->add(5, 2, -12, 0, new PowerUp(Ammo_Shotgun, "Ammo.dae", "ShotgunShells")); db->add(0.0, -4, 10, 0, new PowerUp(Ammo_AK47, "Ammo.dae", "AKAmmo")); db->add(28.0, -4, 2, 0, new PowerUp(Ammo_AK47, "Ammo.dae", "AKAmmo")); db->add(-7.0, 0, -3.0, 0, new PowerUp(Ammo_Jackhammer, "Ammo.dae", "JackhammerAmmo")); db->add(14.0, -4, 6.0, 0, new PowerUp(Ammo_Jackhammer, "Ammo.dae", "JackhammerAmmo")); db->add(10.0, -4, 6, 0, new PowerUp(Ammo_Nailgun, "Ammo.dae", "NailgunAmmo")); db->add(31, -4, 9, 0, new PowerUp(Ammo_Nailgun, "Ammo.dae", "NailgunAmmo")); //db->add(26.0, -2.0, 32, 0, new PowerUp(Ammo_Nailgun, "Ammo.dae", "NailgunAmmo")); //db->add(23.0, 2.0, 29.0, 0, new PowerUp(Ammo_Shotgun, "Ammo.dae", "ShotgunShells")); //db->add(22.0, 2.0, 42.0, 0, new PowerUp(Ammo_Shotgun, "Ammo.dae", "ShotgunShells")); }
[ [ [ 1, 473 ] ] ]
061c45dfdfcde0dd7e7acd8e20dd919ce4eb7163
58ef4939342d5253f6fcb372c56513055d589eb8
/LemonTangram2/source/TangImage/inc/TangImageSave.h
5acd2cdfa4e54dbccee71d2abe96b7e017d43075
[]
no_license
flaithbheartaigh/lemonplayer
2d77869e4cf787acb0aef51341dc784b3cf626ba
ea22bc8679d4431460f714cd3476a32927c7080e
refs/heads/master
2021-01-10T11:29:49.953139
2011-04-25T03:15:18
2011-04-25T03:15:18
50,263,327
0
0
null
null
null
null
GB18030
C++
false
false
1,698
h
/* ============================================================================ Name : TangImageSave.h Author : zengcity Version : 1.0 Copyright : Your copyright notice Description : CTangImageSave declaration ============================================================================ */ #ifndef TANGIMAGESAVE_H #define TANGIMAGESAVE_H // INCLUDES #include <e32std.h> #include <e32base.h> #include "ImageConvertorInterface.h" #include <bitstd.h> #include <bitdev.h> #include <gdi.h> #include "MSaveScreenNotify.h" // CLASS DECLARATION class CImageConvertor; /** * CTangImageSave * */ class CTangImageSave : public CBase , public MWImageConvertorListener { public: // Constructors and destructor ~CTangImageSave(); static CTangImageSave* NewL(const TDesC& aFileName,MSaveScreenNotify* aNotify); static CTangImageSave* NewLC(const TDesC& aFileName,MSaveScreenNotify* aNotify); private: CTangImageSave(MSaveScreenNotify* aNotify); void ConstructL(const TDesC& aFileName); public: //MWImageConvertorListener virtual void OnImageConvertedL(CFbsBitmap &aBitmap); virtual void OnImageConvertedL(const TDesC8 &aImgData); virtual void OnConvertErrorL(TConvertResult aConvertResult); CFbsBitGc& CreateBufferBitmapL(); void StartSave(); void StartSave(CFbsBitmap *aBitmap); private: CImageConvertor* iConvertor; TFileName iFileName; CFbsBitmap* iDoubleBufferBmp; // 位图缓冲,owned CFbsBitmapDevice* iDoubleBufferDevice; // 位图缓冲关联的device,owned, CFbsBitGc* iDoubleBufferGc; // 位图缓冲绘制环境,owned MSaveScreenNotify* iNotify; }; #endif // TANGIMAGESAVE_H
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 61 ] ] ]
f26a9a788d1b709f3ec4d712fbbc55e88b39c1ca
cc946ca4fb4831693af2c6f252100b9a83cfc7d0
/uCash.Cybos/uCash.Cybos.FutureWide.h
edecc9c8470161b0a6d51293fb43eee289d8fdbf
[]
no_license
primespace/ucash-cybos
18b8b324689516e08cf6d0124d8ad19c0f316d68
1ccece53844fad0ef8f3abc8bbb51dadafc75ab7
refs/heads/master
2021-01-10T04:42:53.966915
2011-10-14T07:15:33
2011-10-14T07:15:33
52,243,596
7
0
null
null
null
null
UTF-8
C++
false
false
1,384
h
/* * uCash.Cybos Copyright (c) 2011 Taeyoung Park ([email protected]) * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #pragma once namespace uCash { namespace Cybos { class UCASHCYBOS_API CpFutureWide : public CpObject<CpDib::IDibPtr, CpDib::FutureWide> { public: CpFutureWide(void); ~CpFutureWide(void); }; }}
[ [ [ 1, 34 ] ] ]
ec6ba917dae676179899e554d65519a93a5e86f8
ad80c85f09a98b1bfc47191c0e99f3d4559b10d4
/code/src/node/ntextnode_cmds.cc
f3f76b679a4fe8217f823eab194785306b8ef8d0
[]
no_license
DSPNerd/m-nebula
76a4578f5504f6902e054ddd365b42672024de6d
52a32902773c10cf1c6bc3dabefd2fd1587d83b3
refs/heads/master
2021-12-07T18:23:07.272880
2009-07-07T09:47:09
2009-07-07T09:47:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,523
cc
#define N_IMPLEMENTS nTextNode //------------------------------------------------------------------- // ntextnode_cmds.cc // (C) 2007 Insightec Ltd, -- Ilya Kliot //------------------------------------------------------------------- #include "kernel/npersistserver.h" #include "node/ntextnode.h" #include "gfx/nfont.h" static void n_settext(void*, nCmd*); static void n_gettext(void*, nCmd*); static void n_setsize(void*, nCmd*); static void n_getsize(void*, nCmd*); static void n_israster(void*, nCmd*); static void n_setrasterpos(void*, nCmd*); static void n_getrasterpos(void*, nCmd*); static void n_setalign(void*, nCmd*); static void n_getalign(void*, nCmd*); static void n_setdepth(void*, nCmd*); static void n_getdepth(void*, nCmd*); static void n_setfont(void*, nCmd*); static void n_getfontname(void*, nCmd*); static void n_getfonttype(void*, nCmd*); static void n_setsnap(void*, nCmd*); static void n_getsnap(void*, nCmd*); static void n_setsnapoffs(void*, nCmd*); static void n_getsnapoffs(void*, nCmd*); struct str2halign_t { const char *str; nHorizontalAlign val; }; // horizontal alignment parameter translation table static struct str2halign_t str2halign_table[] = { {"center", N_HA_CENTER}, {"left", N_HA_LEFT}, {"right", N_HA_RIGHT}, {"none", N_HA_NONE}, {0, N_HA_NONE}, }; struct str2valign_t { const char *str; nVerticalAlign val; }; // vertical alignment parameter translation table static struct str2valign_t str2valign_table[] = { {"center", N_VA_CENTER}, {"top", N_VA_TOP}, {"bottom", N_VA_BOTTOM}, {"none", N_VA_NONE}, {0, N_VA_NONE}, }; //-------------------------------------------------------------------- /** str2halign - created 12-Jun-2007 - by Ilya, Insightec, Inc */ static nHorizontalAlign str2halign(const char *str) { int i=0; struct str2halign_t *p = 0; while (p = &(str2halign_table[i++]), p->str) { if (strcmp(p->str, str) == 0) return p->val; } return N_HA_NONE; } //-------------------------------------------------------------------- /** str2valign - created 12-Jun-2007 - by Ilya, Insightec, Inc */ static nVerticalAlign str2valign(const char *str) { int i=0; struct str2valign_t *p = 0; while (p = &(str2valign_table[i++]), p->str) { if (strcmp(p->str, str) == 0) return p->val; } return N_VA_NONE; } //-------------------------------------------------------------------- /** halign2str() - created 12-Jun-2007 - by Ilya, Insightec, Inc */ static const char* halign2str(nHorizontalAlign val) { int i = 0; struct str2halign_t *p = 0; while (p = &(str2halign_table[i++]), p->str) { if (p->val == val) return p->str; } return "none"; } //-------------------------------------------------------------------- /** valign2str() - created 12-Jun-2007 - by Ilya, Insightec, Inc */ static const char* valign2str(nVerticalAlign val) { int i = 0; struct str2valign_t *p = 0; while (p = &(str2valign_table[i++]), p->str) { if (p->val == val) return p->str; } return "none"; } //------------------------------------------------------------------------------ /** @scriptclass ntextnode @superclass nvisnode @classinfo object used to render string with given text using font was set Font defined by 2 parameters - font name, and font type in rendering meaning: pixmap - pixmaps of characters used for rendering bitmap - bitmaps of characters used for rendering texture - textures generated from chars on properly sized bars used for rendering polygon - polygons generated from chars used for rendering extruded - extruded polygons generated from chars used for rendering outline - line list generated from chars used for rendering also fonts size and raster position could be defined default font is tahoma, size is 16 and raster pos 0:0 */ void n_initcmds(nClass *cl) { cl->BeginCmds(); cl->AddCmd("v_settext_s", 'STTX', n_settext); cl->AddCmd("s_gettext_v", 'GTTX', n_gettext); cl->AddCmd("v_setsize_i", 'SFSZ', n_setsize); cl->AddCmd("i_getsize_v", 'GFSZ', n_getsize); cl->AddCmd("b_israster_v", 'ISRS', n_israster); cl->AddCmd("v_setrasterpos_ff", 'STRP', n_setrasterpos); cl->AddCmd("ff_getrasterpos_v", 'GTRP', n_getrasterpos); cl->AddCmd("v_setalign_sisi", 'STAL', n_setalign); cl->AddCmd("sisi_getalign_v", 'GHAL', n_getalign); cl->AddCmd("v_setdepth_f", 'STDP', n_setdepth); cl->AddCmd("f_getdepth_v", 'GTDP', n_getdepth); cl->AddCmd("b_setfont_ss", 'STFN', n_setfont); cl->AddCmd("s_getfontname_v", 'GTFN', n_getfontname); cl->AddCmd("s_getfonttype_v", 'GTFT', n_getfonttype); cl->AddCmd("v_setsnap_b", 'STSN', n_setsnap); cl->AddCmd("b_getsnap_v", 'GTSN', n_getsnap); cl->AddCmd("v_setsnapoffs_ff", 'SSOF', n_setsnapoffs); cl->AddCmd("ff_getsnapoffs_v", 'GSOF', n_getsnapoffs); cl->EndCmds(); } //------------------------------------------------------------------------------ /** @cmd settext @input s - text @output v - none @info set text string for rendering */ static void n_settext(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; self->SetText(cmd->In()->GetS()); } //------------------------------------------------------------------------------ /** @cmd gettext @input v - none @output s - text @info get text for rendering */ static void n_gettext(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; const char* s = self->GetText(); if (!s) s = ""; cmd->Out()->SetS(s); } //------------------------------------------------------------------------------ /** @cmd setsize @input i - size @output v - none @info set font size for rendering */ static void n_setsize(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; self->SetSize(cmd->In()->GetI()); } //------------------------------------------------------------------------------ /** @cmd getsize @input v - none @output i - size @info get font size */ static void n_getsize(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetI(self->GetSize()); } //------------------------------------------------------------------------------ /** @cmd israster @input v - none @output b - is current font raster type (pixmap or bitmap) @info check about raster type of the font */ static void n_israster(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetB(self->IsRaster()); } //------------------------------------------------------------------------------ /** @cmd setrasterpos @input f f - x, y @output v - none @info set text raster position for bitmap and pixmap fonts rendering */ static void n_setrasterpos(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; float x = cmd->In()->GetF(); float y = cmd->In()->GetF(); self->SetRasterPos(x, y); } //------------------------------------------------------------------------------ /** @cmd getrasterpos @input v - none @output f f - x, y @info get text raster position */ static void n_getrasterpos(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; vector2 pos = self->GetRasterPos(); cmd->Out()->SetF(pos.x); cmd->Out()->SetF(pos.y); } //------------------------------------------------------------------------------ /** @cmd setalign @input s(horizontal alignment) i(column) s(vertical alignment) i(line number) @output v - none @info set justified position and line number, for current font the horizontal alignment should be none, center, left or right and column number the vertical alignment should be none, center, top or bottom and line number in form: top - line number, bottom + line number, center - line number for instance: top 2 means that it will be second line down from top, bottom 3 third line up from bottom */ static void n_setalign(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; const char* halign = cmd->In()->GetS(); int cl = cmd->In()->GetI(); const char* valign = cmd->In()->GetS(); int ln = cmd->In()->GetI(); self->SetAlignment(str2halign(halign), cl, str2valign(valign), ln); } //------------------------------------------------------------------------------ /** @cmd getalign @input v - none @output s(horizontal alignment) s(vertical alignment) i(line number) @info get justified position and line number, of the current text the horizontal alignment could be none, center, left or right the vertical alignment could be none, center, top or bottom */ static void n_getalign(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetS(halign2str(self->GetHAlignment())); cmd->Out()->SetI(self->GetColumn()); cmd->Out()->SetS(valign2str(self->GetVAlignment())); cmd->Out()->SetI(self->GetLine()); } //------------------------------------------------------------------------------ /** @cmd setdepth @input f - depth @output v - none @info set depth for extruded font rendering */ static void n_setdepth(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; self->SetDepth(cmd->In()->GetF()); } //------------------------------------------------------------------------------ /** @cmd getdepth @input v - none @output f - depth @info set depth of extruded font */ static void n_getdepth(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetF(self->GetDepth()); } //------------------------------------------------------------------------------ /** @cmd setfont @input s s - font name, font type @output v - none @info set font name (tahoma, arial etc.) and font type - one of: pixmap - pixmaps of characters used for rendering bitmap - bitmaps of characters used for rendering texture - textures generated from chars on properly sized bars used for rendering polygon - polygons generated from chars used for rendering extruded - extruded polygons generated from chars used for rendering outline - line list generated from chars used for rendering */ static void n_setfont(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; const char* name = cmd->In()->GetS(); const char* type = cmd->In()->GetS(); cmd->Out()->SetB(self->SetFont(name, nFont::Str2Type(type))); } //------------------------------------------------------------------------------ /** @cmd getfontname @input v - none @output s - font name @info */ static void n_getfontname(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetS(self->GetFontName()); } //------------------------------------------------------------------------------ /** @cmd getfonttype @input v - none @output s - font type @info */ static void n_getfonttype(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetS(nFont::Type2Str(self->GetFontType())); } //------------------------------------------------------------------------------ /** @cmd setsnap @input b - snap @output v - none @info set calculation of raster position according to unprojected parent n3dnode and some 2d offset on/off */ static void n_setsnap(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; self->SetSnap(cmd->In()->GetB()); } //------------------------------------------------------------------------------ /** @cmd getsnap @input v - none @output b - state of snap @info get state of snap */ static void n_getsnap(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; cmd->Out()->SetB(self->GetSnap()); } //------------------------------------------------------------------------------ /** @cmd setsnapoffs @input f f - x, y offset from unprojected point @output v - none @info set calculation of raster position according to unprojected parent n3dnode and some 2d offset on/off */ static void n_setsnapoffs(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; float x = cmd->In()->GetF(); float y = cmd->In()->GetF(); self->SetSnapOffset(vector2(x,y)); } //------------------------------------------------------------------------------ /** @cmd getsnap @input v - none @output f f - x, y offset from unprojected point @info get snap offset x, y */ static void n_getsnapoffs(void* o, nCmd* cmd) { nTextNode* self = (nTextNode*) o; vector2 offs = self->GetSnapOffset(); cmd->Out()->SetF(offs.x); cmd->Out()->SetF(offs.y); } //------------------------------------------------------------------------------ /** Emit commands to make this object persistent. @param fs file server which makes the object persistent @return true if all ok */ bool nTextNode::SaveCmds(nPersistServer *ps){ bool retval = false; if (nVisNode::SaveCmds(ps)) { nCmd *cmd; //--- settext --- if (this->GetText()) { cmd = ps->GetCmd(this, 'STTX'); cmd->In()->SetS(this->GetText()); ps->PutCmd(cmd); } //--- setsize --- cmd = ps->GetCmd(this, 'SFSZ'); cmd->In()->SetI(this->GetSize()); ps->PutCmd(cmd); //--- setrasterpos --- vector2 pos = this->GetRasterPos(); cmd = ps->GetCmd(this, 'STRP'); cmd->In()->SetF(pos.x); cmd->In()->SetF(pos.y); ps->PutCmd(cmd); //--- setdepth --- cmd = ps->GetCmd(this, 'STDP'); cmd->In()->SetF(this->GetDepth()); ps->PutCmd(cmd); //--- setsnap --- cmd = ps->GetCmd(this, 'STSN'); cmd->In()->SetB(this->GetSnap()); ps->PutCmd(cmd); //--- setoffset --- pos = this->GetSnapOffset(); cmd = ps->GetCmd(this, 'SSOF'); cmd->In()->SetF(pos.x); cmd->In()->SetF(pos.y); ps->PutCmd(cmd); //--- setfont --- if (this->GetFontName()) { cmd = ps->GetCmd(this, 'STFN'); cmd->In()->SetS(this->GetFontName()); cmd->In()->SetS(nFont::Type2Str(this->GetFontType())); ps->PutCmd(cmd); } retval = true; } return retval; } //------------------------------------------------------------------- // EOF //-------------------------------------------------------------------
[ "plushe@411252de-2431-11de-b186-ef1da62b6547" ]
[ [ [ 1, 635 ] ] ]
bf9b95b860d3a1fda7254f5bc9f0756027049737
5fa8f06181e88d96a9166cb238d05b185ebe7a92
/visitor/visitor.hh
7146b1a37780ce2c22c17e3f3e3e08393fb69fc9
[]
no_license
mohitkg/sliqimp
6834092760a8a078428876baaa7cdab91b37e355
54f05bc55ad9c6b7e73abc51fcc0bd8e995d6b69
refs/heads/master
2016-09-07T07:13:04.793483
2007-06-20T10:49:44
2007-06-20T10:49:44
33,323,734
0
0
null
null
null
null
UTF-8
C++
false
false
310
hh
#ifndef VISITOR_HH # define VISITOR_HH # include "../sliq_inc/incremental_engine.hh" # include "../sliq_inc/node.hh" class Visitor { public: virtual void visit (Sliq::Node *node) = 0; virtual void visit (Incremental_sliq::Node *node) = 0; private: }; #endif
[ "davidlandais@af1a0f03-5433-0410-83de-a7259e581374" ]
[ [ [ 1, 16 ] ] ]
40e6554b5a981f262635711d7b2d45c52ab8727b
696cc5f6bda0cbf5838e2a4b6eb322d6d80c76a4
/jni/decoder/Mpg123Decoder.h
e71ed665ca645615947bf69274b29a0f1346556b
[]
no_license
binujayaram/sasken-player
b372e5bd9f79e634cc3d7b71059a65615463f3be
c190f9332bfd0a9c984f415e1477cdcd080d20bd
refs/heads/master
2020-06-02T00:57:19.531354
2010-11-23T18:26:27
2010-11-23T18:26:27
42,916,149
0
1
null
null
null
null
UTF-8
C++
false
false
535
h
#include "decoder.h" #include "mpg123/mpg123.h" #ifndef _MPG123DECODER_H_ #define _MPG123DECODER_H_ class Mpg123Decoder: public decoder { public: ~Mpg123Decoder(); bool open(char *file); void close(); int read(); // void rewind(); // long position(); long skipSamples(long numSamples); private: int readBuffer(); void cleanup(mpg123_handle* handle); mpg123_handle* m_handle; int m_leftSamples; int m_offset; size_t m_buffer_size; unsigned char* m_buffer; }; #endif /* _MPG123DECODER_H_ */
[ [ [ 1, 29 ] ] ]
887a2c535cdbc84531bd73112ff9c96dc5d97c64
4be39d7d266a00f543cf89bcf5af111344783205
/PortableFileSystemWatcher/PortableFileSystemWatcher/FileSystemMonitorGeneric.hpp
ff44952b42d4d4264a99d39f2321440546351d95
[]
no_license
nkzxw/lastigen-haustiere
6316bb56b9c065a52d7c7edb26131633423b162a
bdf6219725176ae811c1063dd2b79c2d51b4bb6a
refs/heads/master
2021-01-10T05:42:05.591510
2011-02-03T14:59:11
2011-02-03T14:59:11
47,530,529
1
0
null
null
null
null
UTF-8
C++
false
false
431
hpp
#ifndef FileSystemMonitorGeneric_h__ #define FileSystemMonitorGeneric_h__ #include "ImplementationSelector.hpp" class FileSystemMonitorGeneric { public: FileSystemMonitorGeneric() : implementation_( new detail::ImplementationType ) {} void startMonitoring() { implementation_->startMonitoring(""); } private: detail::ImplementationType* implementation_; }; #endif // FileSystemMonitorGeneric_h__
[ "fpelliccioni@c29dda52-a065-11de-a33f-1de61d9b9616" ]
[ [ [ 1, 22 ] ] ]
a8da31bcf00244f04fbe3db30fbfa8ca0ca66832
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/multi_index/test/test_key_extractors_main.cpp
a092ba975657852a1faa6c6ded7f5cc43595b73d
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
ISO-8859-1
C++
false
false
505
cpp
/* Boost.MultiIndex test for key extractors. * * Copyright 2003-2004 Joaquín M López Muñoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org/libs/multi_index for library home page. */ #include <boost/test/included/test_exec_monitor.hpp> #include "test_key_extractors.hpp" int test_main(int,char *[]) { test_key_extractors(); return 0; }
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 18 ] ] ]
16d2d5805336f5c014f4b32eee7e411203168cc7
898c56a96d977ff0bcfbaa87aef5e8fcce5a01db
/usr_src/ImageCImg.cpp
6e5d2b822ecddc662f1294aa04222a16362229a8
[]
no_license
pecc0/jw-earth
e00d64523bb6f983196edade38f7c05b3d4ad3ec
ee6df165a9625fdba8ba406055ae10f6bf03beac
refs/heads/master
2016-09-05T23:28:26.383570
2011-03-05T22:59:41
2011-03-05T22:59:41
38,072,455
0
0
null
null
null
null
UTF-8
C++
false
false
3,494
cpp
/* * ImageCImg.cpp * * Created on: Mar 4, 2011 * Author: Petko */ #include "irrlitch/ImageCImg.h" //virtual ([^\(]*) ([a-zA-Z]+)\(([^\)]*)\)([ const]*); //\1 ImageCImg::\2(\3) \4 {} ImageCImg::ImageCImg(CImg<wrappedPixelFormat>* wrapped) : m_wrapped(wrapped), m_size(wrapped->width(), wrapped->height()) { } ImageCImg::~ImageCImg() { } void* ImageCImg::lock() { return m_wrapped->data(); } //! Unlock function. /** Should be called after the pointer received by lock() is not needed anymore. */ void ImageCImg::unlock() { } //! Returns width and height of image data. const core::dimension2d<u32>& ImageCImg::getDimension() const { return m_size; } //! Returns bits per pixel. u32 ImageCImg::getBitsPerPixel() const { return getBytesPerPixel() * 8; } //! Returns bytes per pixel u32 ImageCImg::getBytesPerPixel() const { return m_wrapped->spectrum(); } //! Returns image data size in bytes u32 ImageCImg::getImageDataSizeInBytes() const { return m_wrapped->width() * m_wrapped->height() * getBytesPerPixel(); } //! Returns image data size in pixels u32 ImageCImg::getImageDataSizeInPixels() const { return getImageDataSizeInBytes() * 8; } //! Returns a pixel SColor ImageCImg::getPixel(u32 x, u32 y) const { return SColor(255, m_wrapped->operator ()(x, y, 0, 0), m_wrapped->operator ()(x, y, 0, 1), m_wrapped->operator ()(x, y, 0, 2)); } //! Sets a pixel void ImageCImg::setPixel(u32 x, u32 y, const SColor &color, bool blend) { const wrappedPixelFormat colorArr[] = { color.getRed(), color.getGreen(), color.getBlue() }; m_wrapped->draw_point(x, y, colorArr); } //! Returns the color format ECOLOR_FORMAT ImageCImg::getColorFormat() const { return ECF_R8G8B8; } //! Returns mask for red value of a pixel u32 ImageCImg::getRedMask() const { return 0x00FF0000; } //! Returns mask for green value of a pixel u32 ImageCImg::getGreenMask() const { return 0x0000FF00; } //! Returns mask for blue value of a pixel u32 ImageCImg::getBlueMask() const { return 0x000000FF; } //! Returns mask for alpha value of a pixel u32 ImageCImg::getAlphaMask() const { return 0x0; } //! Returns pitch of image u32 ImageCImg::getPitch() const { return m_wrapped->width() * getBytesPerPixel(); } //! Copies the image into the target, scaling the image to fit void ImageCImg::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch) { } //! Copies the image into the target, scaling the image to fit void ImageCImg::copyToScaling(IImage* target) { } //! copies this surface into another void ImageCImg::copyTo(IImage* target, const core::position2d<s32>& pos) { } //! copies this surface into another void ImageCImg::copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect) { } //! copies this surface into another, using the alpha mask, an cliprect and a color to add with void ImageCImg::copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const SColor &color, const core::rect<s32>* clipRect) { } //! copies this surface into another, scaling it to fit, appyling a box filter void ImageCImg::copyToScalingBoxFilter(IImage* target, s32 bias, bool blend) { } //! fills the surface with black or white void ImageCImg::fill(const SColor &color) { }
[ "[email protected]@b00f97f9-4d11-03a6-6959-139d95cb2541" ]
[ [ [ 1, 154 ] ] ]
4c0dd209e3336d332ec1c5f3e6fdcd1162411616
c655873fdcffba50abae5cba17eab2ea6ab1d63b
/gui/ajouterproduitdialog.h
1d194eb23104f7ae81971e16dfc30a8b74633e78
[]
no_license
Shiryu/ManShop
46a13f246ec2dba014aadc4c37ed9fd3fad3333c
979f587dcb6d98ddee4207e532a72015978a303b
refs/heads/master
2020-05-29T09:04:39.825239
2011-04-15T08:13:35
2011-04-15T08:13:35
1,560,109
0
0
null
null
null
null
UTF-8
C++
false
false
594
h
#ifndef AJOUTERPRODUITDIALOG_H #define AJOUTERPRODUITDIALOG_H #include <QMessageBox> #include <qdjango/QDjangoModel.h> #include "core/produit.h" #include "core/stock.h" #include "core/rproduitstock.h" #include "ui_ajouterproduitdialog.h" class AjouterProduitDialog : public QDialog, private Ui::AjouterProduitDialog { Q_OBJECT private slots: void ajouterProduit(); public: explicit AjouterProduitDialog(QWidget *parent = 0); void initComposants(); bool existe( QString codeStock, QString codeProduit ); }; #endif // AJOUTERPRODUITDIALOG_H
[ [ [ 1, 27 ] ] ]
785f62470838a75dae5ca0dbd75cb55a13f76461
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/lbs/LocAcquisition/src/testsatellite.cpp
7a934d050975bf80078ffbc7e88a1abb7ce42277
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
11,853
cpp
/* * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: Helper class for TSatelliteData & TPositionSatelliteInfo class * */ // System Includes // User Includes #include "testsatellite.h" #include <e32std.h> // Constant Declarations // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- // C++ Default Constructor // --------------------------------------------------------------------------- // TTestSatellite ::TTestSatellite (CStifLogger* aLog):iLog(aLog) { } // --------------------------------------------------------------------------- // C++ Destructor // --------------------------------------------------------------------------- // TTestSatellite ::~TTestSatellite () { } // --------------------------------------------------------- // Test case for Default Constructor of TSatelliteData // --------------------------------------------------------- // TInt TTestSatellite :: DefaultSatelliteData() { TSatelliteData satData; return KErrNone; } // --------------------------------------------------------- // Test case for setting & getting SatelliteId // --------------------------------------------------------- TInt TTestSatellite :: SetGetSatelliteId(CStifItemParser& aItem) { TInt satId1 = 0; TInt error = aItem.GetNextInt(satId1); TSatelliteData satData; if(!error) { satData.SetSatelliteId(satId1); TInt satId2 = satData.SatelliteId(); if(satId2==satId1) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting Azimuth // --------------------------------------------------------- TInt TTestSatellite :: SetGetAzimuth(CStifItemParser& aItem) { TInt azimuth1 = 0; TInt error = aItem.GetNextInt(azimuth1); TReal32 azimuth2 = static_cast<TReal32>(azimuth1); TSatelliteData satData; if(!error) { satData.SetAzimuth(azimuth2); TReal32 azimuth3 = satData.Azimuth(); if(azimuth3==azimuth2) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting Elevation // --------------------------------------------------------- TInt TTestSatellite :: SetGetElevation(CStifItemParser& aItem) { TInt elevation1 = 0; TInt error = aItem.GetNextInt(elevation1); TReal32 elevation2 = static_cast<TReal32>(elevation1); TSatelliteData satData; if(!error) { satData.SetElevation(elevation2); TReal32 elevation3 = satData.Elevation(); if(elevation3==elevation2) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for checking if Used // --------------------------------------------------------- TInt TTestSatellite :: SetGetIsUsed(CStifItemParser& aItem) { TInt used = 0; TInt error = aItem.GetNextInt(used); TSatelliteData satData; if(!error) { satData.SetIsUsed(used); TBool check = satData.IsUsed(); if(check==used) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting the signal strength // --------------------------------------------------------- TInt TTestSatellite :: SetGetSignalStrength(CStifItemParser& aItem) { TInt sigStrength1 = 0; TInt error = aItem.GetNextInt(sigStrength1); TSatelliteData satData; if(!error) { satData.SetSignalStrength(sigStrength1); TInt sigStrength2 = satData.SignalStrength(); if(sigStrength2==sigStrength1) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for Default Constructor of TPositionSatelliteInfo // --------------------------------------------------------- // TInt TTestSatellite :: DefaultPositionSatelliteInfo() { TPositionSatelliteInfo satData; return KErrNone; } // --------------------------------------------------------- // Test case for setting & getting the satellite time // --------------------------------------------------------- // TInt TTestSatellite :: SetGetSatelliteTime(CStifItemParser& aItem) { TInt satTime = 0; TInt error = aItem.GetNextInt(satTime); TTime time(satTime); TPositionSatelliteInfo satData; if(!error) { satData.SetSatelliteTime(time); TTime satelliteTime = satData.SatelliteTime(); if(satelliteTime==time) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting the HorizontalDoP // --------------------------------------------------------- TInt TTestSatellite :: SetGetHorizontalDoP(CStifItemParser& aItem) { TInt horDoP1 = 0; TInt error = aItem.GetNextInt(horDoP1); TReal32 horDoP2 = static_cast<TReal32>(horDoP1); TPositionSatelliteInfo satData; if(!error) { satData.SetHorizontalDoP(horDoP2); TReal32 horDoP3 = satData.HorizontalDoP(); if(horDoP3==horDoP2) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting the VerticalDoP // --------------------------------------------------------- TInt TTestSatellite :: SetGetVerticalDoP(CStifItemParser& aItem) { TInt verDoP1 = 0; TInt error = aItem.GetNextInt(verDoP1); TReal32 verDoP2 = static_cast<TReal32>(verDoP1); TPositionSatelliteInfo satData; if(!error) { satData.SetVerticalDoP(verDoP2); TReal32 verDoP3 = satData.VerticalDoP(); if(verDoP3==verDoP2) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for setting & getting the TimeDoP // --------------------------------------------------------- TInt TTestSatellite :: SetGetTimeDoP(CStifItemParser& aItem) { TInt timeDoP1 = 0; TInt error = aItem.GetNextInt(timeDoP1); TReal32 timeDoP2 = static_cast<TReal32>(timeDoP1); TPositionSatelliteInfo satData; if(!error) { satData.SetTimeDoP(timeDoP2); TReal32 timeDoP3 = satData.TimeDoP(); if(timeDoP3==timeDoP2) { return KErrNone; } else return KErrGeneral; } else return KErrGeneral; } // --------------------------------------------------------- // Test case to check the NumSatellitesInView // --------------------------------------------------------- TInt TTestSatellite :: GetNumSatellitesInView() { TPositionSatelliteInfo satData; TInt numOfSat = satData.NumSatellitesInView(); if(numOfSat==0) { return KErrNone; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for ClearSatellitesInView // --------------------------------------------------------- TInt TTestSatellite :: DoClearSatellitesInView() { TPositionSatelliteInfo satInfo; satInfo.ClearSatellitesInView(); return KErrNone; } // --------------------------------------------------------- // Test case to check the NumSatellitesUsed // --------------------------------------------------------- TInt TTestSatellite :: GetNumSatellitesUsed() { TPositionSatelliteInfo satData; TInt numOfSat = satData.NumSatellitesUsed(); if(numOfSat==0) { return KErrNone; } else return KErrGeneral; } // --------------------------------------------------------- // Test case for AppendSatelliteData // --------------------------------------------------------- TInt TTestSatellite :: DoAppendSatelliteData() { // AppendSatelliteData() returns KErrOverflow if an attempt is made to store // details of more than KMaxSatellitesInView TPositionSatelliteInfo satInfo; TSatelliteData satData,satData1; TInt counter = 0; while(counter<20) { satInfo.AppendSatelliteData(satData); counter++; } satInfo.AppendSatelliteData(satData); TInt err = satInfo.AppendSatelliteData(satData1); return err; } // --------------------------------------------------------- // Test case for GetSatelliteData // --------------------------------------------------------- TInt TTestSatellite :: ToGetSatelliteData() { //GetSatelliteData() returns KErrNotFound if aIndex is outside the range of 0 to //{NumSatellitesInView() - 1}. TSatelliteData satData,satData1,satData2; TPositionSatelliteInfo satInfo; TInt numOfSat = satInfo.NumSatellitesInView(); TInt err = satInfo.GetSatelliteData(numOfSat+1,satData); return err; }
[ "none@none" ]
[ [ [ 1, 377 ] ] ]
91a3fd259256f278a86f4108fe1fd2512a2c2e60
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/nebula2/src/scene/nsceneserver_main.cc
90fc2cc126a565b9e8b94332475b5c5084b889be
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
21,978
cc
//------------------------------------------------------------------------------ // nsceneserver_main.cc // (C) 2002 RadonLabs GmbH //------------------------------------------------------------------------------ #include "scene/nsceneserver.h" #include "scene/nscenenode.h" #include "scene/nrendercontext.h" #include "scene/nmaterialnode.h" #include "scene/nlightnode.h" #include "gfx2/ngfxserver2.h" #include "gfx2/nshader2.h" #include "gfx2/nocclusionquery.h" #include "kernel/nfileserver2.h" #include "shadow2/nshadowserver2.h" #include "resource/nresourceserver.h" #include "mathlib/bbox.h" #include "mathlib/sphere.h" #include "mathlib/line.h" #include "scene/nabstractcameranode.h" #include "util/npriorityarray.h" #include "scene/nshapenode.h" nNebulaScriptClass(nSceneServer, "nroot"); nSceneServer* nSceneServer::Singleton = 0; vector3 nSceneServer::viewerPos; int nSceneServer::sortingOrder = nRpPhase::BackToFront; //------------------------------------------------------------------------------ /** */ nSceneServer::nSceneServer() : isOpen(false), inBeginScene(false), obeyLightLinks(false), gfxServerInBeginScene(false), ffpLightingApplied(false), renderDebug(false), stackDepth(0), shapeBucket(0, 1024), occlusionQuery(0), occlusionQueryEnabled(true), clipPlaneFencing(true), guiEnabled(true), camerasEnabled(true), perfGuiEnabled(false) { n_assert(0 == Singleton); Singleton = this; PROFILER_INIT(profFrame, "profSceneFrame"); PROFILER_INIT(profAttach, "profSceneAttach"); PROFILER_INIT(profValidateResources, "profSceneValidateResources"); PROFILER_INIT(profSplitNodes, "profSceneSplitNodes"); PROFILER_INIT(profComputeScissors, "profSceneComputeScissors"); PROFILER_INIT(profSortNodes, "profSceneSortNodes"); PROFILER_INIT(profRenderShadow, "profSceneRenderShadow"); PROFILER_INIT(profOcclusion, "profSceneOcclusion"); PROFILER_INIT(profRenderPath, "profSceneRenderPath"); PROFILER_INIT(profRenderCameras, "profSceneRenderCameras"); WATCHER_INIT(watchNumInstanceGroups, "watchSceneNumInstanceGroups", nArg::Int); WATCHER_INIT(watchNumInstances, "watchSceneNumInstances", nArg::Int); WATCHER_INIT(watchNumOccluded, "watchSceneNumOccluded", nArg::Int); WATCHER_INIT(watchNumNotOccluded, "watchSceneNumNotOccluded", nArg::Int); WATCHER_INIT(watchNumPrimitives, "watchGfxNumPrimitives", nArg::Int); WATCHER_INIT(watchFPS, "watchGfxFPS", nArg::Float); WATCHER_INIT(watchNumDrawCalls, "watchGfxDrawCalls", nArg::Int); this->groupArray.SetFlags(nArray<Group>::DoubleGrowSize); this->lightArray.SetFlags(nArray<LightInfo>::DoubleGrowSize); this->shadowLightArray.SetFlags(nArray<LightInfo>::DoubleGrowSize); this->rootArray.SetFlags(nArray<ushort>::DoubleGrowSize); this->shadowArray.SetFlags(nArray<ushort>::DoubleGrowSize); this->groupStack.SetSize(MaxHierarchyDepth); this->groupStack.Clear(0); // dummy far far away value^^ this->renderedReflectorDistance = 99999999.9f; // default there is no rendered reflector this->renderContextPtr = 0; // get class pointer to compare, and check this stuff reqReflectClass = kernelServer->FindClass("nreflectioncameranode"); reqRefractClass = kernelServer->FindClass("nclippingcameranode"); n_assert(reqReflectClass); n_assert(reqRefractClass); } //------------------------------------------------------------------------------ /** */ nSceneServer::~nSceneServer() { n_assert(!this->inBeginScene); n_assert(Singleton); Singleton = 0; } //------------------------------------------------------------------------------ /** Open the scene server. This will parse the render path, initialize the shaders assign from the render path, and finally invoke nGfxServer2::OpenDisplay(). */ bool nSceneServer::Open() { n_assert(!this->isOpen); // parse renderpath XML file if (this->renderPath.OpenXml()) { // initialize the shaders assign from the render path nFileServer2::Instance()->SetAssign("shaders", this->renderPath.GetShaderPath()); // open the display nGfxServer2* gfxServer = nGfxServer2::Instance(); bool displayOpened = gfxServer->OpenDisplay(); n_assert(displayOpened); // open the shadow server (after opening display!) nShadowServer2::Instance()->Open(); // initialize the render path object bool renderPathOpened = this->renderPath.Open(); n_assert(renderPathOpened); // unload the XML doc this->renderPath.CloseXml(); // create an occlusion query object this->occlusionQuery = gfxServer->NewOcclusionQuery(); this->isOpen = true; } else { n_error("nSceneServer could not open render path file '%s'!", this->renderPath.GetFilename().Get()); } return this->isOpen; } //------------------------------------------------------------------------------ /** Close the scene server. This will also nGfxServer2::CloseDisplay(). */ void nSceneServer::Close() { n_assert(this->isOpen); n_assert(this->occlusionQuery); this->occlusionQuery->Release(); this->occlusionQuery = 0; this->renderPath.Close(); nShadowServer2::Instance()->Close(); nGfxServer2::Instance()->CloseDisplay(); this->isOpen = false; } //------------------------------------------------------------------------------ /** Begin building the scene. Must be called once before attaching nSceneNode hierarchies using nSceneServer::Attach(). @param viewer the viewer position and orientation */ bool nSceneServer::BeginScene(const matrix44& invView) { n_assert(this->isOpen); n_assert(!this->inBeginScene); PROFILER_START(this->profFrame); PROFILER_START(this->profAttach); this->stackDepth = 0; this->groupStack.Clear(0); this->groupArray.Reset(); this->rootArray.Reset(); matrix44 view = invView; view.invert_simple(); nGfxServer2::Instance()->SetTransform(nGfxServer2::View, view); WATCHER_RESET_INT(watchNumInstanceGroups); WATCHER_RESET_INT(watchNumInstances); WATCHER_RESET_INT(watchNumOccluded); WATCHER_RESET_INT(watchNumNotOccluded); this->inBeginScene = nGfxServer2::Instance()->BeginFrame(); return this->inBeginScene; } //------------------------------------------------------------------------------ /** Attach a scene node to the scene. This will simply invoke nSceneNode::Attach() on the scene node hierarchie's root object. */ void nSceneServer::Attach(nRenderContext* renderContext) { n_assert(renderContext); nSceneNode* rootNode = renderContext->GetRootNode(); n_assert(rootNode); // put index of new root node on root array this->rootArray.Append(this->groupArray.Size()); // reset hints in render context renderContext->SetFlag(nRenderContext::Occluded, false); // let root node hierarchy attach itself to scene rootNode->Attach(this, renderContext); } //------------------------------------------------------------------------------ /** Finish building the scene. */ void nSceneServer::EndScene() { // make sure the modelview stack is clear n_assert(0 == this->stackDepth); this->inBeginScene = false; PROFILER_STOP(this->profAttach); } //------------------------------------------------------------------------------ /** This method is called back by nSceneNode objects in their Attach() method to notify the scene server that a new hierarchy group starts. */ void nSceneServer::BeginGroup(nSceneNode* sceneNode, nRenderContext* renderContext) { n_assert(sceneNode); n_assert(renderContext); n_assert(this->stackDepth < MaxHierarchyDepth); // initialize new group node // FIXME: could be optimized to have no temporary // object which must be copied onto array Group group; group.sceneNode = sceneNode; group.renderContext = renderContext; group.lightPass = 0; bool isTopLevel; if (0 == this->stackDepth) { group.parentIndex = -1; isTopLevel = true; } else { group.parentIndex = this->groupStack[this->stackDepth - 1]; isTopLevel = false; } renderContext->SetSceneGroupIndex(this->groupArray.Size()); this->groupArray.Append(group); // push pointer to group onto hierarchy stack this->groupStack[this->stackDepth] = this->groupArray.Size() - 1; ++this->stackDepth; // immediately call the scene node's RenderTransform method if (isTopLevel) { matrix44 topMatrix = renderContext->GetTransform(); sceneNode->RenderTransform(this, renderContext, topMatrix); } else { sceneNode->RenderTransform(this, renderContext, this->groupArray[group.parentIndex].modelTransform); } } //------------------------------------------------------------------------------ /** This method is called back by nSceneNode objects in their Attach() method to notify the scene server that a hierarchy group ends. */ void nSceneServer::EndGroup() { n_assert(this->stackDepth > 0); this->stackDepth--; } //------------------------------------------------------------------------------ /** Render the actual scene. This method should be implemented by subclasses of nSceneServer. The frame will not be visible until PresentScene() is called. Additional render calls to the gfx server can be invoked between RenderScene() and PresentScene(). */ void nSceneServer::RenderScene() { nGfxServer2* gfxServer = nGfxServer2::Instance(); // split nodes into shapes and lights this->SplitNodes(); // NOTE: this must happen after make sure node resources are loaded // because the reflection/refraction camera stuff depends on it this->ValidateNodeResources(); // compute light scissor rectangles and clip planes this->ComputeLightScissorsAndClipPlanes(); // sort shape nodes for optimal rendering this->SortNodes(); // render camera nodes in scene if (this->camerasEnabled) { this->RenderCameraScene(); } /// reset light passes in shape groups between renderpath for (int i = 0; i < this->shapeBucket.Size(); i++) { const nArray<ushort>& shapeArray = this->shapeBucket[i]; for (int j = 0; j < shapeArray.Size(); j++) { this->groupArray[shapeArray[j]].lightPass = 0; } } // render final scene PROFILER_START(this->profRenderPath); int sectionIndex = this->renderPath.FindSectionIndex("default"); n_assert(-1 != sectionIndex); this->DoRenderPath(this->renderPath.GetSection(sectionIndex)); PROFILER_STOP(this->profRenderPath); // HACK... this->gfxServerInBeginScene = gfxServer->BeginScene(); } //------------------------------------------------------------------------------ /** Finalize rendering and present the current frame. No additional rendering calls may be invoked after calling nSceneServer::PresentScene() */ void nSceneServer::PresentScene() { nGfxServer2* gfxServer = nGfxServer2::Instance(); if (this->gfxServerInBeginScene) { if (this->renderDebug) { this->DebugRenderLightScissors(); this->DebugRenderShapes(); } if (this->perfGuiEnabled) { this->DebugRenderPerfGui(); } gfxServer->DrawTextBuffer(); gfxServer->EndScene(); gfxServer->PresentScene(); } gfxServer->EndFrame(); PROFILER_STOP(this->profFrame); } //------------------------------------------------------------------------------ /** Split the collected scene nodes into light and shape nodes. Fills the lightArray[] and shapeArray[] members. This method is available as a convenience method for subclasses. */ void nSceneServer::SplitNodes() { PROFILER_START(this->profSplitNodes); // reset complex rendered reflector this->renderContextPtr = 0; this->renderedReflectorDistance = 999999.9f; // clear arrays which are filled by this method this->shapeBucket.Clear(); this->lightArray.Clear(); this->shadowLightArray.Clear(); this->shadowArray.Reset(); this->cameraArray.Reset(); ushort i; ushort num = this->groupArray.Size(); for (i = 0; i < num; i++) { Group& group = this->groupArray[i]; n_assert(group.sceneNode); if (group.sceneNode->HasGeometry()) { if (group.renderContext->GetFlag(nRenderContext::ShapeVisible)) { nMaterialNode* shapeNode = (nMaterialNode*)group.sceneNode; // if this is a reflecting shape, parse for render priority if (this->IsAReflectingShape(shapeNode)) { // check if this one is the new (or old) node to be rendered complex if (this->ParsePriority(group)) { this->cameraArray.Reset(); group.renderContext->GetShaderOverrides().SetArg(nShaderState::RenderComplexity, 1); } else { // reset complex flag (we think this one is not the one to be rendered complex) group.renderContext->GetShaderOverrides().SetArg(nShaderState::RenderComplexity, 0); } } int shaderIndex = shapeNode->GetShaderIndex(); if (shaderIndex > -1) { this->shapeBucket[shaderIndex].Append(i); } } } if (group.sceneNode->HasLight()) { n_assert(group.sceneNode->IsA("nlightnode")); group.renderContext->SetSceneLightIndex(this->lightArray.Size()); LightInfo lightInfo; lightInfo.groupIndex = i; this->lightArray.Append(lightInfo); } if (group.sceneNode->HasShadow()) { if (group.renderContext->GetFlag(nRenderContext::ShadowVisible)) { this->shadowArray.Append(i); } } if (group.sceneNode->HasCamera()) { nAbstractCameraNode* newCamera = (nAbstractCameraNode*) group.sceneNode; // do the following stuff only if this camera is a child of the nearest seanode const nRenderContext* renderCandidate = (nRenderContext*) group.renderContext; // check if one reflecting camera has priority to be rendered if (this->renderContextPtr != 0) { // if this is the chosen one to be rendered if (renderCandidate == this->renderContextPtr) { // HACK!!!: at the moment the cameras are only used for water, and all use // the same render target (because this is defined in the section, not by the // camera. Therefor it is useless to render more than one camera per section. // If later other cameras are used this must be fixed. A way must be found // to decide if 2 cameras are the same, or creating different rendertarget results. // check if we already have a camera using the same renderpath section int c; bool uniqueCamera = true; for (c = 0; c < this->cameraArray.Size(); c++) { Group& group = this->groupArray[this->cameraArray[c]]; nAbstractCameraNode* existingCamera = (nAbstractCameraNode*)group.sceneNode; if (existingCamera->GetRenderPathSection() == newCamera->GetRenderPathSection()) { uniqueCamera = false; break; } } if (uniqueCamera) { this->cameraArray.Append(i); } } } } } PROFILER_STOP(this->profSplitNodes); } //------------------------------------------------------------------------------ /** This makes sure that all attached shape and light nodes have loaded their resources. This method is available as a convenience method for subclasses. */ void nSceneServer::ValidateNodeResources() { PROFILER_START(this->profValidateResources); // need to evaluate camera nodes first, because they create // textures used by other nodes ushort i; ushort num = this->cameraArray.Size(); for (i = 0; i < num; i++) { Group& group = this->groupArray[this->cameraArray[i]]; if (!group.sceneNode->AreResourcesValid()) { group.sceneNode->LoadResources(); } } // then evaluate the rest num = this->groupArray.Size(); for (i = 0; i < num; i++) { const Group& group = this->groupArray[i]; if (!group.sceneNode->AreResourcesValid()) { group.sceneNode->LoadResources(); } } PROFILER_STOP(this->profValidateResources); } //------------------------------------------------------------------------------ /** The scene node sorting compare function. The goal is to sort the attached shape nodes for optimal rendering performance. */ int __cdecl nSceneServer::CompareNodes(const ushort* i1, const ushort* i2) { nSceneServer* sceneServer = nSceneServer::Singleton; const nSceneServer::Group& g1 = sceneServer->groupArray[*i1]; const nSceneServer::Group& g2 = sceneServer->groupArray[*i2]; // by render priority int cmp = g1.sceneNode->GetRenderPri() - g2.sceneNode->GetRenderPri(); if (cmp != 0) { return cmp; } // by identical scene node cmp = int(g1.sceneNode) - int(g2.sceneNode); if (cmp == 0) { return cmp; } // distance to viewer (closest first) static vector3 dist1; static vector3 dist2; dist1.set(viewerPos.x - g1.modelTransform.M41, viewerPos.y - g1.modelTransform.M42, viewerPos.z - g1.modelTransform.M43); dist2.set(viewerPos.x - g2.modelTransform.M41, viewerPos.y - g2.modelTransform.M42, viewerPos.z - g2.modelTransform.M43); float diff = dist1.lensquared() - dist2.lensquared(); if (sortingOrder == nRpPhase::FrontToBack) { // (closest first) if (diff < 0.001f) return -1; if (diff > 0.001f) return 1; } else if (sortingOrder == nRpPhase::BackToFront) { if (diff > 0.001f) return -1; if (diff < 0.001f) return 1; } // nodes are identical return 0; } //------------------------------------------------------------------------------ /** Specialized sorting function for shadow casting light sources, sorts lights by range and distance. */ int __cdecl nSceneServer::CompareShadowLights(const LightInfo* i1, const LightInfo* i2) { nSceneServer* sceneServer = nSceneServer::Singleton; const nSceneServer::Group& g1 = sceneServer->groupArray[i1->groupIndex]; const nSceneServer::Group& g2 = sceneServer->groupArray[i2->groupIndex]; // compute intensity static vector3 dist1; static vector3 dist2; dist1.set(viewerPos.x - g1.modelTransform.M41, viewerPos.y - g1.modelTransform.M42, viewerPos.z - g1.modelTransform.M43); dist2.set(viewerPos.x - g2.modelTransform.M41, viewerPos.y - g2.modelTransform.M42, viewerPos.z - g2.modelTransform.M43); nLightNode* ln1 = (nLightNode*)g1.sceneNode; nLightNode* ln2 = (nLightNode*)g2.sceneNode; n_assert(ln1->IsA("nlightnode") && ln2->IsA("nlightnode")); float range1 = ln1->GetLocalBox().extents().x; float range2 = ln2->GetLocalBox().extents().x; float intensity1 = n_saturate(dist1.len() / range1); float intensity2 = n_saturate(dist2.len() / range2); float diff = intensity1 - intensity2; if (diff < 0.001f) return -1; if (diff > 0.001f) return 1; return 0; } //------------------------------------------------------------------------------ /** Sort the indices in the shape array for optimal rendering. */ void nSceneServer::SortNodes() { PROFILER_START(this->profSortNodes); // initialize the static viewer pos vector viewerPos = nGfxServer2::Instance()->GetTransform(nGfxServer2::InvView).pos_component(); // for each bucket: call the sorter hook int i; int num = this->shapeBucket.Size(); for (i = 0; i < num; i++) { int numIndices = this->shapeBucket[i].Size(); if (numIndices > 0) { ushort* indexPtr = (ushort*)this->shapeBucket[i].Begin(); qsort(indexPtr, numIndices, sizeof(ushort), (int(__cdecl*)(const void*, const void*))CompareNodes); } } // sort shadow casting light sources int numShadowLights = this->shadowLightArray.Size(); if (numShadowLights > 0) { qsort(&(this->shadowLightArray[0]), numShadowLights, sizeof(LightInfo), (int(__cdecl*)(const void*, const void*))CompareShadowLights); } PROFILER_STOP(this->profSortNodes); }
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 643 ] ] ]
679400467f46c1370f5495e9210798c52556084e
d8a93d1a0152abf719b6d614a1871f7a65a940ba
/MovieVis/src/PersonPair.cpp
2c99bd1799379103a754b0c1feb0688de0fac8cb
[]
no_license
awshepard/movievis
be0d732e2e54d60ed1a31cd7c67e4ea6d26b0f5a
079432ec45baa98d67d976b28c14cd96116760c6
refs/heads/master
2021-01-18T22:35:58.479908
2010-07-09T04:48:33
2010-07-09T04:48:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
378
cpp
/** * \file PersonPair.cpp * \author Douglas W. Paul and Adam Shepard * * Defines the behavior of the PersonPair class */ #include "PersonPair.hpp" PersonPair::PersonPair(const shared_ptr<Person> &firstPerson, const shared_ptr<Person> &secondPerson) { this->firstPerson = firstPerson; this->secondPerson = secondPerson; } PersonPair::~PersonPair() { }
[ "douglyuckling@483a7388-aa76-4cae-9b69-882d6fd7d2f9" ]
[ [ [ 1, 16 ] ] ]
e645180c74af1f563f827004628885f33c57a5be
51e1cf5dc3b99e8eecffcf5790ada07b2f03f39c
/SMC/src/box.cpp
d45c5eea6a64df1568d45504434f4e98cf0e662f
[]
no_license
jdek/jim-pspware
c3e043b59a69cf5c28daf62dc9d8dca5daf87589
fd779e1148caac2da4c590844db7235357b47f7e
refs/heads/master
2021-05-31T06:45:03.953631
2007-06-25T22:45:26
2007-06-25T22:45:26
56,973,047
2
1
null
null
null
null
UTF-8
C++
false
false
15,142
cpp
/*************************************************************************** box.cpp - classes for some boxes used in the game ------------------- copyright : (C) 2003-2004 by Artur Hallmann (C) 2003-2005 by FluXy ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "include/globals.h" /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ cGoldBox :: cGoldBox( double x, double y ) : cActiveSprite( x, y ) { SetImage( GetImage( "game/box/yellow1_1.png" ) ); movedir = 5; used = 0; type = TYPE_GOLDBOX; visible = 1; massive = 1; image2 = GetImage( "game/box/brown1_1.png" ); SetPos( x, y ); bgp = NULL; // Bouncing GoldPiece } cGoldBox :: ~cGoldBox( void ) { if( bgp ) { delete bgp; bgp = NULL; } image2 = NULL; } void cGoldBox :: PlayerCollision( ObjectDirection cdirection ) { if( cdirection == DIR_UP )// if player jumps from below { if( used == 0 && !bgp ) { pAudio->PlaySound( SOUNDS_DIR "/goldpiece.ogg" ); if( !PosValid( (int)posx, (int)posy - rect.h, (int)(rect.w*0.8), 5 ) ) { if( iCollisionType == 3 && EnemyObjects[iCollisionNumber]->type != TYPE_JPIRANHA ) // if Enemy { pAudio->PlaySound( SOUNDS_DIR "/stomp_3.ogg" ); EnemyObjects[iCollisionNumber]->Die(); } else if( iCollisionType == 2 && ( ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_DEFAULT || ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_LIVE_1 ) ) { ActiveObjects[iCollisionNumber]->BoxCollision( DIR_DOWN, &rect ); } } SetImage( image2 ); bgp = new cBouncingGoldPiece( posx + 2 , posy ); movedir = cdirection; used = 1; } else { pAudio->PlaySound( SOUNDS_DIR "/tock.ogg" ); } } } void cGoldBox :: EnemyCollision( ObjectDirection cdirection ) { if( cdirection == DIR_RIGHT || cdirection == DIR_LEFT ) { if( used == 0 && !bgp ) { pAudio->PlaySound( SOUNDS_DIR "/goldpiece.ogg" ); SetImage( image2 ); bgp = new cBouncingGoldPiece( posx + 2 , posy ); movedir = cdirection; used = 1; } else { if( Visible_onScreen() ) { pAudio->PlaySound( SOUNDS_DIR "/tock.ogg" ); } } } } void cGoldBox :: Update( void ) { if( bgp && bgp->visible ) { if( bgp->counter < DESIRED_FPS * 0.5 ) { bgp->AddVel( 0, 1.62 ); } else if( bgp->posy < posy - 12.0 ) { pAnimationManager->Add( bgp->posx, bgp->posy, 1, WHITE_BLINKING_POINTS ); pointsdisplay->AddPoints( 50, (int)bgp->posx + ( bgp->image->w/3 ), (int)bgp->posy - 5 ); golddisplay->AddGold( 1 ); bgp->SetPos( bgp->posx, posy ); bgp->visible = 0; } else { bgp->SetPos( bgp->posx, posy ); bgp->visible = 0; } bgp->Update(); } else if( bgp ) { delete bgp; bgp = NULL; } if( movedir == DIR_UP ) { if( posy + 10 > startposy ) { Move( 0, -2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, -2.5, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( movedir == DIR_RIGHT ) { if( posx - 10 < startposx ) { Move( 2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 2.5, 0, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( movedir == DIR_LEFT ) { if( posx + 10 > startposx ) { Move( -2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( -2.5, 0, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( posy != startposy || posy != startposx ) { if( posy < startposy ) { Move( 0, 2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, 2.5, 0, 1 ); } if( posy > startposy ) { posy = startposy; } } else if( posx < startposx ) { Move( 2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 2.5, 0, 0, 1 ); } if( posx > startposx ) { posx = startposx; } } else if( posx > startposx ) { Move( -2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( -2.5, 0, 0, 1 ); } if( posx < startposx ) { posx = startposx; } } else { posy = startposy; posx = startposx; } } Draw( screen ); } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ cBonusBox :: cBonusBox( double x, double y, int stype ) : cActiveSprite( x, y ) { counter = 0; type = stype; movedir = 5; used = 0; visible = 1; massive = 1; if( type == TYPE_BONUSBOX_MUSHROOM_FIRE ) { images[0] = GetImage( "game/box/yellow3_1.png" ); SetImage( images[0] ); images[1] = GetImage( "game/box/yellow3_anim_1.png" ); images[2] = GetImage( "game/box/yellow3_anim_2.png" ); images[3] = GetImage( "game/box/yellow3_anim_3.png" ); images[4] = GetImage( "game/box/brown1_1.png" ); } else if( type == TYPE_BONUSBOX_LIVE ) { images[0] = GetImage( "game/box/yellow3_1.png" ); SetImage( images[0] ); images[1] = GetImage( "game/box/yellow3_anim_1.png" ); images[2] = GetImage( "game/box/yellow3_anim_2.png" ); images[3] = GetImage( "game/box/yellow3_anim_3.png" ); images[4] = GetImage( "game/box/brown1_1.png" ); } else { printf( "Unknown BonusBox type : %d\n", type ); } SetPos( x, y ); powerup = NULL; } cBonusBox :: ~cBonusBox( void ) { if( powerup ) { delete powerup; powerup = NULL; } } void cBonusBox :: PlayerCollision( ObjectDirection cdirection ) { if( cdirection == DIR_UP )// if player jumps from below { if( !used ) { if( type == TYPE_BONUSBOX_MUSHROOM_FIRE ) { if( pPlayer->maryo_type == MARYO_SMALL || ( pPlayer->maryo_type == MARYO_FIRE && !Itembox->Item_id ) ) { powerup = (cPowerUp*)new cMushroom( startposx, startposy, TYPE_MUSHROOM_DEFAULT ); } else { powerup = (cPowerUp*)new cFirePlant( startposx, startposy ); } } else if( type == TYPE_BONUSBOX_LIVE ) { powerup = (cPowerUp*)new cMushroom( startposx, startposy, TYPE_MUSHROOM_LIVE_1 ); } pAudio->PlaySound( SOUNDS_DIR "/sprout_1.ogg" ); SetImage( images[4] ); movedir = cdirection; used = 1; if( !PosValid( (int)posx, (int)posy - rect.h, (int)(rect.w*0.8), 5 ) ) { if( iCollisionType == 3 && EnemyObjects[iCollisionNumber]->type != TYPE_JPIRANHA ) // Enemy { pAudio->PlaySound( SOUNDS_DIR "/stomp_3.ogg" ); EnemyObjects[iCollisionNumber]->Die(); } else if( iCollisionType == 2 && ( ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_DEFAULT || ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_LIVE_1 ) ) { ActiveObjects[iCollisionNumber]->BoxCollision( DIR_DOWN, &rect ); } } } else { if( Visible_onScreen() ) { pAudio->PlaySound( SOUNDS_DIR "/tock.ogg" ); } } } } void cBonusBox :: EnemyCollision( ObjectDirection cdirection ) { if( cdirection == DIR_RIGHT || cdirection == DIR_LEFT ) { if( !used ) { if( type == TYPE_BONUSBOX_MUSHROOM_FIRE ) { if( pPlayer->maryo_type == MARYO_SMALL || ( pPlayer->maryo_type == MARYO_FIRE && !Itembox->Item_id ) ) { powerup = (cPowerUp*)new cMushroom( startposx, startposy, TYPE_MUSHROOM_DEFAULT ); } else { powerup = (cPowerUp*)new cFirePlant( startposx, startposy ); } } else if( type == TYPE_BONUSBOX_LIVE ) { powerup = (cPowerUp*)new cMushroom( startposx, startposy, TYPE_MUSHROOM_LIVE_1 ); } pAudio->PlaySound( SOUNDS_DIR "/sprout_1.ogg" ); SetImage( images[4] ); movedir = cdirection; used = 1; if( cdirection == DIR_RIGHT ) { if( !PosValid( (int)posx, (int)posy - rect.h, (int)(rect.w*0.8), 5 ) ) { if( iCollisionType == 3 ) // Enemy { pAudio->PlaySound( SOUNDS_DIR "/stomp_3.ogg" ); EnemyObjects[iCollisionNumber]->Die(); } } } else if( cdirection == DIR_LEFT ) { if( !PosValid( (int)posx - 7, (int)posy, (int)(rect.w*0.8), (int)(rect.h*0.9) ) ) { if( iCollisionType == 3 && EnemyObjects[iCollisionNumber]->type != TYPE_JPIRANHA ) // Enemy { pAudio->PlaySound( SOUNDS_DIR "/stomp_3.ogg" ); EnemyObjects[iCollisionNumber]->Die(); } else if( iCollisionType == 2 && ( ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_DEFAULT || ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_LIVE_1 ) ) { ActiveObjects[iCollisionNumber]->BoxCollision( DIR_DOWN, &rect ); } } } } else { if( Visible_onScreen() ) { pAudio->PlaySound( SOUNDS_DIR "/tock.ogg" ); } } } } void cBonusBox :: Update( void ) { if( powerup ) { powerup->counter += Framerate.speedfactor; powerup->Move( 0, -3.1, 0, 1 ); if( powerup->posy < posy - powerup->rect.h ) { powerup->posy = startposy - powerup->rect.h; powerup->posx = startposx; powerup->counter = 0; powerup->spawned = 1; AddActiveObject( powerup ); powerup = NULL; } else { powerup->Draw( screen ); } } if( !used ) { counter += Framerate.speedfactor; if( counter < 4) { SetImage( images[0] ); } else if( counter < 8 ) { SetImage( images[1] ); } else if( counter < 12 ) { SetImage( images[2] ); } else if( counter < 16 ) { SetImage( images[3] ); } else { counter = 0; } } if( movedir == DIR_UP ) { if( posy + 10 > startposy ) { Move( 0, -2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, -2.5, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( movedir == DIR_RIGHT) { if( posx - 10 < startposx ) { Move( 2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 2.5, 0, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( movedir == DIR_LEFT ) { if( posx + 10 > startposx ) { Move( -2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( -2.5, 0, 0, 1 ); } else if( iCollisionType ) { movedir = 5; } } else { movedir = 5; } } else if( posy != startposy || posy != startposx ) { if( posy < startposy ) { Move( 0, 2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, 2.5, 0, 1 ); } if( posy >= startposy ) { posy = startposy; } } else if( posx < startposx ) { Move( 2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 2.5, 0, 0, 1 ); } if( posx > startposx ) { posx = startposx; } } else if( posx > startposx ) { Move( -2.5, 0 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( -2.5, 0, 0, 1 ); } if( posx < startposx ) { posx = startposx; } } else { posy = startposy; posx = startposx; } } Draw( screen ); } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ cSpinBox :: cSpinBox( double x, double y ) : cActiveSprite( x, y ) { counter = 0; spin_counter = 0; move_up = 0; used = 0; type = TYPE_SPINBOX; visible = 1; massive = 1; images[0] = GetImage( "game/box/yellow1_1.png" ); SetImage( images[0] ); images[1] = GetImage( "game/box/yellow1_spin_1.png" ); images[2] = GetImage( "game/box/yellow1_spin_2.png" ); images[3] = GetImage( "game/box/yellow1_spin_3.png" ); SetPos( x, y ); spin = 0; } cSpinBox :: ~cSpinBox( void ) { // } void cSpinBox :: PlayerCollision( ObjectDirection cdirection ) { if( cdirection == DIR_UP ) // if player jumps from below { if( posy == startposy ) { move_up = 1; used = 1; if( !PosValid( (int)posx, (int)posy - rect.h, (int)(rect.w*0.8), 5 ) ) { if( iCollisionType == 3 && EnemyObjects[iCollisionNumber]->type != TYPE_JPIRANHA ) // Enemy { pAudio->PlaySound( SOUNDS_DIR "/stomp_3.ogg" ); EnemyObjects[iCollisionNumber]->Die(); } else if( iCollisionType == 2 && ( ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_DEFAULT || ActiveObjects[iCollisionNumber]->type == TYPE_MUSHROOM_LIVE_1 ) ) { ActiveObjects[iCollisionNumber]->BoxCollision( DIR_DOWN, &rect ); } } } if( !spin ) { spin = 1; massive = 0; } } } void cSpinBox :: Update( void ) { if( spin ) { counter += Framerate.speedfactor; spin_counter += Framerate.speedfactor; if( counter < 3.2 ) { // } else if( counter < DESIRED_FPS * 2 * 0.1 ) { SetImage( images[1] ); } else if(counter < DESIRED_FPS * 3 * 0.1 ) { SetImage( images[2] ); } else if( counter < DESIRED_FPS * 4 * 0.1 ) { SetImage( images[3] ); } else { SetImage( images[0] ); if( spin_counter > DESIRED_FPS * 5 ) { if( CollideBoundingBox( &pPlayer->rect, &rect ) ) { spin_counter = 0; } else { spin = 0; spin_counter = 0; massive = 1; } } counter = 0; } } if( move_up == 1 ) { if( posy + 10 > startposy ) { Move( 0, -2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, -2.5, 0, 1 ); } else if( iCollisionType ) { move_up = 0; } } else { move_up = 0; } } else if( posy != startposy ) { if( posy < startposy ) { Move( 0, 2.5 ); if( iCollisionType == 1 || iCollisionType == 2 ) // force it { Move( 0, 2.5, 0, 1 ); } } else { posy = startposy; } } Draw( screen ); } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
[ "rinco@ff2c0c17-07fa-0310-a4bd-d48831021cb5" ]
[ [ [ 1, 739 ] ] ]
f57cc0e15c5a3e1568e8fdf8bed600ebc2e61a97
9a48be80edc7692df4918c0222a1640545384dbb
/Libraries/Boost1.40/libs/spirit/example/qi/calc1.cpp
f237944ca6b898eff4417698e1a32b61341f2769
[ "BSL-1.0" ]
permissive
fcrick/RepSnapper
05e4fb1157f634acad575fffa2029f7f655b7940
a5809843f37b7162f19765e852b968648b33b694
refs/heads/master
2021-01-17T21:42:29.537504
2010-06-07T05:38:05
2010-06-07T05:38:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,381
cpp
/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ /////////////////////////////////////////////////////////////////////////////// // // Plain calculator example demonstrating the grammar. The parser is a // syntax checker only and does not do any semantic evaluation. // // [ JDG May 10, 2002 ] spirit1 // [ JDG March 4, 2007 ] spirit2 // /////////////////////////////////////////////////////////////////////////////// #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <iostream> #include <string> using namespace boost::spirit; using namespace boost::spirit::qi; using namespace boost::spirit::ascii; /////////////////////////////////////////////////////////////////////////////// // Our calculator grammar /////////////////////////////////////////////////////////////////////////////// template <typename Iterator> struct calculator : grammar<Iterator, space_type> { calculator() : calculator::base_type(expression) { expression = term >> *( ('+' >> term) | ('-' >> term) ) ; term = factor >> *( ('*' >> factor) | ('/' >> factor) ) ; factor = uint_ | '(' >> expression >> ')' | ('-' >> factor) | ('+' >> factor) ; } rule<Iterator, space_type> expression, term, factor; }; /////////////////////////////////////////////////////////////////////////////// // Main program /////////////////////////////////////////////////////////////////////////////// int main() { std::cout << "/////////////////////////////////////////////////////////\n\n"; std::cout << "Expression parser...\n\n"; std::cout << "/////////////////////////////////////////////////////////\n\n"; std::cout << "Type an expression...or [q or Q] to quit\n\n"; typedef std::string::const_iterator iterator_type; typedef calculator<iterator_type> calculator; calculator calc; // Our grammar std::string str; while (std::getline(std::cin, str)) { if (str.empty() || str[0] == 'q' || str[0] == 'Q') break; std::string::const_iterator iter = str.begin(); std::string::const_iterator end = str.end(); bool r = phrase_parse(iter, end, calc, space); if (r && iter == end) { std::cout << "-------------------------\n"; std::cout << "Parsing succeeded\n"; std::cout << "-------------------------\n"; } else { std::string rest(iter, end); std::cout << "-------------------------\n"; std::cout << "Parsing failed\n"; std::cout << "stopped at: \": " << rest << "\"\n"; std::cout << "-------------------------\n"; } } std::cout << "Bye... :-) \n\n"; return 0; }
[ "metrix@Blended.(none)" ]
[ [ [ 1, 105 ] ] ]
39736abb71d90988329dba6bd0d2d5f9a2bd31b7
bef7d0477a5cac485b4b3921a718394d5c2cf700
/dingus/dingus/resource/TextureCreator.h
b034609d9aad87dffe9bda0ae85c4c00af9222ae
[ "MIT" ]
permissive
TomLeeLive/aras-p-dingus
ed91127790a604e0813cd4704acba742d3485400
22ef90c2bf01afd53c0b5b045f4dd0b59fe83009
refs/heads/master
2023-04-19T20:45:14.410448
2011-10-04T10:51:13
2011-10-04T10:51:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,769
h
// -------------------------------------------------------------------------- // Dingus project - a collection of subsystems for game/graphics applications // -------------------------------------------------------------------------- #ifndef __TEXTURE_CREATOR_H #define __TEXTURE_CREATOR_H namespace dingus { class ITextureCreator : public CRefCounted { public: typedef DingusSmartPtr<ITextureCreator> TSharedPtr; public: virtual ~ITextureCreator() = 0 { } virtual IDirect3DTexture9* createTexture() = 0; }; class CAbstractTextureCreator : public ITextureCreator { public: CAbstractTextureCreator( DWORD usage, D3DFORMAT format, D3DPOOL pool ) : mUsage(usage), mFormat(format), mPool(pool) { } protected: const DWORD mUsage; const D3DFORMAT mFormat; const D3DPOOL mPool; }; /// Creates fixed size texture class CFixedTextureCreator : public CAbstractTextureCreator { public: CFixedTextureCreator( int width, int height, int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool ) : CAbstractTextureCreator(usage,format,pool), mWidth(width), mHeight(height), mLevels(levels) { } virtual IDirect3DTexture9* createTexture(); protected: const int mWidth, mHeight, mLevels; }; /// Creates texture with size proportional to backbuffer class CScreenBasedTextureCreator : public CAbstractTextureCreator { public: CScreenBasedTextureCreator( float widthFactor, float heightFactor, int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool ) : CAbstractTextureCreator(usage,format,pool), mWidthFactor(widthFactor), mHeightFactor(heightFactor), mLevels(levels) { } virtual IDirect3DTexture9* createTexture(); protected: const float mWidthFactor; const float mHeightFactor; const int mLevels; }; /// Creates texture with size proportional to backbuffer, cropped to make divisible by some number. class CScreenBasedDivTextureCreator : public CScreenBasedTextureCreator { public: CScreenBasedDivTextureCreator( float widthFactor, float heightFactor, int bbDivisibleBy, int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool ) : CScreenBasedTextureCreator(widthFactor,heightFactor,levels,usage,format,pool), mBBDivisibleBy(bbDivisibleBy) { } virtual IDirect3DTexture9* createTexture(); protected: const int mBBDivisibleBy; }; /// Creates pow-2 texture with size proportional to backbuffer (lower pow-2) class CScreenBasedPow2TextureCreator : public CScreenBasedTextureCreator { public: CScreenBasedPow2TextureCreator( float widthFactor, float heightFactor, int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool ) : CScreenBasedTextureCreator(widthFactor,heightFactor,levels,usage,format,pool) { } virtual IDirect3DTexture9* createTexture(); }; }; // namespace #endif
[ [ [ 1, 73 ] ] ]
e843d77debd32ce000fd1c34ca768a0626a86faa
2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4
/OUAN/OUAN/Src/Audio/Sound.cpp
e42d516271c8e69da6cc70300a014d391f299999
[]
no_license
juanjmostazo/once-upon-a-night
9651dc4dcebef80f0475e2e61865193ad61edaaa
f8d5d3a62952c45093a94c8b073cbb70f8146a53
refs/heads/master
2020-05-28T05:45:17.386664
2010-10-06T12:49:50
2010-10-06T12:49:50
38,101,059
1
1
null
null
null
null
UTF-8
C++
false
false
1,470
cpp
#include "OUAN_Precompiled.h" #include "Sound.h" #include "AudioSubsystem.h" using namespace OUAN; Sound::Sound(Ogre::ResourceManager* creator, const Ogre::String& name, Ogre::ResourceHandle handle, const Ogre::String& group, bool isManual,Ogre::ManualResourceLoader* loader) :Ogre::Resource(creator, name, handle, group, isManual, loader) ,mFMODSound(NULL) { mSoundData.mId.clear(); mSoundData.mChannelGroupID.clear(); mSoundData.mFileName.clear(); mSoundData.m3D=mSoundData.mStream=mSoundData.mHardware=mSoundData.mLoop=false; mSoundData.minDistance=mSoundData.maxDistance==0.0; mSoundData.volume=1.0; createParamDictionary("Sound"); } Sound::~Sound() { unload(); } void Sound::loadImpl() { AudioSubsystem* audioSS= dynamic_cast<AudioSubsystem*> (mCreator); if (audioSS) { audioSS->createSoundImplementation(mSoundData,mFMODSound); //audioSS->createFMODSound(mSoundData,mFMODSound); } } void Sound::unloadImpl() { AudioSubsystem* audioSS= dynamic_cast<AudioSubsystem*> (mCreator); if (audioSS) { audioSS->destroySoundImplementation(mFMODSound); //audioSS->destroyFMODSound(mFMODSound); mFMODSound=NULL; } } size_t Sound::calculateSize() const { size_t totalSize=sizeof(TSoundData)+sizeof(FMOD::Sound*); return totalSize; } FMOD::Sound* Sound::getFMODSound() const { return mFMODSound; } void Sound::setFMODSound(FMOD::Sound* FMODSound) { mFMODSound=FMODSound; }
[ "ithiliel@1610d384-d83c-11de-a027-019ae363d039" ]
[ [ [ 1, 60 ] ] ]
c2194dc44ec8900fc7bfa60fb8396de4f858f20e
3cd4038d8233f7923b3a5132cdd99166f5265408
/examples/example_3.cpp
130bcb9a429b150bad6e3a804d30f541a646ed37
[]
no_license
svn2github/tiodbc
161e9586cfbcf5976a01fb3edb5164a1e00f055a
84404af14aaf33291eb8a5d9a9bbe784b83f58ee
refs/heads/master
2020-05-21T11:56:26.417426
2011-03-10T01:41:57
2011-03-10T01:41:57
11,218,056
0
0
null
null
null
null
UTF-8
C++
false
false
2,202
cpp
/*************************************************************************** This file is part of project: TinyODBC TinyODBC is hosted under: http://code.google.com/p/tiodbc/ Copyright (c) 2008-2011 SqUe <squarious _at_ gmail _dot_ com> The MIT Licence 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 "../tiodbc.hpp" #include <iostream> using namespace std; int main() { tiodbc::connection my_connection; tiodbc::statement my_statement; // Create a connection with an ODBC Data Source if (!my_connection.connect("MyDSN", "", "")) { cout << "Cannot connect to the Data Source" << endl << my_connection.last_error(); return 1; } // Execute a direct query if (!my_statement.execute_direct(my_connection, "INSERT INTO books (id, title, author) VALUES(\'0\', \'TinyODBC Manual\', \'sque\')")) { cout << "Cannot execute query!" << endl << my_connection.last_error(); return 2; } return 0; }
[ "[email protected]@3924fe7a-104f-0410-b4eb-0b190fd2f428", "squarious@3924fe7a-104f-0410-b4eb-0b190fd2f428" ]
[ [ [ 1, 29 ], [ 57, 57 ] ], [ [ 30, 56 ] ] ]
34fc9635a3d3e38f423243cb34ef8beedc3bc621
cdd119cd2a3c24982bf5f75197e5da1258924478
/mq/src/role.h
8a434ab16a3158d3a4a7172484d4b2b9a0317e9e
[]
no_license
xuxiandi/DOMQ
12bbbd477ce75152c1b5acb8731ddb1833067c62
3a28ebed6323292a1e264b80d969cd94324538b8
refs/heads/master
2020-12-31T02:33:22.791616
2011-05-17T06:01:01
2011-05-17T06:01:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
327
h
#ifndef _ROLE_H__ #define _ROLE_H__ #include <base/net/sockaddr.h> enum QueueRole { SUBSCRIBER = 0, PUBLISHER = 1, }; class Subscriber { private: base::SockAddress addr; std::string name; }; class Publisher { private: base::SockAddress addr; std::string name; }; #endif
[ [ [ 1, 26 ] ] ]
129c84446bad70b7a325c157f9285be2cc270c96
a2ba072a87ab830f5343022ed11b4ac365f58ef0
/ urt-bumpy-q3map2 --username [email protected]/libs/splines/math_quaternion.cpp
3984266729351cf82e88a6eb5c88d38c91a526e3
[]
no_license
Garey27/urt-bumpy-q3map2
7d0849fc8eb333d9007213b641138e8517aa092a
fcc567a04facada74f60306c01e68f410cb5a111
refs/heads/master
2021-01-10T17:24:51.991794
2010-06-22T13:19:24
2010-06-22T13:19:24
43,057,943
0
0
null
null
null
null
UTF-8
C++
false
false
2,694
cpp
/* This code is based on source provided under the terms of the Id Software LIMITED USE SOFTWARE LICENSE AGREEMENT, a copy of which is included with the GtkRadiant sources (see LICENSE_ID). If you did not receive a copy of LICENSE_ID, please contact Id Software immediately at [email protected]. All changes and additions to the original source which have been developed by other contributors (see CONTRIBUTORS) are provided under the terms of the license the contributors choose (see LICENSE), to the extent permitted by the LICENSE_ID. If you did not receive a copy of the contributor license, please contact the GtkRadiant maintainers at [email protected] immediately. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. */ #include "math_quaternion.h" #include "math_matrix.h" void toQuat( idVec3 &src, quat_t &dst ) { dst.x = src.x; dst.y = src.y; dst.z = src.z; dst.w = 0.0f; } void toQuat( angles_t &src, quat_t &dst ) { mat3_t temp; toMatrix( src, temp ); toQuat( temp, dst ); } void toQuat( mat3_t &src, quat_t &dst ) { float trace; float s; int i; int j; int k; static int next[ 3 ] = { 1, 2, 0 }; trace = src[ 0 ][ 0 ] + src[ 1 ][ 1 ] + src[ 2 ][ 2 ]; if ( trace > 0.0f ) { s = ( float )sqrt( trace + 1.0f ); dst.w = s * 0.5f; s = 0.5f / s; dst.x = ( src[ 2 ][ 1 ] - src[ 1 ][ 2 ] ) * s; dst.y = ( src[ 0 ][ 2 ] - src[ 2 ][ 0 ] ) * s; dst.z = ( src[ 1 ][ 0 ] - src[ 0 ][ 1 ] ) * s; } else { i = 0; if ( src[ 1 ][ 1 ] > src[ 0 ][ 0 ] ) { i = 1; } if ( src[ 2 ][ 2 ] > src[ i ][ i ] ) { i = 2; } j = next[ i ]; k = next[ j ]; s = ( float )sqrt( ( src[ i ][ i ] - ( src[ j ][ j ] + src[ k ][ k ] ) ) + 1.0f ); dst[ i ] = s * 0.5f; s = 0.5f / s; dst.w = ( src[ k ][ j ] - src[ j ][ k ] ) * s; dst[ j ] = ( src[ j ][ i ] + src[ i ][ j ] ) * s; dst[ k ] = ( src[ k ][ i ] + src[ i ][ k ] ) * s; } }
[ [ [ 1, 81 ] ] ]
ba1403873b793ce43c50513a2cece684c5f42d80
17083b919f058848c3eb038eae37effd1a5b0759
/SimpleGL/sgl/TextureBuffer.h
fb2211f5a02b0d2fdd31b5edd9bf04278a4e2334
[]
no_license
BackupTheBerlios/sgl
e1ce68dfc2daa011bdcf018ddce744698cc7bc5f
2ab6e770dfaf5268c1afa41a77c04ad7774a70ed
refs/heads/master
2021-01-21T12:39:59.048415
2011-10-28T16:14:29
2011-10-28T16:14:29
39,894,148
0
0
null
null
null
null
UTF-8
C++
false
false
2,684
h
#ifndef SIMPLE_GL_TEXTURE_1D_H #define SIMPLE_GL_TEXTURE_1D_H #include "Texture.h" namespace sgl { // forward class TextureBuffer; /** 1 dimensional texture view interface. */ class Texture1D : public Texture { public: /** Get format of the texture */ virtual Texture::FORMAT SGL_DLLCALL Format() const = 0; /** Get width of the texture */ virtual unsigned int SGL_DLLCALL Width() const = 0; /** Get number of mipmap levels in the texture */ virtual unsigned int SGL_DLLCALL NumMipmaps() const = 0; /** Force mipmap regeneration. * @return result of the operation. Can be SGLERR_INVALID_CALL, SGLERR_UNSUPPORTED */ virtual SGL_HRESULT SGL_DLLCALL GenerateMipmap() = 0; /** Setup sub image of the texture. Will fail for multisample textures. * @param mipmap - mipmap level of the texture for access. * @param offsetx - x offset of the region. * @param width - width of the region. * @param data - texture pixels. * @return status of the operation. Could be SGLERR_INVALID_CALL. */ virtual SGL_HRESULT SGL_DLLCALL SetSubImage( unsigned int mipmap, unsigned int offsetx, unsigned int width, const void* data ) = 0; /** Setup mip level of the texture. Mipmap width and height are calculated * using mipmap level. * @param mipmap - mipmap index. * @param data - texture pixels. If NULL then create an empty texture. * @return status of the operation. Could be SGLERR_OUT_OF_MEMORY, SGLERR_INVALID_CALL */ virtual SGL_HRESULT SGL_DLLCALL SetImage( unsigned int mipmap, const void* data ) = 0; /** Get image data. * @param mipmap - mipmap index. * @param data - texture pixels output. * @return status of the operation. Can be SGLERR_INVALID_CALL if mipmap or data is invalid. */ virtual SGL_HRESULT SGL_DLLCALL GetImage( unsigned int mipmap, void* data ) = 0; /** Setup texture to the device. * @param stage - texture stage. * @return result of the operation. Could return SGLERR_INVALID_CALL if * texture stage is invalid */ virtual SGL_HRESULT SGL_DLLCALL Bind(unsigned int stage) const = 0; /** Unbind texture from the device if it is binded*/ virtual void SGL_DLLCALL Unbind() const = 0; virtual ~Texture1D() {} }; } // namespace sgl #endif // SIMPLE_GL_TEXTURE_1D_H
[ "devnull@localhost" ]
[ [ [ 1, 74 ] ] ]
7524d1fe285e46f5499797ab4d7eb5cff5abd72c
f8c4a7b2ed9551c01613961860115aaf427d3839
/src/cAStar.h
131a4f4ee687e1f82d93bc1439dbac7c7d5d65f8
[]
no_license
ifgrup/mvj-grupo5
de145cd57d7c5ff2c140b807d2d7c5bbc57cc5a9
6ba63d89b739c6af650482d9c259809e5042a3aa
refs/heads/master
2020-04-19T15:17:15.490509
2011-12-19T17:40:19
2011-12-19T17:40:19
34,346,323
0
0
null
null
null
null
UTF-8
C++
false
false
2,469
h
#ifndef __ASTAR_H__ #define __ASTAR_H__ #define mapWidth SCENE_AREA #define mapHeight SCENE_AREA #define numberPeople 3 #include "cScene.h" #include "CTile2D.h" #include "cLog.h" #include "cWalkabilityFunctor.h" class cAStar { private: //Declare constants int tileSize; int onClosedList; int notfinished, notStarted;// path-related constants int found, nonexistent; int walkable, unwalkable;// walkability array constants //Create needed arrays char walkability [mapWidth][mapHeight]; int openList[mapWidth*mapHeight+2]; //1 dimensional array holding ID# of open list items int whichList[mapWidth+1][mapHeight+1]; //2 dimensional array used to record //whether a cell is on the open list or on the closed list. int openX[mapWidth*mapHeight+2]; //1d array stores the x location of an item on the open list int openY[mapWidth*mapHeight+2]; //1d array stores the y location of an item on the open list int parentX[mapWidth+1][mapHeight+1]; //2d array to store parent of each cell (x) int parentY[mapWidth+1][mapHeight+1]; //2d array to store parent of each cell (y) int Fcost[mapWidth*mapHeight+2]; //1d array to store F cost of a cell on the open list int Gcost[mapWidth+1][mapHeight+1]; //2d array to store G cost for each cell. int Hcost[mapWidth*mapHeight+2]; //1d array to store H cost of a cell on the open list int pathLength[numberPeople+1]; //stores length of the found path for critter int pathLocation[numberPeople+1]; //stores current position along the chosen path for critter int *pathBank [numberPeople+1]; //Path reading variables int pathStatus[numberPeople+1]; int xPath[numberPeople+1]; int yPath[numberPeople+1]; public: cAStar(); virtual ~cAStar(); void InitializePathfinder(void); void EndPathfinder(void); int FindPath (int pathfinderID,int startingX, int startingY, int targetX, int targetY); void ReadPath(int pathfinderID,int currentX,int currentY, int pixelsPerFrame); int ReadPathX(int pathfinderID,int pathLocation); int ReadPathY(int pathfinderID,int pathLocation); void ReLoadMap(CTile2D** map,cWalkabilityFunctor* pWalkFunctor); ///////////////////////////////// void LoadMap(CTile2D **map,cWalkabilityFunctor* pWalkFunctor); //VMH. Para poder especificar diferentes valores walkeables void PrintPath(); void NextCell(int *cx,int *cy); private: int idxStep; ///////////////////////////////// }; #endif
[ "[email protected]@7a9e2121-179f-53cc-982f-8ee3039a786c", "[email protected]@7a9e2121-179f-53cc-982f-8ee3039a786c" ]
[ [ [ 1, 4 ], [ 7, 8 ], [ 10, 54 ], [ 56, 68 ] ], [ [ 5, 6 ], [ 9, 9 ], [ 55, 55 ] ] ]
606048eb4d409a6102d84a03ffddd585a6e8dd59
6477cf9ac119fe17d2c410ff3d8da60656179e3b
/Projects/openredalert/src/audio/SoundUtils.h
8ef69fee5a3cc7d72f3339d6f47e9400e4d4e872
[]
no_license
crutchwalkfactory/motocakerteam
1cce9f850d2c84faebfc87d0adbfdd23472d9f08
0747624a575fb41db53506379692973e5998f8fe
refs/heads/master
2021-01-10T12:41:59.321840
2010-12-13T18:19:27
2010-12-13T18:19:27
46,494,539
0
0
null
null
null
null
UTF-8
C++
false
false
1,170
h
// SoundUtils.h // 0.4 // This file is part of OpenRedAlert. // // OpenRedAlert 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, version 2 of the License. // // OpenRedAlert 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 OpenRedAlert. If not, see <http://www.gnu.org/licenses/>. #ifndef SOUNDUTILS_H #define SOUNDUTILS_H #include "SDL/SDL_types.h" /** * */ class SoundUtils { public: static Uint8 Clip(int parameter0); static Uint8 Clip(int, int, int); static void IMADecode(Uint8 *output, Uint8 *input, Uint16 compressed_size, Sint32& sample, Sint32& index); static void WSADPCM_Decode(Uint8 *output, Uint8 *input, Uint16 compressed_size, Uint16 uncompressed_size); }; #endif //SOUNDUTILS_H
[ [ [ 1, 38 ] ] ]
9687b24afaca59270a4fbdf3c84b6d6da27c0218
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/type_traits/test/has_nothrow_copy_test.cpp
16ad2d46deae95ee035837ad143be95f0b9dfb8c
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
11,830
cpp
// (C) Copyright John Maddock 2000. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "test.hpp" #include "check_integral_constant.hpp" #ifdef TEST_STD # include <type_traits> #else # include <boost/type_traits/has_nothrow_copy.hpp> #endif TT_TEST_BEGIN(has_nothrow_copy) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<bool>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<bool const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<bool volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<bool const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<signed char>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<signed char const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<signed char volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<signed char const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned char>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<char>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned char const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<char const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned char volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<char volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned char const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<char const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned short>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<short>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned short const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<short const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned short volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<short volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned short const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<short const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned int>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned int const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned int volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned int const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned long>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned long const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned long volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned long const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long const volatile>::value, false); #endif #ifdef BOOST_HAS_LONG_LONG BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::ulong_long_type>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::long_long_type>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::ulong_long_type const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::long_long_type const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::ulong_long_type volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::long_long_type volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::ulong_long_type const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy< ::boost::long_long_type const volatile>::value, false); #endif #endif #ifdef BOOST_HAS_MS_INT64 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int8>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int8>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int8 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int8 const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int8 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int8 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int8 const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int8 const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int16>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int16>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int16 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int16 const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int16 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int16 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int16 const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int16 const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int32>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int32>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int32 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int32 const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int32 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int32 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int32 const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int32 const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int64>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int64>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int64 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int64 const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int64 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int64 volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<unsigned __int64 const volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<__int64 const volatile>::value, false); #endif #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<float>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<float const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<float volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<float const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<double>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<double const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<double volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<double const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long double>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long double const>::value, true); #ifndef TEST_STD // unspecified behaviour: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long double volatile>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<long double const volatile>::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void*>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int*const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<f1>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<f2>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<f3>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<mf1>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<mf2>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<mf3>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<mp>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<cmf>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<enum_UDT>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int&>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<const int&>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2]>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[3][2]>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2][4][5][6][3]>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<UDT>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void>::value, true); // cases we would like to succeed but can't implement in the language: BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_POD_UDT>::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<POD_UDT>::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<POD_union_UDT>::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_POD_union_UDT>::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_copy_UDT>::value, true, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_assign_UDT>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_construct_UDT>::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<test_abc1>::value, false); TT_TEST_END
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 204 ] ] ]
5ca932b0dc66b5d123973c42d3cb0e2b9dce248f
2dc9ed7fc09dae24600edc4fa4c949f6eba3e339
/release/0.0.2/include/pyasynchio/Proactor_impl_StreamHandler.hpp
53d43127d1e89c1e06ebfa3f118c713371d68eaa
[]
no_license
BackupTheBerlios/pyasynchio-svn
e7f9e5043c828740599113f622fac17a6522fb4b
691051d6a6f6261e66263785f0ec2f1a30b854eb
refs/heads/master
2016-09-07T19:04:33.800780
2005-09-15T16:53:47
2005-09-15T16:53:47
40,805,133
0
0
null
null
null
null
UTF-8
C++
false
false
1,639
hpp
/*! * \file Proactor_impl_StreamHandler.hpp * \brief Proactor::impl::StreamHandler interface. * \author Vladimir Sukhoy */ #ifndef PYASYNCHIO_PROACTOR_IMPL_STREAMHANDLER_HPP_INCLUDED_ #define PYASYNCHIO_PROACTOR_IMPL_STREAMHANDLER_HPP_INCLUDED_ #pragma once #include <pyasynchio/Proactor_impl.hpp> #include <ace/Asynch_IO.h> namespace pyasynchio { class Proactor::impl::StreamHandler : public ACE_Handler { public: StreamHandler() { assert(false); // shouldnt be called by any means. throw std::runtime_error("forbidden constructor"); } virtual ~StreamHandler(); void act(const void *act); void addresses(ACE_INET_Addr remote, ACE_INET_Addr local); void open(ACE_HANDLE new_handle, ACE_Message_Block &message_block); static StreamHandlerPtr Create(Proactor::impl *pro , AbstractStreamHandlerPtr user_stream_handler); void read(size_t count, const void *act, int priority, int signal); void write(const buf &data, const void *act, int priority, int signal); void cancelRead(); void cancelWrite(); void handle_read_stream(const ACE_Asynch_Read_Stream::Result &result); void handle_write_stream(const ACE_Asynch_Write_Stream::Result &result); void close(); protected: StreamHandler(Proactor::impl *pro , AbstractStreamHandlerPtr user_stream_handler); private: Proactor::impl *pro_; AbstractStreamHandlerPtr user_stream_handler_; StreamHandlerWeakPtr thisPtr_; ACE_Asynch_Read_Stream reader_; ACE_Asynch_Write_Stream writer_; }; } // namespace pyasynchio #endif // PYASYNCHIO_PROACTOR_IMPL_STREAMHANDLER_HPP_INCLUDED_
[ "randolphu@1b988373-acfa-0310-9a85-c19025f466bc" ]
[ [ [ 1, 64 ] ] ]
1f6a2e71a9a4f5b5af965524fea8a5d886a087ce
f246dc2a816ccd5acd0776a48c2c24cdb1f4178f
/include/PigletDVSList.h
c355d6261c1828f5fcae40972e9d412de9238668
[]
no_license
profcturner/pigletlib
3f2c4b1af000d73cf4a176a8463c16aaeefde99a
b2ccbb43270a5e8d3a0f8ae6bd3d3cb82a061fec
refs/heads/master
2021-07-24T07:23:10.577261
2007-08-26T22:36:47
2007-08-26T22:36:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,311
h
/** ** Piglet Productions ** ** FileName : PigletDVSList.h ** ** Defines : PigletDoubleVSList <- PigletDoubleVList ** Implements : As above ** ** Description ** ** Based on the vector doubly linked list class, this object also allows ** items to be sorted by insertion, provided that the < operator has been ** sensibly overridden. It is of course to add items unsorted, either by ** calling AddObjectAtStart, or using a base class pointer to call the ** base AddObject function. ** ** This is a template class and so it implemented and defined in this file. ** ** ** Initial Coding : Colin Turner ** ** Date : 8th Novemeber 1998 ** ** ** Copyright applies on this file, and distribution may be limited. ** Copyright Colin Turner 1999, All Rights Reserved. */ /* ** Revision 1.10 ** ** Substantial overhaul to be Watcom C++ friendly ** ** Colin Turner 10th April 1999 ** ** ** Revision 1.00 ** ** Colin Turner 8th November 1998 */ #ifndef Piglet_DVSLIST #define Piglet_DVSLIST template <class DataT> class PigletDoubleVSList; template <class DataT> class PigletDoubleVSList : public PigletDoubleVList<DataT> { public: // Services PigletDoubleVSList() : PigletDoubleVList() {}; PigletDoubleVSList(unsigned short int setflags) : PigletDoubleVList(setflags) {}; int AddObject(DataT * newobject); }; /* ** AddObject ** ** Adds an item to the linked list. By default this is added at the end of ** the list. The object is copied into the list, with new space allocated for ** the copy by the container. ** ** Parameters ** ** newObject The object to be added ** ** Returns ** ** 1 on success, 0 on failure (memalloc failure) ** **/ template <class DataT> int PigletDoubleVSList<DataT>::AddObject(DataT * newobject) { // This function adds an element to the list, by default this is done at // the top, but if the list is sortable it will sort it as ordered by < // Returns 0 on failure, 1 at other times PigletDVListElement<DataT> * pointer; int placed=0; pointer = new PigletDVListElement<DataT>; if (!pointer) { // Memory allocation problem return(0); } pointer->object = newobject; if (start==NULL) { // the list is currently empty, sort or no sort, we add at the top start = end = pointer; placed=1; } else { PigletDVListElement<DataT> * iterator = start; while (iterator!=NULL && !placed) { if (*(pointer->object) < *(iterator->object)) { // place the element if (iterator->prev==NULL) { // At top of list pointer->next=start; start->prev =pointer; start =pointer; placed=1; } else { iterator->prev->next = pointer; pointer->prev = iterator->prev; iterator->prev = pointer; pointer->next = iterator; placed=1; } } iterator=iterator->next; } if (!placed) { // List is not sorted, or we're at the end pointer->prev = end; end->next = pointer; end = pointer; } } itemsInContainer++; return(1); } #endif // (Piglet_DVSLIST)
[ [ [ 1, 136 ] ] ]
f5ad3c367dcc52d7c6dab2d2939063a3caca7c3d
1dfbdc0c6a1e06d5eed685c3f1c3160cd0030744
/api/testcode/parallelLCD/lcd6/lcd6.cpp
c924692721a578c6fe42377de5202c6bc758eb3e
[]
no_license
NCAR/eldora_instrument
e2e7f4cc197e09562f7b307ec0bcc3c253ad97cc
9f097875fd2f912a267d017e3a587c434bce3bff
refs/heads/master
2020-04-27T09:55:41.179715
2008-08-18T23:00:00
2019-03-06T21:23:25
174,234,191
0
0
null
null
null
null
UTF-8
C++
false
false
6,335
cpp
//============================================================================ // Name : lcd6.cpp // Author : Prerna Bang // Version : Worked of lcd5 // Copyright : Your copyright notice // Description : Play around with character size and display options // // LCD is parallel LCD screen and is connected to LCD port on TS7260 board // LCD is HD 44780 compatible and corresponding commands are used // Makefile with TS7620 (ARM) //============================================================================ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <string.h> #define GPIOBASE 0x80840000 // GPIO Control Registers Starting Address #define PADR 0 #define PADDR (0x10 / sizeof(unsigned int)) // 4 #define PHDR (0x40 / sizeof(unsigned int)) // 10 #define PHDDR (0x44 / sizeof(unsigned int)) // 11 // Pre-calibrated: delay values for EP9302, with CPU running at 200MHz #define SETUP 15 #define PULSE 36 #define HOLD 22 // Assembler Instructions // A delay loop used by the LCD driver to wait a number of nanoseconds. #define COUNTDOWN(x) asm volatile ( \ "1:\n"\ "subs %1, %1, #1;\n"\ "bne 1b;\n"\ : "=r" ((x)) : "r" ((x)) \ ); volatile unsigned int *gpio; volatile unsigned int *phdr; volatile unsigned int *phddr; volatile unsigned int *padr; volatile unsigned int *paddr; unsigned int num; // To switch between first and second line of LCD screen void command(unsigned int); void writechars(unsigned char *); unsigned int lcdwait(void); void lcdinit(void); /********************************************************************/ int main(int argc, char *argv[]) { lcdinit(); printf ("LCD Initialize Done\n"); printf("argc %d\n", argc); if (argc == 2) { writechars((unsigned char *)argv[1]); } if (argc > 2) { writechars((unsigned char *)argv[1]); lcdwait(); command(0xa8); // set DDRAM addr to second row writechars((unsigned char *)argv[2]); } if (argc >= 2) return 0; sleep(1); char val[7] ={(char)48, (char)48, (char)48, (char)46, (char)48, (char)48}; while (1) { if (val[5] == '9') { if (val[4] =='9') { if (val[2] == '9') { if (val[0] == '3' && val[1] == '5') { val[0] = (char)48; val[1] = (char)48; val[2] = (char)48; val[4] = (char)48; val[5] = (char)48; } else if (val[1] == '9') { val[0] = val[0]+1; val[1] = (char)48; val[2] = (char)48; val[4] = (char)48; val[5] = (char)48; } else { val[1] = val[1]+1; val[2] = (char)48; val[4] = (char)48; val[5] = (char)48; } } else { val[2] = val[2]+1; val[4] = (char)48; val[5] = (char)48; } } else { val[4] = val[4]+1; val[5] = (char)48; } } else { val[5] = val[5]+1; } writechars((unsigned char *)val); } return 0; } void lcdinit(void) { int fd = open("/dev/mem", O_RDWR|O_SYNC); gpio = (unsigned int *)mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIOBASE); //printf("%x \n", GPIOBASE); //printf("Map addr of gpio: %p\n", gpio); phdr = &gpio[PHDR]; padr = &gpio[PADR]; paddr = &gpio[PADDR]; phddr = &gpio[PHDDR]; *paddr = 0x0; // All of port A to inputs, page 39 Hardware Manual *phddr |= 0x38; // bits 3:5 of port H to outputs *phdr &= ~0x18; // de-assert EN, de-assert RS usleep(5000); command(0x38); // 2 rows, 5x7, 8 bit // Tried using 1 row, but does not work very will with the LCD screen command(0x6); // cursor increment mode lcdwait(); command(0x1); // clear display lcdwait(); command(0xc); // display on, blink off, cursor off lcdwait(); command(0x2); // return home } unsigned int lcdwait(void) { int i; int dat; int tries = 0; unsigned int ctrl = *phdr; *paddr = 0x0; // All of port A to inputs ctrl = *phdr; do { // step 1, apply RS & WR ctrl |= 0x30; // de-assert WR ctrl &= ~0x10; // de-assert RS *phdr = ctrl; // step 2, wait i = SETUP; COUNTDOWN(i); // step 3, assert EN ctrl |= 0x8; *phdr = ctrl; // step 4, wait i = PULSE; COUNTDOWN(i); // step 5, de-assert EN, read result dat = *padr; ctrl &= ~0x8; // de-assert EN *phdr = ctrl; // step 6, wait i = HOLD; COUNTDOWN(i); } while (dat & 0x80 && tries++ < 1000); return dat; } void command(unsigned int cmd) { int i; unsigned int ctrl = *phdr; *paddr = 0xff; // set port A to outputs // step 1, apply RS & WR, send data *padr = cmd; ctrl &= ~0x30; // de-assert RS, assert WR *phdr = ctrl; // step 2, wait i = SETUP; COUNTDOWN(i); // step 3, assert EN ctrl |= 0x8; *phdr = ctrl; // step 4, wait i = PULSE; COUNTDOWN(i); // step 5, de-assert EN ctrl &= ~0x8; // de-assert EN *phdr = ctrl; // step 6, wait i = HOLD; COUNTDOWN(i); } void writechars(unsigned char *dat) { int i; unsigned int ctrl = *phdr; num = num ^ 0x1; // exclusive OR if (num) { // i fluctuates between 0 and 1 due to XOR command(0xa8); // set DDRAM addr to second row lcdwait(); command(0x14); // move one character right } else { command(0x2); // return home lcdwait(); command(0x1); // clear display lcdwait(); command(0x14); // move one character right } do { lcdwait(); *paddr = 0xff; // set port A to outputs // step 1, apply RS & WR, send data //printf("dat = 0x%x, *padr = 0x%x \n", *dat, *padr); *padr = *dat++; ctrl |= 0x10; // assert RS ctrl &= ~0x20; // assert WR *phdr = ctrl; // step 2, wait i = SETUP; COUNTDOWN(i); // step 3, assert EN ctrl |= 0x8; *phdr = ctrl; // step 4, wait i = PULSE; COUNTDOWN(i); // step 5, de-assert EN ctrl &= ~0x8; // de-assert EN *phdr = ctrl; // step 6, wait i = HOLD; COUNTDOWN(i); } while(*dat); usleep(1); // After trial and error // Can not see every increment, but get rough idea }
[ [ [ 1, 296 ] ] ]
92d30ec1868af7a76d024263c3f225b42fed2208
4ab592fb354f75b42181d5375d485031960aaa7d
/DES_GOBSTG/DES_GOBSTG/Core/Export_Lua_HDSS.cpp
7cb070b03120be01baab6fe4727b54d84abdf112
[]
no_license
CBE7F1F65/cca610e2e115c51cef211fafb0f66662
806ced886ed61762220b43300cb993ead00949dc
b3cdff63d689e2b1748e9cd93cedd7e8389a7057
refs/heads/master
2020-12-24T14:55:56.999923
2010-07-23T04:24:59
2010-07-23T04:24:59
32,192,699
0
0
null
null
null
null
UTF-8
C++
false
false
4,388
cpp
#ifndef __NOTUSELUA #ifndef __NOTUSEHDSS #include "../Header/Export_Lua_HDSS.h" #include "../Header/LuaConstDefine.h" #include "../Header/keytable.h" #include "../Header/BResource.h" LuaFunction<bool> * Export_Lua_HDSS::controlExecute; LuaFunction<bool> * Export_Lua_HDSS::stageExecute; LuaFunction<bool> * Export_Lua_HDSS::edefExecute; LuaFunction<bool> * Export_Lua_HDSS::sceneExecute; LuaFunction<bool> * Export_Lua_HDSS::functionExecute; LuaFunction<bool> * Export_Lua_HDSS::eventExecute; void Export_Lua_HDSS::_ChangeSpecialChar(char * str) { int length = strlen(str); if (str[length-1] == '#') { str[length-1] = '_'; str[length] = '3'; str[length+1] = 0; } else if (str[length-1] == '@') { str[length-1] = '_'; str[length] = '2'; str[length+1] = 0; } } bool Export_Lua_HDSS::_LuaRegistConst(LuaObject * obj) { int i = 0; char str[M_STRMAX]; for (; scrKeyTable[i].code != SCR_CONST || strcmp(scrKeyTable[i].word, SCR_CONST_STR); i++) { sprintf(str, "%s%s", HDSS_PREFIX, scrKeyTable[i].word); _ChangeSpecialChar(str); obj->SetInteger(str, scrKeyTable[i].code); } i++; i++; //true i++; //false for (; scrKeyTable[i].code != SCR_KEYSTATE || strcmp(scrKeyTable[i].word, SCR_KEYSTATE_STR); i++) { obj->SetInteger(scrKeyTable[i].word, scrKeyTable[i].code); } i++; for (; scrKeyTable[i].code != SCR_NULL || strcmp(scrKeyTable[i].word, SCR_NULL_STR); i++) { obj->SetNumber(scrKeyTable[i].word, CUINT(scrKeyTable[i].code)); } //SI for (i=0; i<BResource::bres.spritenumber; i++) { if (strlen(BResource::bres.spritedata[i].spritename)) { obj->SetInteger(BResource::bres.spritedata[i].spritename, i); } } return true; } bool Export_Lua_HDSS::_LuaRegistFunction(LuaObject * obj) { LuaObject _hdssobj = obj->CreateTable("hdss"); _hdssobj.Register("Call", LuaFn_HDSS_Call); _hdssobj.Register("Get", LuaFn_HDSS_Get); return true; } bool Export_Lua_HDSS::_Helper_HDSS_GetPara(LuaStack * args, int i, LuaObject * _para) { *_para = (*args)[i]; if (!_para->IsTable()) { ShowError(LUAERROR_LUAERROR, "HDSS arg must be a table."); return false; } return true; } bool Export_Lua_HDSS::InitCallbacks() { LuaState * ls = state; LuaObject _obj = ls->GetGlobal(LUAFN_CONTROLEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_CONTROLEXECUTE); return false; } static LuaFunction<bool> _fcontrol = _obj; _fcontrol = _obj; controlExecute = &_fcontrol; _obj = ls->GetGlobal(LUAFN_STAGEEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_STAGEEXECUTE); return false; } static LuaFunction<bool> _fstage = _obj; _fstage = _obj; stageExecute = &_fstage; _obj = ls->GetGlobal(LUAFN_EDEFEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_EDEFEXECUTE); return false; } static LuaFunction<bool> _fedef = _obj; _fedef = _obj; edefExecute = &_fedef; _obj = ls->GetGlobal(LUAFN_SCENEEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_SCENEEXECUTE); return false; } static LuaFunction<bool> _fscene = _obj; _fscene = _obj; sceneExecute = &_fscene; _obj = ls->GetGlobal(LUAFN_FUNCTIONEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_FUNCTIONEXECUTE); return false; } static LuaFunction<bool> _ffunction = _obj; _ffunction = _obj; functionExecute = &_ffunction; _obj = ls->GetGlobal(LUAFN_EVENTEXECUTE); if (!_obj.IsFunction()) { ShowError(LUAERROR_NOTFUNCTION, LUAFN_EVENTEXECUTE); return false; } static LuaFunction<bool> _fevent = _obj; _fevent = _obj; eventExecute = &_fevent; return true; } bool Export_Lua_HDSS::Execute(DWORD typeflag, DWORD name, DWORD con) { LuaState * ls = state; LuaFunction<bool> *_f; switch (typeflag) { case SCR_CONTROL: _f = controlExecute; break; case SCR_STAGE: _f = stageExecute; break; case SCR_EDEF: _f = edefExecute; break; case SCR_SCENE: _f = sceneExecute; break; case SCR_FUNCTION: _f = functionExecute; break; case SCR_EVENT: _f = eventExecute; break; } bool bret = (*_f)(name, con); if (state->CheckError()) { Export_Lua::ShowError(LUAERROR_LUAERROR, state->GetError()); } return bret; } #endif #endif
[ "CBE7F1F65@4a173d03-4959-223b-e14c-e2eaa5fc8a8b" ]
[ [ [ 1, 180 ] ] ]
06a4f90e23d28409fc534e94b578ee6a95173739
ab41c2c63e554350ca5b93e41d7321ca127d8d3a
/glm/core/type_half.hpp
d5b19a45ea41111cab76180ef4abb77e45b5c304
[]
no_license
burner/e3rt
2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e
775470cc9b912a8c1199dd1069d7e7d4fc997a52
refs/heads/master
2021-01-11T08:08:00.665300
2010-04-26T11:42:42
2010-04-26T11:42:42
337,021
3
0
null
null
null
null
UTF-8
C++
false
false
1,968
hpp
/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-17 // Updated : 2008-08-17 // Licence : This source is under MIT License // File : glm/core/type_half.h /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_type_half #define glm_core_type_half #include <cstdlib> namespace glm { namespace detail { typedef short hdata; float toFloat32(hdata value); hdata toFloat16(float value); class thalf { public: // Constructors thalf(); thalf(thalf const & s); template <typename U> thalf(U const & s); // Cast //operator float(); operator float() const; //operator double(); //operator double() const; // Unary updatable operators thalf& operator= (thalf s); thalf& operator+=(thalf s); thalf& operator-=(thalf s); thalf& operator*=(thalf s); thalf& operator/=(thalf s); thalf& operator++(); thalf& operator--(); float toFloat() const{return toFloat32(data);} hdata _data() const{return data;} private: hdata data; }; void test_half_type(); }//namespace detail detail::thalf operator- (detail::thalf s1, detail::thalf s2); detail::thalf operator* (detail::thalf s1, detail::thalf s2); detail::thalf operator/ (detail::thalf s1, detail::thalf s2); // Unary constant operators detail::thalf operator- (detail::thalf s); detail::thalf operator-- (detail::thalf s, int); detail::thalf operator++ (detail::thalf s, int); }//namespace glm glm::detail::thalf operator+ (glm::detail::thalf s1, glm::detail::thalf s2); #include "type_half.inl" #endif//glm_core_type_half
[ [ [ 1, 79 ] ] ]
5e5e8508659a164cb8ff8d7af02aef48716c41b1
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/ossrv/stdcpp/apps/BCTypeInfo/src/BCTypeInfo.cpp
2530e1d8a26b505db5a1c6f8642e9da7521dbff9
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
5,522
cpp
/* * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ // INCLUDE FILES #include <Stiftestinterface.h> #include "BCTypeInfo.h" #include <SettingServerClient.h> // EXTERNAL DATA STRUCTURES //extern ?external_data; // EXTERNAL FUNCTION PROTOTYPES //extern ?external_function( ?arg_type,?arg_type ); // CONSTANTS //const ?type ?constant_var = ?constant; // MACROS //#define ?macro ?macro_def // LOCAL CONSTANTS AND MACROS //const ?type ?constant_var = ?constant; //#define ?macro_name ?macro_def // MODULE DATA STRUCTURES //enum ?declaration //typedef ?declaration // LOCAL FUNCTION PROTOTYPES //?type ?function_name( ?arg_type, ?arg_type ); // FORWARD DECLARATIONS //class ?FORWARD_CLASSNAME; // ============================= LOCAL FUNCTIONS =============================== // ----------------------------------------------------------------------------- // ?function_name ?description. // ?description // Returns: ?value_1: ?description // ?value_n: ?description_line1 // ?description_line2 // ----------------------------------------------------------------------------- // /* ?type ?function_name( ?arg_type arg, // ?description ?arg_type arg) // ?description { ?code // ?comment // ?comment ?code } */ // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- // CBCTypeInfo::CBCTypeInfo // C++ default constructor can NOT contain any code, that // might leave. // ----------------------------------------------------------------------------- // CBCTypeInfo::CBCTypeInfo( CTestModuleIf& aTestModuleIf ): CScriptBase( aTestModuleIf ) { } // ----------------------------------------------------------------------------- // CBCTypeInfo::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CBCTypeInfo::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KBCTypeInfoLogFileWithTitle, &title); } else { logFileName.Copy(KBCTypeInfoLogFile); } iLog = CStifLogger::NewL( KBCTypeInfoLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); } // ----------------------------------------------------------------------------- // CBCTypeInfo::NewL // Two-phased constructor. // ----------------------------------------------------------------------------- // CBCTypeInfo* CBCTypeInfo::NewL( CTestModuleIf& aTestModuleIf ) { CBCTypeInfo* self = new (ELeave) CBCTypeInfo( aTestModuleIf ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); return self; } // Destructor CBCTypeInfo::~CBCTypeInfo() { // Delete resources allocated from test methods Delete(); // Delete logger delete iLog; } //----------------------------------------------------------------------------- // CBCTypeInfo::SendTestClassVersion // Method used to send version of test class //----------------------------------------------------------------------------- // void CBCTypeInfo::SendTestClassVersion() { TVersion moduleVersion; moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; TFileName moduleName; moduleName = _L("BCTypeInfo.dll"); TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName); } // ========================== OTHER EXPORTED FUNCTIONS ========================= // ----------------------------------------------------------------------------- // LibEntryL is a polymorphic Dll entry point. // Returns: CScriptBase: New CScriptBase derived object // ----------------------------------------------------------------------------- // EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework { return ( CScriptBase* ) CBCTypeInfo::NewL( aTestModuleIf ); } // End of File
[ "none@none" ]
[ [ [ 1, 199 ] ] ]