blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
1356ceacf5fd06c8073ced08306db98c78e67048
d42e75edb5a9e42e8f32510eb3f86e28b6568a2a
/008/13907/13907_김형준.cpp
95f7b54ab7bf08a532b754137d07d2fd5af6caad
[]
no_license
wasuphj/algorithm_study
86ad452bf098b1e1605ebc5e8197176a69726565
780ec32ec193571e05558a714cc0779e2202c732
refs/heads/main
2023-08-25T14:42:10.163787
2021-10-16T04:15:54
2021-10-16T04:15:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,140
cpp
13907_김형준.cpp
#include <iostream> #include <queue> #include <vector> #include <algorithm> using namespace std; vector<pair<int, long long>> roads[1000]; long long d[1000]; vector<long long> taxes = { 0 }; int main() { int N, M, K; int S, D; cin >> N >> M >> K; cin >> S >> D; for (int a, b, w, i = 0; i < M; i++) { cin >> a >> b >> w; roads[a - 1].push_back({ b - 1, w }); roads[b - 1].push_back({ a - 1, w }); } for (int p, i = 1; i <= K; i++) { cin >> p; taxes.push_back(p + taxes[i - 1]); } for (int i = 0; i <= K; i++) { fill(d, d + N, 1e9); priority_queue<pair<int, long long>> q; q.push({ S - 1, 0 }); d[S - 1] = 0; while (!q.empty()) { int cur_node = q.top().first; long long cur_dist = q.top().second; q.pop(); if (d[cur_node] < cur_dist) continue; for (pair<int, long long> next : roads[cur_node]) { int next_node = next.first; long long next_dist = next.second + taxes[i]; long long cost = cur_dist + next_dist; if (d[next_node] > cost) { d[next_node] = cost; q.push({ next_node, cost }); } } } cout << d[D - 1] << endl; } return 0; }
a2318e1485fffc10efd7c91898f39024eedd9167
9e99d7536b00016b67a048034f5c77f95163f106
/BOJ_11726.cpp
6ab812cae130cc0b5480f1e27900f4d28f8922c9
[]
no_license
5Hanui/algorithm
19c1f4d6b4b1641735d88cd00e3089f57265c766
489d416c1c08734324cd20ff6b311277aa3eb36e
refs/heads/master
2022-09-01T11:47:12.444875
2022-07-22T08:28:21
2022-07-22T08:28:21
164,403,510
1
0
null
null
null
null
UTF-8
C++
false
false
412
cpp
BOJ_11726.cpp
#include <iostream> #include <cstring> using namespace std; int cache[1001]; int tile(int n) { if (n == 1) return 1; if (n == 2) return 2; int &ret = cache[n]; if (ret != -1) return ret; ret = 0; ret = tile(n - 1) + tile(n - 2); return ret%10007; } int main() { int num; cin >> num; if (num < 1 || num>1000) exit(-1); memset(cache, -1, sizeof(cache)); cout << tile(num) << endl; }
d9110c2c05f42ac919e53f237c5643f9e895d00a
80d66fd6ff45a4e17f0c4ee47b347b2e11ec7527
/Arduino testing/Test_hastighet.ino
ed943f9f4f2a40ce8ca34e5352fc1811f29e9374
[]
no_license
sHoggard/P2AdaLovelace
0421a252135047a3bcda5fc234ef3cf7335d68a8
880a3a79a610351fcbc33a9780c68ee3b46ac3dd
refs/heads/master
2020-03-08T14:58:28.317329
2018-06-10T20:37:46
2018-06-10T20:37:46
128,199,031
0
0
null
2018-04-25T11:38:27
2018-04-05T11:52:25
C
UTF-8
C++
false
false
2,275
ino
Test_hastighet.ino
int counterL1 = 0; int counterL2 = 0; int counterR1 = 0; int counterR2 = 0; int command = 1700; long startTime, endTime; void incrementLeft1(void); void incrementLeft2(void); void incrementRight1(void); void incrementRight2(void); void setup() { Serial.begin(9600); Serial.println("setup"); //put motors in rest mode pinMode(2, INPUT); pinMode(3, INPUT); while (digitalRead(2) == 0 || digitalRead(3) == 0) { delayMicroseconds(50); } digitalWrite(2, LOW); //go low before switching to output mode digitalWrite(3, LOW); pinMode(2, OUTPUT); pinMode(3, OUTPUT); delay(5); //wait for initialization digitalWrite(2, HIGH); digitalWrite(3, HIGH); delayMicroseconds(1500); //stop motor digitalWrite(2, LOW); digitalWrite(3, LOW); delay(20); //wait Serial.println("setup done"); //attach interrupts attachInterrupt(digitalPinToInterrupt(34), incrementLeft1, CHANGE); attachInterrupt(digitalPinToInterrupt(35), incrementLeft2, CHANGE); attachInterrupt(digitalPinToInterrupt(38), incrementRight1, CHANGE); attachInterrupt(digitalPinToInterrupt(39), incrementRight2, CHANGE); delay(1000); startTime = millis(); endTime = startTime + 30000; digitalWrite(2, HIGH); digitalWrite(3, HIGH); delayMicroseconds(command); digitalWrite(2, LOW); digitalWrite(3, LOW); } void loop() { // put your main code here, to run repeatedly: Serial.println("Left: "); Serial.println(counterL1); Serial.println(counterL2); Serial.println("Right: "); Serial.println(counterR1); Serial.println(counterR2); Serial.println(); if (millis() > endTime) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); delayMicroseconds(1500); digitalWrite(2, LOW); digitalWrite(3, LOW); } else { //necessary if Communications Timeout mode is enabled digitalWrite(2, HIGH); digitalWrite(3, HIGH); delayMicroseconds(command); digitalWrite(2, LOW); digitalWrite(3, LOW); } delay(20); //pause } void incrementLeft1() { counterL1++; } void incrementLeft2() { counterL2++; } void incrementRight1() { counterR1++; } void incrementRight2() { counterR2++; }
fcb2a2fe9b6274f59956def666d907f8331d820b
d149cdffcf3d5f55b237d12426fe99685e29eecc
/PolygonManager.cpp
36aa20cee317288aa598ec9f36a77d0e0f02a162
[]
no_license
truongascii/enigma-editor
af5ca53726a5d23704df6f1ace361edcc99a79ac
49a93891b162eedd0aa6032755d8ddd07e614db7
refs/heads/master
2021-01-21T23:29:58.932062
2012-10-23T11:58:45
2012-10-23T11:58:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
55,072
cpp
PolygonManager.cpp
//----------------------------------------------------------------------------- // File: PolygonManager.cpp // // Desc: Manages all polygon stuff in the scene // // Copyright (c) 2002 Dan //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Includes #include <windows.h> #include <commctrl.h> #include <gl\glaux.h> #include <fstream> #include <gl\glu.h> #include <string.h> #include <gl\gl.h> #include <stdio.h> #include <cmath> #include "PolygonManager.h" #include "TextureManager.h" #include "PolygonTabDB.h" #include "LightManager.h" #include "Application.h" #include "SaveTokens.h" #include "CustomMsg.h" #include "Settings.h" #include "resource.h" #include "Polygon.h" #include "OpenGL.h" #include "dinput.h" #include "Vertex.h" #include "Window.h" #include "Tracer.h" #include "main.h" //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Construction/Destruction //----------------------------------------------------------------------------- CPolygonManager::CPolygonManager() { TRACE_ENTER_FN( CPolygonManager::CPolygonManager ) Log( "CPolygonManager::CPolygonManager()\n" ); m_iLoadedPolygons = 0; m_pPolygons = NULL; TRACE_LEAVE_FN() } CPolygonManager::~CPolygonManager() { TRACE_ENTER_FN( CPolygonManager::~CPolygonManager ) Log( "CPolygonManager::~CPolygonManager()\n" ); if( !Release() ) LOG_ERR() TRACE_LEAVE_FN() } //----------------------------------------------------------------------------- // Name: Init() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::Init() { TRACE_ENTER_FN( CPolygonManager::Init ) Log( "CPolygonManager::Init()\n" ); m_eClassType = POLYGONMANAGER; m_iLoadedPolygons = 0; m_pPolygons = NULL; glMultiTexCoord2fARB = NULL; // Used to select polygons through mouse clicks LU->ResetLookupTable(); m_Tree.bSelected = false; m_Tree.hPolygonManager = NULL; m_Tree.hZone = NULL; m_pQuadricObj = gluNewQuadric(); gluQuadricTexture( m_pQuadricObj, false ); gluQuadricDrawStyle( m_pQuadricObj, GLU_FILL ); glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC) wglGetProcAddress( "glMultiTexCoord2fARB" ); if( glMultiTexCoord2fARB == NULL ) LOG_ERR_RET( false ) RET( true ) } //----------------------------------------------------------------------------- // Name: Release() // Desc: Frees resources and memory //----------------------------------------------------------------------------- bool CPolygonManager::Release() { TRACE_ENTER_FN( CPolygonManager::Release ) Log( "CPolygonManager::Release()\n" ); int iA; try { if( m_pPolygons ) { for( iA = 0; iA < m_iLoadedPolygons; iA++ ) { // If the polygon isnt NULL, then delete it and set it to NULL if( P( iA ) != NULL ) { delete P( iA ); SetP( iA, NULL ); } } delete[] m_pPolygons; } m_iLoadedPolygons = 0; LU->ResetLookupTable(); if( m_pQuadricObj != NULL ) gluDeleteQuadric( m_pQuadricObj ); m_Brush.Release(); } catch( ... ) { LOG_VAR( iA ) LOG_VAR( m_iLoadedPolygons ) LOG_ERR_RET( false ) } RET( true ) } //----------------------------------------------------------------------------- // Name: Reset() // Desc: //----------------------------------------------------------------------------- void CPolygonManager::Reset() { TRACE_ENTER_FN( CPolygonManager::Reset ) Release(); Init(); TRACE_LEAVE_FN() } //----------------------------------------------------------------------------- // Name: NewBrush() // Desc: Selects a new brush type //----------------------------------------------------------------------------- void CPolygonManager::NewBrush( const BRUSHTYPE type ) { TRACE_ENTER_FN( CPolygonManager::NewBrush ) m_Brush.SetType( type ); LU->ResetLookupTable(); TRACE_LEAVE_FN() } //----------------------------------------------------------------------------- // Name: ForgeBrush() // Desc: Takes the current brush and uses it as a template to create a new // polygon. The Polygon Tree is then updated, and the lookup table is // reset because the scene has changed. //----------------------------------------------------------------------------- bool CPolygonManager::ForgeBrush() { TRACE_ENTER_FN( CPolygonManager::ForgeBrush ) TVINSERTSTRUCT tvs; HTREEITEM hPolygon; int iIndex, iA; // Create a temporary holder array for the polygon pointers CPolygon** pTemp = NULL; // Initalize the holder pTemp = new CPolygon*[ m_iLoadedPolygons + 1 ]; // Make sure it was created if( pTemp == NULL ) LOG_ERR() // Copy all polygons into the temp for( iA = 0; iA < m_iLoadedPolygons; iA++ ) pTemp[ iA ] = P( iA ); // Delete the old polygon holder if any polygons were ever in it if( m_pPolygons != NULL ) { delete[] m_pPolygons; m_pPolygons = NULL; } // Increase the size of the polygon array to 1 larger m_pPolygons = new CPolygon*[ m_iLoadedPolygons + 1 ]; // Make sure it was created if( m_pPolygons == NULL ) LOG_ERR_RET( false ) // Copy the temp back into the real one for( iA = 0; iA < m_iLoadedPolygons; iA++ ) SetP( iA, pTemp[ iA ] ); // Delete the temp holder if( pTemp != NULL ) delete[] pTemp; CPolygon* pPoly = m_Brush.Forge(); if( pPoly == NULL ) LOG_ERR_RET( false ) // Put the newly created polygon at the end of the list SetP( m_iLoadedPolygons, pPoly ); // We have one more now m_iLoadedPolygons++; // This is just for convienence iIndex = m_iLoadedPolygons - 1; // Make sure it was actually created if( P( iIndex ) == NULL ) LOG_ERR_RET( false ) // Add a new leaf to the tree at the end. (After the other polygons) tvs.hInsertAfter = TVI_LAST; tvs.item.mask = TVIF_TEXT; tvs.hParent = m_Tree.hZone; tvs.item.pszText = P( iIndex )->m_strName; // Insert it hPolygon = (HTREEITEM)SendDlgItemMessage( m_Tree.hTreeWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); tvs.hParent = hPolygon; // Give the polygon a handle to its leaf P( iIndex )->SetTreeItem( hPolygon ); // Update all the other handles for all the other polygons, faces, and verts for( int iF = 0; iF < P( iIndex )->GetLoadedFaces(); iF++ ) { tvs.item.pszText = F( iIndex, iF )->GetName(); tvs.hParent = (HTREEITEM)SendDlgItemMessage( m_Tree.hTreeWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); F( iIndex, iF )->SetTreeItem( tvs.hParent ); for( int iV = 0; iV < F( iIndex, iF )->GetLoadedVerts(); iV++ ) { tvs.item.pszText = V( iIndex, iF, iV )->GetName(); V( iIndex, iF, iV )->SetTreeItem( (HTREEITEM)SendDlgItemMessage( m_Tree.hTreeWnd, IDC_TREE_POLYGONTREE,TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ) ); } tvs.hParent = hPolygon; } LU->ResetLookupTable(); RecalculateGeometry(); if( !Map->Init() ) LOG_ERR_RET( false ) RET( true ) } //----------------------------------------------------------------------------- // Name: FillPolygonTreeView() // Desc: Runs through all zones, polygons, faces, and verticies to create the // polygon tree in the polygon tab. Gives each instance of every class a // handle to its corresponding leaf. //----------------------------------------------------------------------------- void CPolygonManager::FillPolygonTreeView( HWND hWnd ) { TRACE_ENTER_FN( CPolygonManager::FillPolygonTreeView ) char* str = NULL; TVINSERTSTRUCT tvs; HTREEITEM hPolygon, hFace, hVert; m_Tree.hTreeWnd = hWnd; // Clear the tree HTREEITEM m_hItem = TVI_ROOT; SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE, TVM_DELETEITEM, 0, (LPARAM) (HTREEITEM) m_hItem); tvs.hInsertAfter = TVI_LAST; tvs.item.mask = TVIF_TEXT; tvs.hParent = TVI_ROOT; tvs.item.pszText = "Polygon Manager"; m_Tree.hPolygonManager = (HTREEITEM)SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); tvs.hParent = m_Tree.hPolygonManager; tvs.item.pszText = "Zone 1"; m_Tree.hZone = (HTREEITEM)SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); tvs.hParent = m_Tree.hZone; for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { str = P( iP )->m_strName; tvs.item.pszText = str; hPolygon = (HTREEITEM)SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); tvs.hParent = hPolygon; P( iP )->SetTreeItem( hPolygon ); for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { tvs.item.pszText = F( iP, iF )->GetName(); hFace = (HTREEITEM)SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE,TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); tvs.hParent = hFace; F( iP, iF )->SetTreeItem( hFace ); for( int iV = 0; iV < F( iP, iF )->GetLoadedVerts(); iV++ ) { tvs.item.pszText = V( iP, iF, iV )->GetName(); hVert = (HTREEITEM)SendDlgItemMessage( hWnd, IDC_TREE_POLYGONTREE, TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT) &tvs ); V( iP, iF, iV )->SetTreeItem( hVert ); } tvs.hParent = hPolygon; } tvs.hParent = m_Tree.hZone; } TRACE_LEAVE_FN() } //----------------------------------------------------------------------------- // Name: ApplyTextureToSelected() // Desc: Applys the gives texture to the selected face //----------------------------------------------------------------------------- void CPolygonManager::ApplyTextureToSelected( const HTEXTURE hTexture ) { TRACE_ENTER_FN( CPolygonManager::ApplyTextureToSelected ) int iP = LU->GetPoly(); int iF = LU->GetFace(); if( LU->PolySelected() && LU->FaceSelected() ) { if( SE->m_bTextureTab_Texture1 ) F( iP, iF )->SetTexture1( hTexture ); else if( SE->m_bTextureTab_Texture2 ) F( iP, iF )->SetTexture2( hTexture ); else if( SE->m_bTextureTab_Lightmap ) LOG_ERR() } TRACE_LEAVE_FN() } //----------------------------------------------------------------------------- // Name: GetAssociatedClassType() // Desc: Given a string, usually from the polygon tree, returns what kind of // object it represents. See 'enum.h' for class types. //----------------------------------------------------------------------------- CLASSTYPE CPolygonManager::GetAssociatedClassType( char* str ) { TRACE_ENTER_FN( CPolygonManager::GetAssociatedClassType ) if( str == NULL ) { m_Tree.bSelected = false; RET( NOTHINGCLASS ) } m_Tree.bSelected = true; // Compares the string to all polys, faces, and verts until a match is found // When found, information about the selected object is recorded in the // 'm_Tree' struct. The name is the attribute compared for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { if( strcmp( P( iP )->m_strName, str ) == 0 ) { m_Tree.eCurrentType = P( iP )->GetClassType(); m_Tree.iPoly = iP; RET( P( iP )->GetClassType() ) } for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { if( strcmp( F( iP, iF )->GetName(), str ) == 0 ) { m_Tree.eCurrentType = F( iP, iF )->GetClassType(); m_Tree.iPoly = iP; m_Tree.iFace = iF; RET( F( iP, iF )->GetClassType() ) } for( int iV = 0; iV < F( iP, iF )->GetLoadedVerts(); iV++ ) { if( strcmp( V( iP, iF, iV )->GetName(), str ) == 0 ) { m_Tree.eCurrentType = V( iP, iF, iV )->GetClassType(); m_Tree.iPoly = iP; m_Tree.iFace = iF; m_Tree.iVert = iV; RET( V( iP, iF, iV )->GetClassType() ) } } } } // Nothing should be selected m_Tree.bSelected = false; // If it couldnt fina a match, its unknown RET( NOTHINGCLASS ) } //----------------------------------------------------------------------------- // Name: GetVertexInfo() // Desc: Gets all the information about the selected vertex //----------------------------------------------------------------------------- bool CPolygonManager::GetVertexInfo( int &r, int &g, int &b, int &u, int &v ) { TRACE_ENTER_FN( CPolygonManager::GetVertexInfo ) int iP = m_Tree.iPoly; int iF = m_Tree.iFace; int iV = m_Tree.iVert; r = (int)V( iP, iF, iV )->GetColor().x; g = (int)V( iP, iF, iV )->GetColor().y; b = (int)V( iP, iF, iV )->GetColor().z; u = (int)V( iP, iF, iV )->GetTexU(); v = (int)V( iP, iF, iV )->GetTexV(); RET( true ) } //----------------------------------------------------------------------------- // Name: UpdateTreeSelection() // Desc: Selects and insures that the given selection is visible. //----------------------------------------------------------------------------- bool CPolygonManager::UpdateTreeSelection( HWND hWnd ) { TRACE_ENTER_FN( CPolygonManager::UpdateTreeSelection ) if( !LU->PolySelected() || !LU->FaceSelected() ) RET( true ) if( hWnd == NULL ) LOG_ERR_RET( false ) int iP = LU->GetPoly(); int iF = LU->GetFace(); SendDlgItemMessage(hWnd, IDC_TREE_POLYGONTREE, TVM_SELECTITEM, (WPARAM)TVGN_CARET, (LPARAM)(HTREEITEM)F( iP, iF )->GetTreeItem() ); RET( true ) } //----------------------------------------------------------------------------- // Name: ApplyNewName() // Desc: Sets the new name of the object. Only updates the internal name, not // the name that appears in the polygon tree. (done elsewhere) //----------------------------------------------------------------------------- bool CPolygonManager::ApplyNewName( char* str, CLASSTYPE eType ) { TRACE_ENTER_FN( CPolygonManager::ApplyNewName ) if( str == NULL ) LOG_ERR_RET( false ) int iP = m_Tree.iPoly; int iF = m_Tree.iFace; int iV = m_Tree.iVert; switch( eType ) { case VERTEXCLASS: strcpy( V( iP, iF, iV )->GetName(), str ); break; case FACECLASS: strcpy( F( iP, iF )->GetName(), str ); break; case POLYGONCLASS: strcpy( P( iP )->m_strName, str ); break; } RET( true ) } //----------------------------------------------------------------------------- // Name: SetVertexInfo() // Desc: Sets information about the selected vertex //----------------------------------------------------------------------------- bool CPolygonManager::SetVertexInfo( int iR, int iG, int iB, int iU, int iV ) { TRACE_ENTER_FN( CPolygonManager::SetVertexInfo ) CVertex* pV = V( m_Tree.iPoly, m_Tree.iFace, m_Tree.iVert ); VECT vC( (float)iR, (float)iG, (float)iB ); pV->SetColor( vC ); pV->SetTexU( (float)iU ); pV->SetTexV( (float)iV ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateTexU() // Desc: Tells the face to slide the U coords an 'amount' //----------------------------------------------------------------------------- void CPolygonManager::TranslateTexU( const float amount ) { F( m_Tree.iPoly, m_Tree.iFace )->TranslateTexU( amount ); } //----------------------------------------------------------------------------- // Name: TranslateTexV() // Desc: Tells the face to slide the V coords an 'amount' //----------------------------------------------------------------------------- void CPolygonManager::TranslateTexV( const float amount ) { F( m_Tree.iPoly, m_Tree.iFace )->TranslateTexV( amount ); } //----------------------------------------------------------------------------- // Name: FlipTexU() // Desc: Tells the face to flip th texture in terms of U //----------------------------------------------------------------------------- void CPolygonManager::FlipTexU() { F( m_Tree.iPoly, m_Tree.iFace )->FlipTexU(); } //----------------------------------------------------------------------------- // Name: RotateTex90() // Desc: Tells the face to flip th texture in terms of U //----------------------------------------------------------------------------- void CPolygonManager::RotateTex90() { F( m_Tree.iPoly, m_Tree.iFace )->RotateTex90(); } //----------------------------------------------------------------------------- // Name: RotateTex90() // Desc: Tells the face to flip th texture in terms of U //----------------------------------------------------------------------------- void CPolygonManager::RotateLightmap90() { F( m_Tree.iPoly, m_Tree.iFace )->RotateLightmap90(); } //----------------------------------------------------------------------------- // Name: FlipTexV() // Desc: Tells the face to flip th texture in terms of V //----------------------------------------------------------------------------- void CPolygonManager::FlipTexV() { F( m_Tree.iPoly, m_Tree.iFace )->FlipTexV(); } //----------------------------------------------------------------------------- // Name: SetScale() // Desc: Tells face to sclae the texture by the 'factor' //----------------------------------------------------------------------------- void CPolygonManager::SetScale( const float factor ) { F( m_Tree.iPoly, m_Tree.iFace )->SetScale( factor ); } //----------------------------------------------------------------------------- // Name: SetPanU() // Desc: Sets the pan state of the face to 'bPan' //----------------------------------------------------------------------------- void CPolygonManager::SetPanU( const bool bPan ) { F( m_Tree.iPoly, m_Tree.iFace )->SetPanU( bPan ); } //----------------------------------------------------------------------------- // Name: SetPanV() // Desc: Sets the pan state of the face to 'bPan' //----------------------------------------------------------------------------- void CPolygonManager::SetPanV( const bool bPan ) { F( m_Tree.iPoly, m_Tree.iFace )->SetPanV( bPan ); } //----------------------------------------------------------------------------- // Name: GetPanU() // Desc: Gets the U pan state of the face //----------------------------------------------------------------------------- bool CPolygonManager::GetPanU() { return F( m_Tree.iPoly, m_Tree.iFace )->GetPanU(); } //----------------------------------------------------------------------------- // Name: SetPanV() // Desc: Gets the V pan state of the face //----------------------------------------------------------------------------- bool CPolygonManager::GetPanV() { return F( m_Tree.iPoly, m_Tree.iFace )->GetPanV(); } //----------------------------------------------------------------------------- // Name: SetTranslucent() // Desc: //----------------------------------------------------------------------------- void CPolygonManager::SetTranslucent( const bool bTranslucent ) { F( m_Tree.iPoly, m_Tree.iFace )->SetTranslucent( bTranslucent ); } //----------------------------------------------------------------------------- // Name: GetUseTexture1() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::GetUseTexture1() { TRACE_ENTER_FN( CPolygonManager::GetUseTexture1 ) bool b = F( m_Tree.iPoly, m_Tree.iFace )->UsingTexture1(); RET( b ) } //----------------------------------------------------------------------------- // Name: GetUseTexture2() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::GetUseTexture2() { TRACE_ENTER_FN( CPolygonManager::GetUseTexture2 ) bool b = F( m_Tree.iPoly, m_Tree.iFace )->UsingTexture2(); RET( b ) } //----------------------------------------------------------------------------- // Name: GetUseLightmap() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::GetUseLightmap() { TRACE_ENTER_FN( CPolygonManager::GetUseLightmap ) bool b = F( m_Tree.iPoly, m_Tree.iFace )->UsingLightmap(); RET( b ) } //----------------------------------------------------------------------------- // Name: SetUseTexture1() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetUseTexture1( const bool b ) { TRACE_ENTER_FN( CPolygonManager::SetUseTexture1 ) F( m_Tree.iPoly, m_Tree.iFace )->UseTexture1( b ); RET( true ) } //----------------------------------------------------------------------------- // Name: SetUseTexture2() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetUseTexture2( const bool b ) { TRACE_ENTER_FN( CPolygonManager::SetUseTexture2 ) F( m_Tree.iPoly, m_Tree.iFace )->UseTexture2( b ); RET( true ) } //----------------------------------------------------------------------------- // Name: SetUseLightmap() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetUseLightmap( const bool b ) { TRACE_ENTER_FN( CPolygonManager::SetUseLightmap ) F( m_Tree.iPoly, m_Tree.iFace )->UseLightmap( b ); RET( true ) } //----------------------------------------------------------------------------- // Name: NextFace() // Desc: Selects the next face of the polygon //----------------------------------------------------------------------------- int CPolygonManager::NextFace() { TRACE_ENTER_FN( CPolygonManager::NextFace ) if( !LU->FaceSelected() || ( !LU->BrushSelected() && !LU->PolySelected() ) ) RET( 0 ) CPolygon* pPoly = NULL; if( LU->BrushSelected() ) pPoly = (CPolygon*)&m_Brush; else pPoly = P( LU->GetPoly() ); if( pPoly == NULL ) { LOG_VAR( LU->BrushSelected() ) LOG_VAR( LU->GetPoly() ) LOG_ERR_RET( 0 ) } pPoly->NextFace(); RET( 0 ) } //----------------------------------------------------------------------------- // Name: GenerateTextureCoords() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::GenerateTextureCoords() { TRACE_ENTER_FN( CPolygonManager::GenerateTextureCoords ) if( !LU->FaceSelected() || LU->BrushSelected() ) RET( true ) F( LU->GetPoly(), LU->GetFace() )->GenerateTextureCoordinates(); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateVertX() // Desc: Changes the position of the vertex by 'amount' in the X direction. If // any other points in the polygon share the vertex, they are // automatically moved //----------------------------------------------------------------------------- bool CPolygonManager::TranslateVertX( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateVertX ) if( LU->GetVert() == NA ) LOG_ERR_RET( false ) CPolygon* pPoly = NULL; if( LU->BrushSelected() ) pPoly = (CPolygon*)&m_Brush; else pPoly = P( LU->GetPoly() ); if( pPoly == NULL ) LOG_ERR_RET( false ) // The point that is being moved VECT v = pPoly->V( LU->GetFace(), LU->GetVert() )->GetVertPos(); // Cycle through every vertex in the polygon // looking for a twin. If found, it is moved for( int iF = 0; iF < pPoly->GetLoadedFaces(); iF++ ) for( int iV = 0; iV < pPoly->F( iF )->GetLoadedVerts(); iV++ ) if( v == pPoly->V( iF, iV )->GetVertPos() ) pPoly->V( iF, iV )->TranslateX( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateVertY() // Desc: Changes the position of the vertex by 'amount' in the Y direction. If // any other points in the polygon share the vertex, they are // automatically moved //----------------------------------------------------------------------------- bool CPolygonManager::TranslateVertY( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateVertY ) // If no point has been selected, then fail if( LU->GetVert() == NA ) LOG_ERR_RET( false ) CPolygon* pPoly = NULL; if( LU->BrushSelected() ) pPoly = (CPolygon*)&m_Brush; else pPoly = P( LU->GetPoly() ); if( pPoly == NULL ) LOG_ERR_RET( false ) // The point that is being moved VECT v = pPoly->V( LU->GetFace(), LU->GetVert() )->GetVertPos(); // Cycle through every vertex in the polygon looking for a twin. If found, it is moved for( int iF = 0; iF < pPoly->GetLoadedFaces(); iF++ ) for( int iV = 0; iV < pPoly->F( iF )->GetLoadedVerts(); iV++ ) if( v == pPoly->V( iF, iV )->GetVertPos() ) pPoly->V( iF, iV )->TranslateY( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateVertZ() // Desc: Changes the position of the vertex by 'amount' in the Z direction. If // any other points in the polygon share the vertex, they are // automatically moved //----------------------------------------------------------------------------- bool CPolygonManager::TranslateVertZ( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateVertZ ) // If no point has been selected, then fail if( LU->GetVert() == NA ) LOG_ERR_RET( false ) CPolygon* pPoly = NULL; if( LU->BrushSelected() ) pPoly = (CPolygon*)&m_Brush; else pPoly = P( LU->GetPoly() ); if( pPoly == NULL ) LOG_ERR_RET( false ) // The point that is being moved VECT v = pPoly->V( LU->GetFace(), LU->GetVert() )->GetVertPos(); // Cycle through every vertex in the polygon looking for a twin. If found, it is moved for( int iF = 0; iF < pPoly->GetLoadedFaces(); iF++ ) for( int iV = 0; iV < pPoly->F( iF )->GetLoadedVerts(); iV++ ) if( v == pPoly->V( iF, iV )->GetVertPos() ) pPoly->V( iF, iV )->TranslateZ( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateFaceX() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslateFaceX( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateFaceX ) // Make sure the face is selected if( !LU->FaceSelected() ) LOG_ERR_RET( false ) //Remember which vert was selected int iTemp = LU->GetVert(); int iVerts; // Get the number of verts in this face if( LU->BrushSelected() ) iVerts = m_Brush.F( LU->GetFace() )->GetLoadedVerts(); else iVerts = F( LU->GetPoly(), LU->GetFace() )->GetLoadedVerts(); // Iterate through all the verts of the face, moving each one for( int iV = 0; iV < iVerts; iV++ ) { LU->SetVert( iV ); TranslateVertX( amount ); } // Set the vert that was selected before LU->SetVert( iTemp ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateFaceY() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslateFaceY( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateFaceY ) if( !LU->FaceSelected() ) LOG_ERR_RET( false ) //Remember which vert was selected int iTemp = LU->GetVert(); int iVerts; // Get the number of verts in this face if( LU->BrushSelected() ) iVerts = m_Brush.F( LU->GetFace() )->GetLoadedVerts(); else iVerts = F( LU->GetPoly(), LU->GetFace() )->GetLoadedVerts(); // Iterate through all the verts of the face, moving each one for( int iV = 0; iV < iVerts; iV++ ) { LU->SetVert( iV ); TranslateVertY( amount ); } LU->SetVert( iTemp ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslateFaceZ() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslateFaceZ( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslateFaceZ ) if( !LU->FaceSelected() ) LOG_ERR_RET( false ) //Remember which vert was selected int iTemp = LU->GetVert(); int iVerts; // Get the number of verts in this face if( LU->BrushSelected() ) iVerts = m_Brush.F( LU->GetFace() )->GetLoadedVerts(); else iVerts = F( LU->GetPoly(), LU->GetFace() )->GetLoadedVerts(); // Iterate through all the verts of the face, moving each one for( int iV = 0; iV < iVerts; iV++ ) { LU->SetVert( iV ); TranslateVertZ( amount ); } LU->SetVert( iTemp ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslatePolyX() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslatePolyX( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslatePolyX ) if( LU->BrushSelected() && LU->FaceSelected() ) { m_Brush.TranslateX( amount ); m_Brush.SetBrushOffset( m_Brush.GetCenterVect() ); RET( true ) } if( !LU->PolySelected() ) RET( false ) P( LU->GetPoly() )->TranslateX( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslatePolyY() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslatePolyY( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslatePolyY ) if( LU->BrushSelected() && LU->FaceSelected() ) { m_Brush.TranslateY( amount ); m_Brush.SetBrushOffset( m_Brush.GetCenterVect() ); RET( true ) } if( !LU->PolySelected() ) RET( false ) P( LU->GetPoly() )->TranslateY( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: TranslatePolyZ() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::TranslatePolyZ( const float amount ) { TRACE_ENTER_FN( CPolygonManager::TranslatePolyZ ) if( LU->BrushSelected() && LU->FaceSelected() ) { m_Brush.TranslateZ( amount ); m_Brush.SetBrushOffset( m_Brush.GetCenterVect() ); RET( true ) } if( !LU->PolySelected() ) RET( false ) P( LU->GetPoly() )->TranslateZ( amount ); RET( true ) } //----------------------------------------------------------------------------- // Name: SelectNextVertex() // Desc: Selects the next vertex //----------------------------------------------------------------------------- bool CPolygonManager::SelectNextVertex() { TRACE_ENTER_FN( CPolygonManager::SelectNextVertex ) if( !LU->VertSelected() ) RET( true ) int iVert = LU->GetVert(); iVert++; if( iVert >= 4 ) iVert = 0; LU->SetVert( iVert ); RET( true ) } //----------------------------------------------------------------------------- // Name: DeleteSelectedFace() // Desc: Deletes the selected face. If it was the last face of the selected // polygon, the polygon is deleted as well //----------------------------------------------------------------------------- bool CPolygonManager::DeleteSelectedFace() { TRACE_ENTER_FN( CPolygonManager::DeleteSelectedFace ) if( !LU->FaceSelected() || !LU->PolySelected() || LU->BrushSelected() ) RET( false ) int iPoly = LU->GetPoly(); int iFace = LU->GetFace(); // Remove the selected face from the P( iPoly )->RemoveFace( LU->GetFace() ); // If there are no faces left in the polygon, then delete the polygon if( P( iPoly )->GetLoadedFaces() == 0 ) { DeleteSelectedPolygon(); // Geometry has changed LU->ResetLookupTable(); // If there are still polygons left in the scene if( iPoly < m_iLoadedPolygons ) { // Select the first face of the next polygon LU->SetPoly( iPoly ); LU->SetFace( 0 ); } else if( m_iLoadedPolygons > 0 ) { // If any polygons are left, but the current iPoly // is out of range, (usually because it was the last in the list) // select the first face of the first polygon LU->SetPoly( 0 ); LU->SetFace( 0 ); } } else { // If the polygon was not deleted LU->ResetLookupTable(); // Select the next face of the polygon if( P( iPoly )->GetLoadedFaces() > 0 ) { LU->SetPoly( iPoly ); if( iFace < P( iPoly )->GetLoadedFaces() ) LU->SetFace( iFace ); else LU->SetFace( 0 ); } } // Notify the tree window that a selection was made NewTreeSelection(); RET( true ) } //----------------------------------------------------------------------------- // Name: AlignPolygonTextures() // Desc: /***/ //----------------------------------------------------------------------------- bool CPolygonManager::AlignPolygonTextures() { TRACE_ENTER_FN( CPolygonManager::AlignPolygonTextures ) if( !LU->PolySelected() || !LU->FaceSelected() ) RET( true ) int iP = LU->GetPoly(); for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) F( iP, iF )->GenerateTextureCoordinates(); RET( true ) } //----------------------------------------------------------------------------- // Name: ResetVirtualCoords() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::ResetVirtualCoords() { TRACE_ENTER_FN( CPolygonManager::ResetVirtualCoords ) if( !LU->PolySelected() ) RET( true ) int iP = LU->GetPoly(); for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) F( iP, iF )->ResetVirtualCoords(); RET( true ) } //----------------------------------------------------------------------------- // Name: NewTreeSelection() // Desc: //----------------------------------------------------------------------------- void CPolygonManager::NewTreeSelection() { PostMessage( m_Tree.hTreeWnd, CMSG_NEWSELECTION, 0, 0 ); m_Tree.bSelected = true; } //----------------------------------------------------------------------------- // Name: ResetVirtualCoords() // Desc: //----------------------------------------------------------------------------- CPolygon* CPolygonManager::P( const int iP ) { TRACE_ENTER_FN( CPolygonManager::P ) try { RET( m_pPolygons[iP] ) } catch( ... ) { LOG_VAR( m_iLoadedPolygons ) LOG_VAR( iP ) LOG_ERR_RET( NULL ) } } //----------------------------------------------------------------------------- // Name: ResetVirtualCoords() // Desc: //----------------------------------------------------------------------------- CFace* CPolygonManager::F( const int iP, const int iF ) { TRACE_ENTER_FN( CPolygonManager::F ) try { RET( P( iP )->F( iF ) ) } catch( ... ) { LOG_VAR( m_iLoadedPolygons ) LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( NULL ) } } //----------------------------------------------------------------------------- // Name: ResetVirtualCoords() // Desc: //----------------------------------------------------------------------------- CVertex* CPolygonManager::V( const int iP, const int iF, const int iV ) { TRACE_ENTER_FN( CPolygonManager::V ) try { RET( P( iP )->V( iF, iV ) ) } catch( ... ) { LOG_VAR( m_iLoadedPolygons ) LOG_VAR( iP ) LOG_VAR( iF ) LOG_VAR( iV ) LOG_ERR_RET( NULL ) } } //----------------------------------------------------------------------------- // Name: SetV() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetV( const int iP, const int iF, const int iV, CVertex* pV ) { TRACE_ENTER_FN( CPolygonManager::SetV ) Log( "CPolygonManager::SetV()\n" ); TRACE_LEAVE_FN() return true; } //----------------------------------------------------------------------------- // Name: SetF() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetF( const int iP, const int iF, CFace* pF ) { TRACE_ENTER_FN( CPolygonManager::SetF ) if( !P( iP )->SetF( iF, pF ) ) LOG_ERR_RET( false ) TRACE_LEAVE_FN() return true; } //----------------------------------------------------------------------------- // Name: SetP() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SetP( const int iPolygon, CPolygon* pPoly ) { TRACE_ENTER_FN( CPolygonManager::SetP ) m_pPolygons[iPolygon] = pPoly; RET( true ) } //----------------------------------------------------------------------------- // Name: DeleteSelectedPolygon() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::DeleteSelectedPolygon() { TRACE_ENTER_FN( CPolygonManager::DeleteSelectedPolygon ) int iIndex = 0; if( m_iLoadedPolygons <= 0 ) LOG_ERR_RET( true ) // Make sure a polygon is selected if( !LU->PolySelected() ) LOG_ERR_RET( true ) // Get the index of the polygon to remove int iP = LU->GetPoly(); // If its already gone, skip deletion if( P( iP ) != NULL ) { delete P( iP ); SetP( iP, NULL ); } CPolygon** pTemp = new CPolygon*[m_iLoadedPolygons]; // See if our temporary list was created alright if( pTemp == NULL ) LOG_ERR_RET( false ) for( iIndex = 0; iIndex < m_iLoadedPolygons; iIndex++ ) pTemp[iIndex] = NULL; iIndex = 0; // Copy the non null polygons into a temporary list, without gaps for( iP = 0; iP < m_iLoadedPolygons; iP++ ) { if( P( iP ) == NULL ) continue; pTemp[iIndex] = P( iP ); iIndex++; } // Delete the origional list if( m_pPolygons != NULL ) { delete[] m_pPolygons; m_pPolygons = NULL; } m_iLoadedPolygons--; if( m_iLoadedPolygons <= 0 ) { LU->ResetLookupTable(); RET( true ) } // Create a new list, one less in length m_pPolygons = new CPolygon*[m_iLoadedPolygons]; if( m_pPolygons == NULL ) LOG_ERR_RET( false ) // Copy the temporary list to the real one for( iP = 0; iP < m_iLoadedPolygons; iP++ ) SetP( iP, pTemp[iP] ); RET( true ) } //----------------------------------------------------------------------------- // Name: GetTotalFaces() // Desc: Returns the total number of faces in all normal polygons //----------------------------------------------------------------------------- int CPolygonManager::GetTotalFaces() { TRACE_ENTER_FN( CPolygonManager::GetTotalFaces ) int iTotal = 0; for( int a = 0; a < m_iLoadedPolygons; a++ ) iTotal += P( a )->GetLoadedFaces(); RET( iTotal ); } //----------------------------------------------------------------------------- // Name: Save() // Desc: Saves the state of the polygon manager to the 'File' //----------------------------------------------------------------------------- bool CPolygonManager::Save( const char* File, ofstream &out ) { TRACE_ENTER_FN( CPolygonManager::Save ) out << PM_BEGIN << NEWLINE; out << PM_NUMPOLYGONS << ' ' << m_iLoadedPolygons << NEWLINE; out << PM_CURRENTMODE << ' ' << m_CurrentMode << NEWLINE; out << PM_CLASSTYPE << ' ' << (int)m_eClassType << NEWLINE; out << PM_END << NEWLINE; for( int iP = 0; iP < m_iLoadedPolygons; iP++ ) P( iP )->Save( File, out ); RET( true ) } //----------------------------------------------------------------------------- // Name: Open() // Desc: /***/ //----------------------------------------------------------------------------- bool CPolygonManager::Open( const char* File, ifstream& in ) { TRACE_ENTER_FN( CPolygonManager::Open ) int iTemp; char strToken[256]; Reset(); in >> strToken; if( strcmp( PM_BEGIN, strToken ) != 0 ) LOG_ERR_RET( false ) in >> strToken; while( strcmp( PM_END, strToken ) != 0 ) { if( !IsPolygonManagerToken( strToken ) ) LOG_ERR_RET( false ) /*********************** VERSION 1.0 TOKENS BEGIN ***********************/ if( strcmp( PM_NUMPOLYGONS, strToken ) == 0 ) { in >> m_iLoadedPolygons; } else if( strcmp( PM_CURRENTMODE, strToken ) == 0 ) { in >> m_CurrentMode; } else if( strcmp( PM_CLASSTYPE, strToken ) == 0 ) { in >> iTemp; m_eClassType = GetClassEnumType( iTemp ); } else { Log( "Unknown PolygonManager Token: " ); Log( strToken ); Log( "\n" ); } in >> strToken; } m_pPolygons = new CPolygon*[m_iLoadedPolygons]; if( m_pPolygons == NULL ) LOG_ERR_RET( false ) for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { SetP( iP, new CPolygon() ); if( P( iP ) == NULL ) LOG_ERR_RET( false ) P( iP )->Open( File, in ); } LU->ResetLookupTable(); RET( true ) } //----------------------------------------------------------------------------- // Name: ExpandFace() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::ExpandFace() { TRACE_ENTER_FN( CPolygonManager::ExpandFace ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); if( pF == NULL ) LOG_ERR_RET( false ) m_Brush.SetType( CUSTOMBRUSH, pF ); } RET( true ) } //----------------------------------------------------------------------------- // Name: SlideFaceForward() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SlideFaceForward() { TRACE_ENTER_FN( CPolygonManager::SlideFaceForward ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vN = pF->GetFaceNormal(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() += vN * SE->m_fGeometry_MoveFactor; pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: SlideFaceBackward() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SlideFaceBackward() { TRACE_ENTER_FN( CPolygonManager::SlideFaceBackward ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vN = pF->GetFaceNormal(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() += vN * -SE->m_fGeometry_MoveFactor; pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: Inflate() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::Inflate() { TRACE_ENTER_FN( CPolygonManager::Inflate ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vC = pF->GetFaceCenter(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() += ( pF->V( iV )->GetVertPos() - vC ) * SE->m_fGeometry_MoveFactor; pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: Deflate() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::Deflate() { TRACE_ENTER_FN( CPolygonManager::Deflate ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vC = pF->GetFaceCenter(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() -= ( pF->V( iV )->GetVertPos() - vC ) * SE->m_fGeometry_MoveFactor; pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: RotateLeft() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::RotateLeft() { TRACE_ENTER_FN( CPolygonManager::RotateLeft ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vC = pF->GetFaceCenter(); const VECT vN = pF->GetFaceNormal(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() = RotPtByLn( pF->V( iV )->GetVertPos(), SE->m_fGeometry_MoveFactor, vC, vN ); pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: RotateRight() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::RotateRight() { TRACE_ENTER_FN( CPolygonManager::RotateRight ) if( LU->PolySelected() && LU->FaceSelected() ) { CFace* pF = F( LU->GetPoly(), LU->GetFace() ); CPolygon* pP = P( LU->GetPoly() ); int iV; VECT vOld; if( pF == NULL ) LOG_ERR_RET( false ) if( pP == NULL ) LOG_ERR_RET( false ) const int iNumVerts = pF->GetLoadedVerts(); const VECT vC = pF->GetFaceCenter(); const VECT vN = pF->GetFaceNormal(); for( iV = 0; iV < iNumVerts; iV++ ) { vOld = pF->V( iV )->GetVertPos(); pF->V( iV )->GetVertPos() = RotPtByLn( pF->V( iV )->GetVertPos(), -SE->m_fGeometry_MoveFactor, vC, vN ); pP->MoveAllMatching( vOld, pF->V( iV )->GetVertPos() ); } } RET( true ) } //----------------------------------------------------------------------------- // Name: AlignAllTextures() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::AlignAllTextures() { TRACE_ENTER_FN( CPolygonManager::AlignAllTextures ) int iP, iF; for( iP = 0; iP < GetLoadedPolygons(); iP++ ) for( iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) F( iP, iF )->GenerateTextureCoordinates(); RET( true ) } //----------------------------------------------------------------------------- // Name: ComputeVertexConnections() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::ComputeVertexConnections() { TRACE_ENTER_FN( CPolygonManager::ComputeVertexConnections ) SnapVertsToGrid(); for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { for( int iV = 0; iV < F( iP, iF )->GetLoadedVerts(); iV++ ) { CVertex* pV = V( iP, iF, iV ); SearchAndConnectVerts( pV, iP ); } } } RET( true ) } //----------------------------------------------------------------------------- // Name: SearchAndConnectVerts() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SearchAndConnectVerts( CVertex* pV, const int iP1 ) { TRACE_ENTER_FN( CPolygonManager::SearchAndConnectVerts ) VECT v1 = pV->GetVertPos(); VECT v2; pV->ClearAllVertexConnections(); for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { if( iP == iP1 ) continue; for( int iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { for( int iV = 0; iV < F( iP, iF )->GetLoadedVerts(); iV++ ) { v2 = V( iP, iF, iV )->GetVertPos(); if( v1 == v2 ) { if( strcmp( pV->GetName(), V( iP, iF, iV )->GetName() ) != 0 ) pV->AddVertexConnection( V( iP, iF, iV ), iP, iF ); } } } } RET( false ) } //----------------------------------------------------------------------------- // Name: RemoveCoencidingFaces() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::RemoveCoencidingFaces() { TRACE_ENTER_FN( CPolygonManager::RemoveCoencidingFaces ) int iP, iF; SnapVertsToGrid(); try { for( iP = 0; iP < GetLoadedPolygons(); iP++ ) { for( iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { SearchAndRemoveFaces( F( iP, iF ), iP, iF ); } } } catch( ... ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( false ) } RET( true ) } //----------------------------------------------------------------------------- // Name: SearchAndRemoveFaces() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SearchAndRemoveFaces( CFace* pF, const int iCurPoly, const int iCurFace ) { TRACE_ENTER_FN( CPolygonManager::SearchAndRemoveFaces ) int iP = 0, iF = 0; if( pF == NULL ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( false ) } try { for( iP = 0; iP < GetLoadedPolygons(); iP++ ) { CPolygon* pP = P( iP ); if( pP == NULL ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( false ) } for( iF = 0; iF < pP->GetLoadedFaces(); iF++ ) { CFace* pF = F( iP, iF ); if( pF == NULL ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( false ) } if( pF->IsCoenciding( pF ) ) { const int iPoly = LU->GetPoly(); const int iFace = LU->GetFace(); LU->SetPoly( iP ); LU->SetFace( iF ); DeleteSelectedFace(); LU->SetPoly( iCurPoly ); LU->SetFace( iCurFace ); DeleteSelectedFace(); LU->SetPoly( iPoly ); LU->SetFace( iFace ); } } } } catch( ... ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_ERR_RET( false ) } RET( true ) } //----------------------------------------------------------------------------- // Name: SnapVertsToGrid() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::SnapVertsToGrid() { TRACE_ENTER_FN( CPolygonManager::SnapVertsToGrid ) int iP, iF, iV; try { for( iP = 0; iP < GetLoadedPolygons(); iP++ ) { for( iF = 0; iF < P( iP )->GetLoadedFaces(); iF++ ) { for( iV = 0; iV < F( iP, iF )->GetLoadedVerts(); iV++ ) { CVertex* pV = V( iP, iF, iV ); if( pV == NULL ) LOG_ERR_RET( false ) pV->SnapVertsToGrid(); } } } } catch( ... ) { LOG_VAR( iP ) LOG_VAR( iF ) LOG_VAR( iV ) LOG_ERR_RET( false ) } RET( true ) } //----------------------------------------------------------------------------- // Name: RecalculateGeometry() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::RecalculateGeometry() { TRACE_ENTER_FN( CPolygonManager::RecalculateGeometry ) if( !RemoveCoencidingFaces() ) LOG_ERR_RET( false ) if( !ComputeVertexConnections() ) LOG_ERR_RET( false ) if( !AlignAllTextures() ) LOG_ERR_RET( false ) RET( true ) } //----------------------------------------------------------------------------- // Name: RebuildGeometry() // Desc: //----------------------------------------------------------------------------- bool CPolygonManager::RebuildGeometry() { TRACE_ENTER_FN( CPolygonManager::RebuildGeometry ) for( int iP = 0; iP < GetLoadedPolygons(); iP++ ) { P( iP )->Rebuild(); } RET( true ) }
ecc29cc59eb6e510f9aa7048b66dca6da1217ade
56a69b1609068c2d19f2d409e060f40a2dea0398
/Encryption-Decryption/baseConvert.cpp
afe1456d4ce5116233ca5d0655a96acfa37f9689
[]
no_license
kartikay101/Programming-Challenges
6fb0498c27746230a222b898d81961e2e6654c25
3caaf3465318bda772fc37d9c3b7e2e0136fb1bd
refs/heads/master
2020-03-22T14:02:00.387297
2019-10-17T19:08:22
2019-10-17T19:08:22
140,148,961
1
0
null
null
null
null
UTF-8
C++
false
false
1,710
cpp
baseConvert.cpp
/** * @Author: Kartikay Shandil <kartikay101> * @Date: 2018-07-10T11:35:09+05:30 * @Last modified by: kartikay101 * @Last modified time: 2018-07-11T21:49:55+05:30 */ // The input file is Input.txt present in res folder. #include<iostream> #include<fstream> const std::string ifile_path="res/Input.txt"; const std::string ofile_path="res/base64.txt"; const std::string encode_decode="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; std::string toBase64(std::string binary){ int len=binary.length(); binary.substr(0,len-8); // removing last unintended newline character 00001010 len-=8; char ch; std::string res=""; std::string padding=""; int pad=len%6; for(int i=0;i<pad;i++){ binary+='0'; } while (pad%8!=0) { pad=pad+6; padding+='='; } int num=0,cnt=0,x=32,byte; for(int i=0;i<len;i++){ cnt++; byte=binary[i]=='1'?1:0; num+=x*byte; x/=2; if(cnt==6){ res+=encode_decode[num]; x=32; num=0; cnt=0; } } return res+padding; } std::string toBinary(char ch){ int ascii=(int)ch; std::string res=""; int cnt=0; int bit; while(ascii>0){ bit=ascii%2; ch=(bit==1)?'1':'0'; ascii/=2; res=ch+res; cnt++; } for(int i=cnt;i<8;i++){ res='0'+res; } return res; } int main(int argc, char const *argv[]) { std::ifstream input; std::ofstream output; input.open(ifile_path.c_str()); output.open(ofile_path.c_str()); char ch; std::string binary=""; while (input.get(ch)){ binary+=toBinary(ch); } output<<toBase64(binary); input.close(); output.close(); return 0; }
d46e08d6dd83fd357a672a4ea6c86b79b1ff6e56
04904c58080f35d7720dfc06799c5af38e092b9c
/question4/FindNumberIn2DArray.cpp
5feacdef696ca386d79cf5a206f02d86448c4d5e
[]
no_license
hear-snow/SomeBasicQuestion
e0c626d59bfe10211890fb466325d18b0c10a222
8fff9e5831216e39e088ef77c043a442331d487c
refs/heads/master
2021-05-21T13:33:14.906174
2020-05-10T03:53:12
2020-05-10T03:53:12
252,668,248
0
0
null
null
null
null
GB18030
C++
false
false
1,528
cpp
FindNumberIn2DArray.cpp
#include<iostream> #define ROW 4 #define COL 4 using namespace std; bool Find( int ( *num )[ 4 ], int rows, int columns, int target ) { if( num != nullptr && rows > 0 && columns > 0 ) { int row = 0, column = columns - 1; while( row < rows && column > 0 ) { if( num[ row ][ column ] == target ) return true; else if( num[ row ][ column ] > target ) column--; else row++; } } return false; } void Test1() { int num[ ROW ][ COL ] = { { 1, 2, 8, 9}, { 2, 4, 9, 12 }, { 4, 7, 10, 13 }, { 6, 8, 11, 15 } }; int target = 7; cout << "test1: 二维数组中包含要查找的数字" << endl; cout << "正确的结果: 包含" << endl; cout << "实际的结果: "; if( Find( num, ROW, COL, target ) ) cout << "包含" << endl; else cout << "不包含" << endl; } void Test2() { int num[ ROW ][ COL ] = { { 1, 2, 8, 9}, { 2, 4, 9, 12 }, { 4, 7, 10, 13 }, { 6, 8, 11, 15 } }; int target = 3; cout << "test2: 二维数组中不包含要查找的数字" << endl; cout << "正确的结果: 不包含" << endl; cout << "实际的结果: "; if( Find( num, ROW, COL, target ) ) cout << "包含" << endl; else cout << "不包含" << endl; } void Test3() { int num[ ROW ][ COL ] = {}; int target = 3; cout << "test3: 特殊输入" << endl; cout << "正确的结果: 不包含" << endl; cout << "实际的结果: "; if( Find( num, ROW, COL, target ) ) cout << "包含" << endl; else cout << "不包含" << endl; } int main() { Test1(); Test2(); Test3(); return 0; }
cd79f42d716cc7d2bf27bc88447b6cdeea1cfe82
90ed847a28798c77934aa9d8eb8fd62b45bdd7fa
/CSUB.cpp
591e80299fbcb67ec0f47961eb6b2fcd08468765
[]
no_license
niveditaprity/codechef
4379641ecf7957f0529a6449373cfdde8539f4bc
3ae55b1c6bc71ccd78327a075fdba87491eac903
refs/heads/master
2023-01-23T20:41:52.489726
2020-11-27T14:32:32
2020-11-27T14:32:32
264,115,989
1
0
null
null
null
null
UTF-8
C++
false
false
394
cpp
CSUB.cpp
#include<bits/stdc++.h> using namespace std; typedef long long LL; int main() { int t; cin >> t; while(t--) { string s; int n,i,cur=0; LL ans=0; cin >> n >> s; for(i=0; i<n; i++) { if(s[i]=='1') { cur++; ans+=(long long)(cur); } } cout << ans << endl; } return 0; }
9bb1fe7a94fed8cad0749afc9da1b23a3eca437b
3bf9969f2e8eac6e93bc4b3569605af49d2d7f55
/Array/ArrayConsecutiveElement.cpp
1cd6465e3394e6a32d49729d53f172d243b9854f
[]
no_license
jainitesh/mission_self
95cc4eb4299b00de62c0e3bdd79c1fe55ad29209
6eec46dba0064311e21d429eb186e0b2c07ce18e
refs/heads/master
2021-01-20T14:25:28.943340
2017-05-23T17:12:54
2017-05-23T17:12:54
90,609,829
0
0
null
null
null
null
UTF-8
C++
false
false
667
cpp
ArrayConsecutiveElement.cpp
/* Author : Nitesh Jain Date : 08/05/2017 Link : http://www.geeksforgeeks.org/check-if-array-elements-are-consecutive/ */ #include<iostream> #include <vector> using namespace std; bool CheckConsecutiveArray (vector<int>& arr) { int min = 999999999; for (auto i : arr) if(i < min) min=i ; for (int i = 0 ; i < arr.size(); i++) { if ((abs(arr[i]) - min) >= arr.size()) return false; if (arr[abs(arr[i])-min] < 0) return false; arr[abs(arr[i])-min] = -arr[abs(arr[i])-min]; } return true;; } main() { vector<int> a = {75,78,76,77,73,74}; cout<<CheckConsecutiveArray (a)<<endl; }
c5b88f6c2ce56c304e8eb557aed89b84bf55ab3c
ddaee858df7eb141a097ee0b2a0fd3b67181bbeb
/BinarySearchTree/BST.cpp
f60ad931f08f2b5effb22e83bce10d83c9c2459f
[ "MIT" ]
permissive
landiinii/C-Based
60c577cb985c6bd4304b9785a792c148179f8f9f
ede5528829eb6a32c259ee7cb49d426af4582b6d
refs/heads/main
2022-12-20T11:41:34.250558
2020-10-12T16:49:27
2020-10-12T16:49:27
303,188,244
1
0
null
null
null
null
UTF-8
C++
false
false
5,955
cpp
BST.cpp
#include "BST.h" using namespace std; Node* root; NodeInterface * BST::getRootNode() const{ return root; } Node* BST::findPrev(Node* finder, Node* subject){ cout << "findP " << finder->data << endl; if(finder == NULL){ return NULL; } if(finder->data == subject->data){ return root; } if(finder->left != NULL){ if(finder->left->data == subject->data){ return finder; } } if(finder->right != NULL){ if(finder->right->data == subject->data){ return finder; } } if(subject->data < finder->data){ cout << "ER L" << endl; if(finder->left == NULL){ return NULL; } return findPrev(finder->left, subject); } else if(subject->data > finder->data){ cout << "ER R" << endl; if(finder->right == NULL){ return NULL; } return findPrev(finder->right, subject); } } Node* BST::findSpot(Node* finder, int data){ if(data == finder->data){ cout << "findA" << endl; return NULL; } else if(data < finder->data){ //cout << "find 2.1" << endl; if(finder->left == NULL){ //cout << "find 2.2" << endl; return finder; } else{ //cout << "find 2.3" << endl; return findSpot(finder->left, data); } } else if(data > finder->data){ //cout << "find 3.1" << endl; if(finder->right == NULL){ //cout << "find 3.2" << endl; return finder; } else{ //cout << "find 3.3" << endl; return findSpot(finder->right, data); } } } bool BST::totalRemove(Node*& subject, Node*& parent){ cout << "totalRemove "; if(parent == subject){ if(subject->left == NULL){ root = subject->right; } if(subject->right == NULL){ root = subject->left; } cout << subject->data << " er 1" << endl; delete subject; return true; } if(parent->left == subject){ if(subject->left == NULL){ parent->left = subject->right; } if(subject->right == NULL){ parent->left = subject->left; } cout << subject->data << " er 2" << endl; delete subject; return true; } else{ if(subject->left == NULL){ parent->right = subject->right; } if(subject->right == NULL){ parent->right = subject->left; } cout << subject->data << " er 3" << endl; delete subject; return true; } } Node* BST::findIOP(Node* papa){ cout << "findIOP" << endl; if(papa != NULL){ if(papa->right == NULL){ cout << "null" << endl; return papa; } else{ cout << "other" << endl; return findIOP(papa->right); } } else{ return NULL; } } bool BST::dethrone(Node*& dethroned, Node*& parent){ cout << "dethrone " << dethroned->data << endl; Node* heir = NULL; heir = findIOP(dethroned->left); cout << heir->data << endl; Node* temp = heir->left; Node* fill = findPrev(root, heir); if(fill != dethroned){ fill->right = temp; heir->left = dethroned->left; } heir->right = dethroned->right; if(dethroned == root){ root = heir; } else{ if(parent->right == dethroned) parent->right = heir; else if(parent->left == dethroned) parent->left = heir; } delete dethroned; return true; } bool BST::add(int data){ cout << "add " << data << endl; if (root == NULL){ Node* newRoot = new Node(data); root = newRoot; return true; } else{ Node* finder = root; finder = findSpot(finder, data); if(finder == NULL){ return false; } else{ Node* newNode = new Node(data); if(finder->data > data){ finder->left = newNode; return true; } else{ finder->right = newNode; return true; } } } } Node* BST::findRemove(Node* root, int data){ if(data == root->data){ return root; } else if(data < root->data){ if(root->left == NULL){ return NULL; } else{ return findRemove(root->left, data); } } else if(data > root->data){ if(root->right == NULL){ return NULL; } else{ return findRemove(root->right, data); } } } bool BST::remove(int data){ cout << "remove " << data << endl; Node* subject = findRemove(root, data); if(subject == NULL){ return false; } Node* parent = findPrev(root, subject); if(subject->left == NULL && subject->right == NULL){ if(subject == root){ delete root; root = NULL; return true; } else if(parent->right == subject){ delete subject; parent->right = NULL; return true; } else{ delete subject; parent->left = NULL; return true; } cout << " true " << endl; } else if(subject->left == NULL || subject->right == NULL){ if(totalRemove(subject, parent)){ cout << " True " << endl; return true; } else{ cout << " False " << endl; return false; } } else if(subject->right != NULL && subject->left != NULL){ return dethrone(subject, parent); } else{ return false; } } void BST::clear(){ cout << "clear" << endl; while(root != NULL){ remove(root->data); } }
391f7d28b86d9a526db1bc40470d5d20947dfed3
ee1423adcd4bfeb2703464996171d103542bad09
/dali-core/dali-core-HEAD-5d42e5d/automated-tests/dali-test-suite/text/utc-Dali-Utf8.cpp
4efd8c3e9e4fd9f16bdab73db9bc15ccd9c85cae
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-flora-1.1" ]
permissive
sak0909/Dali
26ac61a521ab1de26a7156c51afd3cc839cb705a
0b383fc316b8b57afcf9a9e8bac6e24a4ba36e49
refs/heads/master
2020-12-30T12:10:51.930311
2017-05-16T21:56:24
2017-05-16T21:57:14
91,505,804
0
1
null
null
null
null
UTF-8
C++
false
false
1,881
cpp
utc-Dali-Utf8.cpp
// // Copyright (c) 2014 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.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://floralicense.org/license/ // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an AS IS BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include <iostream> #include <stdlib.h> #include <tet_api.h> #include <dali/public-api/dali-core.h> #include <dali-test-suite-utils.h> using namespace Dali; static void Startup(); static void Cleanup(); extern "C" { void (*tet_startup)() = Startup; void (*tet_cleanup)() = Cleanup; } enum { POSITIVE_TC_IDX = 0x01, NEGATIVE_TC_IDX, }; #define MAX_NUMBER_OF_TESTS 10000 extern "C" { struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; } TEST_FUNCTION( UtcDaliUtf8SequenceLength, POSITIVE_TC_IDX ); // Called only once before first test is run. static void Startup() { } // Called only once after last test is run static void Cleanup() { } // Positive test case for a method static void UtcDaliUtf8SequenceLength() { tet_infoline("UtcDaliUtf8SequenceLength "); TestApplication application; std::string latinText( "amazing" ); std::string japaneseText( "すごい" ); std::string accent("é"); tet_infoline("utf8 1 byte Test "); DALI_TEST_EQUALS( Utf8SequenceLength( latinText[0] ), 1u, TEST_LOCATION ); tet_infoline("utf8 3 byte Test "); DALI_TEST_EQUALS( Utf8SequenceLength( japaneseText[0] ), 3u, TEST_LOCATION ); tet_infoline("utf8 2 byte Test "); DALI_TEST_EQUALS( Utf8SequenceLength( accent[0] ), 2u, TEST_LOCATION ); }
d6cb632e5a691b43ed4db96a5f14563ba4f5575b
58ee29d16a0b99d6a3514428de36377b7db5bf1a
/Data structures/NodoCola.cpp
12058ae280ecdfc4f50ad003a14957e83c506b84
[ "MIT" ]
permissive
Alvarohf/University-work
146ec0fc4236bd4394f2dffd9f6a5e80b7a801cb
407791f552da73c474bc8a75fb22627a75a2db5f
refs/heads/master
2023-02-11T10:22:44.807075
2021-01-07T23:45:58
2021-01-07T23:45:58
300,091,811
0
0
null
null
null
null
UTF-8
C++
false
false
129
cpp
NodoCola.cpp
#include "NodoCola.hpp" NodoCola::NodoCola(Cliente c, NodoCola* sig) { cliente=c; siguiente=sig; } NodoCola::~NodoCola() { }
5fcc2a15f678e0985776a19e58213ae41dff958f
c8e8192628c87ad567db8d518a894e90da4e4e53
/Arrays/Find Majority Element.cpp
84a37c6f4faccfb3cca28162ee931825ce9d2091
[]
no_license
Samir-Singh/DataStructure-and-Algorithm
f904a5803a3ee5de110f1f4c6c0fde0ad57e2cac
e09730bf46ef0202e8de0dc6f1528c1d1d118e10
refs/heads/main
2023-03-20T10:04:26.135964
2021-03-17T13:30:47
2021-03-17T13:30:47
324,924,772
1
0
null
null
null
null
UTF-8
C++
false
false
1,054
cpp
Find Majority Element.cpp
/* Find Majority Element in an array. Majority element in an array arr[] of size n is if element appears more than n/2 times. ex1 : Input : arr[]={3,3,4,2,4,4,2,4,4} O/P : 4 Explanation : frequency of 4 is 5 which is more than half of the size of the array ex2 : Input : arr[]={3,3,4,2,4,4,2,4} O/P : No Majority Element Explanation : there is no element whose frequeancy is more than n/2 Time Complexity : O(n) Space Complexity : O(1) Algorithm name : Moore's Voting Algorithm */ #include<iostream> using namespace std; void findMajority(int arr[], int n) { int count,element,i; count=element=0; for(i=0; i<n; i++) { if(arr[i]==element) count++; else if(count==0) element=arr[i]; else count--; } count=0; for(i=0; i<n; i++) { if(arr[i]==element) count++; } if(count>n/2) cout<<element; else cout<<"No Majority Element"; } int main() { int arr[]={3,3,4,2,4,4,2,4,4}; int n=sizeof(arr)/sizeof(int); findMajority(arr,n); return 0; }
b8d43081aa81a2130f816699fb4ec804141c1190
8793eef053377f833d64806623ff6c03fe8697d5
/test/myMenu_using_BP_lcd/myMenu_using_BP_lcd.ino
6a723874064563ca61787f19471d54aab3737fd1
[]
no_license
kamze/IF23_project
a664b8f33bc16e206a4da7f82c32ecaa1e70646d
e5eb24661901c310b3f67133fe7da38ce50209cc
refs/heads/master
2021-01-20T14:08:23.162456
2017-06-13T18:02:36
2017-06-13T18:02:36
90,563,912
0
0
null
null
null
null
UTF-8
C++
false
false
7,762
ino
myMenu_using_BP_lcd.ino
/** * This is the structure of the modelled menu * * Batterie ok ? if used return 1 " L1: Batterie; L2 e %" * Iteneraire * Start ok? L1: newfile; L2: deltaT=15sec" * Stop ok? stop the GPS * Options file * NewFile: ok? * OverWr: ok? * Option points * 1sec: ok? * 30sec ok? * 1min ok? * GPSData * Coord ok? "L1: latitude;L2 longitude" * Time ok? "L1:date ; L2:time" * Status ok? "L1: sat nomber;L2 Hdop" * SpdAlti ok? "L1:speed ; L2:Altitude" * Filemnger ok? "L1: Taille available ; L2: nombre fichier" * lister chose effaser... * *CE QUI MANQUE: retour depuis n'importe quelle item vers son pere * prevoir define etat used * ajouter des option pour les delai & et fichiers * */ #include <Arduino.h> #include <MenuBackend.h> #include <LiquidCrystal.h> #include <Bounce2.h> #include "InputManager.h" #include "defineUsedAction.h" void handleInvalidMove(MenuMoveEvent menu); void menuChangeEvent(MenuChangeEvent changed); void menuUseEvent(MenuUseEvent used); void navigateMenus( byte read); //this controls the menu backend and the event generation LiquidCrystal lcd(4, 5, 6, 7, 8, 9); byte menuUsedCode=0; InputManager BP_mnger(15,16,17,A0); byte read; bool isStarted=false; bool isNewFile=true; unsigned int GPSSearchPeriod=2000;//2000 milisecondes MenuBackend menu = MenuBackend(menuUseEvent,menuChangeEvent); //beneath is the list of menu items needed to build the menu MenuItem Battery = MenuItem(menu, "Battery ", 1);//----usable MenuItem Iteneraire = MenuItem(menu, "Itener ", 1); MenuItem Start = MenuItem(menu, "Start ", 2);//----usable MenuItem Stop = MenuItem(menu, "Stop ", 2);//----usable MenuItem FileOpn = MenuItem(menu, "FileOpn ", 2); MenuItem NewFile = MenuItem(menu, "NewFile ", 3);//----usable MenuItem OverWr = MenuItem(menu, "OverWr ", 3);//----usable MenuItem PtOpn = MenuItem(menu, "PtOpn ", 2); MenuItem Seconde_1 = MenuItem(menu, "Court ", 3);//----usable MenuItem Secondes_15 = MenuItem(menu, "Moyen ", 3);//----usable MenuItem Minute_1 = MenuItem(menu, "Long ", 3);//----usable MenuItem GPSData = MenuItem(menu, "GPSData ", 1); MenuItem Coord = MenuItem(menu, "Coord ", 2);//----usable MenuItem Time = MenuItem(menu, "Time ", 2);//----usable MenuItem Status = MenuItem(menu, "Status ", 2);//----usable MenuItem SpdAlti = MenuItem(menu, "SpdAlti ", 2);//----usable MenuItem Filemnger = MenuItem(menu, "Filemngr", 1);//----usable // Display somthing on line 1 and 2 of the lcd screen void DisplayText(String line1,String line2){ lcd.clear(); lcd.setCursor(0, 0); lcd.print(line1); lcd.setCursor(0, 1); lcd.print(line2); } // Display somthing on line 1 and 2 of the lcd screen void DisplayValues(String line1,float value, byte precision=3){ lcd.clear(); lcd.setCursor(0, 0); lcd.print(line1); lcd.setCursor(0, 1); lcd.print(value,precision); } void menuSetup() { Serial.println("Setting up menu..."); //add the file menu to the menu root menu.getRoot().add(Battery); Battery.addRight(Iteneraire).addRight(GPSData ).addRight(Filemnger); Iteneraire.add(Start ).addRight(Stop).addRight(FileOpn).addRight(PtOpn); GPSData.add(Coord).addRight(Time).addRight(Status).addRight(SpdAlti); FileOpn.add(NewFile).addRight(OverWr); PtOpn.add(Seconde_1).addRight(Secondes_15).addRight(Minute_1); } // This is where you define a behaviour for a menu item void DisplayUsedEvent(byte usedEventNumber ){ switch (usedEventNumber) { case UBattery: DisplayValues("Battery",BP_mnger.gettension(),1); break; case UStart: DisplayText("Started","Filename"); isStarted=true; break; case UStop: DisplayText("UStop","Filename"); isStarted=false; break; case UNewFile: DisplayText("UNewFile","Filename"); isNewFile=true; break; case UOverWr: DisplayText("UOverWr","Filename"); isNewFile=false; break; case UCourt: DisplayText("UCourt","Filename"); GPSSearchPeriod=2000; break; case UMoyen: DisplayText("UMoyen","Filename"); GPSSearchPeriod=15000; break; case ULong: DisplayText("ULong","Filename"); GPSSearchPeriod=60000; break; case UCoord: DisplayText("UCoord","Filename"); break; case UTime: DisplayText("UTime","Filename"); break; case UStatus: DisplayText("UStatus","Filename"); break; case USpdAlti: DisplayText("USpdAlti","Filename"); break; case UFilemnger: DisplayText("UFilemnger","Filename"); break; } } void menuUseEvent(MenuUseEvent used) { /*lcd.setCursor(0, 0); lcd.print(used.item.getName()); lcd.setCursor(0, 1); lcd.print("Used ");*/ // ------battery------------ if(used.item.isEqual(Battery)){ //Serial.println(used.item.getName()); menuUsedCode=UBattery; } // ------Iteneraire------------ else if (used.item.isEqual(Start)) { // Serial.println(used.item.getName()); menuUsedCode=UStart ; } else if (used.item.isEqual(Stop)) { // Serial.println(used.item.getName()); menuUsedCode=UStop ; } else if(used.item.isEqual(NewFile)){ //Serial.println(used.item.getName()); menuUsedCode=UNewFile; } else if (used.item.isEqual(OverWr)) { //Serial.println(used.item.getName()); menuUsedCode=UOverWr; } else if (used.item.isEqual(Seconde_1)) { // Serial.println(used.item.getName()); menuUsedCode=UCourt; } else if(used.item.isEqual(Secondes_15)){ //Serial.println(used.item.getName()); menuUsedCode=UMoyen; } else if (used.item.isEqual(Minute_1)) { Serial.println(used.item.getName()); menuUsedCode=ULong; } // ------GPSdata------------ else if(used.item.isEqual(Coord)){ //Serial.println(used.item.getName()); menuUsedCode=UCoord; } else if (used.item.isEqual(Time)) { //Serial.println(used.item.getName()); menuUsedCode=UTime; } else if (used.item.isEqual(Status)) { //Serial.println(used.item.getName()); menuUsedCode=UStatus; } else if (used.item.isEqual(SpdAlti)) { //Serial.println(used.item.getName()); menuUsedCode=USpdAlti; } // ------File manger------------ else if (used.item.isEqual(Filemnger)) { //Serial.println(used.item.getName()); menuUsedCode=UFilemnger; } } /*Here we get a notification whenever the user changes the menu That is, when the menu is navigated*/ void menuChangeEvent(MenuChangeEvent changed) { //Serial.print("Menu change "); //Serial.print(changed.from.getName()); //Serial.print(" "); //Serial.println(changed.to.getName()); //------by lcd---------------- lcd.setCursor(0, 0); lcd.print(changed.from.getName()); lcd.setCursor(0, 1); lcd.print(changed.to.getName()); } void navigateMenus( byte read) { MenuItem currentMenu=menu.getCurrent(); switch (read){ case 1: if(!(currentMenu.hasAfterChildren())){ //if the current menu has a child and has been pressed enter then menu navigate to item below menu.use(); } else{ //otherwise, if menu has no child and has been pressed enter the current menu is used menu.moveDown(); } break; case 2: menu.moveLeft(); break; case 3: menu.moveRight(); break; case 4: //menu.toRoot(); //back to main menu.moveUp(); break; } } void setup() { Serial.begin(9600); lcd.begin(8, 2); menuSetup(); Serial.println("Starting navigation:\r\nOK: s Down: s Left: q Right: d z: esp"); } void loop() { read=BP_mnger.pressedButton(); navigateMenus(read); if(menuUsedCode!=0){ Serial.print("menuUsedCode: "); Serial.println(menuUsedCode); DisplayUsedEvent(menuUsedCode); menuUsedCode=0; } }
c0d4bcaeddfabac4b10c54b8211b96840d5b1c53
93d995beeb0cc7933b1953d468dd0abc552acc02
/Common/Primitive/Sample2D_Text.cpp
7329294357ab29d6a5e3c2ba601705cfdf1fd5f9
[]
no_license
shatanzhihu/occsamplemfc
4e9cf757b84cdbfb2233e829f26aa2242a507db9
0ca4151f3f79276006978563de46eb83c8c15e14
refs/heads/master
2021-05-27T03:22:31.944242
2013-06-20T11:59:12
2013-06-20T11:59:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,063
cpp
Sample2D_Text.cpp
#include "stdafx.h" #include "Sample2D_Text.h" IMPLEMENT_STANDARD_HANDLE(Sample2D_Text,AIS2D_InteractiveObject) IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Text,AIS2D_InteractiveObject) Sample2D_Text::Sample2D_Text (const TCollection_AsciiString& aText, const Standard_Real anX , // = 0 const Standard_Real anY , // = 0 const Aspect_TypeOfText aType, // = SOLID, const Quantity_PlaneAngle anAngle, // = 0.0 const Standard_Real aslant, // = 0.0 const Standard_Integer aColorIndex, // = 0 const Standard_Integer aFontIndex, // = 1 const Quantity_Factor aScale, // = 1 const Standard_Boolean aIsUnderline, // = Standard_False, const Standard_Boolean aIsZoomable, // = Standard_True const Graphic2d_TypeOfAlignment aTypeOfAlignment) // = Graphic2d_TOA_LEFT :AIS2D_InteractiveObject() { myText = aText ; myX = anX ; myY = anY ; myTypeOfText = aType ; myAngle = anAngle ; mySlant = aslant ; myFontIndex = aFontIndex ; myColorIndex = aColorIndex ; myScale = aScale ; myWidth = 0 ; myHeight = 0 ; myIsUnderline = aIsUnderline ; myIsZoomable = aIsZoomable ; myTypeOfAlignment = aTypeOfAlignment; } void Sample2D_Text::SetContext(const Handle(AIS2D_InteractiveContext)& theContext) { AIS2D_InteractiveObject::SetContext(theContext); Handle(Graphic2d_Text) text; text = new Graphic2d_Text(this, myText, myX, myY, myAngle,myTypeOfText,myScale); text->SetFontIndex (myFontIndex); text->SetColorIndex (myColorIndex); text->SetSlant (mySlant); text->SetUnderline (myIsUnderline); text->SetZoomable (myIsZoomable); text->SetAlignment (myTypeOfAlignment); }
68cebe47e49a8b2c621991332efd8f9634847f94
17f8599c8f3a6c7258db6cd19897611a7c9d89ef
/firmware/system/drivers/Pin.cpp
4e7614ffc09c65cebe207c1c76f174d6f23de982
[]
no_license
ezhov93/Mdr1923VK014
7e0fbe5125184ad549e30943ee93a52e2127229e
3391fdb9dbb01c6f7f26c95783d213741521fc7a
refs/heads/master
2022-12-24T09:55:01.767774
2020-10-08T08:37:47
2020-10-08T08:37:47
262,274,379
0
0
null
null
null
null
UTF-8
C++
false
false
1,549
cpp
Pin.cpp
#include "Pin.h" #include "system/1923VK014.h" void Pin::init(const Mode mode, const Function function) const { enum Power { PowerDiverOff, Power300ns, Power100ns, Power10ns }; // Clock enable const uint portClkEnable = (1 << (13 + ((_portAddr & 0xFFFF) >> 12))); CLK_CNTR->PER0_CLK |= portClkEnable; PortControl *port = reinterpret_cast<PortControl *>(_portAddr); port->KEY = _KEY_; // Function const uint cntOfFunction = _number / 8; const uint func = (function << ((_number % 8) * 4)); port->CFUNC[cntOfFunction] = func; // Input / Output if (mode < Output) port->COE = numberPos(); else port->SOE = numberPos(); // Digital / Analog if (mode == AnalogInput || mode == AnalogOutput) port->CANALOG = numberPos(); else port->SANALOG = numberPos(); // Pullup / Pulldown if (mode == InputPullup || mode == OutputPullup) { port->SPULLUP = numberPos(); } else if (mode == InputPulldown || mode == OutputPulldown) { port->SPULLDOWN = numberPos(); } else { port->CPULLDOWN = numberPos(); port->CPULLUP = numberPos(); } // Power const uint cntOfPwr = _number / 16; const uint pwr = (Power10ns << ((_number % 16) * 2)); port->CPWR[cntOfPwr] = pwr; port->SPWR[cntOfPwr] = pwr; } bool Pin::read() const { return reinterpret_cast<PortControl *>(_portAddr)->RXTX & numberPos(); } void Pin::set() const { reinterpret_cast<PortControl *>(_portAddr)->SRXTX = numberPos(); } void Pin::reset() const { reinterpret_cast<PortControl *>(_portAddr)->CRXTX = numberPos(); }
76a50b3ee5f974ae356c086d7c82fd948f1c812f
de030f8c3ba5b9090fd5d2a6c7ee37832b283f73
/NType/src/DetectorConstruction.cc
4e9e0ebaa1d11383e0fc1acc870c1e279c5d384b
[]
no_license
sfinch/geant4
311bfb503b982b91b72cd06935b4a05aaf51f219
7b977f01236a61bfae191517c29590b2fbf71b0f
refs/heads/master
2016-09-06T19:20:48.147955
2012-12-13T00:39:15
2012-12-13T00:39:15
7,140,069
1
1
null
null
null
null
UTF-8
C++
false
false
16,722
cc
DetectorConstruction.cc
// // $id: detectorconstruction.cc,v 1.1 2010-10-18 15:56:17 maire exp $ // GEANT4 tag $Name: geant4-09-04-patch-01 $ // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "DetectorConstruction.hh" #include "DetectorMessenger.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "G4UImanager.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Torus.hh" #include "G4Orb.hh" #include "G4UnionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4RotationMatrix.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4PVReplica.hh" #include "G4GeometryManager.hh" #include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" #include "G4SolidStore.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction::DetectorConstruction() :crystalMaterial(0),defaultMaterial(0), solidWorld(0),logicWorld(0),physiWorld(0), logCrystal(0),physiCrystal(0) { detectorDistance = 10.*cm; // default parameter values of the crystal crystalHalfLength = (79.4/2)*mm; crystalRad = (64.5/2)*mm; crystalEndRad = (8)*mm; holeRad = (11.2/2)*mm; holeDepth = (72.7)*mm; deadLayerThick = 1.3*mm; // default parameter values of the HPGe shellHalfLength = (105./2)*mm; endGap = 4.0*mm; windowThickness = 0.50*mm; wallThickness = 1.0*mm; ComputeHPGeParameters(); // materials DefineMaterials(); SetCrystalMaterial("Ge"); SetWindowMaterial("Be"); SetWallMaterial("Al"); // create commands for interactive definition of the HPGe detectorMessenger = new DetectorMessenger(this); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction::~DetectorConstruction(){ delete detectorMessenger; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction::Construct(){ return ConstructHPGe(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::DefineMaterials(){ //This function illustrates the possible ways to define materials G4String symbol; //a=mass of a mole; G4double a, z, density; //z=mean number of protons; G4int ncomponents; G4double fractionmass; // // define Elements // G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole); G4Element* O = new G4Element("Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole); // // define a material from elements. case 2: mixture by fractional mass // G4Material* Air = new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2); Air->AddElement(N, fractionmass=0.7); Air->AddElement(O, fractionmass=0.3); // // examples of vacuum // G4Material* Vacuum = new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density, kStateGas, 2.73*kelvin, 3.e-18*pascal); G4Material* beam = new G4Material("Beam", density= 1.e-5*g/cm3, ncomponents=1, kStateGas, STP_Temperature, 2.e-2*bar); beam->AddMaterial(Air, fractionmass=1.); // print table // G4cout << *(G4Material::GetMaterialTable()) << G4endl; //default materials of the World defaultMaterial = Vacuum; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction::ConstructHPGe(){ // Clean old geometry, if any // G4GeometryManager::GetInstance()->OpenGeometry(); G4PhysicalVolumeStore::GetInstance()->Clean(); G4LogicalVolumeStore::GetInstance()->Clean(); G4SolidStore::GetInstance()->Clean(); // complete the HPGe parameters definition ComputeHPGeParameters(); // // World // solidWorld = new G4Box("World", //its name WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size logicWorld = new G4LogicalVolume(solidWorld, //its solid defaultMaterial, //its material "World"); //its name physiWorld = new G4PVPlacement(0, //no rotation G4ThreeVector(), //at (0,0,0) logicWorld, //its logical volume "World", //its name 0, //its mother volume false, //no boolean operation 0); //copy number // // Crystal // //Making the exterior crystal shape G4VSolid *cyl1 = new G4Tubs("cyl1", //name 0.*cm, //inner radius crystalRad-crystalEndRad, //outer radius crystalHalfLength, //z half length 0.*deg, //starting phi 360.*deg); //ending phi G4VSolid *cyl2 = new G4Tubs("cyl2", //name 0.*cm, //innter radius crystalRad, //outer radius crystalHalfLength-.5*crystalEndRad, //z half length 0.*deg, //starting phi 360.*deg); //ending phi G4VSolid *tor = new G4Torus("tor", //name 0.*cm, //inner r crystalEndRad, //outer r crystalRad-crystalEndRad,//torus rad 0.*deg, //start phi 360.*deg); //end phi G4VSolid *crystal1 = new G4UnionSolid("crystal1", //name cyl1,cyl2,0,G4ThreeVector(0.,0.,-.5*crystalEndRad)); G4VSolid *crystal2 = new G4UnionSolid("crystal2", //name crystal1, tor,0,G4ThreeVector(0.,0.,crystalHalfLength-crystalEndRad)); //making the hole G4VSolid *inCyl = new G4Tubs("inCyl", //name 0.*cm, //inner radius holeRad, //outer radius 0.5*(holeDepth-holeRad), //z half length 0.*deg, //starting phi 360.*deg); //ending phi G4VSolid *inSph = new G4Orb("inSph",holeRad); hole = new G4UnionSolid("hole", inCyl,inSph,0,G4ThreeVector(0.,0.,.5*(holeDepth-holeRad))); //making the dead layer G4VSolid *dead1 = new G4Tubs("dead1", //name 0.*cm, //inner radius holeRad+deadLayerThick, //outer radius 0.5*(holeDepth-holeRad), //z half length 0.*deg, //starting phi 360.*deg); //ending phi G4VSolid *dead2 = new G4Orb("dead2",holeRad+deadLayerThick); G4VSolid *dead3 = new G4UnionSolid("dead3", dead1,dead2,0,G4ThreeVector(0.,0.,.5*(holeDepth-holeRad))); deadLayer = new G4SubtractionSolid("deadLayer", dead3,hole,0,G4ThreeVector(0.,0.,0.)); //final detector shape activeCrystal = new G4SubtractionSolid("solidCrystal", crystal2,dead3,0,G4ThreeVector(0.,0.,-crystalHalfLength+0.5*holeDepth-0.5*holeRad)); logCrystal = new G4LogicalVolume(activeCrystal, crystalMaterial, //material "logCrystal"); logDeadLayer = new G4LogicalVolume(deadLayer, crystalMaterial, //material "logDeadLayer"); G4RotationMatrix *rm = new G4RotationMatrix(); rm->rotateY(90.*deg); physiCrystal = new G4PVPlacement(rm, //rotation G4ThreeVector(crystalHalfLength+windowThickness+endGap,0.,0.),//placement logCrystal, //its logical volume "physiCrystal", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number physiDeadLayer = new G4PVPlacement(rm, //rotation G4ThreeVector(3.*crystalHalfLength+windowThickness+endGap-holeDepth,0.*mm,0.), //placement logDeadLayer, //its logical volume "physiDeadLayer", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number //Make the outer shell G4VSolid *outerShell = new G4Tubs("outerShell", //name crystalRad+endGap, //inner rad crystalRad+endGap+wallThickness, //outer rad shellHalfLength, //half length 0.*deg, //starting phi 360.*deg); //ending phi logShell = new G4LogicalVolume(outerShell, wallMaterial, //material "logShell"); physiShell = new G4PVPlacement(rm, //rotation G4ThreeVector(shellHalfLength,0.,0.), //placement logShell, //its logical volume "physiShell", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number //Make the window G4VSolid *window = new G4Tubs("window", //name 0, //inner rad crystalRad+endGap, //outer rad 0.5*windowThickness, //thickness 0.*deg, //starting phi 360.*deg); //ending phi logWindow = new G4LogicalVolume(window, windowMaterial, //material "logWindow"); physiWindow = new G4PVPlacement(rm, //rotation G4ThreeVector(.5*windowThickness,0.,0.), //placement logWindow, //its logical volume "physiWindow", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number //Make the sheilding G4NistManager* manager = G4NistManager::Instance(); G4Material *copper = manager->FindOrBuildMaterial("G4_Cu"); G4Material *lead = manager->FindOrBuildMaterial("G4_Pb"); G4VSolid *shield1 = new G4Tubs("shield1", //name 0, //inner rad crystalRad+endGap+wallThickness, //outer rad 0.5*4.0*mm, //thickness 0.*deg, //starting phi 360.*deg); //ending phi logShield1 = new G4LogicalVolume(shield1, copper, //material "logShield1"); physiShield1= new G4PVPlacement(rm, //rotation G4ThreeVector(-.5*4.0*mm,0.,0.), //placement logShield1, //its logical volume "physiShield1", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number /* G4VSolid *shield2 = new G4Tubs("shield2", //name 0, //inner rad crystalRad+endGap+wallThickness, //outer rad 0.5*9.0*mm, //thickness 0.*deg, //starting phi 360.*deg); //ending phi logShield2 = new G4LogicalVolume(shield2, lead, //material "logShield2"); physiShield2= new G4PVPlacement(rm, //rotation G4ThreeVector((-.5*9.0-4.0)*mm,0.,0.), //placement logShield2, //its logical volume "physiShield2", //its name logicWorld, //its mother volume false, //no boolean operation 0); //copy number */ //Set solid angle theta = pi - acos(detectorDistance*1./ sqrt(crystalRad*crystalRad + detectorDistance*detectorDistance)); G4UImanager* UI = G4UImanager::GetUIpointer(); std::stringstream strbld; strbld << "/gps/ang/mintheta " << theta << " rad"; UI->ApplyCommand(strbld.str()); strbld.str(""); strbld.clear(); strbld << "/gps/ang/rot1 0 0 -1"; UI->ApplyCommand(strbld.str()); strbld.str(""); strbld.clear(); PrintHPGeParameters(); // // Visualization attributes // logicWorld->SetVisAttributes (G4VisAttributes::Invisible); G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); simpleBoxVisAtt->SetVisibility(true); // Below are vis attributes that permits someone to test / play // with the interactive expansion / contraction geometry system of the // vis/OpenInventor driver : {G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0)); simpleBoxVisAtt->SetVisibility(true); // delete logCrystal->GetVisAttributes(); logShell->SetVisAttributes(simpleBoxVisAtt);} {G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,1.0,0.0,0.2)); atb->SetForceSolid(true); logCrystal->SetVisAttributes(atb);} // {G4VisAttributes* atb= new G4VisAttributes(G4Colour(1.0,0.0,0.0,0.2)); // atb->SetForceSolid(true); // logDeadLayer->SetVisAttributes(atb);} //{G4VisAttributes* atb= new G4VisAttributes(G4Colour(1.0,0.0,0.0,0.2)); // atb->SetForceSolid(true); // logWindow->SetVisAttributes(atb);} //{G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,0.0,1.0,0.01)); // atb->SetForceSolid(true); // logShell->SetVisAttributes(atb);} return physiWorld; //always return the physical World } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::PrintHPGeParameters(){ G4double activeVol = activeCrystal->GetCubicVolume(); G4double activeSA = activeCrystal->GetSurfaceArea(); G4double deadVol = deadLayer->GetCubicVolume(); G4double deadSA = deadLayer->GetSurfaceArea(); G4double holeVol = hole->GetCubicVolume(); G4double holeSA = hole->GetSurfaceArea(); G4double solidangle = 2*pi*(1-cos(pi-theta)); G4cout << "\n------------------------------------------------------------" << "\n---> The crysyal is " << crystalMaterial->GetName() << "\n" << crystalRad/mm << "mm outer radius \n" << 2.*crystalHalfLength/mm << "mm length \n" << crystalEndRad/mm << "mm end radius \n" << holeRad/mm << "mm hole radius \n" << holeDepth/mm << "mm hole depth \n" << deadLayerThick/mm << "mm dead layer \n" << "---> Shielding properties \n" << 2.*shellHalfLength/mm << "mm shell length \n" << wallThickness/mm << "mm wall of " << wallMaterial->GetName() << "\n" << endGap/mm << "mm end gap \n" << windowThickness/mm << "mm window of " << windowMaterial->GetName() << "\n" << "--->Calculated quantities \n" << holeVol/(cm*cm*cm) << " cm^3 hole volume \n" << holeSA/(cm*cm) << " cm^2 hole surface area \n" << activeVol/(cm*cm*cm) << " cm^3 Active volume \n" << activeSA/(cm*cm) << " cm^2 Active surface area \n" << deadVol/(cm*cm*cm) << " cm^3 Dead layer volume \n" << deadSA/(cm*cm) << " cm^2 Dead layer surface area \n" << theta << " theta \n" << solidangle << " /4*pi solid angle\n" << "\n------------------------------------------------------------\n"; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetCrystalMaterial(G4String materialChoice){ // search the material by its name G4NistManager* manager = G4NistManager::Instance(); crystalMaterial = manager->FindOrBuildMaterial("G4_"+materialChoice); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetWindowMaterial(G4String materialChoice){ // search the material by its name G4NistManager* manager = G4NistManager::Instance(); windowMaterial = manager->FindOrBuildMaterial("G4_"+materialChoice); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetWallMaterial(G4String materialChoice){ // search the material by its name G4NistManager* manager = G4NistManager::Instance(); wallMaterial = manager->FindOrBuildMaterial("G4_"+materialChoice); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetDetectorDistance(G4double val){ detectorDistance = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetCrystalHalfLength(G4double val){ crystalHalfLength = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetCrystalRad(G4double val){ crystalRad = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetCrystalEndRad(G4double val){ crystalEndRad = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetHoleRad(G4double val){ holeRad = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetHoleDepth(G4double val){ holeDepth = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetDeadLayerThick(G4double val){ deadLayerThick = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetShellHalfLength(G4double val){ shellHalfLength = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetEndGap(G4double val){ endGap = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetWindowThickness(G4double val){ windowThickness = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::SetWallThickness(G4double val){ wallThickness = val; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4RunManager.hh" void DetectorConstruction::UpdateGeometry(){ G4RunManager::GetRunManager()->DefineWorldVolume(ConstructHPGe()); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
8351af36c19e5819b04c84ce722acf59f8780da7
81ce443a9b15bd49904a54954d820e49024b949e
/Entity.hpp
acc5161db3abcd0755eb357580c63510fda788e0
[]
no_license
ritvik06/Road-Traffic-Simulator
17508a709558780f2f247a13094c7638153e88ae
3ba83eba4bf15e058da8b1180601062f47868a60
refs/heads/master
2020-04-27T12:34:15.974843
2019-04-14T01:21:07
2019-04-14T01:21:07
174,335,837
0
0
null
null
null
null
UTF-8
C++
false
false
744
hpp
Entity.hpp
//================================= // include guard #ifndef __ENTITY_HPP_INCLUDED__ #define __ENTITY_HPP_INCLUDED__ //================================= // included dependencies #include<cstdlib> #include<tuple> //================================= // the actual class using namespace std; class Entity { public: char symbol; tuple<double, double> coordinates; tuple<double, double> dimensions; Entity(double length, double breadth, double x, double y, char sym); tuple<double,double> getLocation(); tuple<double,double> getDimensions(); void setLocation(tuple<double,double> location); void setDimensions(tuple<double,double> size); }; #endif // __ENTITY_HPP_INCLUDED__
6ba1c915270f75578f9be2a001b2d423e5a6c253
3ebe0e3e84a4c2b8ed991dddafc031bdf141fc2e
/p3/build-Texturing/qrc_textures.cpp
f937cd21fb73aff9b3882806b5a915878bea8cbd
[]
no_license
tectronics/graphics-assignments
939e615a164e80b707b3567e642b4f821ebef41c
7b3d172e83bff15f4481f6b68e3a3797d0f61873
refs/heads/master
2018-07-15T22:15:53.351900
2015-03-27T01:44:34
2015-03-27T01:44:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
128,401
cpp
qrc_textures.cpp
/**************************************************************************** ** Resource object code ** ** Created by: The Resource Compiler for Qt version 4.8.5 ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include <QtCore/qglobal.h> static const unsigned char qt_resource_data[] = { // /home/paspy/Dropbox/UCD/ECS 175/Project/p3/Texturing/flower.png 0x0,0x0,0x61,0x2b, 0x89, 0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0, 0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x8,0x2,0x0,0x0,0x0,0x7b,0x1a,0x43,0xad, 0x0,0x0,0x0,0x9,0x70,0x48,0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9d,0x8c,0x48,0x88,0x87,0x10,0x4f, 0x9e,0xb8,0xfe,0xe9,0x64,0x20,0x49,0x48,0x92,0x10,0x3d,0x33,0xde,0x9f,0x73,0x70, 0xae,0x7a,0xf4,0x14,0x0,0x1,0x28,0x8c,0x80,0x17,0xdb,0xfa,0xdf,0x73,0xfd,0x2e, 0x42,0x9c,0x84,0xb8,0x8,0xc9,0xdf,0x65,0xee,0x53,0x32,0x20,0x10,0x22,0x11,0xa2, 0x10,0x22,0xa7,0x5f,0x6,0x38,0x67,0x35,0x4,0x0,0x40,0x0,0x40,0x1,0xe1,0x20, 0xc4,0x47,0x88,0x27,0x9f,0x5d,0xff,0x29,0x62,0x36,0xa5,0x67,0x12,0x21,0x71,0x42, 0xd2,0xba,0x6f,0x97,0xf7,0x2d,0xe1,0x21,0x0,0x0,0x2,0x50,0x20,0x30,0xb3,0xb8, 0x13,0x20,0x42,0x5c,0x84,0xf8,0x9,0x71,0x15,0xdc,0x74,0xb8,0x48,0x88,0x9f,0x10, 0x91,0x90,0x18,0x21,0x72,0xda,0x66,0x5,0x38,0x77,0x3d,0x32,0x0,0x0,0x1,0x28, 0x10,0x8a,0x7a,0x42,0x6f,0xaa,0xe2,0xef,0x7b,0xff,0xce,0xdb,0x2,0x93,0x37,0xf, 0x21,0x2,0x21,0xf1,0xf4,0xcc,0xa,0x50,0xb1,0x84,0xf7,0x2d,0xc7,0x24,0x30,0x80, 0x0,0x40,0x0,0xf2,0x9c,0x2,0x2b,0xfb,0xcc,0xfc,0xa6,0xdc,0x7b,0x32,0x30,0xbf, 0x72,0x90,0x50,0xba,0x46,0xac,0xd8,0x80,0x51,0x3,0x20,0x0,0x85,0x22,0x0,0x42, 0xf1,0x9,0x0,0xf7,0x9e,0xf7,0xf7,0x16,0xcd,0x2e,0x88,0xa9,0x72,0x10,0xf7,0x9e, 0x6,0x9c,0x5b,0x39,0x88,0x72,0x52,0xcd,0x55,0xa8,0xff,0x0,0x8,0x0,0x32,0x80, 0x7c,0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,0xc1,0xad,0x4a,0xff,0xc3,0x66,0xb2, 0x9f,0xb0,0xcc,0xbb,0x7,0x4c,0x0,0xe4,0x8a,0xbc,0x9b,0x6,0x98,0xde,0x65,0x51, 0xde,0x41,0x78,0x27,0xe5,0x9d,0x54,0xf0,0x51,0x4e,0x24,0x9c,0x48,0x8,0x47,0x8, 0x23,0x84,0x72,0x52,0x29,0x15,0x7d,0x54,0xf4,0x71,0xae,0x7a,0xce,0x55,0xcf,0xbb, 0xea,0x39,0x57,0x3d,0xee,0x23,0x83,0x0,0x80,0x99,0x34,0xc0,0x88,0xec,0x57,0xfa, 0x1e,0xd6,0x27,0xde,0x26,0xcc,0xcc,0xec,0x97,0xe1,0xf6,0xc7,0x5c,0x61,0x93,0x7b, 0x22,0xb3,0x97,0x30,0x38,0x38,0x67,0x35,0xef,0x5b,0xc2,0xb9,0xeb,0x79,0xdf,0x72, 0xb1,0x62,0x3,0x32,0x6,0x8,0x0,0x98,0x16,0x33,0xde,0x21,0x77,0xff,0x4a,0x1f, 0x7d,0x95,0x99,0x99,0x74,0x12,0x98,0x1,0xce,0x15,0x79,0x3a,0xf,0x9c,0xe,0x38, 0x67,0xb5,0x58,0xb9,0x49,0x28,0xdf,0x0,0x19,0x80,0x0,0x80,0x99,0x52,0x1,0x6d, 0x78,0xab,0xdc,0xf3,0xa0,0x95,0xa,0x12,0x92,0x99,0x5e,0x81,0x19,0xe0,0x5c,0x91, 0xd7,0xf3,0xc0,0x69,0x91,0x1,0xa9,0x5c,0x6a,0xb8,0x49,0xac,0xbe,0x5a,0xf0,0x2f, 0x47,0x51,0x8,0x2,0x0,0xce,0x8c,0x11,0x3d,0x2c,0x1f,0xff,0x89,0x11,0x3d,0xc0, 0xcc,0xc,0x14,0x8c,0xcb,0x9,0xc1,0x72,0xbe,0x5c,0x11,0x26,0x24,0x5c,0xe4,0xde, 0x4e,0xe0,0xbd,0xcd,0xce,0x96,0x4f,0x49,0x35,0x57,0x43,0x3,0x20,0x0,0x60,0x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0,0xde,0x2d,0x94, 0xac,0x84,0x1d,0xce,0x51,0x6,0xc2,0x84,0x44,0xf3,0x4d,0x6,0xa6,0x5c,0x7f,0x34, 0x6f,0x2a,0xfe,0x67,0x4,0xa7,0x57,0xe5,0x29,0x98,0x3,0xb0,0x5b,0x6,0xe0,0x16, 0x4a,0x5a,0x61,0x87,0x73,0xf7,0xa4,0x2a,0x21,0x32,0x21,0x2e,0x42,0x5c,0xb6,0xdf, 0x32,0x66,0xbd,0xf7,0xb4,0xb2,0x4d,0xd7,0xf8,0xcf,0x1e,0x33,0xde,0x69,0x29,0x63, 0xd8,0xe1,0x85,0xc,0x0,0xcc,0xb3,0x41,0x44,0xce,0xd3,0xc,0xd,0x48,0x4f,0x40, 0x6d,0xdb,0x6c,0x20,0x2f,0x1e,0x72,0x2e,0x30,0x7d,0xd2,0x88,0x1e,0x44,0xef,0x83, 0x0,0x80,0x79,0x37,0x89,0xb3,0xd2,0xb1,0xf0,0x76,0xd8,0x21,0x9d,0x1e,0x36,0x69, 0x8f,0x10,0x7b,0x2a,0xe4,0x4f,0x16,0x94,0xeb,0x7f,0x57,0x0,0x4c,0x59,0x1f,0x7f, 0xb,0xfd,0x2e,0xef,0x40,0x9,0xc8,0x76,0x50,0xde,0x2d,0x94,0x6f,0x10,0x4a,0x5a, 0x8d,0xc9,0x36,0x58,0x23,0xd,0x32,0xa0,0x12,0x22,0x12,0x22,0x10,0xe2,0x20,0xc4, 0x41,0x88,0x40,0x88,0x98,0xdd,0xc8,0xc7,0x22,0x44,0x27,0xc4,0x20,0x44,0x25,0x44, 0x25,0xc4,0x20,0x44,0x2f,0xb8,0xed,0xb,0xcc,0x32,0xe3,0x9d,0x4c,0x8f,0xe3,0xbc, 0x7,0x64,0x0,0x20,0x1d,0x49,0x40,0xd3,0x27,0x50,0x51,0xcd,0x48,0xdc,0x9d,0xb5, 0x9c,0x20,0x57,0xdf,0x9b,0x2b,0x9,0xd0,0x27,0xb1,0x18,0x14,0x19,0x0,0x48,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0x7f,0x72,0x34,0xde,0x42,0x79,0x47,0x81,0x19,0x5f,0x87,0x57,0x38,0x77, 0x77,0xe2,0x80,0xd,0x20,0x0,0xe9,0x21,0x94,0xec,0x4a,0x69,0x91,0x62,0x6e,0x9b, 0x98,0x1a,0x7a,0xb9,0xe7,0xbe,0x9f,0xef,0xbb,0xeb,0xa5,0xee,0x1f,0x8d,0x26,0x3a, 0x6d,0xa7,0x2,0xfe,0x65,0xee,0x95,0x5f,0x71,0xaf,0xfa,0x47,0xce,0x55,0x5b,0x18, 0x6,0x37,0x8,0x19,0xa5,0x2c,0xc8,0xa1,0x8e,0x1,0x8a,0x5,0xfb,0x96,0x80,0x74, 0x4b,0x49,0xd7,0x59,0x6f,0x79,0xcd,0x58,0xb2,0xe7,0xf5,0x54,0xff,0x91,0xd0,0x4b, 0xcb,0x2b,0xaf,0x58,0x57,0x7b,0x73,0x83,0xaf,0xd5,0x3e,0x1a,0x40,0x45,0x9f,0xa3, 0xe1,0x66,0xde,0xb7,0x44,0xe9,0xfd,0x9d,0x3e,0xba,0x9d,0x99,0x79,0xbc,0x51,0x20, 0x41,0xc9,0x51,0xce,0x6a,0xe7,0xd9,0x12,0x8b,0x36,0x59,0x14,0x1d,0xef,0x5c,0xc0, 0x4e,0x11,0x8,0x40,0xba,0x48,0x6a,0x11,0x86,0x8b,0x39,0xa6,0x86,0x15,0x33,0xc7, 0x53,0x7d,0x13,0x83,0x3,0x87,0x47,0x5f,0x58,0x51,0x79,0xd5,0xb2,0xca,0xcb,0x5b, 0x4a,0x37,0x64,0xe9,0xe0,0xb9,0x59,0x64,0x2,0x42,0x49,0xab,0x67,0xd5,0x57,0xf5, 0x9a,0xab,0xe4,0xee,0x7,0xcc,0x58,0x47,0xde,0x99,0x57,0x25,0xa4,0x97,0x63,0xc7, 0x78,0x6b,0x90,0x63,0x3a,0x21,0xb5,0x4,0xde,0xff,0x9c,0xb,0xa,0x22,0x6c,0x0, 0x1,0x48,0x5b,0x6,0x80,0x54,0x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x58,0x37,0xc7,0x62,0x74,0xe,0xb,0x8a,0x4d,0x42, 0x22,0x94,0xc8,0x94,0xb8,0xa0,0x2,0x10,0x0,0x8,0x40,0x2e,0x2b,0x1c,0x60,0xee, 0x1c,0x1e,0x7d,0xa1,0x2b,0xfc,0xe6,0x35,0x2d,0x77,0xaf,0xa9,0xbe,0xd1,0x2d,0x96, 0xda,0x4a,0x6,0x84,0x35,0xff,0x62,0x29,0x63,0x66,0xac,0x4d,0x1b,0xd9,0x66,0x44, 0xe,0x59,0xfa,0x24,0x31,0x55,0x66,0x69,0x64,0xfe,0x1b,0x3e,0x28,0x4f,0x5,0xaf, 0xca,0xf1,0x13,0xfa,0xc4,0x38,0x65,0x3,0x1c,0xb,0x52,0x12,0x3b,0xd7,0x40,0x3e, 0x41,0x59,0xf,0x67,0xad,0x32,0xb1,0xa6,0x65,0x2e,0x2d,0xc0,0x39,0x38,0x57,0x3d, 0xec,0x0,0x1,0x48,0x53,0xf2,0x8e,0x5d,0x60,0xe7,0x8a,0xac,0x4f,0x3e,0xdf,0xf1, 0x1f,0xbb,0x87,0x1e,0xb9,0xba,0xe5,0xee,0xb5,0xd5,0x37,0xda,0x6a,0x36,0x85,0x73, 0x56,0x71,0xce,0x2b,0xc5,0xea,0x2b,0x9,0x21,0x96,0x1c,0x34,0x53,0x41,0x4b,0x1e, 0x36,0x93,0xbd,0x4c,0x8f,0xbf,0x77,0xbb,0x7d,0x9c,0x4c,0x25,0x7f,0x96,0xfa,0xee, 0x2d,0xf6,0xc4,0x22,0x96,0xfe,0xee,0x31,0x3,0x27,0xff,0x90,0x70,0x9c,0x54,0x4a, 0x45,0x2f,0x15,0xfc,0x9c,0xbb,0x5e,0xe6,0x1d,0x2f,0xf,0xfc,0xba,0x9b,0x84,0xe6, 0xbf,0x19,0x49,0x27,0xe4,0x28,0xc7,0x56,0xa1,0x3,0xce,0xad,0x65,0xab,0x21,0x0, 0x10,0x80,0xf4,0xf5,0x27,0x94,0x80,0xe6,0x95,0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,0xc1,0x1,0x23,0x4c,0x33, 0x92,0x9a,0x29,0x2b,0x46,0x62,0x5c,0xee,0x53,0x8d,0xe4,0xa4,0x32,0x92,0xd0,0xc6, 0x4d,0x66,0x68,0x46,0xd2,0x22,0xd6,0xd4,0x46,0x39,0x4a,0x39,0x8b,0x99,0x1c,0xe5, 0x9,0xa1,0x16,0x33,0x38,0xca,0x9f,0xf8,0xb9,0x69,0x19,0x1c,0xe5,0x28,0xe5,0x4d, 0x4b,0xe3,0x39,0x91,0x31,0x8b,0x52,0x9e,0x10,0x76,0xe2,0xf7,0xa7,0xfb,0x39,0x25, 0xc4,0x29,0xf8,0x79,0x4e,0xac,0x72,0x37,0x8b,0xbc,0xab,0xcc,0xd5,0x50,0xee,0x6c, 0xe4,0x39,0xd1,0xc1,0x7b,0x78,0x4e,0x44,0xeb,0x83,0x62,0x11,0x80,0x29,0xde,0x9, 0xfe,0xf7,0x96,0xe3,0xf7,0x18,0x96,0x8a,0x56,0x7,0x84,0x10,0x81,0x93,0xee,0x58, 0xf5,0xed,0xd6,0xaa,0xeb,0x32,0x54,0xff,0x91,0x8d,0x58,0x28,0xd1,0x15,0x4a,0xf6, 0xf4,0x45,0xf7,0x8e,0x26,0xbb,0x52,0x7a,0x34,0xa5,0x47,0x19,0xb3,0x2c,0x66,0xfe, 0xe9,0x6c,0xd4,0x8c,0x8e,0x3e,0x4a,0x9,0x21,0x94,0x10,0x4a,0x38,0x4a,0x39,0x81, 0x93,0x9c,0x82,0xcf,0x25,0x96,0x78,0xc4,0x32,0x89,0x77,0x3b,0x5,0xaf,0x47,0x2a, 0x17,0x38,0xa9,0xcc,0xd9,0x58,0xee,0x6a,0x74,0xa,0xbe,0x32,0x57,0x83,0x53,0xf0, 0xa1,0x63,0x14,0xd7,0x28,0x28,0x9e,0x57,0x5d,0x55,0xbd,0x79,0x2c,0xd5,0xb3,0x63, 0xe0,0xc1,0xfc,0x3a,0x9b,0xc,0x64,0x88,0xa5,0xe5,0x97,0xb6,0x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a1,0x18,0xf1,0x50, 0xb2,0x67,0x42,0x1e,0x38,0x1a,0x7a,0xa9,0x27,0xfc,0x96,0x66,0xa6,0x18,0x81,0xf1, 0x1,0x38,0x47,0x1a,0xfc,0xab,0x6f,0x5a,0xf2,0xa5,0x96,0xb2,0x8d,0x30,0x5,0x32, 0x80,0x3c,0xc0,0x29,0xf8,0x16,0x96,0xac,0x5b,0x58,0xb2,0x6e,0x45,0xe5,0x95,0xe3, 0xc9,0xde,0x23,0xa1,0x97,0xe,0x8f,0x6e,0x8d,0x69,0x63,0xc,0x75,0x21,0x0,0xce, 0xc1,0x79,0x71,0x12,0xd6,0xda,0x41,0x0,0xf2,0xf,0x97,0xe0,0x5f,0x50,0xb2,0xae, 0xd2,0xd3,0xb2,0xaa,0xfa,0xba,0xa1,0xd8,0xe1,0xa3,0xa1,0x6d,0xc3,0xf1,0x63,0xb8, 0x72,0x12,0x80,0xd9,0x43,0x29,0x57,0xe9,0x6a,0x2a,0x75,0xd6,0xc3,0x14,0xf3,0x32, 0x23,0x4a,0x40,0xb9,0xc5,0xb4,0xf4,0xb8,0x36,0x1e,0x53,0x47,0x3b,0x27,0x76,0xf5, 0x45,0xf7,0xc6,0xb5,0xb1,0x70,0x6a,0xd0,0x62,0x26,0xaa,0x43,0x0,0xcc,0x14,0x45, 0x89,0x25,0x37,0x2e,0xf9,0xe2,0x86,0xfa,0x8f,0xc2,0x14,0x10,0x80,0x42,0x40,0x35, 0x93,0x9a,0x91,0x52,0xcd,0xe4,0xc0,0xe4,0x81,0x60,0xfc,0x58,0x6f,0x64,0xcf,0x84, 0x3c,0x60,0x98,0x2a,0x94,0x0,0x80,0xd3,0x69,0x2e,0xbd,0xe0,0x23,0x2b,0xbf,0x89, 0x55,0x40,0x10,0x80,0xc2,0x24,0xa6,0x86,0x6,0x27,0xf,0x76,0x47,0x76,0xf,0xc7, 0x8f,0x27,0xb4,0x89,0x98,0x3a,0x6a,0x32,0x3,0xb3,0x5,0x0,0x10,0x42,0x78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xf,0xa3,0xda,0x3,0x1,0x0,0xf9,0xc4,0xa4,0x3a,0x12,0xd7,0xc6,0x60, 0x7,0x70,0xe,0x70,0x94,0xaf,0x70,0x37,0xad,0xaa,0xba,0x76,0x49,0xf9,0x25,0x8, 0xf9,0x21,0x0,0x20,0xff,0x18,0x8e,0xb7,0x27,0xb5,0x30,0xec,0x0,0xe6,0xe4,0xf7, 0xdd,0x62,0x69,0x95,0xa7,0x65,0x51,0xd9,0x85,0xa8,0xf6,0x40,0x0,0x40,0x1e,0x13, 0x53,0x47,0x75,0xcb,0xd6,0x77,0x40,0x56,0xba,0x9b,0xfd,0x8e,0xaa,0xb8,0x36,0x1e, 0x57,0xc7,0x35,0x33,0xc5,0x98,0x85,0x82,0x55,0x4e,0xa0,0x94,0x73,0xa,0xbe,0x1a, 0xcf,0x92,0x95,0x55,0x57,0x37,0xf8,0x56,0x39,0x5,0x1f,0xaa,0x3d,0x10,0x0,0x90, 0xdf,0xc4,0xd5,0x71,0xc3,0x54,0xed,0xfc,0x84,0xb,0x4b,0xd6,0x5d,0xd3,0xf2,0x39, 0x81,0x73,0x44,0xd5,0xe1,0x50,0xb2,0x3b,0xa6,0x84,0x6,0x26,0xf7,0xf,0x27,0x8e, 0x27,0xb5,0xb0,0xc5,0x4c,0xb4,0x60,0x66,0x9d,0x3e,0xa1,0x94,0x52,0x91,0x73,0xd5, 0x78,0x97,0x5c,0x50,0x7f,0x1b,0xce,0x6a,0x86,0x0,0x80,0x42,0xa,0xff,0x43,0x9, 0x6d,0xdc,0xce,0x1,0xb5,0xc0,0x49,0x55,0x9e,0xc5,0x65,0xae,0x46,0x42,0x88,0xcf, 0x51,0xb5,0xc0,0xbf,0x96,0x31,0x4b,0x33,0x53,0x9a,0x29,0x47,0xd5,0xe1,0x43,0x23, 0x5b,0xfb,0xa2,0xef,0x8c,0xa7,0xfa,0x74,0x53,0x46,0x5a,0x90,0x5e,0x78,0x4e,0x74, 0x9,0xfe,0x46,0xff,0xea,0xa,0x77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,0x13,0x42,0xd6,0xd4,0xdc,0x60,0x5a, 0x7a,0xff,0xe4,0xfe,0xae,0xf0,0xae,0xa1,0xd8,0xd1,0xf1,0x54,0xaf,0x62,0x24,0x74, 0x33,0xc5,0x18,0x2b,0xda,0xcc,0x80,0x12,0x3a,0xb5,0x98,0xc7,0xe7,0xa8,0x6a,0xf0, 0xad,0x6a,0xf0,0xaf,0x5a,0x5c,0xb6,0xa9,0xca,0xd3,0x82,0x81,0x0,0x1,0x0,0x45, 0x87,0x6a,0xa6,0x34,0x1b,0xaf,0x1,0xf5,0x39,0x2a,0x1b,0xfc,0xab,0xe6,0xf3,0x9, 0x3c,0x27,0x2e,0x2a,0xbb,0x70,0x51,0xd9,0x85,0x11,0x25,0x10,0x95,0x83,0x16,0x33, 0xba,0xc2,0xbb,0x47,0x93,0x9d,0x61,0x79,0x28,0xa9,0x45,0x74,0x4b,0x36,0x2d,0xad, 0x18,0xf4,0x80,0x12,0xca,0x73,0x92,0x57,0x2a,0xaf,0x74,0x37,0x2f,0x29,0xbf,0xa4, 0xd1,0xbf,0x1a,0xf5,0x7d,0x0,0x1,0x28,0x76,0x26,0x95,0x11,0xc3,0xae,0x93,0xc0, 0x94,0xd0,0x72,0xd7,0x82,0x74,0xd5,0xa3,0xcb,0x9c,0xd,0x53,0x1f,0xb5,0xb8,0xfc, 0x62,0x42,0xc8,0x94,0x1e,0xa8,0x66,0xaa,0x2f,0xba,0x77,0x22,0x35,0x10,0x96,0x7, 0x53,0x7a,0x54,0x37,0x15,0xdd,0x52,0x2c,0x66,0x12,0xc2,0x18,0x79,0xf7,0x5f,0x79, 0xe8,0xec,0xe9,0xbb,0x91,0x3e,0xa1,0x2,0xe7,0x70,0x8,0x1e,0xaf,0x54,0x51,0xeb, 0x5d,0xde,0x54,0xba,0x7e,0x49,0xf9,0xc5,0xa5,0xce,0x7a,0x74,0x7b,0x0,0x1,0x0, 0x53,0x19,0x40,0xc2,0xb6,0x4b,0xe9,0x29,0xe5,0x16,0xf8,0xd7,0x65,0xe8,0xc3,0x4f, 0xe8,0xc1,0x8a,0xca,0x2b,0x9,0x21,0x31,0x35,0x14,0x55,0x82,0xba,0x29,0x8f,0x24, 0x3a,0x12,0x5a,0x58,0x33,0xe5,0x29,0xcb,0x98,0x96,0xc1,0x51,0x8e,0x11,0x66,0x5a, 0xba,0xc8,0x3b,0xd,0x4b,0x13,0x38,0x7,0x21,0x8c,0x12,0xca,0x8,0x23,0x84,0x9a, 0x96,0xc6,0x73,0xa2,0x6e,0x2a,0x3c,0x27,0x72,0x94,0xb7,0x98,0xc9,0x51,0x9e,0x10, 0xca,0x98,0x49,0x29,0x67,0x5a,0x3a,0xcf,0x89,0x8c,0x59,0x16,0xb3,0x78,0x4e,0x98, 0xba,0x71,0x93,0x52,0xee,0xc4,0xaf,0x59,0xcc,0xe0,0x28,0x7f,0xce,0x3f,0x9f,0x7a, 0x3c,0x4a,0xf9,0xa9,0xc7,0x60,0xcc,0xa2,0x94,0x27,0x84,0x89,0x9c,0xd3,0x23,0x95, 0x71,0x94,0x2f,0x73,0x36,0x96,0xbb,0x1a,0x11,0xec,0x3,0x8,0x0,0x38,0x63,0x6, 0x30,0x6a,0x5b,0x1,0xe0,0xa9,0x30,0xcb,0xe9,0xdf,0xf9,0xe3,0x77,0x54,0xfb,0x1d, 0xd5,0x27,0xf2,0x3,0x0,0x8a,0x1,0xe,0x26,0x28,0x72,0xc2,0xf2,0xa0,0x6d,0x2f, 0x82,0x17,0x79,0x97,0x4f,0xaa,0x40,0x1b,0x1,0x0,0x1,0x0,0xe9,0x27,0xa6,0x86, 0xec,0x7c,0xe,0xa8,0x83,0xf7,0x70,0x14,0x49,0x2a,0x0,0x10,0x0,0x90,0x1,0x22, 0xf2,0x90,0x9d,0xcf,0x1,0x15,0x78,0x7,0xda,0x8,0x0,0x8,0x0,0xc8,0x8,0xc3, 0x89,0xe3,0x8a,0x11,0xb7,0x71,0x6,0xe0,0xc6,0xbc,0x25,0x0,0x10,0x0,0x90,0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x5c,0xbc,0xff,0x5d,0x49, 0x4f,0xb0,0xd6,0xf9,0x8d,0x16,0x7c,0xe7,0x7d,0xa7,0x14,0xdf,0x90,0x15,0x68,0xe9, 0x8f,0xb6,0x43,0xe7,0xf2,0xda,0xf,0x10,0xcf,0x1,0xc4,0xb8,0x79,0xc8,0x39,0xee, 0xb2,0xf5,0xeb,0x17,0x64,0x36,0x67,0xf1,0xa9,0x7d,0x7f,0x55,0x58,0xa7,0xee,0x4c, 0x86,0x7f,0x52,0xf7,0x8f,0x93,0xe1,0xd3,0xb7,0x23,0x67,0x64,0x32,0x60,0xb9,0x4a, 0x5c,0xba,0xde,0xd7,0x0,0x5f,0xea,0xda,0x7f,0x4c,0x7d,0x6d,0x32,0x7c,0x3a,0x45, 0x7,0xca,0x7c,0xbe,0x22,0x94,0x8a,0x6c,0x7a,0x23,0xbf,0x70,0x75,0xfd,0x47,0x97, 0x1e,0x7c,0xbf,0x71,0xd,0xc8,0xa5,0x80,0x2a,0x42,0xa9,0x8e,0x8,0x54,0x60,0x53, 0x9a,0x19,0x4e,0x55,0x16,0xd,0xc3,0x17,0x78,0xa1,0x82,0x36,0x67,0x8f,0x50,0x32, 0x6a,0xd3,0x9a,0xac,0x40,0xff,0xef,0xca,0x3f,0xc8,0xbf,0xc,0x4,0x70,0x35,0x73, 0x2b,0x98,0x9d,0x69,0x1a,0x56,0x67,0x99,0x68,0x9d,0x10,0x29,0xa,0x36,0xb,0xcb, 0x7e,0xea,0xee,0x44,0x1b,0xe2,0x53,0xed,0x93,0x32,0x21,0x80,0x73,0xf1,0xf7,0x50, 0x52,0xc6,0xdb,0xa3,0xa,0x4c,0xfd,0x98,0x40,0x28,0xce,0x27,0x2e,0x7d,0xf1,0xc0, 0x9f,0x23,0x66,0x36,0x28,0x26,0x72,0x23,0xf8,0x6a,0x1a,0xcd,0x77,0x91,0xa1,0x3f, 0x34,0xe6,0x1e,0xd7,0xa8,0x5b,0xe8,0xf7,0xd5,0xc1,0xec,0xcc,0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c4,0x76,0x26,0x73,0x63,0x48,0x93,0xb8, 0x96,0xb9,0xa5,0xf8,0x21,0x44,0xa1,0x94,0x1d,0x64,0x0,0x38,0x91,0x59,0xcd,0xdc, 0xd4,0x8b,0x32,0x28,0x40,0x5e,0x97,0x22,0x80,0x54,0x39,0x90,0x67,0x13,0x88,0xfd, 0xd1,0x30,0xc,0x86,0xa4,0x9,0xa,0x54,0x5e,0x0,0x54,0x57,0xc8,0x3a,0x75,0xa7, 0xd3,0x3a,0xc6,0x1a,0x1c,0x17,0x3c,0xad,0xdb,0xfb,0xf8,0x87,0x50,0x71,0x12,0x55, 0x49,0xc6,0x5a,0x77,0xc8,0xc0,0x89,0x22,0xaf,0xa7,0x12,0xc8,0xa3,0xad,0xca,0xda, 0x38,0x62,0x82,0x54,0x79,0x3,0x25,0x2a,0x27,0x0,0x81,0xef,0xee,0xc,0x46,0x89, 0x4d,0x67,0x99,0xa8,0xcd,0xe2,0x88,0x6b,0x4a,0xb9,0x86,0x72,0xf7,0x80,0x99,0xca, 0xb0,0x21,0x94,0x53,0x6d,0xc3,0xb,0x6c,0x7b,0x18,0x0,0x84,0x39,0xb2,0x5b,0xdc, 0x2c,0xb2,0x38,0xc4,0x4e,0x89,0x0,0x44,0x20,0x16,0x2a,0x29,0x1d,0xa7,0x41,0x17, 0x89,0x5a,0x86,0xcb,0x17,0x2a,0x29,0x45,0x46,0x17,0x4,0xd0,0x6a,0xe9,0xc1,0xab, 0xdf,0xf0,0xa8,0xb1,0x92,0xaf,0x24,0xd2,0x74,0xa8,0xc8,0x69,0x99,0x6b,0x5e,0x64, 0x4d,0x75,0xa4,0xca,0xbf,0xc,0x6e,0x2c,0xd1,0x35,0x18,0xed,0x7d,0x1c,0xe0,0x3b, 0x80,0x46,0xff,0x47,0xd0,0x35,0xfe,0xcd,0x94,0x43,0xed,0x3f,0x44,0x80,0x3c,0x22, 0x2b,0xc3,0x6d,0x1b,0xc4,0x2b,0xdb,0x68,0xa7,0x1,0xa,0xc,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0x7a,0x76, 0x91,0xa4,0x15,0x4b,0xb1,0x1a,0x16,0x26,0x1e,0x18,0xf8,0xec,0x7c,0xfc,0x12,0xe2, 0xe7,0xab,0xf9,0x1f,0x0,0x0,0xd9,0xd4,0xbf,0x20,0x0,0x31,0xd6,0xf7,0xe4,0xa1, 0xc1,0xcf,0x4f,0x78,0x4f,0x4e,0x78,0x4f,0x6e,0x97,0xd3,0x5f,0x32,0x6e,0xe6,0x7c, 0xb1,0xea,0xe5,0xd5,0x80,0x63,0xf,0xbe,0x48,0x6f,0x8a,0x9,0xef,0xc9,0x43,0x83, 0xbf,0x46,0x92,0x5b,0xc0,0xf3,0x7b,0x72,0xd7,0x73,0xe6,0xc,0xcb,0x9c,0xd6,0x7e, 0x55,0xa5,0x97,0x4,0x20,0x54,0x7d,0x11,0xbb,0xd5,0x7d,0x60,0xe0,0x78,0x7,0x5e, 0xdb,0x23,0xf9,0x8e,0x18,0x6,0xc0,0x6e,0x71,0xed,0xf3,0x3c,0x85,0xba,0x42,0x6a, 0xf2,0x3f,0x0,0x80,0xff,0x7,0x8c,0x1b,0x54,0x77,0x93,0xbc,0x7f,0xcb,0x0,0x0, 0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82, }; static const unsigned char qt_resource_name[] = { // flower.png 0x0,0xa, 0xd,0xc8,0xf1,0x87, 0x0,0x66, 0x0,0x6c,0x0,0x6f,0x0,0x77,0x0,0x65,0x0,0x72,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67, }; static const unsigned char qt_resource_struct[] = { // : 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, // :/flower.png 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, }; QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT bool qRegisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); extern Q_CORE_EXPORT bool qUnregisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); QT_END_NAMESPACE int QT_MANGLE_NAMESPACE(qInitResources_textures)() { QT_PREPEND_NAMESPACE(qRegisterResourceData) (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_textures)) int QT_MANGLE_NAMESPACE(qCleanupResources_textures)() { QT_PREPEND_NAMESPACE(qUnregisterResourceData) (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources_textures))
e24a24b3341ba884909440574969e930972b535d
ba9b2dbdcdb7b508d9700e1ebdef8abbe2b9f6a0
/delta ćwiczenie 7.cpp
4e2910c1bb50d79815a342e7d68e10f8b8f6e783
[]
no_license
DawidDziuba/-wiczenia-ppk
8cb9926feabc1b17ecef0c2ce492d8e10785a521
c83a10f19bd6d708cf3f44060b62029925f369eb
refs/heads/master
2022-12-26T19:00:53.071412
2020-10-14T07:07:04
2020-10-14T07:07:04
302,431,651
0
0
null
null
null
null
UTF-8
C++
false
false
770
cpp
delta ćwiczenie 7.cpp
#include<iostream> #include <math.h> using namespace std; int main() { double a, b, c; cout<< "Podaj zmienna a ";cin>> a; cout<< "Podaj zmienna b ";cin>> b; cout<< "Podaj zmienna c ";cin>> c; // ax2+bx+c double delta, x1, x2; // sqrtb2-4ac, (-b -+ sqrt delta)/ 2a delta= sqrt ( b*b -4*a*c); // cout << delta<<endl; if( a == 0) { if( b == 0) { if(c == 0) cout<< "Tozsamosc"; else cout<< "Sprzecznosc"; } else { x1= -(c/b); cout<< x1; } } else { if (delta > 0) { x1=(-b-sqrt(delta))/(2*a); x2=(-b+sqrt(delta))/(2*a); cout<< x1,x2; } else if (delta == 0) { x1=(-b)/(2*a); cout<< x1; } else { cout<< "rozwiazanie znajduje sie w zbiorze liczb urojonych"; } } }
9d94ef31eaf5da22594d6db96a0a7b33ddb2f72c
21390f77aaf8c4815c1ffd43ac0d4235d41b0b57
/Sort_Search/LCPrimarySS2.h
77ca42be58b4ab8b568a14160d884f650a0d7c0d
[]
no_license
RenjieChiang/myLC
ce8e396a3cde25aaf904215f186cf34186080325
1fab036076ead36aabc57ac079485a683628eacf
refs/heads/master
2023-06-24T04:36:17.887823
2021-07-28T08:59:08
2021-07-28T08:59:08
349,935,717
0
0
null
2021-04-08T02:20:50
2021-03-21T08:07:05
C++
UTF-8
C++
false
false
1,361
h
LCPrimarySS2.h
// // Created by tianbot on 2021/4/5. // /* * 第一个错误的版本 你是产品经理,目前正在带领一个团队开发新的产品。不幸的是,你的产品的最新版本没有通过质量检测。由于每个版本都是基于之前的版本开发的,所以错误的版本之后的所有版本都是错的。 假设你有 n 个版本 [1, 2, ..., n],你想找出导致之后所有版本出错的第一个错误的版本。 你可以通过调用 bool isBadVersion(version) 接口来判断版本号 version 是否在单元测试中出错。实现一个函数来查找第一个错误的版本。你应该尽量减少对调用 API 的次数。 示例: 给定 n = 5,并且 version = 4 是第一个错误的版本。 调用 isBadVersion(3) -> false 调用 isBadVersion(5) -> true 调用 isBadVersion(4) -> true 所以,4 是第一个错误的版本。 相关标签 二分查找 作者:力扣 (LeetCode) 链接:https://leetcode-cn.com/leetbook/read/top-interview-questions-easy/xnto1s/ 来源:力扣(LeetCode) 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 */ #ifndef MYLEETCODE_LCPRIMARYSS2_H #define MYLEETCODE_LCPRIMARYSS2_H class LCPrimarySS2 { public: int firstBadVersion(int n); bool isBadVersion(int version); }; #endif //MYLEETCODE_LCPRIMARYSS2_H
689e842ecde81e8c2712b8dfb3cb551cf319eb8b
58a37bb5a670848010f855bba97e26d4eecc6568
/solved/spojbr/BIT.cpp
2198d40543341808e07c61a0c95c4e9d468f379c
[]
no_license
ederfmartins/programming-challenges-snippets
603d5700947fd1b07943c0774fc247ecef7b0216
0f798e5869425458b0d304911d10be6771bd70c9
refs/heads/master
2020-04-09T17:22:04.537706
2016-08-18T17:25:33
2016-08-18T17:25:33
40,633,045
0
0
null
null
null
null
UTF-8
C++
false
false
311
cpp
BIT.cpp
#include <iostream> using namespace std; int main() { int n, t = 1; int i, j, k, l; while (cin >> n) { if (n == 0) break; i = n/50; n %= 50; j = n/10; n %= 10; k = n/5; n %= 5; l = n; cout << "Teste " << t++ << endl; cout << i << " " << j << " " << k << " " << l << endl; } return 0; }
4e60c986383abfa3991349ac81c24d132b09e530
912458deb28b04326fb1650d9722a441231d624e
/Homework06/InheritenceClass/Bear.cpp
3304a3bc3ad5e2c5cfcfd4d2e006334b237af55a
[]
no_license
prog1261-2020/homework-seandoucet-nbcc
006f4b8f065a09553a294f420caa08b3efcaf5d8
a1b9f3a9f00b3b1e174f4cf7359fce7c8678062b
refs/heads/master
2020-12-09T19:48:41.409575
2020-03-24T14:54:40
2020-03-24T14:54:40
233,403,224
0
0
null
null
null
null
UTF-8
C++
false
false
271
cpp
Bear.cpp
// Program Header File #include "Bear.h" // C++ Standard Library Pre Processor #include <iostream> Bear::Bear() : Animal() { } void Bear::Speak() { std::cout << "Bear Speaking..." << std::endl; } void Bear::Move() { std::cout << "I am Moving..." << std::endl; }
41e485ea9baaa1a18873dca8adb26296f67874c6
a4bbeec539f2b1b7892ad7de3602c498b8326092
/BPTree.cpp
c6b268c665a9c141cd5adb4129f1dc2cee79c205
[]
no_license
anonymousubmitter/project2
0a299cf1e0468fd74213631745699c245936543a
5a1a6607fce0791d455281c7db6f428eae294c9c
refs/heads/master
2022-12-25T23:26:32.812254
2020-09-27T23:44:29
2020-09-27T23:44:29
297,234,977
0
0
null
null
null
null
UTF-8
C++
false
false
4,053
cpp
BPTree.cpp
#include "BPTree.h" BPTree::~BPTree() { delete root_pointer; root_pointer = NULL; } BPTree::BPTree(Pointer* p, int nodeSize) { cache->getFileOrAdd(p, file, nodeSize); root_pointer = new Pointer(p); } void BPTree::print(int level) { printNode(root_pointer, level); } void BPTree::printNode(Pointer* node_pointer, int level) { InnerNode* node = new InnerNode(node_pointer, file, false); if (node->isLeaf()) { for (int j = 0; j < level; j++) printf("\t"); for (int i = 0; i < node->getNoElements(); i++) { //for (int j = 0; j < level; j++) printf("\t"); cout << "( " << node->getKeyAt(i) << ", " << node->getValueAt(i) << ") " ; } printf("\n"); bool is_first; } else { for (int i = 0; i < node->getNoElements(); i++) { printNode(node->getPointerAt(i), level+1); for (int j = 0; j < level; j++) printf("\t"); cout << "( " << node->getKeyAt(i) << ", " << node->getValueAt(i) << ")" << endl; } printNode(node->getPointerAt(node->getNoElements()), level+1); } delete node; } VALUE BPTree::find(KEY key) { if (!file->exists()) { return -1; } return findValue(this->root_pointer, key, true); } void BPTree::find(KEY low, KEY high, vector<KEY>* result) { if (!file->exists()) { return; } findValue(this->root_pointer, low, high, result, true); } void BPTree::findValue(Pointer* node_pointer, KEY low, KEY high, vector<KEY>* result, bool only_snode) { Time* time = new Time; Util::startTime(time); int i = 0; InnerNode* node; bool read_cache; Pointer* curr_pointer = new Pointer(node_pointer); DiskIterator* iter = NULL; while(true) { pages_read++; read_cache = false; if(cache->getPageIfExists(curr_pointer, node)) read_cache = true; else { node = new InnerNode(curr_pointer, file, false); cache_misses++; } i = node->getKeyIndex(low, 0, node->getNoElements()); if (node->isLeaf()) { iter = new DiskIterator(curr_pointer, i, node, file, PAGE_SIZE, -1, true, false, 2560, high); break; } delete curr_pointer; curr_pointer = new Pointer(node->getPointerAt(i)); if (!read_cache) delete node; } while (!iter->reachedEnd()) { KEY curr_key = iter->getKey(); if (curr_key <= high) result->push_back(curr_key); else break; iter->moveNext(); } get_page_time += Util::getTimeElapsed(time); if (!read_cache) delete node; delete time; delete curr_pointer; delete iter; return; } VALUE BPTree::findValue(Pointer* node_pointer, KEY key, bool only_snode) { Time* time = new Time; Util::startTime(time); int i = 0; InnerNode* node; bool read_cache; Pointer* curr_pointer = new Pointer(node_pointer); while(true) { pages_read++; read_cache = false; if(cache->getPageIfExists(curr_pointer, node)) { read_cache = true; } else { node = new InnerNode(curr_pointer, file, false); cache_misses++; } i = node->getKeyIndex(key, 0, node->getNoElements()); if (node->isLeaf()) { if (i == node->getNoElements() || node->getKeyAt(i) != key) { if (!read_cache) delete node; get_page_time += Util::getTimeElapsed(time); delete time; delete curr_pointer; return -1; } VALUE val = node->getValueAt(i); if (!read_cache) delete node; get_page_time += Util::getTimeElapsed(time); delete time; delete curr_pointer; return val; } delete curr_pointer; curr_pointer = new Pointer(node->getPointerAt(i)); if (!read_cache) delete node; } }
da5b6c4b2ea1c32ea2e0e05238fff189706d00c8
95a66516553ca9bf67a8ed1b71dda63b605774c6
/source/predictdepth.cpp
e867c1f78e231a93460091739763f93b15058234
[]
no_license
pdrgrc/WaSP
7fcb661714b35db77e407bbf82361830ffb353d9
fb704948d4f878f16fbc4d81f6bc5dc7a39fa6f9
refs/heads/master
2020-07-27T00:17:45.939236
2019-02-09T10:15:42
2019-02-09T10:15:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,194
cpp
predictdepth.cpp
#include "predictdepth.hh" #include "warping.hh" #include "medianfilter.hh" #include "ppm.hh" #include "inpainting.hh" #include "warping.hh" #include <ctime> #include <vector> void predictDepth(view* SAI, view *LF) { /* forward warp depth */ if (SAI->has_depth_references) { /* currently we forward warp the depth from the N (for HDCA N = 5, lenslet maybe 1?) references */ unsigned short **warped_color_views_0_N = new unsigned short*[SAI->n_depth_references](); unsigned short **warped_depth_views_0_N = new unsigned short*[SAI->n_depth_references](); float **DispTargs_0_N = new float*[SAI->n_depth_references](); for (int ij = 0; ij < SAI->n_depth_references; ij++) { view *ref_view = LF + SAI->depth_references[ij]; int tmp_w, tmp_r, tmp_ncomp; aux_read16PGMPPM(ref_view->path_out_pgm, tmp_w, tmp_r, tmp_ncomp, ref_view->depth); aux_read16PGMPPM(ref_view->path_out_ppm, tmp_w, tmp_r, tmp_ncomp, ref_view->color); warpView0_to_View1(ref_view, SAI, warped_color_views_0_N[ij], warped_depth_views_0_N[ij], DispTargs_0_N[ij]); delete[](ref_view->depth); delete[](ref_view->color); ref_view->depth = NULL; ref_view->color = NULL; } /* merge depth using median*/ int startt = clock(); #pragma omp parallel for for (int ij = 0; ij < SAI->nr*SAI->nc; ij++) { std::vector<unsigned short> depth_values; for (int uu = 0; uu < SAI->n_depth_references; uu++) { //for (int uu = 0; uu < SAI->n_references; uu++) { unsigned short *pp = warped_depth_views_0_N[uu]; float *pf = DispTargs_0_N[uu]; if (*(pf + ij) > INIT_DISPARITY_VALUE) { depth_values.push_back(*(pp + ij)); } } if (depth_values.size() > 0) SAI->depth[ij] = getMedian(depth_values); } //std::cout << "time elapsed in depth merging\t" << (int)clock() - startt << "\n"; /* hole filling for depth */ holefilling(SAI->depth, 1, SAI->nr, SAI->nc, 0); for (int ij = 0; ij < SAI->n_depth_references; ij++) { delete[](warped_color_views_0_N[ij]); delete[](warped_depth_views_0_N[ij]); delete[](DispTargs_0_N[ij]); } delete[](warped_color_views_0_N); delete[](warped_depth_views_0_N); delete[](DispTargs_0_N); } }
fe1a7b7ab98daa54c24c70bef031a6772033e107
7ea5365a0424c50be888cfba52c54fab1779b879
/백준/Old/boj11055_LIS_DP.cpp
5450888774940efd08a0b144a6b8c6edf0e71699
[]
no_license
judemin/AlgorithmSolutions
a3e26fb7685f7357fad7fe05743f975fe2fde406
cef19d14ab7bf9ca70aa73f87d49834f2ee24f31
refs/heads/master
2023-06-29T05:22:00.109993
2021-08-04T07:07:25
2021-08-04T07:07:25
259,854,361
0
0
null
null
null
null
UTF-8
C++
false
false
501
cpp
boj11055_LIS_DP.cpp
#define _CRT_SECURE_NO_WARNINGS #define N 1001 #include<iostream> using namespace std; int A[N], n; int dVal[N]; int main(void) { freopen("input.txt", "r", stdin); int i, j; int res = -1; cin >> n; for (i = 0; i < n; i++) cin >> A[i]; for (i = 0; i < n; i++) { int max = 0; for (j = 0; j < i; j++) if (A[j] < A[i] && dVal[j] > max) max = dVal[j]; dVal[i] = A[i] + max; if (dVal[i] > res) res = dVal[i]; } cout << res << endl; return 0; } /* 10 1 100 2 50 60 3 5 6 7 8 */
7cf4b828bc86e93a83703c55f4bd0537440ae842
ec1095d7b8847e977faec34cbd08732410c5b699
/Random/HOT/main3.cpp
cb1b26f9048b5c16aab6e90c18bce0d617c2cfc7
[ "Unlicense" ]
permissive
AssemblerTC/Workspace
4847052d41ce3fae52cd5931876c3124de10ba9b
bdb27e2165ab61471b3515c4a1684e5bdf2238d6
refs/heads/master
2020-12-24T21:00:52.205445
2015-10-10T16:27:47
2015-10-10T16:27:47
41,767,852
0
0
null
null
null
null
UTF-8
C++
false
false
1,722
cpp
main3.cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) ((int)(x).size()) #define forn(i, n) for (int i = 0; i < (n); i++) typedef long long int number; const int maxn = 5010; int n; vector<int> g[maxn]; int parent[maxn]; vector<vector<int> > level, new_level; void next_level() { new_level.clear(); for (const auto& group: level) { vector<int> new_group; for (int u: group) for (int v: g[u]) if (v != parent[u]) { new_group.pb(v); parent[v] = u; } if (sz(new_group) > 0)//this is important new_level.pb(new_group); } swap(level, new_level); } vector<number> size_group; number dp[maxn][3]; number solve(int pos, int rem) { if (rem == 0) return 1LL; if (pos == sz(size_group)) return number(rem == 0); if (dp[pos][rem] != -1LL) return dp[pos][rem]; number ans = solve(pos + 1, rem); ans += size_group[pos] * solve(pos + 1, rem - 1); return dp[pos][rem] = ans; } int main() { scanf("%d", &n); forn (i, n - 1) { int u, v; scanf("%d %d", &u, &v); g[u].pb(v); g[v].pb(u); } number ans = 0; for (int center = 1; center <= n; center++) { memset(parent, -1, sizeof(parent)); level.clear(); for (int v: g[center]) {//first level after root level.pb({v}); parent[v] = center; } while (sz(level) >= 3) {//can't take 3 node if there are < 3 groups size_group.clear();//colect the sizes of groups forn (i, sz(level)) { assert(sz(level[i]) > 0);//this should be > 0 size_group.pb(sz(level[i])); } memset(dp, -1, sizeof(dp)); ans += solve(0, 3); next_level(); } } printf("%lld\n", ans); return 0; }
4aed6454742ee7e78362ff024737a7fa9712d2a2
e8282e3ae8aafa07b7f7261c639f206c4e97e0fc
/02 - SMA/Camp 1 OSN Kelas 11/Hari-17/rijeci.cpp
74922eddcd1e236cdf4f629ece761fcbdc9d299a
[]
no_license
irfansofyana/cp-codes
7cad844da49b901ccf678b75c31ed41e2fa9d645
9fa723129088f0e4832ecb7e012fe586b6d59e41
refs/heads/master
2023-04-04T00:48:36.334817
2021-04-12T03:07:06
2021-04-12T03:07:06
218,084,148
0
0
null
null
null
null
UTF-8
C++
false
false
278
cpp
rijeci.cpp
#include <bits/stdc++.h> using namespace std; int i,n,a,b; int temp; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); cin >> k; a = 0; b = 1; for (i = 2 ; i <= k ; i++) { temp = a; a = b; b = temp+b; } cout << a << " " << b << endl; return 0; }
fb30f5b87810a4b668a3f1e2e6ef2aac161148c2
342cbe7777582d31e3e331272ccd5208680ae0d1
/src/windows/CMD3D11/CMD3D11Rtv.h
916b8cdd8a969cf15b9c5fffca4e7f7bebbf1c25
[]
no_license
marukun318/WinAppDX11
6e3b65b44443d801ccbb89a6e37ab40462a77a7f
4ada97ee2f2d2d4c67e1ad524983faebc6eff160
refs/heads/master
2020-05-04T17:48:04.035577
2019-08-26T10:53:23
2019-08-26T10:53:23
179,327,073
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
814
h
CMD3D11Rtv.h
// Direct3D11 Render Texture View Wrapper class // written by Takeshi Maruyam // #pragma once #ifndef __CMD311Rtv_H__ #define __CMD311Rtv_H__ #include "common.h" #include "CMD3D11.h" class CMD3D11Rtv { public: CMD3D11Rtv(int, int); ~CMD3D11Rtv(); inline ID3D11ShaderResourceView* GetShaderResouceView() { return m_pShaderResView; } ID3D11Texture2D* m_pOffScreen = nullptr; // オフスクリーンテクスチャ ID3D11ShaderResourceView* m_pShaderResView = nullptr; // テクスチャ シェーダーリソースビュー ID3D11RenderTargetView* m_pRenderTargetView = nullptr; // レンダーターゲットビュー ID3D11UnorderedAccessView* m_pUAV = nullptr; // テクスチャ アンオーダ−ドアクセスビュー int m_width; int m_height; }; #endif // ! __CMD311Rtv_H__
179bdf622b6fdaea6599d995ace97afadc29bbd5
cd99ca9461435d1417cb146d966e54272fbcc7ad
/3rd party/maxsdk/howto/3dsmaxPluginWizard/Templates/1033/IK_TYPE_IKSolver.cpp
ad11cbc84d00430f53c3fe483dc2434645b23075
[]
no_license
mortany/xray15
eacce7965e785dd71d1877eae25c1f9eff680eec
72a13fb24e9b388850bc769427c231da8f599228
refs/heads/master
2020-08-02T20:45:23.493981
2019-10-14T18:48:48
2019-10-14T18:48:48
211,499,718
0
0
null
2019-09-28T12:50:47
2019-09-28T12:50:46
null
UTF-8
C++
false
false
4,309
cpp
IK_TYPE_IKSolver.cpp
[!output TEMPLATESTRING_COPYRIGHT] #include "[!output PROJECT_NAME].h" #define [!output CLASS_NAME]_CLASS_ID Class_ID([!output CLASSID1], [!output CLASSID2]) using namespace IKSys; class [!output CLASS_NAME] : public [!output SUPER_CLASS_NAME] { public: //Constructor/Destructor [!output CLASS_NAME](); virtual ~[!output CLASS_NAME](); virtual bool IsHistoryDependent() const; virtual bool DoesOneChainOnly() const; virtual bool IsInteractive() const; virtual bool UseSlidingJoint() const; virtual bool UseSwivelAngle() const; virtual bool IsAnalytic() const ; virtual bool SolveEERotation() const; virtual Interface_ID ExpectGoal() const; virtual const IKSys::ZeroPlaneMap* GetZeroPlaneMap(const Point3& , const Point3&) const { return NULL; } virtual float GetPosThreshold() const; virtual float GetRotThreshold() const; virtual unsigned GetMaxIteration() const; virtual void SetPosThreshold(float); virtual void SetRotThreshold(float); virtual void SetMaxIteration(unsigned); virtual ReturnCondition Solve(IKSys::LinkChain&); virtual Class_ID ClassID() {return [!output CLASS_NAME]_CLASS_ID;} virtual SClass_ID SuperClassID() { return IK_SOLVER_CLASS_ID; } virtual void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} }; [!output TEMPLATESTRING_CLASSDESC] [!if PARAM_MAPS != 0] [!output TEMPLATESTRING_PARAMBLOCKDESC] [!endif] [!output CLASS_NAME]::[!output CLASS_NAME]() { } [!output CLASS_NAME]::~[!output CLASS_NAME]() { } bool [!output CLASS_NAME]::IsHistoryDependent() const { #pragma message(TODO("Let the IK system know whether you a History dependent or not. Return TRUE for History Dependent")) return false; } bool [!output CLASS_NAME]::DoesOneChainOnly() const { #pragma message(TODO("Specify whether you can work on more than one chain or not")) return true; } bool [!output CLASS_NAME]::IsInteractive() const { #pragma message(TODO("Return whether you support Interactive ?")) return false; } bool [!output CLASS_NAME]::UseSlidingJoint() const { #pragma message(TODO("Do you use a sliding joint")) return false; } bool [!output CLASS_NAME]::UseSwivelAngle() const { #pragma message(TODO("DO you use the Swivel angle")) return true; } bool [!output CLASS_NAME]::IsAnalytic() const { #pragma message(TODO("Is this an Analytic solver - Return TRUE for yes")) return true; } /****************************************************************************************************** * RotThreshold() is not relevant to solver that does not SolveEERotation(). UseSwivelAngle() and SolveEERotation() cannot both be true. * \******************************************************************************************************/ bool [!output CLASS_NAME]::SolveEERotation() const { #pragma message(TODO("To be implemented")) return false; } Interface_ID [!output CLASS_NAME]::ExpectGoal() const { #pragma message(TODO("To be implemented")) return kGoalID; } float [!output CLASS_NAME]::GetPosThreshold() const { #pragma message(TODO("Return the Position Threshold of the solver")) return 0.0f; } float [!output CLASS_NAME]::GetRotThreshold() const { #pragma message(TODO("Return the Rotation Threshold of the solver")) return 0.0f; } unsigned [!output CLASS_NAME]::GetMaxIteration() const { return 0; } void [!output CLASS_NAME]::SetPosThreshold(float) { #pragma message(TODO("Set the Position Threshold")) } void [!output CLASS_NAME]::SetRotThreshold(float) { #pragma message(TODO("Set the Rotation Threshold")) } void [!output CLASS_NAME]::SetMaxIteration(unsigned) { } /************************************************************************************************* * This the method that is actually called to perform the IK specific task. This only use this method if you answers true to DoesOneChainOnly() and false to HistoryDependent(). The solver is not designed to be invoked recursively. The recursion logic existing among the ik chains is taken care of by the Max IK (sub-)System. * \*************************************************************************************************/ IKSolver :: ReturnCondition [!output CLASS_NAME] :: Solve (IKSys::LinkChain& /*linkChain*/){ #pragma message(TODO("Implement the actual IK Solver")) return 0; }
370505f33f4929b3fee7b34564a81fa3b120ecad
5ac0a4230bda5b950bbe5004a6d5efe40fa41407
/types/dexobj.cpp
d111cedfd9c49d031203aef2c3b62da15380aac6
[]
no_license
ludamad/dexscript
9fbf0424b9bb251335442b364b99b2601eba211f
781ecea5ffadb660b3c4902c673621c198935b2e
refs/heads/master
2021-01-13T01:59:33.135499
2018-10-07T02:09:07
2018-10-07T02:09:07
9,822,548
0
1
null
null
null
null
UTF-8
C++
false
false
2,031
cpp
dexobj.cpp
/* DexScript scripting language, a value-based scripting language. * Mutation must be made explicit. The language makes heavy use of * copy-on-write techniques. * * Copyright (C) 2012 Adam Domurad * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>.*/ #include "dexobj.h" #include "dextype.h" #include "../interp/error.h" #include "util/strmake.h" #include "../stdobjs/str.h" #include "dexset.h" #include "dexstdops.h" #include "dexnum.h" using namespace std; //Use create_string etc to pass C arguments DexRef create_dex_object(DexType* dext, DexRef* args, size_t n){ DexRef ret = (*dext->constr)(dext,args,n); return ret; } void destroy_dex_object(DexObj* dobj){ /*int i = dobj->refc; dobj->refc = 100; static bool nested = false; if (!nested){ cout << "Refc: " << (i+1) << endl; nested = true; DexRef r = dobj; cout << "Destroying ... "; if (r->type == &strType) dex_str_print(r); else dex_print(r); cout << endl; nested = false; } dobj->refc = 0;*/ (*dobj->type->destr)(dobj); free(dobj); } void default_destroy(DexObj* d){ } DexRef none_construct(DexType* dext, DexRef* args, size_t argn){ error(OP_ERROR, str_make("Type '", dext->tname, "' is not callable.")); return NONE; } void remove_interned(DexObj* d){ //cout << "IREF: " << d->refc << endl; set_remove(dex_state.internObjs, d); }
dd6f9987d6ff647a96335e634358b43f218f2992
c2cbeaa1bfd68ec3fc55dae643151906d420e2da
/src/view/TractorBeamView.cpp
a83754e550a80476899dbfa199e6315bc6503144
[ "MIT" ]
permissive
acsor/Non-Gravitar
ea8885e495f7a49b6dfa7d3e0cb364686825a697
9d21cf7ab5ef49f6976fcaf25fa01cacbb209740
refs/heads/master
2022-03-05T16:29:37.769875
2019-10-30T13:29:00
2019-10-30T13:29:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,926
cpp
TractorBeamView.cpp
// MIT License // // Copyright (c) 2018 Oscar B. // // 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 "TractorBeamView.hpp" #include "utils/Utils.hpp" namespace gvt { const sf::Color TractorBeamView::BEAM_COLOR = sf::Color::Magenta; void TractorBeamView::draw (sf::RenderTarget &t, sf::RenderStates s) const { ClosedShapeView::draw(t, s); t.draw(mTriangle, mTranslation * mRotation); } TractorBeamView::TractorBeamView (shared_ptr<TractorBeam> const &beam): ClosedShapeView(beam) { mTriangle = sf::VertexArray(sf::LineStrip, 4); for (size_t i = 0; i < mTriangle.getVertexCount(); i++) mTriangle[i].color = BEAM_COLOR; mTriangle[0].position = {0, (float) beam->height()}; mTriangle[1].position = {(float) (beam->width() / 2.0), 0}; mTriangle[2].position = {(float) beam->width(), (float) beam->height()}; mTriangle[3].position = {0, (float) beam->height()}; } }
859cec50b322441650aac759d3017a07583cea77
47d5102b787c29fc65525dacdc2bc891e4b14b42
/Server_0.5.1/WorldModel/Object.cpp
4ee2cf9d24931f8eb8f2978aea36d72f0743c948
[]
no_license
joreh/Joreh
aee6a3508fcc4d7f47149295ff5323aafa4d1b5a
28c72d3b6541efc75e398f49807ccd8962095902
refs/heads/master
2020-12-03T03:14:52.465780
2012-05-15T11:23:27
2012-05-15T11:23:27
3,532,851
0
0
null
null
null
null
UTF-8
C++
false
false
4,276
cpp
Object.cpp
#include "Object.h" #include <iostream> #include <sstream> using namespace std; Object::Object( unsigned id, Vector3D pos, Vector3D vel, string teamName, Model* fm ) { m_pos = pos; m_vel = vel; m_id = id; m_model = fm; m_attrVal = fm->getAttrValMap(); setTeamName( teamName ); cout << m_attrVal.size() << endl; printAgentAttr(); } void Object::printAgentAttr() { for( map<string, double>::iterator itr = m_attrVal.begin(); itr != m_attrVal.end(); itr ++ ) cout << itr->first << "=" << itr->second << " "; cout << endl; } void Object::setPosition( Vector3D position ) { m_pos = position; } Vector3D Object::getPosition() const { return m_pos; } void Object::setVelocity( Vector3D vel ) { m_vel = vel; } Vector3D Object::getVelocity() const { return m_vel; } void Object::setID( unsigned id ) { m_id = id; } unsigned Object::getID() const { return m_id; } void Object::setTeamName( string teamName ) { m_teamName = teamName; } const string &Object::getTeamName() const { return m_teamName; } string Object::toString() const { ostringstream out; out << "(" << m_id << " " << m_pos.getX() << " " << m_pos.getY() << ")"; return out.str(); } Model *Object::getModel() const { return m_model; } double Object::getAttrVal( string attr ) { if( m_attrVal.find( attr ) == m_attrVal.end() ) cerr << "no " << attr << " attribute" << endl; return m_attrVal[attr]; } void Object::setAttrVal( string attr, double value ) { m_attrVal[attr] = value; } /* double Object::getMaxSpeed() const { return m_speed; } void Object::setMaxSpeed(double speed) { m_speed = speed; } double Object::getStateCoef() const { return m_stateCoef; } void Object::setStateCoef(double sc) { m_stateCoef = sc; } double Object::getAmo() const { return m_amo; } void Object::setAmo( double amo ) { m_amo = amo; } double Object::getFood() const { return m_food; } void Object::setFood( double food ) { m_food = food; } double Object::getFirePower() const { return m_firePower; } void Object::setFirePower( double firePower ) { m_firePower = firePower; } double Object::getFireAccr() const { return m_fireAccr; } void Object::setFireAccr( double fireAccr ) { m_fireAccr = fireAccr; } double Object::getFireNoise() const { return m_fireNoise; } void Object::setFireNoise( double fireNoise ) { m_fireNoise = fireNoise; } double Object::getWeaponRange() const { return m_weaponRange; } void Object::setWeaponRange( double weaponRange ) { m_weaponRange = weaponRange; } double Object::getColdArmRange() const { return m_coldArmRange; } void Object::setColdArmRange( double coldArmRange ) { m_coldArmRange = coldArmRange; } double Object::getSoundRange() const { return m_soundRange; } void Object::setSoundRange( double soundRange ) { m_soundRange = soundRange; } double Object::getDataRange() const { return m_dataRange; } void Object::setDataRange( double dataRange ) { m_dataRange = dataRange; } double Object::getEffectiveVision() const { return m_effectiveVision; } void Object::setEffectiveVision( double effectiveVision ) { m_effectiveVision = effectiveVision; } double Object::getMaxVision() const { return m_maxVision; } void Object::setMaxVision( double maxVision ) { m_maxVision = maxVision; } double Object::getBeingSeen() const { return m_beingSeen; } void Object::setBeingSeen( double beingSeen ) { m_beingSeen = beingSeen; } double Object::getMoveNoise() const { return m_moveNoise; } void Object::setMoveNoise( double moveNoise ) { m_moveNoise = moveNoise; } double Object::getSpirit() const { return m_spirit; } void Object::setSpirit( double spirit ) { m_spirit = spirit; } double Object::getTiredness() const { return m_tiredNess; } void Object::setTiredness( double tiredness ) { m_tiredNess = tiredness; } double Object::getWellness() const { return m_wellness; } void Object::setWellness( double wellness ) { m_wellness = wellness; } double Object::getStress() const { return m_stress; } void Object::setStress( double stress ) { m_stress = stress; } double Object::getVision() const { return m_vision; } void Object::setVision( double vision ) { m_vision = vision; }*/
e70dc790930bfa4ede024fbfffd342b1a185b653
8e2e4ce153e91f65cf9199823d17fae5fb1cb17b
/imagezero/include/imagezero/image.h
a6af6c1be409e41695cbb396f52220734b722743
[ "BSD-2-Clause" ]
permissive
swri-robotics/imagezero_transport
030aaa3ef611bc345dd757f1cd6f10c114880622
28a539860fe01f11c26b8fd5e800f71823880a4d
refs/heads/master
2022-03-06T00:56:03.529553
2022-02-09T02:58:32
2022-02-09T02:58:32
69,680,376
34
11
BSD-3-Clause
2022-02-09T02:51:07
2016-09-30T15:52:47
C++
UTF-8
C++
false
false
721
h
image.h
#ifndef IZ_IMAGE_H #define IZ_IMAGE_H 1 #include <cstddef> namespace IZ { template< typename Sample = unsigned char, ptrdiff_t samplesPerPixel = 3 > class Image { public: int width() const { return m_width; } int height() const { return m_height; } ptrdiff_t samplesPerLine() const { return m_spl; } Sample *data() const { return m_data; } void setWidth(int width) { m_width = width; } void setHeight(int height) { m_height = height; } void setSamplesPerLine(ptrdiff_t samplesPerLine) { m_spl = samplesPerLine; } void setData(Sample *data) { m_data = data; } protected: int m_width; int m_height; ptrdiff_t m_spl; Sample *m_data; }; } // namespace IZ #endif
e9ef1b51d0825eec69b6465d28d45e5693c373d2
52878995dcbbd398e766617552140329ee35f3ca
/DP10-Palindrome Partitioning II.cpp
fb530a1318d88e0386ae5c0f492fcbb79ebefbda
[]
no_license
niteshkumartiwari/daily-competitive-programming
a3d657507f3639dbe4a00fb4dd622061cdcbe9d2
ab47765b17c91f0d3494e748862cdf2291ce1a9c
refs/heads/master
2021-06-23T10:29:31.514748
2021-03-28T05:25:58
2021-03-28T05:25:58
204,979,930
1
0
null
null
null
null
UTF-8
C++
false
false
1,204
cpp
DP10-Palindrome Partitioning II.cpp
/* Given a string A, partition A such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of A. Input 1: A = "aba" Output 1: 0 Explanation 1: "aba" is already a palindrome, so no cuts are needed. Input 2: A = "aab" Output 2: 1 */ #include <bits/stdc++.h> #define ll long long using namespace std; int minCut(string A) { int n = A.size(); vector<vector<bool>> isPal(n, vector<bool>(n, false)); for (int i = 0; i < n; i++) isPal[i][i] = true; for (int len = 2; len <= n; len++) { for (int i = 0; i < n - len + 1; i++) { int j = i + len - 1; if (A[i] == A[j] && len == 2) isPal[i][j] = true; else if (A[i] == A[j]) isPal[i][j] = isPal[i + 1][j - 1]; } } vector<int> dp(n); for (int i = 0; i < n; i++) { if (isPal[0][i]) { dp[i] = 0; continue; } dp[i] = i; for (int j = 0; j < i; j++) { if (isPal[j + 1][i] && dp[i] > dp[j] + 1) dp[i] = dp[j] + 1; } } return dp[n - 1]; } int main() { return 0; }
716e06be297d5a8f85f4af9281a6477cad492a7d
53d2d2596e793844a69a9b812406237395096fe9
/moretemp/cppbin/src/neotags - Copy.cpp
2d23fde8c515a39cd879985d94f14e4a331da405
[ "BSD-3-Clause" ]
permissive
roflcopter4/random
5d569e3cac4b9d4a6ed464b7871cfcc17481a161
186e676f24a86196083d80a2eabd2e6814baaa71
refs/heads/master
2021-01-25T11:02:58.305458
2018-08-06T00:26:34
2018-08-06T00:26:34
123,381,299
0
0
null
null
null
null
UTF-8
C++
false
false
11,518
cpp
neotags - Copy.cpp
#include "neotags.h" #include <clocale> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; using uint = unsigned int; #ifdef DOSISH # define WIN_THREADS #endif #ifdef USE_PTHREADS # include <pthread.h> #endif struct pdata { int threadnum; const string *vim_buf; const string *lang; const string *order; const vector<string> *skip; const vector<string> *equiv; vector<struct lldata> *lst; uint start; uint num; }; static void *do_search(void *vdata); static bool ll_cmp(const struct lldata *A, const struct lldata *B); static void Search(vector<struct lldata> *tags, const string *vim_buf, const string *lang, const string *order, const vector<string> *skip, const vector<string> *equiv); static vector<string> get_colon_data(char *oarg); char *program_name; #ifdef DOSISH # define __CONST__ # define SEPCHAR ';' # include <malloc.h> # define VDECL(TYPE_, NAME_, NUM_) \ auto NAME_ = static_cast<TYPE_ *>(_malloca((NUM_) * sizeof(TYPE_))) # define FREEA(PTR_) _freea(static_cast<void *>(PTR_)) #else # define VDECL(TYPE_, NAME_, NUM_) TYPE_ NAME_[NUM_] # define FREEA(PTR_) # define __CONST__ const # define SEPCHAR ':' #endif #define REQUIRED_INPUT 8 //bool invalidChar (const int c) //{ // return !(c >= 0 && c < 128); //} //void stripUnicode(string & str) //{ // str.erase(remove_if(str.begin(),str.end(), invalidChar), str.end()); //} int main(int argc, char *argv[]) { setlocale(LC_NUMERIC, ""); int files_read = 0; program_name = handle_progname(*argv++); if (isatty(0)) errx(1, "This program can't be run manually."); if (--argc != REQUIRED_INPUT) errx(2, "Error: Wrong number of paramaters (%d, need %d).", argc, REQUIRED_INPUT); cerr << "Program ID: " PROG_ID << endl; auto files = get_colon_data(*argv++); auto ctlang = string(*argv++); auto vimlang = string(*argv++); auto order = string(*argv++); bool strip = xatoi(*argv++); //++argv; // arg not used in C++ but required for C implementation auto nchars = xatoi(*argv++); auto skip = get_colon_data(*argv++); auto equiv = get_colon_data(*argv++); //string vim_buf; vector<struct lldata> tags; for (uint i = 0; i < files.size() && files.at(i).at(0) && files.at(i + 1).at(0); i += 2) files_read += getlines(&tags, &files.at(i), &files.at(i + 1)); if (files_read == 0) errx(1, "Error: no files were successfully read."); else warnx("Read %d files\n", files_read); //stringstream buffer; //buffer << cin.rdbuf(); const char *otmp = new char[nchars + 1]; char *tmp = const_cast<char *>(otmp); int ch; //fread(tmp, 1llu, nchars, stdin); for (size_t i = 0; i < nchars; ++i) if ((ch = getchar()) > 0 && ch < 127) *tmp++ = ch; else if (ch == EOF) break; *tmp = '\0'; string vim_buf(otmp); delete[] otmp; if (strip) { cerr << "Stripping comments..." << endl; struct lldata tmp = {vim_buf, '\0'}; char *buf = strip_comments(&tmp, vimlang.c_str()); if (buf) { vim_buf = buf; delete[] buf; } } Search(&tags, &vim_buf, &ctlang, &order, &skip, &equiv); return 0; } static vector<string> get_colon_data(char *oarg) { unsigned num = 0; char *arg = oarg; if (*arg != '\0') { do if (*arg == SEPCHAR) { *arg++ = '\0'; ++num; } while (*arg++); } // The loop above will miss the last element, so we increment num. arg = oarg; vector<string> data(++num); for (unsigned i = 0; i < (num - 1); ++i) { while (*arg++) ; data[i] = oarg; oarg = arg; } return data; } static bool /* Comparison function for qsort */ ll_cmp(const struct lldata *A, const struct lldata *B) { bool ret; if (A->kind == B->kind) { //if (A->s.length() == B->s.length()) // ret = memcmp(A->s, B->s, A->s.length()); ret = A->s < B->s; /*else ret = A->s.length() < B->s.length();*/ } else ret = A->kind < B->kind; return ret; } /* ========================================================================== */ static bool in_order(const vector<string> *equiv, const string *order, char *group) { // `group' is actually a pointer to a char, not a C string. for (const auto& item : *equiv) { if (*group == item.at(0)) { *group = item.at(1); break; } } //return order->find_first_of(*group) != (-1lu); return strchr(order->c_str(), *group) != nullptr; } static inline string stolower(string s) { transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return tolower(c); }); return s; } static bool is_correct_lang(const string *lang, __CONST__ string *match_lang) { #ifdef DOSISH if ((*match_lang)[match_lang->size()] == '\r') match_lang->pop_back(); #endif if (stolower(*match_lang) == stolower(*lang)) return true; if ((stolower(*lang) == "c" || stolower(*lang) == "c\\+\\+") && (stolower(*match_lang) == "c++" || stolower(*match_lang) == "c")) return true; return false; } static bool skip_tag(const vector<string> *skip, const string *find) { for (const auto& tag : *skip) if (tag == *find) return true; return false; } /*============================================================================*/ static void Search(vector<struct lldata> *tags, const string *vim_buf, const string *lang, const string *order, const vector<string> *skip, const vector<string> *equiv) { if (tags->empty()) { cerr << "No tags found!" << endl; return; } //int num_threads = find_num_cpus(); //if (num_threads == 0) // num_threads = 4; //cerr << "Using " << num_threads << " cpus." << endl; //VDECL(pthread_t, tid, num_threads); const int num_threads = 1; //pthread_t tid[1]; //for (int i = 0; i < num_threads; ++i) { const int i = 0; auto tmp = new struct pdata; const uint quot = (tags->size() / num_threads); uint64_t num; //if (i == (num_threads - 1)) //num = tags->size() - ((num_threads - 1) * quot); //else num = quot; tmp->threadnum = i; tmp->vim_buf = vim_buf; tmp->lang = lang; tmp->order = order; tmp->skip = skip; tmp->equiv = equiv; tmp->lst = tags; tmp->start = i * quot; tmp->num = static_cast<uint>(num); errno = 0; //if (pthread_create(tid + i, nullptr, do_search, tmp) != 0 || errno) // err(1, "pthread_create failed"); //} auto out = vector<vector<struct lldata> *>(num_threads); //for (unsigned th = 0; th < num_threads ; ++th) { void *ret = do_search(tmp); //pthread_join(tid[th], &tmp); out[0] = static_cast<vector<struct lldata> *>(ret); //} size_t total = 0; for (auto &out_i : out) total += out_i->size(); size_t offset = 0; auto alldata = vector<struct lldata *>(total); for (auto &out_i : out) if (!out_i->empty()) for (auto& item : *out_i) alldata[offset++] = &item; sort(alldata.begin(), alldata.end(), ll_cmp); /* Always display the first item. */ if (alldata.empty()) errx(4, "WTF"); cout << alldata.at(0)->kind << "\n" << alldata.at(0)->s << endl; for (size_t i = 1; i < alldata.size(); ++i) { if (alldata.at(i)->s != alldata.at(i - 1)->s) cout << alldata.at(i)->kind << "\n" << alldata.at(i)->s << endl; } for (auto &Tout : out) delete Tout; //FREEA(tid); } static void * do_search(void *vdata) { #define CUR_STR ((*data->lst)[i].s) const auto data = static_cast<struct pdata *>(vdata); const auto end = data->start + data->num; auto ret = new vector<struct lldata>; for (uint i = data->start; i < end; ++i) { if (CUR_STR.at(0) == '!') continue; vector<string> lst; int64_t First, Last; // The format for substr is given by the starting index and the // length, not by start index and last index, so we have to do // some shenanigans here to make it work. for (First = Last = 0; Last >= 0; First = Last + 1) lst.push_back(CUR_STR.substr( First, (Last = CUR_STR.find('\t', First)) - First) ); string name = lst.at(0); string match_lang; char kind = '\0'; for (uint it = 2; it < lst.size(); ++it) { string tok = lst.at(it); if (tok.size() == 1) kind = tok.at(0); else if (tok.substr(0, 9) == "language:") match_lang = tok.substr(9); } if (!kind || match_lang.empty()) continue; // Prune tags. Include only those that are: // 1) of a type in the `order' list, // 2) of the correct language (applies mainly to C // and C++, generally ctags filters languages), // 3) are not included in the `skip' list, and // 4) are present in the current vim buffer // If invalid, just move on. if (in_order(data->equiv, data->order, &kind) && is_correct_lang(data->lang, &match_lang) && //!skip_tag(data->skip, &name) && strstr(data->vim_buf->c_str(), name.c_str()) != nullptr) //data->vim_buf->find(name) != string::npos) { struct lldata tmp = { string(name), kind }; ret->push_back(tmp); } } delete data; //pthread_exit(static_cast<void *>(ret)); return static_cast<void *>(ret); // NOTREACHED }
0d2e8146d231ad3cb6970ef8e1d5bce6bcfaa85a
df718f9114e9472f7eb094c962f000b910c0af53
/mts/cmm_value_list.cpp
328c717ab1afdd90130429abc1d4b4d41e7fd06b
[]
no_license
doinglu/cmm
65ac7d867b9e2d9e024077dd89d57fd87f8d987e
cdb5210db3c519676d4ffc8074e8661a8a5b51ba
refs/heads/master
2021-01-10T13:03:31.183195
2016-02-28T00:20:01
2016-02-28T00:20:01
46,947,558
3
4
null
null
null
null
UTF-8
C++
false
false
5,649
cpp
cmm_value_list.cpp
// cmm_value_list.cpp #include "cmm.h" #include "cmm_value_list.h" #include "cmm_value.h" namespace cmm { // Append a new value to list void ValueList::append_value(ReferenceImpl* value) { STD_ASSERT(("The value was already owned by a list.", !value->owner)); value->owner = this; #if USE_LIST_IN_VALUE_LIST m_container.append_node(value); #elif USE_VECTOR_IN_VALUE_LIST value->offset = get_count(); m_container.push_back(value); #else m_container.put(value); #endif if (m_high < value) m_high = value; if (m_low > value) m_low = value; } // Conact two memory list then clear one void ValueList::concat_list(ValueList* list) { size_t list_count = list->get_count(); if (!list_count) // Target list is empry return; // Concat to my list #if USE_LIST_IN_VALUE_LIST while (list->m_container.size() > 0) { auto* node = list->m_container.begin().get_node(); STD_ASSERT(("The value was not owned by the list.", node->owner == list)); // Take off list->m_container.remove_node(node); // Join me node->owner = this; if (m_low > node) m_low = node; if (m_high < node) m_high = node; m_container.append_node(node); } #elif USE_VECTOR_IN_VALUE_LIST auto* head_address = list->get_head_address(); size_t offset = this->get_count(); for (size_t i = 0; i < list_count; i++) { STD_ASSERT(("Bad owner of value in list when concating.", (head_address[i])->owner == list)); auto* p = head_address[i]; p->offset = offset++; if (m_low > p) m_low = p; if (m_high < p) m_high = p; } m_container.push_back_array(head_address, list_count); #else for (auto& it : list->m_container) { STD_ASSERT(("Bad owner of value in list when concating.", it->owner == list)); it->owner = this; if (m_low > it) m_low = it; if (m_high < it) m_high = it; m_container.put(it); } #endif // Clear target list list->reset(); } // Remove a value from list void ValueList::remove(ReferenceImpl* value) { STD_ASSERT(("Value is not in this list.", value->owner == this)); #if USE_LIST_IN_VALUE_LIST m_container.remove_node(value); #elif USE_VECTOR_IN_VALUE_LIST STD_ASSERT(("Value offset is invalid.", value->offset < get_count())); STD_ASSERT(("Value is not in the specified offset.", m_container[value->offset] == value)); // Replace with tail element & shrink auto value_offset = value->offset; auto tail_offset = get_count() - 1; m_container[value_offset] = m_container[tail_offset]; m_container[value_offset]->offset = value_offset; m_container[tail_offset] = 0; m_container.shrink(tail_offset); #else // Replace with tail element & shrink m_container.erase(value); #endif // Remove owner value->owner = 0; } // Free all linked values in list void ValueList::free() { #if USE_LIST_IN_VALUE_LIST while (m_container.size() > 0) { auto* node = m_container.begin().get_node(); node->unbind(); XDELETE(node); } #elif USE_VECTOR_IN_VALUE_LIST auto* p = get_head_address(); auto list_count = get_count(); for (size_t i = 0; i < list_count; i++) { // Set owner to 0 to prevent unbind when destructing p[i]->owner = 0; XDELETE(p[i]); } #else for (auto& it : m_container) { // Set owner to 0 to prevent unbind when destructing it->owner = 0; XDELETE(it); } #endif // Clear reset(); } // Constructor MarkValueState::MarkValueState(ValueList* _value_list) : value_list(_value_list), container(&_value_list->get_container()) { #if USE_LIST_IN_VALUE_LIST // Do nothing #elif USE_VECTOR_IN_VALUE_LIST impl_ptrs_address = value_list->get_head_address(); #endif low = (void*)value_list->m_low; high = (void*)((char*)value_list->m_high + sizeof(BufferImpl) + BufferImpl::RESERVE_FOR_CLASS_ARR); } #if 0 // Mark value void MarkValueState::mark_value(ReferenceImpl* ptr_value) { // Try remove from set #if USE_LIST_IN_VALUE_LIST if (true) #elif USE_VECTOR_IN_VALUE_LIST size_t offset = ptr_value->offset; if (offset < container->size() && impl_ptrs_address[offset] == ptr_value) #else if (container->contains(ptr_value)) #endif { // Got the valid pointer if (!ptr_value->owner) // Already marked return; // set owner to 0 means marked already ptr_value->owner = 0; ptr_value->mark(*this); return; } // Not valid pointer, is this a class pointer? auto* buffer_impl = (BufferImpl *)(((char*)ptr_value) - BufferImpl::RESERVE_FOR_CLASS_ARR - sizeof(BufferImpl)); #if USE_LIST_IN_VALUE_LIST // Shouldn't be here STD_FATAL("No here.\n"); #elif USE_VECTOR_IN_VALUE_LIST offset = buffer_impl->offset; if (offset < container->size() && impl_ptrs_address[offset] == buffer_impl) #else if (container->contains(buffer_impl)) #endif { // Got the valid pointer if (!buffer_impl->owner) // Already marked return; // set owner to 0 means marked already buffer_impl->owner = 0; buffer_impl->mark(*this); } } #endif } // End of namespace: cmm
fa3a9f6a800eefec8022b7db031a8a1dcea5b540
cc2db180f70cc01ab3a984f4d312174360640437
/MDecoder/mdecoder.cpp
a240d6a3a426eda31823441ba622c0c8cdc48f57
[]
no_license
gateslu/ShowDemo
54c8ff8f902f3b63bd299da0ea8fe0c252b14e3f
75ea7c508c35643ee8ebc02fe46a63377a344d1f
refs/heads/master
2020-06-04T17:54:45.407833
2012-11-17T08:59:41
2012-11-17T08:59:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,828
cpp
mdecoder.cpp
#include "mdecoder.h" #include "mdecoderclass.h" DECHANDLE InitDecoder(void) { MDecoderClass *m_dec= new MDecoderClass; return (DECHANDLE)m_dec; } int ReleaseDecoder (DECHANDLE _dec) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; delete _dec; return 0; } int OpenDecoder (DECHANDLE _dec, const char *filename, int &_Width, int &_Height) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; m_dec->openDecoder(filename,_Width, _Height); return 1; } int SetCallbackf(DECHANDLE _dec, fDataCallback dcb) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; return 1; } int SetDisplay(DECHANDLE _dec, MDisplay display, MoveToThreadCB moveToThread, RemoveFromThreadCB removeFromThread, void *pContext) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; m_dec->setDisplayFun(display, moveToThread, removeFromThread, pContext); return 1; } int v_setPlay(DECHANDLE _dec) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; m_dec->play(); return 1; } int v_setPause(DECHANDLE _dec) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; m_dec->pause(); return 1; } int v_setStop(DECHANDLE _dec) { if (!_dec) return 1; MDecoderClass *m_dec = (MDecoderClass *)_dec; m_dec->stop(); return 1; } void RgbToBGR_Mirror(unsigned char* bgrData, int dataSize, long width, long height, bool rgbToBgr, bool mirror) { rgbToBGR_Mirror(bgrData, dataSize, width, height, rgbToBgr, mirror); } void SaveToBMP(unsigned char *pRGBBuf, int linesize, int width, int height, const char *fileName) { SaveFrame(pRGBBuf, linesize, width, height, fileName); }
6a5325f06ef8b31fb45759aed3658d91f71c4da8
10be72895509bb7712bfd478632c4c9653edc10b
/pp/p1/p1.h
ef599d8c6157c72bc12b8d223ea4ddd95caeac73
[]
no_license
Darkxiete/chapter10
fd6b00d3391892df5dfbe94a9be9c217360df186
0b7f4dbd0f7b7ceb948b11ff2383e0b8bf2ee64a
refs/heads/master
2020-07-06T02:45:00.490983
2019-08-18T09:27:01
2019-08-18T09:27:01
202,863,864
0
0
null
null
null
null
UTF-8
C++
false
false
463
h
p1.h
// // Created by xk on 2019/8/18. // #ifndef CHAPTER10_P1_H #define CHAPTER10_P1_H #include <string> using std::string; class BankAccount { private: string name; string accountnum; double balance; public: // 默认参数在原型中,而不是函数定义中 BankAccount(const string &client, const string &num, double bal = 0.0); void show() const; void deposit(double m); void withdraw(double m); }; #endif //CHAPTER10_P1_H
55c278ba12ba502c2faabc1ce618d5269f1d4c77
a88564964a2d891bc527f43f99a40b8ae96cf11c
/src/Etterna/Globals/SpecialFiles.cpp
5598f13afcf9ec9e586edc5a341201b455500f83
[ "MIT", "GPL-1.0-or-later", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jameskr97/etterna
f09dca2777f307e1f9ed9444e26792890920f9e2
5acb2a3be336bc6f92b96ef8dd73743f92e84552
refs/heads/master
2023-02-20T10:45:06.686289
2023-01-09T07:46:49
2023-01-09T07:46:49
173,903,384
0
3
MIT
2019-05-04T02:30:57
2019-03-05T08:11:58
C++
UTF-8
C++
false
false
1,147
cpp
SpecialFiles.cpp
#include "global.h" #include "SpecialFiles.h" const std::string SpecialFiles::USER_PACKAGES_DIR = "UserPackages/"; const std::string SpecialFiles::PACKAGES_DIR = "Packages/"; const std::string SpecialFiles::KEYMAPS_PATH = "Save/Keymaps.ini"; const std::string SpecialFiles::EDIT_MODE_KEYMAPS_PATH = "Save/EditMode_Keymaps.ini"; const std::string SpecialFiles::PREFERENCES_INI_PATH = "Save/Preferences.ini"; const std::string SpecialFiles::THEMES_DIR = "Themes/"; const std::string SpecialFiles::LANGUAGES_SUBDIR = "Languages/"; // TODO: A theme should be able to specify a base language. const std::string SpecialFiles::BASE_LANGUAGE = "en"; const std::string SpecialFiles::METRICS_FILE = "metrics.ini"; const std::string SpecialFiles::CACHE_DIR = "Cache/"; const std::string SpecialFiles::BASE_THEME_NAME = "_fallback"; const std::string SpecialFiles::DEFAULTS_INI_PATH = "Data/Defaults.ini"; const std::string SpecialFiles::STATIC_INI_PATH = "Data/Static.ini"; const std::string SpecialFiles::TYPE_TXT_FILE = "Data/Type.txt"; const std::string SpecialFiles::SONGS_DIR = "Songs/"; const std::string SpecialFiles::NOTESKINS_DIR = "NoteSkins/";
918c59ee8757ada7b4c38a5c5344dfd9c059a149
6680f8d317de48876d4176d443bfd580ec7a5aef
/Header/misGroupTab.h
f49c960319c500c8acef4587438d7dbdda68ab30
[]
no_license
AlirezaMojtabavi/misInteractiveSegmentation
1b51b0babb0c6f9601330fafc5c15ca560d6af31
4630a8c614f6421042636a2adc47ed6b5d960a2b
refs/heads/master
2020-12-10T11:09:19.345393
2020-03-04T11:34:26
2020-03-04T11:34:26
233,574,482
3
0
null
null
null
null
UTF-8
C++
false
false
974
h
misGroupTab.h
#pragma once #include "misModelObserver.h" #include "misSubsequenceLayout.h" class MISLIBRARYEXPORT misGroupTab :public misOldObject { private: std::string m_tabNmae; misModelObserver::Pointer m_Observer; public: typedef misGroupTab Self; typedef misOldObject Superclass; typedef ::itk::SmartPointer< Self > Pointer; typedef ::itk::SmartPointer< const Self > ConstPointer; static Pointer New(void); void SetObserver(misModelObserver::Pointer observer); int get_m_ID() const; void set_m_ID(int left); std::string get_m_Name() const; std::string get_m_TabName() const; void set_m_TabName(std::string left); bool GetSubTab(std::string name, misSubsequenceLayout& subtab); void set_m_Name(std::string left); int GetSubTabCount() { return m_SubTabs.size(); } std::list<misSubsequenceLayout> m_SubTabs; typedef std::list<misSubsequenceLayout> ListType; private: int m_ID; std::string m_Name; };
5d5e88847677254f1020e3a1d63cf865f6b221ce
7ac373bb49d71159d2e014bb24b9870257be50ac
/Проект/program.h
51bbd046aa706cc1e940146892c9ee05e0d1baba
[]
no_license
RexUmbra/Reminder
28403fdc103098f2de69184d2e663703d55e4d4d
df1490e0c5cd1283d9e845a7996f261b14e10aec
refs/heads/master
2023-01-02T14:07:34.692605
2020-11-01T19:27:49
2020-11-01T19:27:49
309,132,624
0
0
null
null
null
null
UTF-8
C++
false
false
772
h
program.h
#pragma once #include <iostream> #include <stdlib.h> #include <malloc.h> #include <Windows.h> #include <time.h> #include <stddef.h> #include <stdio.h> #include <ctime> #include <vector> #include <thread> #include <fstream> #include "Struct.h" #include <atlconv.h> #define _CRT_SECURE_NO_WARNINGS using namespace std; class Program { private: vector<dateStruct> vecZadani; time_t realTimeSec; tm* realDateTm = new tm; dateStruct realDate; int amountReminder; public: Program(); void opredVrem(); void opredDate(); void addReminder(string textReminder, int year,int mon,int mday, int hour, int min); void sortVecZadani(); void fromStringToWchar_t(string text, wchar_t *text2); void provZad(); void main(); void save(); void download(); void threadF(); };
ef71ad78982c3af2904dc03451d59fc980fc6076
13a32b92b1ba8ffb07e810dcc8ccdf1b8b1671ab
/home--tommy--mypy/mypy/lib/python2.7/site-packages/pystan/stan/lib/stan_math/stan/math/prim/scal/fun/inc_beta.hpp
f113759371107ad13f5eef3eaf4454e15cd8f44c
[ "Unlicense", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
tommybutler/mlearnpy2
8ec52bcd03208c9771d8d02ede8eaa91a95bda30
9e5d377d0242ac5eb1e82a357e6701095a8ca1ff
refs/heads/master
2022-10-24T23:30:18.705329
2022-10-17T15:41:37
2022-10-17T15:41:37
118,529,175
0
2
Unlicense
2022-10-15T23:32:18
2018-01-22T23:27:10
Python
UTF-8
C++
false
false
372
hpp
inc_beta.hpp
#ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_HPP #define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_HPP #include <boost/math/special_functions/beta.hpp> namespace stan { namespace math { inline double inc_beta(double a, double b, double x) { using boost::math::ibeta; return ibeta(a, b, x); } } } #endif
8672c363571bbf8a6425c47b4a2798ad338c316d
17c9d963215bf630b22f1a36e05880c0938719c9
/BOJ 1100.cpp
b06b4d193183647fb2102a529f45f572cd5d0bdf
[]
no_license
Jae-Yeon/ProblemSolving
5f099ad7546c491f9fc24f828f735727c8aee4ce
840e7017798cd5d8d9d1a0e96796d526021bbb1f
refs/heads/master
2023-04-14T00:14:57.288770
2023-04-09T14:43:56
2023-04-09T14:43:56
128,633,772
1
0
null
null
null
null
UTF-8
C++
false
false
535
cpp
BOJ 1100.cpp
//백준 온라인 저지 1100번 하얀 #include <iostream> #include <string> using namespace std; int main() { string k; int cnt = 0; for (int i = 0; i < 8; i++)//줄 번호 { cin >> k; for (int j = 0; j < 8; j++)//인덱스 번호 if (k[j] == 'F' && (j + 1) % 2 == 1 && (i + 1) % 2 == 1) // 홀수번째 문자열의 홀수번째 인덱스는 흰색 cnt++; else if (k[j] == 'F' && (j + 1) % 2 == 0 && (i + 1) % 2 == 0) //짝수번째 문자열의 짝수번째 인덱스는 흰색 cnt++; } cout << cnt; }
428a842b6cbd381e7e260df8a42d58095681e46a
b3870ebc978490962188051fe8f04c8f29414915
/Hash/Group_Anagrams.cpp
96a9c0ab066648a127f1c1579d30bf768e3b5285
[]
no_license
Tonyxin/Leetcode
985eab75d5cdb95f6fdfea6c6993f80e06c9cfc4
abfcd19c64f997467f91b15d07f1fe390cdc66c7
refs/heads/master
2020-07-24T14:24:43.456450
2017-03-30T07:58:32
2017-03-30T07:58:32
73,786,341
0
0
null
2016-11-15T07:26:24
2016-11-15T07:08:53
null
GB18030
C++
false
false
779
cpp
Group_Anagrams.cpp
/* 问题描述: 给一些string,将string中所用字母相同的组成一组 For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], ["nat","tan"], ["bat"] ] 解决方法: 排序是王道! 对每个string按字母排序,建立string→vector<string>哈希映射 */ class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { vector<vector<string>> result; int n = strs.size(); if (!n) return result; map<string, vector<string>> map_s2vs; for (auto str : strs) { string src_str = str; sort(str.begin(), str.end()); map_s2vs[str].push_back(src_str); } for (auto itr = map_s2vs.begin(); itr != map_s2vs.end(); itr++) result.push_back((*itr).second); return result; } };
41bbf74bcc30dd2072ab420afb499ec5a171e0f4
0f15ce90bb2a457607335ed3f5ec7bf4608c5ad8
/Game/graphics/skinModel/SkinModelRender.cpp
7306dc87adc3a7aaf629b3546bfc524efb62671f
[]
no_license
Takahashi0213/rengame
85e4ae04cd752bde8d7ae93b07cb768b0655de13
fd0e51d18e02a031123b5289e9dfaa808bf25618
refs/heads/master
2021-07-05T01:48:29.611026
2020-12-08T01:07:00
2020-12-08T01:07:00
209,469,267
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
5,638
cpp
SkinModelRender.cpp
#include "stdafx.h" #include "SkinModelRender.h" SkinModelRender::SkinModelRender() { //スキンモデルサポーターにアドレスを渡しておく m_skinModelSupporter.SkinModelRenderSetting(this); } SkinModelRender::~SkinModelRender() { } /// <summary> /// 初期化する /// </summary> /// <param name="filePath">モデルのファイルパス</param> void SkinModelRender::Model_Init(const wchar_t* filePath) { std::vector<VertexBuffer> m_vertexBufferArray; //頂点バッファの配列。 std::vector<IndexBuffer> m_indexBufferArray; //インデックスバッファの配列。 m_skinModel.Init(filePath); //ポリゴンリストの作成 m_skinModel.FindMesh([&](const auto& mesh) { ID3D11DeviceContext* deviceContext = g_graphicsEngine->GetD3DDeviceContext(); //頂点バッファを作成。 { D3D11_MAPPED_SUBRESOURCE subresource; //VRAM上の頂点バッファにアクセスできるようにする。 HRESULT hr = deviceContext->Map(mesh->vertexBuffer.Get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &subresource); if (FAILED(hr)) { return; } D3D11_BUFFER_DESC bufferDesc; mesh->vertexBuffer->GetDesc(&bufferDesc); int vertexCount = bufferDesc.ByteWidth / mesh->vertexStride; char* pData = (char*)subresource.pData; VertexBuffer vertexBuffer; CVector3 pos; for (int i = 0; i < vertexCount; i++) { pos = *((CVector3*)pData); vertexBuffer.push_back(pos); //次の頂点へ。 pData += mesh->vertexStride; } //頂点バッファをアンロック deviceContext->Unmap(mesh->vertexBuffer.Get(), 0); m_vertexBufferArray.push_back(vertexBuffer); } //インデックスバッファを作成。 { D3D11_MAPPED_SUBRESOURCE subresource; //インデックスバッファをロック。 HRESULT hr = deviceContext->Map(mesh->indexBuffer.Get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &subresource); if (FAILED(hr)) { return; } D3D11_BUFFER_DESC bufferDesc; mesh->indexBuffer->GetDesc(&bufferDesc); //@todo cmoファイルはインデックスバッファのサイズは2byte固定。 IndexBuffer indexBuffer; int stride = 2; int indexCount = bufferDesc.ByteWidth / stride; unsigned short* pIndex = (unsigned short*)subresource.pData; for (int i = 0; i < indexCount; i++) { indexBuffer.push_back(pIndex[i]); } //インデックスバッファをアンロック。 deviceContext->Unmap(mesh->indexBuffer.Get(), 0); m_indexBufferArray.push_back(indexBuffer); } }); //Vectorへセット //float X = m_vertexBufferArray[0][m_indexBufferArray[0][0]].x; for (int i = 0; i < m_indexBufferArray.size(); i++) { for (int ii = 0; ii < m_indexBufferArray[i].size(); ii += 3) { Polygon poly; for (int iii = 0; iii < 3; iii++) { poly.vertPos[iii].x = m_vertexBufferArray[i][m_indexBufferArray[i][ii + iii]].x; poly.vertPos[iii].y = m_vertexBufferArray[i][m_indexBufferArray[i][ii + iii]].y; poly.vertPos[iii].z = m_vertexBufferArray[i][m_indexBufferArray[i][ii + iii]].z; } //ベクトルを計算 CVector3 v1 = poly.vertPos[1] - poly.vertPos[0]; CVector3 v2 = poly.vertPos[2] - poly.vertPos[0]; CVector3 N; N.Cross(v2, v1); N.Normalize(); //法線 poly.normal = N; m_polygonList.push_back(poly); } } Update(); //ここに書く意味あるのかな…とりあえず書く } /// <summary> /// 初期化する /// </summary> /// <param name="filePath">モデルのファイルパス</param> /// <param name="pos">初期座標</param> /// <param name="rot">初期回転</param> /// <param name="scl">初期拡大率</param> void SkinModelRender::Model_Init(const wchar_t* filePath, const CVector3& pos, const CQuaternion& rot, const CVector3& scl, EnFbxUpAxis enFbxUpAxis) { m_skinModel.Init(filePath, enFbxUpAxis); m_position = pos; m_rotation = rot; m_scale = scl; Update(); } /// <summary> /// 初期化する /// </summary> /// <param name="filePath">モデルのファイルパス</param> /// <param name="animationClips">アニメーションクリップの配列の先頭アドレス</param> /// <param name="numAnimationClips">アニメーションクリップの数</param> void SkinModelRender::Model_Init_Anim(const wchar_t* filePath, AnimationClip* animationClips, int numAnimationClips, EnFbxUpAxis enFbxUpAxis) { m_skinModel.Init(filePath, enFbxUpAxis); InitAnimation(animationClips, numAnimationClips); } //アニメーションの初期化 void SkinModelRender::InitAnimation(AnimationClip* animationClips, int numAnimationClips) { m_animationClips = animationClips; m_numAnimationClips = numAnimationClips; if (m_animationClips != nullptr) { m_animation.Init(m_skinModel, m_animationClips, m_numAnimationClips); } } /// <summary> /// アップデート /// </summary> void SkinModelRender::Update() { if (m_isUpdateSkinModelSupporter == true) { m_skinModelSupporter.SkinModelSupporterUpdate(); } if (m_animationClips != nullptr && m_isUpdateAnimation == true) { m_animation.Update(1.0f / m_animationSpeed); } m_skinModel.UpdateWorldMatrix(m_position, m_rotation, m_scale); //キャスターフラグがオンなら登録 if (m_shadowCasterFlag == true) { ShadowMap::GetInstance()->RegistShadowCaster(&m_skinModel); ShadowMap::GetInstance()->Update(LightMaker::GetInstance()->GetLightCameraPosition(), LightMaker::GetInstance()->GetLightCameraTarget()); } } /// <summary> /// 描画 /// </summary> void SkinModelRender::Render() { if (m_isDraw == false) { return; } m_skinModel.Draw( g_camera3D.GetViewMatrix(), g_camera3D.GetProjectionMatrix() ); }
4489d577ab934f77ae746dc40e14ee594afb1654
e55b77146fb0e753ec0b16e65bc778bddbdcbfa5
/src/common/JsonH5.cpp
fcccdf1dc5a8d8ec935f70ee424f2ce5ebc53e82
[ "BSD-2-Clause" ]
permissive
ess-dmsc/events-nmx-classify
fe5ad09732b300d716d8d529542a20da7f819e59
d706105e2462fa881aa4642ef2fb0916d51d727e
refs/heads/master
2021-01-18T13:11:55.778891
2020-06-10T12:16:51
2020-06-10T12:16:51
80,731,730
1
0
null
2017-10-15T14:45:07
2017-02-02T14:17:43
C++
UTF-8
C++
false
false
764
cpp
JsonH5.cpp
#include "JsonH5.h" namespace H5CC { void to_json(json& j, const Enum<int16_t>& e) { j["___choice"] = e.val(); std::multimap<std::string, int16_t> map; for (auto a : e.options()) map.insert({a.second, a.first}); j["___options"] = json(map); } void from_json(const json& j, Enum<int16_t>& e) { auto o = j["___options"]; for (json::iterator it = o.begin(); it != o.end(); ++it) e.set_option(it.value(), it.key()); e.set(j["___choice"]); } void to_json(json& j, const H5CC::DataSet& d) { auto s = d.shape(); j["___shape"] = s.shape(); if (s.is_extendable()) j["___extends"] = s.max_shape(); if (d.is_chunked()) j["___chunk"] = d.chunk_shape().shape(); for (auto a : d.attributes()) j[a] = attribute_to_json(d, a); } }
86796fb6d73c480789674aa575d825be14a69b70
6e8356b60b4d8ee19187a508363fc17d775de883
/bsdrawscales.cpp
8d356e338a9acd7a3db3a8cab90ca9d325290b94
[ "Apache-2.0" ]
permissive
elijivp/bsdraw
b4d171c01a9da5b627030faa9a0b0cc5ae4600aa
ef92ee59c881e3624a4ef3fa671d4c398999b2f8
refs/heads/master
2022-10-20T21:41:31.162481
2022-10-09T11:11:34
2022-10-09T11:11:34
164,239,962
6
0
null
null
null
null
UTF-8
C++
false
false
196,515
cpp
bsdrawscales.cpp
/// This file contains special class who describes Bars around bsdraws /// Each Bar, or margin, allow you to locate scales, labels, lines, etc.. near bsdraw /// Each Bar is a mini layout. He eats in one turn two special interfaces: /// - MarginElement for place and draw /// - MEQWrapper for control /// Background and foreground ColorPolicy can be bsdraw-depended. Or You can make is standard by QPalette /// Created By: Elijah Vlasov #include "bsdrawscales.h" #include "core/bsqdraw.h" #include "palettes/bsipalette.h" #include <QPainter> #include <QResizeEvent> #include <QStaticText> #include <QVBoxLayout> #include <QScrollBar> #include <QFrame> #include <QDoubleSpinBox> #include <cfloat> enum { /// 1. marks mode DBMODE_STRETCHED_POW2=1, DBMODE_STRETCHED=2, DBMODE_STATIC=3 }; enum { SPACING_AFTERWIDTH=6, SPACING_AFTERHEIGHT=4 }; MarginElement::~MarginElement() { } typedef void (*posfunc_fn)(struct texts_t* t); struct texts_t { QStaticText uin_text; QSize uin_locsize; int visible; int pos_decay; QPoint pos_mark; QPoint pos_mark_dopdock; posfunc_fn pos_update_fn; QPoint c_pos_result; texts_t(): visible(0), pos_update_fn(nullptr) {} }; struct memark_t { QPoint anchor; QRect rect; }; //inline void assignText(texts_t* tt, const QString& text) //{ // tt->uin_text.setText(text); // QSize loc = tt->uin_text.size().toSize(); // if (tt->uin_locsize.isValid()) // if (tt->uarea_atto != AT_RIGHT) // tt->uarea_pos.rx() += tt->uin_locsize.width() - loc.width(); // tt->uin_locsize = loc; //} inline void assignText(texts_t* tt, const QString& text) { tt->uin_text.setText(text); tt->uin_locsize = tt->uin_text.size().toSize(); if (tt->pos_update_fn) tt->pos_update_fn(tt); } inline void assignText(texts_t* tt, const QString& text, const QFont& m_font) { assignText(tt, text); tt->uin_text.prepare(QTransform(), m_font); } inline void assignText(texts_t* tt, const QString& text, bool m_fontReplaced, const QFont& m_font) { assignText(tt, text); if (m_fontReplaced) tt->uin_text.prepare(QTransform(), m_font); } static const bool BAR_VERT[] = { true, true, false, false }; //static const bool BAR_NEEDMOVE[] = { true, false, true, false }; template <int n> void posfunc_nn_mid(texts_t* t); template <> void posfunc_nn_mid<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->pos_decay + t->uin_locsize.width(), t->uin_locsize.height()/2 + 1); } template <> void posfunc_nn_mid<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(-t->pos_decay, t->uin_locsize.height()/2 + 1); } template <> void posfunc_nn_mid<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width()/2, t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nn_mid<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width()/2, -t->pos_decay); } template <int n> void posfunc_nn_up(texts_t* t); template <> void posfunc_nn_up<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->pos_decay + t->uin_locsize.width(), t->uin_locsize.height() + 1); } template <> void posfunc_nn_up<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(-t->pos_decay, t->uin_locsize.height() + 1); } template <> void posfunc_nn_up<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(/*t->uin_locsize.width()/2*0*/1, t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nn_up<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(/*t->uin_locsize.width()/2*0*/1, -t->pos_decay); } template <int n> void posfunc_nn_down(texts_t* t); template <> void posfunc_nn_down<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->pos_decay + t->uin_locsize.width(), /*0*t->uin_locsize.height()/2 + */1); } template <> void posfunc_nn_down<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(-t->pos_decay, /*t->uin_locsize.height()/2 + */1); } template <> void posfunc_nn_down<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width(), t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nn_down<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width(), -t->pos_decay); } static posfunc_fn POSFUNC_NN_MID[4] = { posfunc_nn_mid<AT_LEFT>, posfunc_nn_mid<AT_RIGHT>, posfunc_nn_mid<AT_TOP>, posfunc_nn_mid<AT_BOTTOM> }; static posfunc_fn POSFUNC_NN_UP[4] = { posfunc_nn_up<AT_LEFT>, posfunc_nn_up<AT_RIGHT>, posfunc_nn_up<AT_TOP>, posfunc_nn_up<AT_BOTTOM> }; static posfunc_fn POSFUNC_NN_DOWN[4] = { posfunc_nn_down<AT_LEFT>, posfunc_nn_down<AT_RIGHT>, posfunc_nn_down<AT_TOP>, posfunc_nn_down<AT_BOTTOM> }; //texts[i].pos_mark = QPoint(mcur.x() + (mnext.x() - mcur.x()), mcur.y() + (mnext.y() - mcur.y())); //if (atto == AT_LEFT) // texts[i].uarea_pos = mcur - QPoint(decayH + texts[i].uin_locsize.width(), locdock == 0? texts[i].uin_locsize.height() + 0 : // locdock == 1? (mcur.y() - mnext.y())/2 + texts[i].uin_locsize.height()/2 : // mcur.y() - mnext.y() // ); //else if (atto == AT_RIGHT) // texts[i].uarea_pos = mcur - QPoint(-decayH, locdock == 0? texts[i].uin_locsize.height() + 0 : // locdock == 1? (mcur.y() - mnext.y())/2 + texts[i].uin_locsize.height()/2 : // mcur.y() - mnext.y() // ); //else if (atto == AT_TOP) // texts[i].uarea_pos = mcur - QPoint( locdock == 0? 0 : // locdock == 1? (mcur.x() - mnext.x())/2 + texts[i].uin_locsize.width()/2 : // mcur.x() - mnext.x() + texts[i].uin_locsize.width(), // decayV + texts[i].uin_locsize.height()); //else if (atto == AT_BOTTOM) // texts[i].uarea_pos = mcur - QPoint( locdock == 0? 0 : // locdock == 1? (mcur.x() - mnext.x())/2 + texts[i].uin_locsize.width()/2 : // mcur.x() - mnext.x() + texts[i].uin_locsize.width(), // -decayV); //texts[i].uarea_atto = atto; template <int n> void posfunc_nm_mid(texts_t* t); template <> void posfunc_nm_mid<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->pos_decay + t->uin_locsize.width(), t->uin_locsize.height()/2 + 1); } template <> void posfunc_nm_mid<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(-t->pos_decay, t->uin_locsize.height()/2 + 1); } template <> void posfunc_nm_mid<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width()/2, t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nm_mid<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark - QPoint(t->uin_locsize.width()/2, -t->pos_decay); } template <int n> void posfunc_nm_up(texts_t* t); template <> void posfunc_nm_up<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(t->pos_decay + t->uin_locsize.width(), t->uin_locsize.height()); } template <> void posfunc_nm_up<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(-t->pos_decay, t->uin_locsize.height()); } template <> void posfunc_nm_up<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(0, t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nm_up<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(0, -t->pos_decay); } template <int n> void posfunc_nm_down(texts_t* t); template <> void posfunc_nm_down<AT_LEFT>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(t->pos_decay + t->uin_locsize.width(), 0); } template <> void posfunc_nm_down<AT_RIGHT>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(-t->pos_decay, 0); } template <> void posfunc_nm_down<AT_TOP>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(t->uin_locsize.width(), t->pos_decay + t->uin_locsize.height()); } template <> void posfunc_nm_down<AT_BOTTOM>(texts_t* t) { t->c_pos_result = t->pos_mark_dopdock - QPoint(t->uin_locsize.width(), -t->pos_decay); } static posfunc_fn POSFUNC_NM_MID[4] = { posfunc_nm_mid<AT_LEFT>, posfunc_nm_mid<AT_RIGHT>, posfunc_nm_mid<AT_TOP>, posfunc_nm_mid<AT_BOTTOM> }; static posfunc_fn POSFUNC_NM_UP[4] = { posfunc_nm_up<AT_LEFT>, posfunc_nm_up<AT_RIGHT>, posfunc_nm_up<AT_TOP>, posfunc_nm_up<AT_BOTTOM> }; static posfunc_fn POSFUNC_NM_DOWN[4] = { posfunc_nm_down<AT_LEFT>, posfunc_nm_down<AT_RIGHT>, posfunc_nm_down<AT_TOP>, posfunc_nm_down<AT_BOTTOM> }; typedef bool (*cross_fn)(texts_t* t, int d); template <int n> bool crossing_up(texts_t* t, int d); template <> bool crossing_up<AT_LEFT>(texts_t* t, int d) { return t->c_pos_result.y() + t->uin_locsize.height()/2 > d; } template <> bool crossing_up<AT_RIGHT>(texts_t* t, int d) { return t->c_pos_result.y() + t->uin_locsize.height()/2 > d; } template <> bool crossing_up<AT_TOP>(texts_t* t, int d) { return t->c_pos_result.x() + t->uin_locsize.width()/2 > d; } template <> bool crossing_up<AT_BOTTOM>(texts_t* t, int d) { return t->c_pos_result.x() + t->uin_locsize.width()/2 > d; } template <int n> bool crossing_down(texts_t* t, int d); template <> bool crossing_down<AT_LEFT>(texts_t* t, int d) { return t->c_pos_result.y() - t->uin_locsize.height()/2 < d; } template <> bool crossing_down<AT_RIGHT>(texts_t* t, int d) { return t->c_pos_result.y() - t->uin_locsize.height()/2 < d; } template <> bool crossing_down<AT_TOP>(texts_t* t, int d) { return t->c_pos_result.x() - t->uin_locsize.width()/2 < d; } template <> bool crossing_down<AT_BOTTOM>(texts_t* t, int d) { return t->c_pos_result.x() - t->uin_locsize.width()/2 < d; } static cross_fn CROSS_UP[4] = { crossing_up<AT_LEFT>, crossing_up<AT_RIGHT>, crossing_up<AT_TOP>, crossing_up<AT_BOTTOM> }; static cross_fn CROSS_DOWN[4] = { crossing_down<AT_LEFT>, crossing_down<AT_RIGHT>, crossing_down<AT_TOP>, crossing_down<AT_BOTTOM> }; class DSNumFormatter { enum RFM { RFM_FLOATING, RFM_INTEGER, RFM_INTEGER_ROUNDED }; RFM rfm; int precision_ge1, precision_l1; char letter_ge1, letter_l1; bool nonamed; int precision_offset; bool useThreshold; double threshold_ge; int precision_gethr; char letter_gethr; public: DSNumFormatter(char symb_ge1, int precis_ge1, char symb_l1, int precis_l1, bool meganamed=false): rfm(RFM_FLOATING), nonamed(!meganamed), precision_offset(0), useThreshold(false) { setFloating(symb_ge1, precis_ge1, symb_l1, precis_l1); } DSNumFormatter(): rfm(RFM_FLOATING), nonamed(true), precision_offset(0), useThreshold(false) { setFloating('f', 1, 'g', 3, 100000.0, 'g', 2); } void setFloating(char symb_ge1, int precis_ge1, char symb_l1, int precis_l1) { rfm = RFM_FLOATING; letter_ge1 = symb_ge1; precision_ge1 = precis_ge1 + precision_offset; if (precision_ge1 < 0) precision_ge1 = 0; letter_l1 = symb_l1; precision_l1 = precis_l1 + precision_offset; if (precision_l1 < 0) precision_l1 = 0; } void setFloating(char symb_ge1, int precis_ge1, char symb_l1, int precis_l1, double thresh_ge, char symb_gethr, int precis_gethr) { setFloating(symb_ge1, precis_ge1, symb_l1, precis_l1); useThreshold = true; threshold_ge = thresh_ge; letter_gethr = symb_gethr; precision_gethr = precis_gethr + precision_offset; if (precision_gethr < 0) precision_gethr = 0; } void setFloatingStrict(int pp){ rfm = RFM_FLOATING; precision_ge1 = pp; precision_l1 = pp; precision_gethr = pp; precision_offset = 0; } void setPrecisionOffset(int po){ precision_offset = po; } void setInteger(){ rfm = RFM_INTEGER; } void setIntegerRounded(){ rfm = RFM_INTEGER_ROUNDED; } int maxPrecision() const { if (rfm != RFM_FLOATING) return 0; int result = precision_offset + (precision_l1 > precision_ge1? precision_l1 : precision_ge1); return result < 0? 0 : result; } void setFloatingAuto(float ll, float hl) { float diap = qAbs(hl - ll); if (diap >= 1000.0f) setFloating('f', 1, 'g', 2); else if (diap > 10.0f || ll >= 1.0f || ll <= -1.0f) setFloating('f', 1, 'g', 2); else if (diap > 1.0f) setFloating('f', 1, 'g', 2); // add count analysis else if (diap > 0.1f) setFloating('f', 2, 'f', 2); else setFloating('f', 3, 'f', 3); } template <typename T> QString operator()(T value_original) const { if (rfm >= RFM_INTEGER) { long int value = rfm == RFM_INTEGER_ROUNDED? (long int)qRound64(value_original) : (long int)(value_original); if (nonamed) return QString::number(value); long int valuep = value < 0? -value : value; static const char letters[] = { ' ', ' ', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y', ' ' }; long int mlt = 1; for (unsigned int i=0; i<sizeof(letters)/sizeof(const char); i++) { if (valuep > mlt) { mlt *= 1000; continue; } return QString::number(value/mlt + letters[i]); } return QString::number(value); } else { double value = double(value_original); double valuep = value < 0? -value : value; char fmt_letter = valuep >= 1.0? useThreshold && valuep >= threshold_ge? letter_gethr : letter_ge1 : letter_l1; int fmt_precision = valuep >= 1.0? useThreshold && valuep >= threshold_ge? precision_gethr : precision_ge1 : precision_l1; if (nonamed) return QString::number(value, fmt_letter, fmt_precision); int oletter = 0; static const char letters[] = { ' ', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y', ' ' }; static double numbers[] = { 1e+3, 1e+6, 1e+9, 1e+12, 1e+15, 1e+18, 1e+21, 1e+24, 1e+26 }; const int nummax = sizeof(numbers)/sizeof(double); while (valuep >= numbers[oletter]) oletter++; if (oletter >= nummax) return QString::number(value, 'g', fmt_precision); return QString::number(value/(oletter == 0? 1.0 : numbers[oletter-1]), fmt_letter, fmt_precision) + letters[oletter]; } } }; static void rearrange(bool vertical, bool mirrored, texts_t* texts, int countMaxiTotal, bool backward=true) { int iprev=0; if (vertical) { if (mirrored) { for (int i=1; i<countMaxiTotal; i++) if (texts[i].visible) { if (texts[iprev].c_pos_result.y() + texts[iprev].uin_locsize.height() + 1 > texts[i].c_pos_result.y()) texts[i].visible = 2; else iprev = i; } } else { for (int i=1; i<countMaxiTotal; i++) if (texts[i].visible) { // if (texts[iprev].uarea_pos.y() + texts[iprev].uin_locsize.height() + 2 < texts[i].uarea_pos.y()) !! bad boi if (texts[iprev].c_pos_result.y() < texts[i].c_pos_result.y() + texts[i].uin_locsize.height() + 1) texts[i].visible = 2; else iprev = i; } } } else { if (mirrored) { for (int i=1; i<countMaxiTotal; i++) if (texts[i].visible) { if (texts[iprev].c_pos_result.x() < texts[i].c_pos_result.x() + texts[i].uin_locsize.width() + 4) texts[i].visible = 2; else iprev = i; } } else { for (int i=1; i<countMaxiTotal; i++) if (texts[i].visible) { if (texts[iprev].c_pos_result.x() + texts[iprev].uin_locsize.width() + 4 > texts[i].c_pos_result.x()) texts[i].visible = 2; else iprev = i; } } } if (backward) { if (iprev > 0 && texts[countMaxiTotal-1].visible == 2) { texts[countMaxiTotal-1].visible = 1; texts[iprev].visible = 0; for (int i=iprev-1; i>0 && texts[i].visible != 1; i--) if (texts[i].visible == 2) { int d2 = i; for (int j=i-1; j>0; j--) { if (texts[j].visible == 1) { texts[j].visible = 2; break; } if (texts[j].visible == 2) d2 = j; } texts[d2].visible = 1; break; } } } for (int i=1; i<countMaxiTotal; i++) if (texts[i].visible == 2) texts[i].visible = 0; } static void rectAlign(const QRect& area, Qt::Alignment alignment, QPoint* result, QPointF* sign); enum RELATED_FLAG { RF_NONE=0, RF_SETBOUNDS=1, RF_SETENUMERATE=2, RF_SETTAPS=3, RF_SETTAPWDG=4, RF_UPDATETAP_PARAM }; union relatedopts_t { struct { float LL, HL; float MOD; } rel_fixed; struct { mtap_qstring_fn tapfn; const void* param; int slen; } rel_tap_qstring; struct { // int step; int numcount; int recycle; int enfrom; } rel_enumerate; relatedopts_t(){} relatedopts_t(const bounds_t bnd, float mod=0.0f){ rel_fixed.LL = bnd.LL; rel_fixed.HL = bnd.HL; rel_fixed.MOD = mod; } relatedopts_t(mtap_qstring_fn tapfn, const void* param, int maxlen){ rel_tap_qstring.tapfn = tapfn; rel_tap_qstring.param = param; rel_tap_qstring.slen = maxlen; /*rel_tap_qstring.sstr.reserve(maxlen); */ } relatedopts_t(int numcount, int enfrom, int recycle){ rel_enumerate.numcount = numcount; rel_enumerate.enfrom = enfrom; rel_enumerate.recycle = recycle; } }; class MarginCallback { int c_rtexttype; relatedopts_t c_rdata; float c_reloffset; bool c_updatesetDimm; protected: struct tapcontent_t { int lmoffset, lmardimm; } tapctt; public: virtual ~MarginCallback(); int cachedRTexttype() const { return c_rtexttype; } const relatedopts_t& cachedRdata() const { return c_rdata; } public: bool bdContentUpdate(bool forcedupdate=true) { return bdContentUpdate(c_rtexttype, c_rdata, forcedupdate); } bool bdContentUpdate(int rtexttype, const relatedopts_t& rdata, bool forcedupdate=false) { bool docall = (rtexttype != c_rtexttype) | forcedupdate; c_rtexttype = rtexttype; if (rtexttype == RF_SETBOUNDS) { docall |= (rdata.rel_fixed.LL != c_rdata.rel_fixed.LL) || (rdata.rel_fixed.HL != c_rdata.rel_fixed.HL); if (docall) { c_rdata = rdata; float ll = rdata.rel_fixed.LL + (rdata.rel_fixed.HL - rdata.rel_fixed.LL)*c_reloffset; float hl = rdata.rel_fixed.HL + (rdata.rel_fixed.HL - rdata.rel_fixed.LL)*c_reloffset; bdContentUpdateBounds(ll, hl, rdata.rel_fixed.MOD); } } else if (rtexttype == RF_SETTAPS || rtexttype == RF_UPDATETAP_PARAM) { docall = true; if (rtexttype == RF_SETTAPS) c_rdata = rdata; else c_rdata.rel_tap_qstring.param = rdata.rel_tap_qstring.param; QString sstr(c_rdata.rel_tap_qstring.slen, Qt::Uninitialized); bdContentUpdateTaps(sstr, c_rdata.rel_tap_qstring.tapfn, c_rdata.rel_tap_qstring.param, c_reloffset, tapctt); } else if (rtexttype == RF_SETENUMERATE) { docall |= (rdata.rel_enumerate.enfrom != c_rdata.rel_enumerate.enfrom) || (rdata.rel_enumerate.numcount != c_rdata.rel_enumerate.numcount); if (docall) { c_rdata = rdata; bdContentUpdateEnumerate(rdata.rel_enumerate.enfrom, rdata.rel_enumerate.numcount, rdata.rel_enumerate.recycle, c_reloffset); } } return docall; } protected: virtual void bdContentUpdateBounds(float LL, float HL, float MOD=0)=0; virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn, const void* param, float relatedoffset, const tapcontent_t&)=0; virtual void bdContentUpdateEnumerate(int from, int count, int recycle, float relatedoffset)=0; public: MarginCallback(): c_reloffset(0), c_updatesetDimm(false) { c_rtexttype = RF_NONE; c_rdata.rel_fixed.LL = c_rdata.rel_fixed.HL = 0; c_rdata.rel_enumerate.enfrom = c_rdata.rel_enumerate.numcount = -1; tapctt.lmoffset = 0; tapctt.lmardimm = 1; } void setUpdateOnSetDimm(bool ups){ c_updatesetDimm = ups; } void setRelatedOffset(int offset, bool autocallupdates=true) { tapctt.lmoffset = offset; if (tapctt.lmardimm != 0) // ntf?? { float reloffset = tapctt.lmoffset / tapctt.lmardimm; if (c_reloffset != reloffset) { c_reloffset = reloffset; if (autocallupdates) bdContentUpdate(c_rtexttype, c_rdata, autocallupdates); } } } void storeDimm(int dimm/*, bool autocallupdates=false*/) { if (dimm != 0) // ntf?? { tapctt.lmardimm = dimm; c_reloffset = tapctt.lmoffset / tapctt.lmardimm; // if (autocallupdates) // bdContentUpdate(c_rtexttype, c_rdata, autocallupdates); if (c_updatesetDimm && dimm > 0) bdContentUpdate(c_rtexttype, c_rdata, c_updatesetDimm); } } // c_rtexttype == RF_SETTAPS? c_rdata.rel_tap_qstring.slen : 0; } }; MarginCallback::~MarginCallback(){} class MarginTextformat { private: DSNumFormatter numfmt; bool numfmt_locked; char* prefix, *postfix; char prefix_array[12], postfix_array[12]; int c_prefix_len, c_postfix_len; int postfix_pex; protected: QFont m_font; bool m_fontReplaced; public: enum { PEX_FIRST=1, PEX_LAST=2, PEX_ALL=1|2|4 }; MarginTextformat(): numfmt_locked(false), prefix(nullptr), postfix(nullptr), c_prefix_len(0), c_postfix_len(0), postfix_pex(PEX_ALL), m_fontReplaced(false) {} MarginTextformat(const QFont& fnt): numfmt_locked(false), prefix(nullptr), postfix(nullptr), c_prefix_len(0), c_postfix_len(0), postfix_pex(PEX_ALL), m_font(fnt), m_fontReplaced(true) {} virtual ~MarginTextformat(); public: // int precision() const { return numfmt.precision(); } // int rmaxlen() const { return c_rtexttype == RF_SETBOUNDS? 7 + numfmt_locked*2 : c_rtexttype == RF_SETENUMERATE? /*c_rdata.rel_enumerate.numcount*/7 + numfmt_locked*2 : // c_rtexttype == RF_SETTAPS? c_rdata.rel_tap_qstring.slen : 0; } int precision(){ return numfmt.maxPrecision(); } int max_symbols() const { return c_prefix_len + 4 + (numfmt.maxPrecision()) + c_postfix_len; } public: enum FMT { FMT_X0, FMT_X2, FMT_X4 }; void numformatUpdate(float LL, float HL) { if (numfmt_locked == false) numfmt.setFloatingAuto(LL, HL); } void numformatOffset(int pp) { numfmt.setPrecisionOffset(pp); } void numformatFix(int pp) { numfmt_locked = true; numfmt.setFloatingStrict(pp); } // void setFormat(char symb_ge1, int precis_ge1, char symb_l1, int precis_l1, bool meganamed=false) // { // numfmt_locked = false; // numfmt.setFormat(symb_ge1, precis_ge1, symb_l1, precis_l1, meganamed); // } void numformatInteger(bool rounded) { numfmt_locked = true; rounded? numfmt.setIntegerRounded() : numfmt.setInteger(); } void setPrefix(const char* str) { if (str == nullptr) prefix = nullptr; else { for (c_prefix_len=0; str[c_prefix_len] != '\0'; c_prefix_len++) prefix_array[c_prefix_len] = str[c_prefix_len]; prefix_array[c_prefix_len] = '\0'; prefix = prefix_array; } } void setPostfix(const char* str) { if (str == nullptr) postfix = nullptr; else { for (c_postfix_len=0; str[c_postfix_len] != '\0'; c_postfix_len++) postfix_array[c_postfix_len] = str[c_postfix_len]; postfix_array[c_postfix_len] = '\0'; postfix = postfix_array; } } void setPostfixPositions(int PEX) { postfix_pex = PEX; } public: void setFont(const QFont& fnt) { m_font = fnt; m_fontReplaced = true; tfContentUpdate(); } const QFont& font() const { return m_font; } QFont& font() { return m_font; } protected: virtual void tfContentUpdate()=0; protected: void turnPrefix(bool on) { prefix = on && c_prefix_len? prefix_array : nullptr; } void turnPostfix(bool on) { postfix = on && c_postfix_len? postfix_array : nullptr; } bool postfixLimited() const { return postfix_pex != PEX_ALL; } void turnPostfixByPosition(int pos, int count) { bool on = postfix_pex == PEX_ALL || (pos == 0 && postfix_pex & PEX_FIRST) || (pos == count-1 && postfix_pex & PEX_LAST); turnPostfix(on); } QString& redact(QString& sstr) const { if (prefix) sstr = prefix + sstr; if (postfix) sstr = sstr + postfix; return sstr; } QString redact(const QString& sstr) const { QString result(sstr); if (prefix) result = prefix + result; if (postfix) result = result + postfix; return result; } QString redact(float value) const { return redact(numfmt(value)); } QString redact(double value) const { return redact(numfmt(value)); } }; MarginTextformat::~MarginTextformat(){} /********************************************************************************************************************/ /********************************************************************************************************************/ /*************************** SPACES&LABELS *****************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ class MarginSpace: public MarginElement { int space; public: MarginSpace(int space) { this->space = space; } ~MarginSpace(); void setSpace(int newspace) { space = newspace; } protected: virtual bool updateArea(const uarea_t&, int){ return true; } virtual void draw(QPainter&){} virtual void sizeHint(ATTACHED_TO, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = space; *minsegm_main = *minsegm_pre = *minsegm_post = 0; } virtual void changeColor(const QColor&){} }; MarginSpace::~MarginSpace(){} class MarginElementCached: public MarginElement { protected: friend class DrawBars; private: uarea_t cached_area; bool filled; protected: bool mec_filled() const { return filled; } const uarea_t& mec_area() const { return cached_area; } protected: virtual void draw(QPainter&){} virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (UPDATEFOR == UF_RESIZE) { filled = true; cached_area = area; } return true; } protected: QColor c_color; bool c_color_redefined; virtual void changeColor(const QColor& clr){ c_color = clr; c_color_redefined = true; } public: MarginElementCached(): c_color_redefined(false) { filled = false; } MarginElementCached(QColor color): c_color(color), c_color_redefined(true) { filled = false; } ~MarginElementCached(); }; MarginElementCached::~MarginElementCached(){} class MarginColoredSpace: public MarginElementCached { int space; QColor color; QRect dtrt; bool useAllZone; public: MarginColoredSpace(int space, QColor color, bool maxzone=true): MarginElementCached(color), useAllZone(maxzone) { this->space = space; } ~MarginColoredSpace(); void setSpace(int newspace){ space = newspace; } protected: virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; int d1 = useAllZone? 0 : area.segm_pre, d2 = (useAllZone? area.segment_full : area.segment_full - area.segm_post - area.segm_over)-1; if (area.atto == AT_LEFT) dtrt.setCoords(area.atto_end, d1, area.atto_begin, d2); else if (area.atto == AT_RIGHT) dtrt.setCoords(area.atto_begin, d1, area.atto_end, d2); else if (area.atto == AT_TOP) dtrt.setCoords(d1, area.atto_end, d2, area.atto_begin); else if (area.atto == AT_BOTTOM) dtrt.setCoords(d1, area.atto_begin, d2, area.atto_end); return true; } virtual void draw(QPainter& painter) { painter.fillRect(dtrt, c_color); } virtual void sizeHint(ATTACHED_TO, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = space; *minsegm_main = *minsegm_pre = *minsegm_post = 0; } }; MarginColoredSpace::~MarginColoredSpace(){} class MarginContour: public MarginElementCached { int space; int count; QRect dtrt[3]; bool useAllZone; public: MarginContour(int space=0, bool maxzone=true): count(space == 0? 1 : 3), useAllZone(maxzone) { this->space = space; } MarginContour(int space, QColor color, bool maxzone=true): MarginElementCached(color), count(space == 0? 1 : 3), useAllZone(maxzone) { this->space = space; } ~MarginContour(); void setSpace(int newspace) { space = newspace; count = space? 3 : 1; } protected: virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; int d1 = useAllZone? 0 : area.segm_pre, d2 = (useAllZone? area.segment_full : area.segment_full - area.segm_post - area.segm_over)-1; int nspace = space == 0? 0 : space-1; if (area.atto == AT_LEFT) { dtrt[0].setCoords(area.atto_begin - nspace, d1, area.atto_begin - nspace, d2); dtrt[1].setCoords(area.atto_begin - nspace, d1, area.atto_begin, d1); dtrt[2].setCoords(area.atto_begin - nspace, d2, area.atto_begin, d2); } else if (area.atto == AT_RIGHT) { dtrt[0].setCoords(area.atto_begin + nspace, d1, area.atto_begin + nspace, d2); dtrt[1].setCoords(area.atto_begin, d1, area.atto_begin + nspace, d1); dtrt[2].setCoords(area.atto_begin, d2, area.atto_begin + nspace, d2); } else if (area.atto == AT_TOP) { dtrt[0].setCoords(d1, area.atto_begin - nspace, d2, area.atto_begin - nspace); dtrt[1].setCoords(d1, area.atto_begin - nspace, d1, area.atto_begin); dtrt[2].setCoords(d2, area.atto_begin - nspace, d2, area.atto_begin); } else if (area.atto == AT_BOTTOM) { dtrt[0].setCoords(d1, area.atto_begin + nspace, d2, area.atto_begin + nspace); dtrt[1].setCoords(d1, area.atto_begin, d1, area.atto_begin + nspace); dtrt[2].setCoords(d2, area.atto_begin, d2, area.atto_begin + nspace); } return true; } virtual void draw(QPainter& painter) { // MarginElementCached::draw(painter); if (c_color_redefined) for (int i=0; i<count; i++) painter.fillRect(dtrt[i], c_color); else for (int i=0; i<count; i++) painter.fillRect(dtrt[i], painter.brush()); } virtual void sizeHint(ATTACHED_TO, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = space == 0? 1 : space; *minsegm_main = *minsegm_pre = *minsegm_post = 0; } }; MarginContour::~MarginContour(){} class MarginLabel: public MarginElementCached { texts_t label; Qt::Alignment alignment; Qt::Orientation orientation; QSize orient_size; QTransform ttransform; QPoint ttranspoint; bool useneispace; QFont m_font; bool m_fontReplaced; //protected: // int c_width, c_height; private: void prepare() { QSizeF loc = label.uin_text.size(); label.uin_locsize = QSize(qRound(loc.width()), qRound(loc.height())); if (orientation == Qt::Horizontal) { if (m_fontReplaced) label.uin_text.prepare(QTransform(), m_font); orient_size = label.uin_locsize; } else if (orientation == Qt::Vertical) { ttransform.rotate(-90); label.uin_text.prepare(ttransform, m_font); orient_size = QSize(label.uin_locsize.height(), label.uin_locsize.width()); } // qDebug()<<label.uin_locsize<<orient_size; } public: MarginLabel(const QString& text, bool useNeighborSpace=false, Qt::Alignment align=Qt::AlignCenter, Qt::Orientation orient=Qt::Horizontal): alignment(align), orientation(orient), useneispace(useNeighborSpace), m_fontReplaced(false) { setText(text); } MarginLabel(const QString& text, const QFont& fnt, bool useNeighborSpace=false, Qt::Alignment align=Qt::AlignCenter, Qt::Orientation orient=Qt::Horizontal): alignment(align), orientation(orient), useneispace(useNeighborSpace) { setText(text, fnt); } ~MarginLabel(); void setText(const QString& text) { label.uin_text.setText(text); prepare(); } void setText(const QString& text, const QFont& fnt) { label.uin_text.setText(text); m_font = fnt; m_fontReplaced = true; prepare(); } void setFont(const QFont& fnt) { m_font = fnt; m_fontReplaced = true; prepare(); } protected: virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; int a1 = area.atto_end; int a2 = area.atto_begin; int d = useneispace? area.segment_full : area.segm_main; int dd = useneispace? 0 : area.segm_pre + 1; const QRect& actualArea = area.atto == AT_LEFT? QRect(a1, dd, a2 - a1, d) : area.atto == AT_RIGHT? QRect(a2, dd, a1 - a2, d) : area.atto == AT_TOP? QRect(dd, a1, d, a2 - a1) : QRect(dd, a2, d, a1 - a2); QPointF textOffsetSign; rectAlign(actualArea, alignment/*Qt::AlignLeft | Qt::AlignTop*/, &ttranspoint, &textOffsetSign); if (orientation == Qt::Vertical) textOffsetSign = QPointF(-(1.0 + textOffsetSign.y()), textOffsetSign.x()); // label.pos_mark = label.c_pos_result = QPoint(int(textOffsetSign.x()*(label.uin_locsize.width()-1)), int(textOffsetSign.y()*label.uin_locsize.height())); label.visible = 1; return true; } virtual void draw(QPainter& painter) { // MarginElementCached::draw(painter); if (label.visible) { painter.save(); painter.translate(ttranspoint); if (m_fontReplaced) painter.setFont(m_font); if (ttransform.type() != QTransform::TxNone) painter.setTransform(ttransform, true); painter.drawStaticText(label.c_pos_result, label.uin_text); painter.restore(); } } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { if (BAR_VERT[atto]) { *atto_size = orient_size.width(); *minsegm_main = orient_size.height(); } else { *atto_size = orient_size.height(); *minsegm_main = orient_size.width(); } *minsegm_pre = *minsegm_post = 0; } }; MarginLabel::~MarginLabel(){} /********************************************************************************************************************/ /********************************************************************************************************************/ /*************************** POINTER *****************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ class MarginSingle: public MarginElementCached, public MarginCallback { int round; int mlenmaxi, mwid; protected: bool relative; float c_LL, c_HL, c_MOD; memark_t mark; float pos_origin; float pos_mark; public: MarginSingle(int rounding, int _marklen, float pos, bool _relative): round(rounding), mlenmaxi(_marklen), mwid(_marklen? 1 : 0), relative(_relative), c_LL(0.0f), c_HL(1.0f), c_MOD(0.0f), pos_origin(pos) { _update_single_pos(); } ~MarginSingle(); int mlen() const { return mlenmaxi; } void _update_single_pos(){ if (relative) pos_mark = (pos_origin - c_LL)/(c_HL - c_LL); else pos_mark = pos_origin; } virtual void setPosition(float pos) { pos_origin = pos; _update_single_pos(); if (mec_filled()) _update_single_area(mec_area()); } void setMarkLength(int length){ mlenmaxi = length; } void setMarkWidth(int width){ mwid = width; /*needRedrawByMark = true;*/ } void setMarkSize(int length, int width){ mlenmaxi = length; mwid = width; /*needRedrawByMark = true;*/ } protected: void _update_single_area(const uarea_t& area) { const int dimm_main = area.segm_main-1; float pm = BAR_VERT[area.atto] ^ area.mirrored? 1.0f - pos_mark : pos_mark; int offs = area.segm_pre + (round == 0? qRound(dimm_main*pm) : round == 1? int(dimm_main*pm) : int(dimm_main*pm) + 1); switch (area.atto) { case AT_LEFT: { mark.anchor = QPoint(area.atto_begin, offs); mark.rect.setCoords(area.atto_begin - (mlenmaxi-1), offs, area.atto_begin, offs); break; } case AT_RIGHT: { mark.anchor = QPoint(area.atto_begin, offs); mark.rect.setCoords(area.atto_begin, offs, area.atto_begin + (mlenmaxi-1), offs); break; } case AT_TOP: { mark.anchor = QPoint(offs, area.atto_begin); mark.rect.setCoords(offs, area.atto_begin - (mlenmaxi-1), offs, area.atto_begin); break; } case AT_BOTTOM: { mark.anchor = QPoint(offs, area.atto_begin); mark.rect.setCoords(offs, area.atto_begin, offs, area.atto_begin + (mlenmaxi-1)); break; } } // if (BAR_VERT[area.atto]) // { // float r = round == 0? qRound(i*d3) : round == 1? int(i*d3) : int(i*d3) + 1; // int offs = area.segm_pre + (; // int offs = area.mirrored? area.segm_pre + dimm_main*pos_mark: // area.segm_pre + dimm_main*(1.0f - pos_mark); // int l1 = area.atto_begin; // int l2 = area.atto_begin + (area.atto == AT_LEFT? -(mlenmaxi-1) : (mlenmaxi-1)); // mark.anchor = QPoint(l1, offs); // if (area.atto == AT_LEFT) // mark.rect.setCoords(l2, offs, l1, offs); // else // mark.rect.setCoords(l1, offs, l2, offs); // } // else // { // int offs = area.mirrored? area.segm_pre + dimm_main*(1.0f - pos_mark): // area.segm_pre + dimm_main*pos_mark; // int l1 = area.atto_begin; // int l2 = area.atto_begin + (area.atto == AT_TOP? -(mlenmaxi-1) : (mlenmaxi-1)); // mark.anchor = QPoint(offs, l1); // if (area.atto == AT_TOP) // mark.rect.setCoords(offs, l2, offs, l1); // else // mark.rect.setCoords(offs, l1, offs, l2); // } } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; _update_single_area(area); storeDimm(area.segm_main); return true; } virtual void draw(QPainter& painter) { MarginElementCached::draw(painter); if (mlenmaxi) { if (c_color_redefined) painter.fillRect(mark.rect, c_color); else painter.fillRect(mark.rect, painter.brush()); } } virtual void sizeHint(ATTACHED_TO /*atto*/, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = (mlenmaxi? mlenmaxi + 2 : 0); *minsegm_main = *minsegm_pre = *minsegm_post = 0; } protected: virtual void bdContentUpdateBounds(float ll, float hl, float mod) { c_LL = ll; c_HL = hl; c_MOD = mod; if (relative) { _update_single_pos(); if (mec_filled()) _update_single_area(mec_area()); } } virtual void bdContentUpdateTaps(QString& /*base*/, mtap_qstring_fn /*tapfn*/, const void* /*param*/, float /*relatedoffset*/, const tapcontent_t& /*tctt*/) { } virtual void bdContentUpdateEnumerate(int from, int count, int /*recycle*/, float /*relatedoffset*/) { c_LL = from; c_HL = from + count; c_MOD = 0.0f; if (relative) { _update_single_pos(); // pos_mark = c_LL if (mec_filled()) _update_single_area(mec_area()); } } }; MarginSingle::~MarginSingle(){} class MarginPointer: public MarginSingle, public MarginTextformat { ORIENTATION orient; bool textInnerPlaced; texts_t pointer; Qt::Alignment alignment; float c_value; bool f_assigned; public: MarginPointer(int rounding, int _marklen, float pos, bool _relative, ORIENTATION _orient, bool textinner, Qt::Alignment align=Qt::AlignCenter/*, Qt::Orientation orient=Qt::Horizontal*/): MarginSingle(rounding, _marklen, pos, _relative), orient(_orient), textInnerPlaced(textinner), alignment(align), c_value(-1.0f), f_assigned(false) { _update_pointer_pos(pos_mark); pointer.visible = 1; } MarginPointer(int rounding, int _marklen, float pos, bool _relative, ORIENTATION _orient, bool textinner, const QFont& fnt, Qt::Alignment align=Qt::AlignCenter/*, Qt::Orientation orient=Qt::Horizontal*/): MarginSingle(rounding, _marklen, pos, _relative), MarginTextformat(fnt), orient(_orient), textInnerPlaced(textinner), alignment(align), c_value(-1.0f), f_assigned(false) { _update_pointer_pos(pos_mark); pointer.visible = 1; } ~MarginPointer(); float _update_pointer_pos(float p){ c_value = c_LL + p*(c_HL-c_LL); if (c_MOD != 0.0f) c_value -= int(c_value/c_MOD)*c_MOD; return c_value; } virtual void setPosition(float pos01) { MarginSingle::setPosition(pos01); assignText(&pointer, redact(_update_pointer_pos(pos_mark))); if (mec_filled()) _update_pointer_area(mec_area(), true); } void setPositionBifunc(float pos01, float posBi) { MarginSingle::setPosition(pos01); assignText(&pointer, redact(_update_pointer_pos(posBi))); // qDebug()<<"Position : "<<pos01<<" self : "<<pos_mark; if (mec_filled()) _update_pointer_area(mec_area(), true); } void setPosition(float pos01_A, float pos01_B) { if (mec_filled()) { bool v = BAR_VERT[mec_area().atto]? orientationMirroredVert(orient) : orientationMirroredHorz(orient); bool m = orientationTransposed(orient) ^ BAR_VERT[mec_area().atto]; // MarginSingle::setPosition(m? pos01_B : pos01_A); float pos01 = m? pos01_B : pos01_A; setPositionBifunc( v ? 1.0f - pos01 : pos01, pos01); } } void setVisible(bool visible) { pointer.visible = visible? 1 : 0; } bool isVisible() const { return pointer.visible != 0; } protected: virtual void tfContentUpdate(){ assignText(&pointer, redact(c_value), m_font); } protected: void _update_pointer_area(const uarea_t& area, bool updateSingle) { if (updateSingle) MarginSingle::_update_single_area(area); const int decays[] = { 3 + mlen(), 3 + mlen(), 0 + mlen(), 0 + mlen()}; pointer.pos_mark = mark.anchor; pointer.pos_decay = decays[area.atto]; pointer.pos_update_fn = POSFUNC_NN_MID[area.atto]; if (textInnerPlaced) { int d1 = area.segm_pre + (area.segm_main-1); int d2 = area.segm_pre; if (CROSS_UP[area.atto](&pointer, area.mirrored? d2 : d1)) pointer.pos_update_fn = BAR_VERT[area.atto]? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]; else if (CROSS_DOWN[area.atto](&pointer, area.mirrored? d1 : d2)) pointer.pos_update_fn = BAR_VERT[area.atto]? POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_UP[area.atto]; } pointer.pos_update_fn(&pointer); } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginSingle::updateArea(area, UPDATEFOR) == false) return false; if (!f_assigned) { assignText(&pointer, redact(_update_pointer_pos(pos_mark))); f_assigned = true; } _update_pointer_area(area, false); return true; } virtual void draw(QPainter& painter) { if (pointer.visible) { MarginSingle::draw(painter); if (m_fontReplaced) { painter.save(); painter.setFont(m_font); painter.drawStaticText(pointer.c_pos_result, pointer.uin_text); painter.restore(); } else painter.drawStaticText(pointer.c_pos_result, pointer.uin_text); } } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { MarginSingle::sizeHint(atto, atto_size, minsegm_main, minsegm_pre, minsegm_post); QFontMetrics fm(m_font); int maxsymbols = cachedRTexttype() == RF_SETTAPS? cachedRdata().rel_tap_qstring.slen : max_symbols(); QSize meansize(SPACING_AFTERWIDTH + fm.averageCharWidth()*maxsymbols, SPACING_AFTERHEIGHT + fm.height()); *atto_size += (BAR_VERT[atto]? meansize.width() : meansize.height()); *minsegm_main += BAR_VERT[atto]? meansize.height() : meansize.width(); int d_half_dly = textInnerPlaced? 0 : BAR_VERT[atto]? meansize.height()/2 : meansize.width()/2; *minsegm_pre += d_half_dly; *minsegm_post += d_half_dly; } protected: virtual void bdContentUpdateBounds(float ll, float hl, float mod) { MarginSingle::bdContentUpdateBounds(ll, hl, mod); MarginTextformat::numformatUpdate(c_LL, c_HL); if (relative) { if (f_assigned && mec_filled()) _update_pointer_area(mec_area(), true); } else assignText(&pointer, redact(_update_pointer_pos(pos_mark))); } virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float relatedoffset, const tapcontent_t& tctt) { MarginSingle::bdContentUpdateTaps(base, tapfn, param, relatedoffset, tctt); float LLof = c_LL + (c_HL-c_LL)*relatedoffset; float HLof = c_HL + (c_HL-c_LL)*relatedoffset; tapfn(int(LLof + pos_mark*(HLof-LLof)), tctt.lmardimm, tctt.lmoffset, param, base); assignText(&pointer, redact(base)); } virtual void bdContentUpdateEnumerate(int from, int count, int recycle, float relatedoffset) { MarginSingle::bdContentUpdateEnumerate(from, count, recycle, relatedoffset); MarginTextformat::numformatInteger(false); assignText(&pointer, redact(_update_pointer_pos(pos_mark))); // ntf: reloffset } }; MarginPointer::~MarginPointer(){} /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /*************************** MARKS *****************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ /********************************************************************************************************************/ class MarginMarksBase: public MarginElementCached, public MarginCallback, public MarginTextformat { protected: int mlenmaxi, mlenmini, mwid; protected: MarginMarksBase(): mlenmaxi(4), mlenmini(2), mwid(1){} ~MarginMarksBase(); int mlen() const { return mlenmaxi; } public: void setMarkLength(int length){ mlenmaxi = length; /*needRedrawByMark = true;*/ } void setMarkMiniLength(int length){ mlenmini = length; /*needRedrawByMark = true;*/ } void setMarkWidth(int width){ mwid = width; /*needRedrawByMark = true;*/ } void setMarkSize(int length, int width, int lengthmini=4) { mlenmaxi = length; mlenmini = lengthmini; mwid = width; /*needRedrawByMark = true;*/ } protected: virtual void tfContentUpdate(){ if (mec_filled()) MarginElementCached::updateArea(mec_area(), UF_CONTENT); } }; MarginMarksBase::~MarginMarksBase(){} typedef MarginMarksBase MarginComplicated; /************************************************************************************************************/ class MarginINMarks: public MarginMarksBase { protected: int algoType; memark_t* ua_marks; int* ua_marklinks2; int countMaxiNoted, countMaxiHided, countMini; int pixStep_pixSpace; int miniPerMaxi; int round; // 0 - default rounding, 1 - no round, 2 - no round and +1 for all except first and last public: MarginINMarks(): //needRedrawByMark(false), algoType(DBMODE_STRETCHED_POW2), ua_marks(nullptr), ua_marklinks2(nullptr), countMaxiNoted(0), countMaxiHided(0), countMini(0), pixStep_pixSpace(0), miniPerMaxi(0), round(0) { } ~MarginINMarks(); void init(int algotype, int marksLimit, int pixStep_minSpacing, int roundsteps, int _miniPerMaxi) /// marksLimit = 0 for init later { algoType = algotype; pixStep_pixSpace = pixStep_minSpacing; if (pixStep_pixSpace <= 0) pixStep_pixSpace = INT_MAX; miniPerMaxi = _miniPerMaxi; round = roundsteps; setMarksCount(marksLimit); } virtual int setMarksCount(int marksLimit) { if (marksLimit) { if (ua_marks) delete []ua_marks; if (ua_marklinks2) delete []ua_marklinks2; if (algoType == DBMODE_STRETCHED_POW2 && marksLimit > 2) { int mc = 2; while (2*mc + 1 <= marksLimit) mc *= 2; marksLimit = mc + 1; } countMaxiNoted = marksLimit; countMaxiHided = 0; countMini = 0; ua_marks = new memark_t[marksLimit + miniPerMaxi*countMaxiNoted]; ua_marklinks2 = new int[marksLimit]; for (int i=0; i<marksLimit; i++) ua_marklinks2[i] = i; } return marksLimit; } protected: int calcCountStepAndJump(int totalCount, int pixLen, const int minSpacing, int *step_out, int* jumpfrom_out, int* jumpto_out) const { float pixStep = pixLen/float(totalCount - 1); int result = 0, step=1, jumpfrom=0, jumpto=0; // qDebug()<<pixLen<<pixStep<<minSpacing; if (pixLen <= minSpacing) { result = 2; step = totalCount-1; // pref = "<pix"; } else if (pixStep >= minSpacing) { result = totalCount; // pref = QString::number(minSpacing) + "> = standard"; } else { step = 2; while (pixStep*step < minSpacing) { step++; // qDebug()<<step<<step*pixStep<<pixLen; } // qDebug()<<"step calc: "<<pixStep<<minSpacing<<"... "<<step; if ((totalCount-1) % step == 0) { // pref = "odd"; result = totalCount/step + 1; } else if ((totalCount-1)/3 <= step) { step = (totalCount-1)/2; jumpfrom = step; jumpto = totalCount - 1 - step; result = 3; } else { const int right = int((totalCount-1)/step)*step; jumpfrom = right; jumpto = (totalCount-1); result = (totalCount)/step + (totalCount % step == 0? 0 : 1); // pref = QString("MaxiMUL"); } } // qDebug()<<pref<<": "<<result<<"___"<<step<<"JUMP: "<<jumpfrom<<"->"<<jumpto; *step_out = step; *jumpfrom_out = jumpfrom; *jumpto_out = jumpto; return result; } protected: // virtual bool needredraw() const { return MarginElementCached::needredraw() | needRedrawByMark; } virtual void draw(QPainter& painter) { // MarginElementCached::draw(painter); { // for (int i=0; i<countMaxiNoted + (miniPerMaxi > 0? countMini : 0); i++) // painter.fillRect(ua_marks[i].rect, c_color_redefined? c_color : foregroundColor); if (c_color_redefined) for (int i=0; i<countMaxiNoted + (miniPerMaxi > 0? countMini : 0); i++) painter.fillRect(ua_marks[i].rect, c_color); else for (int i=0; i<countMaxiNoted + (miniPerMaxi > 0? countMini : 0); i++) painter.fillRect(ua_marks[i].rect, painter.brush()); } // needRedrawByMark = false; } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; // if ((mec_filled() && mec_area().segm_main == area.segm_main) && BAR_NEEDMOVE[area.atto]) // return false; const int dimm_main = area.segm_main - 1; const int countMaxiTotal = countMaxiNoted + countMaxiHided; int over_recycle = 1; float over_deltapix[] = { 1, 1 }; int over_step[] = { 1, 1 }; // each x element still alive int jumpfrom(0), jumpto(0); // center elements highlight int over_count[] = { 0, 0 }; int minimod = 1; if (algoType == DBMODE_STATIC) { over_deltapix[0] = float(pixStep_pixSpace); countMaxiNoted = dimm_main / pixStep_pixSpace + 1; if (countMaxiNoted > countMaxiTotal) countMaxiNoted = countMaxiTotal; countMini = 0; int miniover=0; if (miniPerMaxi) { over_recycle += 1; minimod = miniPerMaxi + 1; miniover = int(((dimm_main % pixStep_pixSpace) / float(pixStep_pixSpace)) * (miniPerMaxi + 1)); if (miniover < 0) miniover = 0; countMini = miniPerMaxi*(countMaxiNoted-1) + miniover; over_deltapix[1] = over_deltapix[0] / minimod; } over_count[0] = countMaxiNoted; over_count[1] = minimod*(countMaxiNoted-1) + miniover + 1; } else { over_deltapix[0] = dimm_main/float(countMaxiTotal - 1); if (algoType == DBMODE_STRETCHED_POW2) { countMaxiNoted = countMaxiTotal; if (over_deltapix[0] < pixStep_pixSpace && countMaxiNoted > 2) { float odp = dimm_main/float(countMaxiNoted - 1); while (odp < pixStep_pixSpace) { countMaxiNoted -= countMaxiNoted/2; odp = dimm_main/float(countMaxiNoted - 1); over_step[0] *= 2; // qDebug()<<countMaxiNoted<<over_deltapix[0]<<pixStep_pixSpace; if (countMaxiNoted < 3) break; } // qDebug()<<over_step[0]; } } else { countMaxiNoted = calcCountStepAndJump(countMaxiTotal, dimm_main, pixStep_pixSpace, &over_step[0], &jumpfrom, &jumpto); } countMini = 0; if (miniPerMaxi && countMaxiNoted == countMaxiTotal) { if (over_deltapix[0]/(miniPerMaxi+1) > 5) { over_recycle += 1; minimod = miniPerMaxi + 1; countMini = miniPerMaxi*(countMaxiNoted-1); over_step[1] = 1; over_deltapix[1] = over_deltapix[0] / minimod; } } // if (miniPerMaxi) // { // float over_deltamini = dimm_main/float(countMaxiNoted - 1); // if (over_deltamini/(miniPerMaxi+1) > 5) // { // over_recycle += 1; // minimod = miniPerMaxi + 1; // countMini = miniPerMaxi*(countMaxiNoted-1); // over_step[1] = 1; // over_deltapix[1] = over_deltamini / minimod; // } // } over_count[0] = countMaxiTotal; over_count[1] = minimod*(countMaxiNoted-1); } countMaxiHided = countMaxiTotal - countMaxiNoted; int over_mlen[] = { mlenmaxi, mlenmini }; int m=0; for (int i=0; i<countMaxiNoted + countMaxiHided; i++) ua_marklinks2[i] = -1; for (int o=0; o<2; o++) { if (over_count[o] == 0) continue; if (BAR_VERT[area.atto]) { int d2 = area.mirrored? area.segm_pre : area.segm_pre + area.segm_main - 1; float d3 = area.mirrored? -over_deltapix[o] : over_deltapix[o]; int l1 = area.atto_begin; int l2 = area.atto_begin + (area.atto == AT_LEFT? -(over_mlen[o]-1) : (over_mlen[o]-1)); for (int i=0; i<over_count[o]; i += over_step[o]) { if (o == 1 && i % minimod == 0) continue; if (o == 0) ua_marklinks2[i] = m; int offs = d2 - (round == 0 || i == 0 || i == over_count[0]-1? qRound(i*d3) : round == 1? int(i*d3) : int(i*d3) + 1); ua_marks[m].anchor = QPoint(l1, offs); if (area.atto == AT_LEFT) ua_marks[m].rect.setCoords(l2, offs, l1, offs); else ua_marks[m].rect.setCoords(l1, offs, l2, offs); m++; if (jumpfrom && i + over_step[0] == jumpfrom){ i = jumpto - over_step[0]; jumpfrom = 0; } } } else { int d2 = area.mirrored? area.segm_pre + area.segm_main - 1 : area.segm_pre; float d3 = area.mirrored? -over_deltapix[o] : over_deltapix[o]; int l1 = area.atto_begin; int l2 = area.atto_begin + (area.atto == AT_TOP? -(over_mlen[o]-1) : (over_mlen[o]-1)); for (int i=0; i<over_count[o]; i += over_step[o]) { if (o == 1 && i % minimod == 0) continue; if (o == 0) ua_marklinks2[i] = m; int offs = d2 + (round == 0 || i == 0 || i == over_count[0]-1? qRound(i*d3) : round == 1? int(i*d3) : int(i*d3) + 1); ua_marks[m].anchor = QPoint(offs, l1); if (area.atto == AT_TOP) ua_marks[m].rect.setCoords(offs, l2, offs, l1); else ua_marks[m].rect.setCoords(offs, l1, offs, l2); m++; if (jumpfrom && i + over_step[0] == jumpfrom){ i = jumpto - over_step[0]; jumpfrom = 0; } } } } // for over return true; } virtual void sizeHint(ATTACHED_TO /*atto*/, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = mlenmaxi + 2; *minsegm_main = 1; *minsegm_pre = *minsegm_post = 0; } protected: virtual void bdContentUpdateBounds(float, float, float=0){} virtual void bdContentUpdateTaps(QString&, mtap_qstring_fn, const void*, float, const tapcontent_t&){} virtual void bdContentUpdateEnumerate(int, int, int, float){} }; MarginINMarks::~MarginINMarks() { if (ua_marks && ua_marklinks2) { delete []ua_marks; delete []ua_marklinks2; } } /**************************/ class MarginINMarksTextToMark: public MarginINMarks { texts_t* texts; bool textInnerPlaced; public: MarginINMarksTextToMark(bool innerTextPlacement): textInnerPlaced(innerTextPlacement) {} ~MarginINMarksTextToMark(); virtual int setMarksCount(int marksLimit) { marksLimit = MarginINMarks::setMarksCount(marksLimit); texts = new texts_t[marksLimit]; return marksLimit; } protected: // virtual bool needredraw() const { return MarginINMarksTexted::needredraw(); } virtual void draw(QPainter& painter) { MarginINMarks::draw(painter); { if (m_fontReplaced) painter.setFont(m_font); for (int i=0; i<countMaxiNoted + countMaxiHided; i++) if (texts[i].visible) painter.drawStaticText(texts[i].c_pos_result, texts[i].uin_text); } } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { bool ua = MarginINMarks::updateArea(area, UPDATEFOR); if (ua == false && (UPDATEFOR != UF_CONTENT)) return false; storeDimm(area.segm_main); const int decays[] = { 3 + mlenmaxi, 3 + mlenmaxi, 0 + mlenmaxi, 0 + mlenmaxi }; void (*lposfunc_nn_mid)(texts_t*) = POSFUNC_NN_MID[area.atto]; void (*lposfunc_nn_fnbeg)(texts_t*) = area.mirrored? POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_UP[area.atto]; void (*lposfunc_nn_fnend)(texts_t*) = area.mirrored? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]; for (int i=0; i<countMaxiNoted + countMaxiHided; i++) { texts[i].pos_decay = decays[area.atto]; if (ua_marklinks2[i] != -1) { texts[i].pos_mark = ua_marks[ua_marklinks2[i]].anchor; if (textInnerPlaced && i == 0) texts[i].pos_update_fn = lposfunc_nn_fnbeg; else if (textInnerPlaced && i == countMaxiNoted + countMaxiHided - 1) texts[i].pos_update_fn = lposfunc_nn_fnend; else texts[i].pos_update_fn = lposfunc_nn_mid; texts[i].visible = 1; texts[i].pos_update_fn(&texts[i]); } else texts[i].visible = 0; } rearrange(BAR_VERT[area.atto], area.mirrored, texts, countMaxiNoted + countMaxiHided); return true; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { MarginINMarks::sizeHint(atto, atto_size, minsegm_main, minsegm_pre, minsegm_post); QFontMetrics fm(m_font); int maxsymbols = cachedRTexttype() == RF_SETTAPS? cachedRdata().rel_tap_qstring.slen : max_symbols(); QSize meansize(SPACING_AFTERWIDTH + fm.averageCharWidth()*maxsymbols, SPACING_AFTERHEIGHT + fm.height()); int d_atto_size = BAR_VERT[atto]? meansize.width() : meansize.height(); int d_half_dly = textInnerPlaced? 0 : BAR_VERT[atto]? meansize.height()/2 : meansize.width()/2; *atto_size += d_atto_size; *minsegm_pre = d_half_dly; *minsegm_post = d_half_dly; } protected: virtual void bdContentUpdateBounds(float LL, float HL, float mod) { const int total = countMaxiNoted + countMaxiHided; float bndstep = (HL - LL)/(total - 1); MarginTextformat::numformatUpdate(LL, HL); if (mod != 0.0f) { float pv = LL; for (int i=0; i<total; i++) { float v = LL + i*bndstep; v -= int(v/mod)*mod; if (i == total-1 && pv > v) { if (v < mod/120.0f) v += mod; } if (postfixLimited()) turnPostfixByPosition(i, total); assignText(&texts[i], redact(v), m_fontReplaced, m_font); pv = v; } } else for (int i=0; i<total; i++) { if (postfixLimited()) turnPostfixByPosition(i, total); assignText(&texts[i], redact(LL + i*bndstep), m_fontReplaced, m_font); } } virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float /*relatedoffset*/, const tapcontent_t& tctt) { for (int i=0; i<countMaxiNoted + countMaxiHided; i++) { if (postfixLimited()) turnPostfixByPosition(i, countMaxiNoted + countMaxiHided); tapfn(i, tctt.lmardimm, tctt.lmoffset, param, base); assignText(&texts[i], redact(base), m_fontReplaced, m_font); } } virtual void bdContentUpdateEnumerate(int from, int /*count*/, int /*recycle*/, float relatedoffset) { MarginTextformat::numformatInteger(false); for (int i=0; i<countMaxiNoted + countMaxiHided; i++) { if (postfixLimited()) turnPostfixByPosition(i, countMaxiNoted + countMaxiHided); int num = from + i + int((countMaxiNoted + countMaxiHided)*relatedoffset); // if (recycle != -1) num = num % recycle; assignText(&texts[i], redact(QString::number(num)), m_fontReplaced, m_font); } } }; MarginINMarksTextToMark::~MarginINMarksTextToMark(){} class MarginINMarks2only: public MarginINMarks { texts_t* texts; bool textInnerPlaced; public: MarginINMarks2only(bool innerTextPlacement): textInnerPlaced(innerTextPlacement){} ~MarginINMarks2only(); virtual int setMarksCount(int marksLimit) { marksLimit = MarginINMarks::setMarksCount(marksLimit); texts = new texts_t[2]; return marksLimit; } protected: virtual void draw(QPainter& painter) { MarginINMarks::draw(painter); if (m_fontReplaced) painter.setFont(m_font); for (int i=0; i<2; i++) if (texts[i].visible) painter.drawStaticText(texts[i].c_pos_result, texts[i].uin_text); } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { bool ua = MarginINMarks::updateArea(area, UPDATEFOR); if (ua == false && (UPDATEFOR != UF_CONTENT)) return false; storeDimm(area.segm_main); const int decays[] = { 3 + mlenmaxi, 3 + mlenmaxi, 0 + mlenmaxi, 0 + mlenmaxi }; int lmp[] = { 0, algoType == DBMODE_STATIC? countMaxiNoted - 1 : countMaxiNoted + countMaxiHided - 1 }; for (int i=0; i<2; i++) if (ua_marklinks2[lmp[i]] != -1) { texts[i].pos_mark = ua_marks[ua_marklinks2[lmp[i]]].anchor; texts[i].pos_decay = decays[area.atto]; // texts[i].pos_update_fn = textInnerPlaced? (area.mirrored? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]) : // POSFUNC_NN_MID[area.atto]; if (textInnerPlaced) { texts[i].pos_update_fn = area.mirrored ^ (i == 0)? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]; } else texts[i].pos_update_fn = POSFUNC_NN_MID[area.atto]; texts[i].visible = 1; texts[i].pos_update_fn(&texts[i]); } else { texts[i].visible = 0; texts[i].pos_update_fn = nullptr; } // if (textInnerPlaced) // { // POSFUNC_NN_UP[area.atto](&texts[area.mirrored? 1 : 0], decays[area.atto]); // POSFUNC_NN_DOWN[area.atto](&texts[area.mirrored? 0 : 1], decays[area.atto]); // } // else // { // POSFUNC_NN_MID[area.atto](&texts[0], decays[area.atto]); // POSFUNC_NN_MID[area.atto](&texts[1], decays[area.atto]); // } return true; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { MarginINMarks::sizeHint(atto, atto_size, minsegm_main, minsegm_pre, minsegm_post); QFontMetrics fm(m_font); int maxsymbols = cachedRTexttype() == RF_SETTAPS? cachedRdata().rel_tap_qstring.slen : max_symbols(); QSize meansize(SPACING_AFTERWIDTH + fm.averageCharWidth()*maxsymbols, SPACING_AFTERHEIGHT + fm.height()); int d_atto_size = BAR_VERT[atto]? meansize.width() : meansize.height(); int d_half_dly = textInnerPlaced? 0 : BAR_VERT[atto]? meansize.height()/2 : meansize.width()/2; *atto_size += d_atto_size; *minsegm_pre = d_half_dly; *minsegm_post = d_half_dly; } protected: virtual void bdContentUpdateBounds(float LL, float HL, float mod) { MarginTextformat::numformatUpdate(LL, HL); if (mod != 0.0f) { LL -= int(LL/mod)*mod; HL -= int(HL/mod)*mod; if (HL <= LL) { if (HL < mod/120.0f) HL += mod; } } for (int i=0; i<2; i++) { if (postfixLimited()) turnPostfixByPosition(i, 2); assignText(&texts[i], redact(i == 0? LL : HL), m_fontReplaced, m_font); } } virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float /*relatedoffset*/, const tapcontent_t& tctt) { for (int i=0; i<2; i++) { if (postfixLimited()) turnPostfixByPosition(i, 2); tapfn(i, tctt.lmardimm, tctt.lmoffset, param, base); assignText(&texts[i], redact(base), m_fontReplaced, m_font); } } virtual void bdContentUpdateEnumerate(int from, int /*count*/, int /*recycle*/, float /*relatedoffset*/) { MarginTextformat::numformatInteger(false); for (int i=0; i<2; i++) { if (postfixLimited()) turnPostfixByPosition(i, 2); assignText(&texts[i], redact(QString::number(from + i)), m_fontReplaced, m_font); } } }; MarginINMarks2only::~MarginINMarks2only(){} /******************************************************************************************************************/ /******************************************************************************************************************/ /******************************************************************************************************************/ enum { DOCK_PREV, DOCK_BETWEEN, DOCK_NEXT }; class MarginINMarksTextBetweenMark: public MarginINMarks { protected: texts_t* texts; int docking; bool showLastEnumer; unsigned int submod; public: MarginINMarksTextBetweenMark(): docking(DOCK_BETWEEN), showLastEnumer(false), submod(1) { } ~MarginINMarksTextBetweenMark(); void init_wide(int algotype, int marksLimit, int pixStep_minSpacing, unsigned int step, int roundsteps, bool alwaysShowLast, int dockto) { MarginINMarks::init(algotype, marksLimit, pixStep_minSpacing, roundsteps, 0); docking = dockto; showLastEnumer = alwaysShowLast; submod = step; } virtual int setMarksCount(int marksLimit) { marksLimit = MarginINMarks::setMarksCount(marksLimit); if (marksLimit) texts = new texts_t[marksLimit-1 + 1]; return marksLimit; } protected: virtual void draw(QPainter& painter) { MarginINMarks::draw(painter); if (m_fontReplaced) painter.setFont(m_font); for (int i=0; i<countMaxiNoted + countMaxiHided - 1; i++) if (texts[i].visible) painter.drawStaticText(texts[i].c_pos_result, texts[i].uin_text); } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { bool ua = MarginINMarks::updateArea(area, UPDATEFOR); if (ua == false && (UPDATEFOR != UF_CONTENT)) return false; storeDimm(area.segm_main); const int total = countMaxiNoted + countMaxiHided - 1; int last0=0, last1=0, subctr = 0; for (int i=0; i<total; ) { if (ua_marklinks2[i] != -1) { int j=i+1; for (; j<total+1; j++) { if (ua_marklinks2[j] != -1) break; else texts[j].visible = 0; } last1 = last0; last0 = i; if (algoType == DBMODE_STATIC && j > total) texts[i].visible = 0; else { texts[i].visible = (subctr++ % int(submod) == 0)? 1 : 0; QPoint& mcur = ua_marks[ua_marklinks2[i]].anchor, &mnext = j == total+1? ua_marks[ua_marklinks2[i]].anchor : ua_marks[ua_marklinks2[j]].anchor; //// qDebug()<<i<<ua_marklinks2[i]<<j<<ua_marklinks2[j]<<total+1<<-(mnext - mcur).y()/2; _recalcPos(i, area.atto, mcur, mnext, docking); } i = j; } else texts[i++].visible = 0; } if (showLastEnumer) { if (last0 && texts[total-1].visible != 1) { texts[total - 1].visible = 1; if (last0 != total-1) { texts[last0].visible = 0; if (algoType == DBMODE_STATIC) { // texts[total - 1].uarea_pos = texts[last].uarea_pos; // _recalcPos(total-1, area.atto, ua_marks[ua_marklinks2[last1]].anchor, ua_marks[ua_marklinks2[last0]].anchor, docking); // why dock_prev? intuition _recalcPos(total-1, area.atto, ua_marks[ua_marklinks2[last1]].anchor, ua_marks[ua_marklinks2[last0]].anchor, DOCK_NEXT); } else { #if 1 // _recalcPos(total-1, area.atto, ua_marks[ua_marklinks2[last]].anchor, ua_marks[ua_marklinks2[total]].anchor, docking == DOCK_PREV? DOCK_NEXT : docking == DOCK_NEXT? DOCK_PREV : DOCK_BETWEEN); // _recalcPos(total-1, area.atto, ua_marks[ua_marklinks2[last0]].anchor, ua_marks[ua_marklinks2[total]].anchor, docking == DOCK_PREV? DOCK_NEXT : docking == DOCK_NEXT? DOCK_PREV : DOCK_BETWEEN); _recalcPos(total-1, area.atto, ua_marks[ua_marklinks2[last0]].anchor, ua_marks[ua_marklinks2[total]].anchor, DOCK_NEXT); #else texts[total - 1].uarea_pos = texts[last].uarea_pos; #endif } } } } rearrange(BAR_VERT[area.atto], area.mirrored, texts, total); return true; } void _recalcPos(int i, ATTACHED_TO atto, const QPoint& mcur, const QPoint& mnext, int locdock) { int dx = mnext.x() - mcur.x(), dy = mnext.y() - mcur.y(); int ddo = 8; texts[i].pos_decay = 2; texts[i].pos_mark = QPoint(mcur.x() + dx/2, mcur.y() + dy/2); if (locdock == 0) // texts[i].pos_mark_dopdock = QPoint(mcur.x() + (dx > 0? dx/ddo < 2? 2 : dx/ddo : 0), mcur.y() + (dy > 0? dy/ddo < 2? 2 : dy/ddo : 0)); texts[i].pos_mark_dopdock = QPoint(mcur.x() + dx/ddo, mcur.y() + dy/ddo); else if (locdock == 1) texts[i].pos_mark_dopdock = texts[i].pos_mark; else // texts[i].pos_mark_dopdock = QPoint(mnext.x() - (dx > 0? dx/ddo < 2? 2 : dx/ddo : 0), mnext.y() - (dy > 0? dy/ddo < 2? 2 : dy/ddo : 0)); texts[i].pos_mark_dopdock = QPoint(mnext.x() - dx/ddo, mnext.y() - dy/ddo); texts[i].pos_update_fn = locdock == 0? POSFUNC_NM_UP[atto] : locdock == 1? POSFUNC_NM_MID[atto] : POSFUNC_NM_DOWN[atto]; if (!texts[i].uin_locsize.isNull()) texts[i].pos_update_fn(&texts[i]); // qDebug()<<i<<texts[i].pos_mark<<locdock; // if (atto == AT_LEFT) // texts[i].uarea_pos = mcur - QPoint(decayH + texts[i].uin_locsize.width(), locdock == 0? texts[i].uin_locsize.height() + 0 : // locdock == 1? (mcur.y() - mnext.y())/2 + texts[i].uin_locsize.height()/2 : // mcur.y() - mnext.y() // ); // else if (atto == AT_RIGHT) // texts[i].uarea_pos = mcur - QPoint(-decayH, locdock == 0? texts[i].uin_locsize.height() + 0 : // locdock == 1? (mcur.y() - mnext.y())/2 + texts[i].uin_locsize.height()/2 : // mcur.y() - mnext.y() // ); // else if (atto == AT_TOP) // texts[i].uarea_pos = mcur - QPoint( locdock == 0? 0 : // locdock == 1? (mcur.x() - mnext.x())/2 + texts[i].uin_locsize.width()/2 : // mcur.x() - mnext.x() + texts[i].uin_locsize.width(), // decayV + texts[i].uin_locsize.height()); // else if (atto == AT_BOTTOM) // texts[i].uarea_pos = mcur - QPoint( locdock == 0? 0 : // locdock == 1? (mcur.x() - mnext.x())/2 + texts[i].uin_locsize.width()/2 : // mcur.x() - mnext.x() + texts[i].uin_locsize.width(), // -decayV); // texts[i].uarea_atto = atto; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { MarginINMarks::sizeHint(atto, atto_size, minsegm_main, minsegm_pre, minsegm_post); QFontMetrics fm(m_font); int maxsymbols = cachedRTexttype() == RF_SETTAPS? cachedRdata().rel_tap_qstring.slen : max_symbols(); QSize meansize(SPACING_AFTERWIDTH + fm.averageCharWidth()*maxsymbols, SPACING_AFTERHEIGHT + fm.height()); int d_atto_size = BAR_VERT[atto]? meansize.width() : meansize.height(); // int d_half_dly = BAR_VERT[atto]? meansize.height()/4 : meansize.width()/4; // ? /4 ? int d_half_dly = 0; *atto_size = qMax(*atto_size, d_atto_size); *minsegm_pre += d_half_dly; *minsegm_post += d_half_dly; } protected: virtual void bdContentUpdateBounds(float LL, float HL, float mod) { const int total = countMaxiNoted + countMaxiHided - 1; float bndstep = qAbs(HL - LL)/total; MarginTextformat::numformatUpdate(LL, HL); if (mod != 0.0f) { float pv = LL; for (int i=0; i<total; i++) { if (postfixLimited()) turnPostfixByPosition(i, total); float v = LL + i*bndstep; v -= int(v/mod)*mod; if (i == total-1 && pv > v) { if (v < mod/120.0f) v += mod; // v = pv + bndstep; } assignText(&texts[i], redact(v), m_fontReplaced, m_font); pv = v; } } else for (int i=0; i<total; i++) { if (postfixLimited()) turnPostfixByPosition(i, total); assignText(&texts[i], redact(LL + i*bndstep), m_fontReplaced, m_font); } } virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float /*relatedoffset*/, const tapcontent_t& tctt) { for (int i=0; i<countMaxiNoted + countMaxiHided - 1; i++) { if (postfixLimited()) turnPostfixByPosition(i, countMaxiNoted + countMaxiHided - 1); tapfn(i, tctt.lmardimm, tctt.lmoffset, param, base); assignText(&texts[i], redact(base), m_fontReplaced, m_font); } } virtual void bdContentUpdateEnumerate(int from, int , int , float ) { MarginTextformat::numformatInteger(false); for (int i=0; i<countMaxiNoted + countMaxiHided - 1; i++) { if (postfixLimited()) turnPostfixByPosition(i, countMaxiNoted + countMaxiHided - 1); int num = from + i; assignText(&texts[i], redact(QString::number(num)), m_fontReplaced, m_font); } } }; MarginINMarksTextBetweenMark::~MarginINMarksTextBetweenMark(){} /******************************************************************************************************************/ /******************************************************************************************************************/ /******************************************************************************************************************/ class MarginINMarksWidgetBetween: public MarginINMarks { protected: static const int decayH = 2; static const int decayV = 2; protected: bool showLastEnumer; unsigned int submod; unsigned int maxperpendiculardimm; QVector<QWidget*> widgets; union wdgfill_t { struct { bool doretap; mtap_qwidget_fn ftor; void* fpm; } wf_dynamic; struct { QWidget** wlist; unsigned int wcount; } wf_static; } wfdetails; enum { WF_OFF, WF_STATIC, WF_DYNAMIC } wftype; QWidget* parent; public: MarginINMarksWidgetBetween(): showLastEnumer(false), submod(1), maxperpendiculardimm(0), wftype(WF_OFF){} ~MarginINMarksWidgetBetween(); void init_wide(int algotype, int marksLimit, int pixStep_minSpacing, unsigned int step, int roundsteps, bool alwaysShowLast, unsigned int maxperpdimm, mtap_qwidget_fn ftor, void* fpm, QWidget* prnt) { MarginINMarks::init(algotype, marksLimit, pixStep_minSpacing, roundsteps, 0); showLastEnumer = alwaysShowLast; submod = step; maxperpendiculardimm = maxperpdimm; { wftype = WF_DYNAMIC; wfdetails.wf_dynamic.doretap = true; wfdetails.wf_dynamic.ftor = ftor; wfdetails.wf_dynamic.fpm = fpm; } parent = prnt; } void init_wide(int algotype, int marksNwidgetsCount, int pixStep_minSpacing, unsigned int step, int roundsteps, bool alwaysShowLast, unsigned int maxperpdimm, QWidget* wdgs[], QWidget* prnt) { MarginINMarks::init(algotype, marksNwidgetsCount, pixStep_minSpacing, roundsteps, 0); showLastEnumer = alwaysShowLast; submod = step; maxperpendiculardimm = maxperpdimm; if (marksNwidgetsCount > 1) { wftype = WF_STATIC; wfdetails.wf_static.wcount = marksNwidgetsCount - 1; wfdetails.wf_static.wlist = new QWidget*[wfdetails.wf_static.wcount]; for (unsigned int i=0; i<wfdetails.wf_static.wcount; i++) { wdgs[i]->setParent(prnt); // wdgs[i] wfdetails.wf_static.wlist[i] = wdgs[i]; } } parent = prnt; } void retap() { if (wftype == WF_DYNAMIC) { wfdetails.wf_dynamic.doretap = true; if (mec_filled()) updateArea(mec_area(), UF_CONTENT); } } protected: virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { bool ua = MarginINMarks::updateArea(area, UPDATEFOR); if (ua == false && (UPDATEFOR != UF_CONTENT)) return false; const int total = countMaxiNoted + countMaxiHided - 1; if (wftype == WF_DYNAMIC && wfdetails.wf_dynamic.doretap) { for (int i=0; i<widgets.count(); i++) widgets[i]->deleteLater(); widgets.resize(total); for (int i=0; i<total; i++) { widgets[i] = wfdetails.wf_dynamic.ftor(i, ua_marks[ua_marklinks2[i]].anchor.x(), area.segm_main, wfdetails.wf_dynamic.fpm); widgets[i]->setParent(parent); if (BAR_VERT[area.atto]) widgets[i]->setMaximumWidth(maxperpendiculardimm); else widgets[i]->setMaximumHeight(maxperpendiculardimm); } wfdetails.wf_dynamic.doretap = false; } else if (wftype == WF_STATIC) { if (total > widgets.size()) { int ad = widgets.size(); for (int i=ad; i<total; i++) widgets.push_back(wfdetails.wf_static.wlist[i]); } else if (total < widgets.size()) { int ad = widgets.size(); for (int i=ad; i<total; i++) widgets[i]->setVisible(false); widgets.resize(total); } } int last=0, subctr = 0; for (int i=0; i<total; ) { if (ua_marklinks2[i] != -1) { int j=i+1; for (; j<total+1; j++) { if (ua_marklinks2[j] != -1) break; else widgets[j]->setVisible(false); } if (algoType == DBMODE_STATIC && j > total) widgets[i]->setVisible(false); else { widgets[last = i]->setVisible(subctr++ % int(submod) == 0); QPoint& mcur = ua_marks[ua_marklinks2[i]].anchor; //, &mnext = j == total+1? ua_marks[ua_marklinks2[i]].anchor : ua_marks[ua_marklinks2[j]].anchor; // if (area.atto == AT_LEFT) // widgets[i]->move(mcur - QPoint(decayH + qMin<int>(widgets[i]->width(), maxperpendiculardimm), -(mnext - mcur).y()/2 + texts[i].uin_locsize.height()/2)); // else if (area.atto == AT_RIGHT) // texts[i].uarea_pos = mcur - QPoint(-decayH, -(mnext - mcur).y()/2 + texts[i].uin_locsize.height()/2); // else if (area.atto == AT_TOP) // texts[i].uarea_pos = mcur - QPoint(-(mnext - mcur).x()/2 + texts[i].uin_locsize.width()/2, decayV + texts[i].uin_locsize.height()); // else if (area.atto == AT_BOTTOM) // texts[i].uarea_pos = mcur - QPoint(-(mnext - mcur).x()/2 + texts[i].uin_locsize.width()/2, -decayV); if (area.atto == AT_LEFT) widgets[i]->move(mcur - QPoint(-decayH + qMin<int>(widgets[i]->width(), maxperpendiculardimm), decayV)); else if (area.atto == AT_RIGHT) widgets[i]->move(mcur - QPoint(-decayH, decayV)); else if (area.atto == AT_TOP) widgets[i]->move(mcur - QPoint(-decayH, decayV + qMin<int>(widgets[i]->height(), maxperpendiculardimm))); else if (area.atto == AT_BOTTOM) widgets[i]->move(mcur - QPoint(-decayH, -decayV)); widgets[i]->setVisible(true); } i = j; } else widgets[i++]->setVisible(false); } if (showLastEnumer && last && !widgets[total-1]->isVisible()) { widgets[total - 1]->setVisible(true); if (last != total-1) widgets[last]->setVisible(false); } return true; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { MarginINMarks::sizeHint(atto, atto_size, minsegm_main, minsegm_pre, minsegm_post); // int d_atto_size = BAR_VERT[atto]? meansize.width()+2 : meansize.height()+2; int d_atto_size = maxperpendiculardimm + (BAR_VERT[atto]? decayH : decayV); int d_half_dly = 0; *atto_size = qMax(*atto_size, d_atto_size); *minsegm_pre += d_half_dly; *minsegm_post += d_half_dly; } public: }; MarginINMarksWidgetBetween::~MarginINMarksWidgetBetween(){} /************************************************************************************************************/ class MarginEXMarks: public MarginMarksBase { protected: memark_t* ua_marks; int countMaxiNoted, countMaxiHided, countMini; float odd, oddbase; int pixSpace; int miniPerMaxi; int divalgo; int round; // 0 - rounding, 1 - no round, 2 - no round and +1 for all except first and last int c_multiplier; protected: bool textInnerPlaced; texts_t* texts; public: MarginEXMarks(bool innerTextPlacement): ua_marks(nullptr), countMaxiNoted(0), countMaxiHided(0), countMini(0), pixSpace(0), miniPerMaxi(0), round(0), c_multiplier(0), textInnerPlaced(innerTextPlacement), texts(nullptr) { } ~MarginEXMarks(); void init(int marksLimit, float ODD, float ODDbase, int minSpacing, int roundsteps, int _miniPerMaxi, int _divalgo) /// marksLimit = 0 for init later { Q_ASSERT(ODD != 0.0f); odd = ODD; oddbase = ODDbase; pixSpace = minSpacing; miniPerMaxi = _miniPerMaxi; round = roundsteps; divalgo = _divalgo; if (marksLimit) { if (ua_marks) delete []ua_marks; countMaxiNoted = marksLimit; countMaxiHided = 0; countMini = 0; ua_marks = new memark_t[marksLimit + (marksLimit-1)*miniPerMaxi]; texts = new texts_t[marksLimit]; } } protected: virtual void draw(QPainter& painter) { if (c_color_redefined) for (int i=0; i<countMaxiNoted + (miniPerMaxi > 0? countMini : 0); i++) painter.fillRect(ua_marks[i].rect, c_color); else for (int i=0; i<countMaxiNoted + (miniPerMaxi > 0? countMini : 0); i++) painter.fillRect(ua_marks[i].rect, painter.brush()); for (int i=0; i<countMaxiNoted; i++) if (texts[i].visible) painter.drawStaticText(texts[i].c_pos_result, texts[i].uin_text); } virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) // forced for strict for bounds return false; storeDimm(area.segm_main); recalculate(area); return true; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { *atto_size = mlenmaxi + 2; *minsegm_main = 1; QFontMetrics fm(m_font); int maxsymbols = cachedRTexttype() == RF_SETTAPS? cachedRdata().rel_tap_qstring.slen : max_symbols(); QSize meansize(SPACING_AFTERWIDTH + fm.averageCharWidth()*maxsymbols, SPACING_AFTERHEIGHT + fm.height()); int d_atto_size = BAR_VERT[atto]? meansize.width() : meansize.height(); int d_half_dly = textInnerPlaced? 0 : BAR_VERT[atto]? meansize.height()/2 : meansize.width()/2; *atto_size += d_atto_size; *minsegm_pre = d_half_dly; *minsegm_post = d_half_dly; } protected: virtual void tfContentUpdate(){ if (mec_filled()) MarginElementCached::updateArea(mec_area(), UF_CONTENT); } protected: virtual void bdContentUpdateBounds(float LL, float HL, float /*mod*/) { MarginTextformat::numformatUpdate(LL, HL); if (mec_filled()) { c_multiplier = 0; recalculate(mec_area()); } } virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float relatedoffset, const tapcontent_t& tctt) { // for (int i=0; i<countMaxiNoted + countMaxiHided; i++) // { // tapfn(i, tctt.lmardimm, tctt.lmoffset, param, base); // assignText(&texts[i], redact(base), m_fontReplaced, m_font); // } if (mec_filled()) { c_multiplier = 0; } } virtual void bdContentUpdateEnumerate(int from, int count, int recycle, float relatedoffset) { MarginTextformat::numformatInteger(false); if (mec_filled()) { c_multiplier = 0; recalculate(mec_area()); } } private: float modcast(float v){ return v - int(v/cachedRdata().rel_fixed.MOD)*cachedRdata().rel_fixed.MOD; } float modcast2(float v, float pv) { float result = v - int(v/cachedRdata().rel_fixed.MOD)*cachedRdata().rel_fixed.MOD; if (result < pv && result < oddbase + cachedRdata().rel_fixed.MOD/120.0f) result += cachedRdata().rel_fixed.MOD; return result; } void recalculate(const uarea_t& area) { const int countMaxiTotal = countMaxiNoted + countMaxiHided; float LL = cachedRdata().rel_fixed.LL, HL = cachedRdata().rel_fixed.HL; bool isMOD = cachedRdata().rel_fixed.MOD != 0.0f; const int decays[] = { 3 + mlenmaxi, 3 + mlenmaxi, 0 + mlenmaxi, 0 + mlenmaxi }; bool doChangeLabel = false; int l1 = area.atto_begin; int l2 = area.atto_begin + (area.atto == AT_LEFT || area.atto == AT_TOP? -(mlenmaxi-1) : (mlenmaxi-1)); bool MVORIG = BAR_VERT[area.atto] ^ !area.mirrored; // original plus-based formula if (LL > HL) { MVORIG = !MVORIG; float tmp = LL; LL = HL; HL = tmp; } int multiplier = 1; { const int countMaxiInside = countMaxiTotal - 2; float countReglineF = (HL - LL)/odd; int divs0[] = { 1000, 10, 5, 2 }; // fixed len 4 int divs1[] = { 1500, 15, 5, 3 }; int divs2[] = { 100000, 1000, 100, 10 }; int* divs = divalgo == 2? divs2 : divalgo == 1? divs1 : divs0; // if (divalgo == 1) // qDebug()<<"15 3 2"; for (int d=0; d<4; d++) { while (countReglineF/divs[d] > countMaxiInside) { countReglineF /= divs[d]; multiplier *= divs[d]; } } if (countReglineF > countMaxiInside) { countReglineF /= divs[4-1]; multiplier *= divs[4-1]; } // qDebug()<<"<<<"<<area.segm_main<<pixSpace<<countReglineF; if (pixSpace > 0 && countReglineF > 1) { if (area.segm_main > pixSpace) { int inversedCount = int(countReglineF); while (area.segm_main / inversedCount < pixSpace) { inversedCount /= 2; multiplier *= 2; } } else { multiplier *= area.segm_main; } } doChangeLabel = multiplier != c_multiplier; c_multiplier = multiplier; } int m=0; float fpxStep=0; // multiplied true bnd-offset by odd int pxBegin=0; float fpxFirst=0; // dimm-offset by odd float fpxLast=0; int pxEnd=0; { float mover = LL; const int dimm_main = area.segm_main - 1; // pxBegin = MVORIG? area.segm_pre : area.segm_pre + area.segm_main - 1; // pxEnd = MVORIG? area.segm_pre + area.segm_main - 1 : area.segm_pre; pxBegin = MVORIG? area.segm_pre : area.segm_pre + dimm_main; pxEnd = MVORIG? area.segm_pre + dimm_main : area.segm_pre; ua_marks[m].anchor = area.atto == AT_LEFT || area.atto == AT_RIGHT ? QPoint(l1, pxBegin) : QPoint(pxBegin, l1); if (area.atto == AT_LEFT) ua_marks[m].rect.setCoords(l2, pxBegin, l1, pxBegin); else if (area.atto == AT_RIGHT) ua_marks[m].rect.setCoords(l1, pxBegin, l2, pxBegin); else if (area.atto == AT_TOP) ua_marks[m].rect.setCoords(pxBegin, l2, pxBegin, l1); else if (area.atto == AT_BOTTOM) ua_marks[m].rect.setCoords(pxBegin, l1, pxBegin, l2); texts[m].pos_mark = ua_marks[m].anchor; texts[m].pos_decay = decays[area.atto]; texts[m].pos_update_fn = textInnerPlaced ? area.mirrored? POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_UP[area.atto] : POSFUNC_NN_MID[area.atto]; if (doChangeLabel) { turnPostfixByPosition(0, countMaxiTotal); assignText(&texts[m], redact(isMOD? modcast(mover): mover), m_fontReplaced, m_font); } texts[m].pos_update_fn(&texts[m]); texts[m].visible = 1; m++; { if (doChangeLabel) { turnPostfixByPosition(1, countMaxiTotal); } float odd1 = multiplier*odd; mover = (LL - oddbase) - int((LL - oddbase)/odd1)*odd1; // bnd-offset by odd if (mover < 0) mover = LL - (odd1 + mover) + odd1; else mover = LL - mover + odd1; // int dlen0 = (mover - LL)/(HL - LL)*area.segm_main; // fpxFirst = pxBegin + (MVORIG? dlen0 : -dlen0); // fpxStep = (MVORIG? odd1 : -odd1)/(HL-LL)*area.segm_main; fpxFirst = pxBegin + (MVORIG? mover - LL : -(mover - LL))/(HL - LL)*dimm_main; fpxStep = (MVORIG? odd1 : -odd1)/(HL-LL)*dimm_main; #define FAST_ASSIGN_TEXT \ texts[m].pos_mark = ua_marks[m].anchor; \ texts[m].pos_decay = decays[area.atto]; \ texts[m].pos_update_fn = POSFUNC_NN_MID[area.atto]; \ if (doChangeLabel) \ assignText(&texts[m], redact(isMOD? modcast(mover): mover), m_fontReplaced, m_font); \ texts[m].pos_update_fn(&texts[m]); if (area.atto == AT_LEFT) { while (mover < HL) { Q_ASSERT(m + 2 <= countMaxiTotal); float pos1 = (m - 1)*fpxStep; switch (round) { case 0: fpxLast = qRound(fpxFirst + pos1); break; case 1: fpxLast = int(fpxFirst + pos1); break; case 2: fpxLast = int(fpxFirst + pos1) + 1; break; } ua_marks[m].anchor = QPoint(l1, fpxLast); ua_marks[m].rect.setCoords(l2, fpxLast, l1, fpxLast); FAST_ASSIGN_TEXT mover += odd1; m++; } } else if (area.atto == AT_RIGHT) { while (mover < HL) { Q_ASSERT(m + 2 <= countMaxiTotal); float pos1 = (m - 1)*fpxStep; switch (round) { case 0: fpxLast = qRound(fpxFirst + pos1); break; case 1: fpxLast = int(fpxFirst + pos1); break; case 2: fpxLast = int(fpxFirst + pos1) + 1; break; } ua_marks[m].anchor = QPoint(l1, fpxLast); ua_marks[m].rect.setCoords(l1, fpxLast, l2, fpxLast); FAST_ASSIGN_TEXT mover += odd1; m++; } } else if (area.atto == AT_TOP) { while (mover < HL) { Q_ASSERT(m + 2 <= countMaxiTotal); float pos1 = (m - 1)*fpxStep; switch (round) { case 0: fpxLast = qRound(fpxFirst + pos1); break; case 1: fpxLast = int(fpxFirst + pos1); break; case 2: fpxLast = int(fpxFirst + pos1) + 1; break; } ua_marks[m].anchor = QPoint(fpxLast, l1); ua_marks[m].rect.setCoords(fpxLast, l2, fpxLast, l1); FAST_ASSIGN_TEXT mover += odd1; m++; } } else if (area.atto == AT_BOTTOM) { while (mover < HL) { Q_ASSERT(m + 2 <= countMaxiTotal); float pos1 = (m - 1)*fpxStep; switch (round) { case 0: fpxLast = qRound(fpxFirst + pos1); break; case 1: fpxLast = int(fpxFirst + pos1); break; case 2: fpxLast = int(fpxFirst + pos1) + 1; break; } ua_marks[m].anchor = QPoint(fpxLast, l1); ua_marks[m].rect.setCoords(fpxLast, l1, fpxLast, l2); FAST_ASSIGN_TEXT mover += odd1; m++; } } #define FAST_CHECK_FOR_HIDE_TEXT(xy) \ int pxPrev = ua_marks[0].anchor.xy(); \ if (MVORIG) for (int i=1; i<m; i++){ \ if (ua_marks[i].anchor.xy() - pxPrev > pixSpace) \ { \ texts[i].visible = 1; \ pxPrev = ua_marks[i].anchor.xy(); \ } \ else \ texts[i].visible = 0; \ } \ else for (int i=1; i<m; i++){ \ if (pxPrev - ua_marks[i].anchor.xy() > pixSpace) \ { \ texts[i].visible = 1; \ pxPrev = ua_marks[i].anchor.xy(); \ } \ else \ texts[i].visible = 0; \ } if (area.atto == AT_LEFT) { FAST_CHECK_FOR_HIDE_TEXT(y) } else if (area.atto == AT_RIGHT) { FAST_CHECK_FOR_HIDE_TEXT(y) } else if (area.atto == AT_TOP) { FAST_CHECK_FOR_HIDE_TEXT(x) } else if (area.atto == AT_BOTTOM) { FAST_CHECK_FOR_HIDE_TEXT(x) } // for (int i=1; i<m; i++) // texts[i].visible = 1; if (m > 1) { // if (texts[m-1].visible) // texts[m-1].visible = (MVORIG ? (pxEnd - fpxLast) : -(pxEnd - fpxLast)) > (BAR_VERT[area.atto] ? texts[m-1].uin_locsize.height() : texts[m-1].uin_locsize.width())? 1 : 0; if (texts[m-1].visible) texts[m-1].visible = (MVORIG ? (pxEnd - fpxLast) : -(pxEnd - fpxLast)) > pixSpace? 1 : 0; } } ua_marks[m].anchor = area.atto == AT_LEFT || area.atto == AT_RIGHT ? QPoint(l1, pxEnd) : QPoint(pxEnd, l1); if (area.atto == AT_LEFT) ua_marks[m].rect.setCoords(l2, pxEnd, l1, pxEnd); else if (area.atto == AT_RIGHT) ua_marks[m].rect.setCoords(l1, pxEnd, l2, pxEnd); else if (area.atto == AT_TOP) ua_marks[m].rect.setCoords(pxEnd, l2, pxEnd, l1); else if (area.atto == AT_BOTTOM) ua_marks[m].rect.setCoords(pxEnd, l1, pxEnd, l2); texts[m].pos_mark = ua_marks[m].anchor; texts[m].pos_decay = decays[area.atto]; texts[m].pos_update_fn = textInnerPlaced ? area.mirrored? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_MID[area.atto]; if (doChangeLabel) { turnPostfixByPosition(countMaxiTotal-1, countMaxiTotal); assignText(&texts[m], redact(isMOD? modcast2(HL, mover): HL), m_fontReplaced, m_font); } texts[m].pos_update_fn(&texts[m]); texts[m].visible = 1; m++; } countMaxiNoted = m; countMaxiHided = countMaxiTotal - countMaxiNoted; Q_ASSERT(countMaxiHided >= 0); // void (*lposfunc_nn_mid)(texts_t*, int) = POSFUNC_NN_MID[area.atto]; // void (*lposfunc_nn_fnbeg)(texts_t*, int) = area.mirrored? POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_UP[area.atto]; // void (*lposfunc_nn_fnend)(texts_t*, int) = area.mirrored? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]; // for (int i=0; i<countMaxiNoted; i++) // { // if (textInnerPlaced && i == 0) // lposfunc_nn_fnbeg(&texts[i], decays[area.atto]); // else if (textInnerPlaced && i == countMaxiNoted - 1) // lposfunc_nn_fnend(&texts[i], decays[area.atto]); // else // lposfunc_nn_mid(&texts[i], decays[area.atto]); // } // rearrange(BAR_VERT[area.atto], area.mirrored, texts, countMaxiNoted); if (miniPerMaxi && qAbs(fpxStep)/(miniPerMaxi+1) > 5 && m > 2) { countMini = m; l2 = area.atto_begin + (area.atto == AT_LEFT || area.atto == AT_TOP? -(mlenmini-1) : (mlenmini-1)); float step2 = fpxStep/(miniPerMaxi+1); float pxMini = fpxFirst; int oddplus = 0, ncount=(m-2-1)*(miniPerMaxi + 1); // if (MVORIG) { if ((fpxFirst - pxBegin + 1) / step2 >= 2) { pxMini -= int((fpxFirst - pxBegin) / step2) * step2; oddplus = (fpxFirst - pxBegin) / step2; ncount += oddplus; } if ((pxEnd - fpxLast + 1) / step2 >= 2) { ncount += (pxEnd - fpxLast + 1) / step2; } } for (int i=0; i<ncount; i++) { if ((i - oddplus) % (miniPerMaxi+1) == 0) continue; int offs = int ( round == 0 ? qRound(pxMini + i*step2) : round == 1 ? pxMini + i*step2 : pxMini + (i*step2) + 1 ); // ua_marks[m].anchor = area.atto == AT_LEFT || area.atto == AT_RIGHT ? QPoint(l1, offs) : QPoint(offs, l1); if (area.atto == AT_LEFT) ua_marks[m].rect.setCoords(l2, offs, l1, offs); else if (area.atto == AT_RIGHT) ua_marks[m].rect.setCoords(l1, offs, l2, offs); else if (area.atto == AT_TOP) ua_marks[m].rect.setCoords(offs, l2, offs, l1); else if (area.atto == AT_BOTTOM) ua_marks[m].rect.setCoords(offs, l1, offs, l2); m++; } countMini = m - countMini; } else countMini = 0; Q_ASSERT(m <= countMaxiTotal + (countMaxiTotal-1)*miniPerMaxi); // qDebug()<<m<<countMaxiTotal + (countMaxiTotal-1)*miniPerMaxi; } }; MarginEXMarks::~MarginEXMarks() { if (ua_marks) delete []ua_marks; if (texts) delete []texts; } /**************************/ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //#define RAKOFLAG class MarginCallback; class MarginElement; class DrawBars_impl { public: DrawBars_impl(): c_mirroredHorz(false), c_mirroredVert(false), main_opacity(0.0f), drawBoundsUpdater(false), drawCoreInited(false) { } int c_hint_draw_width, c_hint_draw_height; bool c_mirroredHorz, c_mirroredVert; int c_width, c_height, c_overheadRight, c_overheadBottom; QMargins c_margins; int c_scalingHorz, c_scalingVert; bool expandNeighborBarsIfNeed; #ifdef RAKOFLAG bool rakoflag; #endif int clr_policy; bool c_back_fill; QBrush c_back_brush, c_front_brush; QPen c_front_pen; float main_opacity; bool drawBoundsUpdater; struct { int summ; int segm_minimal; int segm_pre; int segm_post; int c_size; } ttr[4]; public: enum { MIRALG_NONE, MIRALG_IGNORE, MIRALG_INVERT }; struct melem_t { MarginElement* pme; MEQWrapper* pwp; int offset, length; bool shared, visible, ivbanned; int miralg; melem_t(){} melem_t(MarginElement* _pme, MEQWrapper* _pwp, bool isshared, bool interventBanned, int _miralg): pme(_pme), pwp(_pwp), offset(0), length(0), shared(isshared), visible(true), ivbanned(interventBanned), miralg(_miralg) {} }; QVector<melem_t> elems[4]; QVector<MarginCallback*> elemsBoundDepended; QVector<MarginCallback*> elemsScrollDepended; QVector<MarginComplicated*> elemsBoundsSetupDepended; typedef QVector<melem_t>::iterator melem_iterator_t; bool drawCoreInited; void clearTTR(ATTACHED_TO atto) { ttr[atto].summ = ttr[atto].segm_minimal = ttr[atto].segm_pre = ttr[atto].segm_post = /*ttr[atto].c_dly = */ttr[atto].c_size = 0; } void clearTTR() { for (int i=0; i<4; i++) clearTTR(ATTACHED_TO(i)); } void updateTTR() { ttr[AT_LEFT].c_size = qMax(ttr[AT_LEFT].summ, qMax(ttr[AT_TOP].segm_pre, ttr[AT_BOTTOM].segm_pre)); ttr[AT_RIGHT].c_size = qMax(ttr[AT_RIGHT].summ, qMax(ttr[AT_TOP].segm_post, ttr[AT_BOTTOM].segm_post)); ttr[AT_TOP].c_size = qMax(ttr[AT_TOP].summ, qMax(ttr[AT_LEFT].segm_pre, ttr[AT_RIGHT].segm_pre)); ttr[AT_BOTTOM].c_size = qMax(ttr[AT_BOTTOM].summ, qMax(ttr[AT_LEFT].segm_post, ttr[AT_RIGHT].segm_post)); } void reupdateBars(int UF_LEFT, int UF_RIGHT, int UF_TOP, int UF_BOTTOM) // Any cttr changed -> all areas need to be updated { MarginElement::uarea_t areaVert = { AT_LEFT, 0,0, ttr[AT_TOP].c_size, c_height - ttr[AT_TOP].c_size - ttr[AT_BOTTOM].c_size - c_overheadBottom, ttr[AT_BOTTOM].c_size, c_overheadBottom, c_height, c_mirroredVert, c_scalingVert }; if (UF_LEFT != -1 && areaVert.segm_main > 0) for (int i=0; i<elems[0].count(); i++) { int apt = ttr[AT_LEFT].c_size - 1 - elems[0][i].offset; areaVert.atto_begin = apt; areaVert.atto_end = apt - elems[0][i].length; areaVert.mirrored = elems[0][i].miralg == MIRALG_IGNORE? elems[0][i].miralg == MIRALG_INVERT? true : false : elems[0][i].miralg == MIRALG_INVERT? !c_mirroredVert : c_mirroredVert; elems[0][i].pme->updateArea(areaVert, UF_LEFT); } areaVert.atto = AT_RIGHT; if (UF_RIGHT != -1 && areaVert.segm_main > 0) for (int i=0; i<elems[1].count(); i++) { int apt = c_width - 1 - ttr[AT_RIGHT].c_size + 1 + elems[1][i].offset; areaVert.atto_begin = apt; areaVert.atto_end = apt + elems[1][i].length; areaVert.mirrored = elems[1][i].miralg == MIRALG_IGNORE? elems[1][i].miralg == MIRALG_INVERT? true : false : elems[1][i].miralg == MIRALG_INVERT? !c_mirroredVert : c_mirroredVert; elems[1][i].pme->updateArea(areaVert, UF_RIGHT); } MarginElement::uarea_t areaHorz = { AT_TOP, 0,0, ttr[AT_LEFT].c_size, c_width - ttr[AT_LEFT].c_size - ttr[AT_RIGHT].c_size - c_overheadRight, ttr[AT_RIGHT].c_size, c_overheadRight, c_width, c_mirroredHorz, c_scalingHorz }; if (UF_TOP != -1 && areaHorz.segm_main > 0) for (int i=0; i<elems[2].count(); i++) { int apt = ttr[AT_TOP].c_size - 1 - elems[2][i].offset; areaHorz.atto_begin = apt; areaHorz.atto_end = apt - elems[2][i].length; areaHorz.mirrored = elems[2][i].miralg == MIRALG_IGNORE? elems[2][i].miralg == MIRALG_INVERT? true : false : elems[2][i].miralg == MIRALG_INVERT? !c_mirroredHorz : c_mirroredHorz; elems[2][i].pme->updateArea(areaHorz, UF_TOP); } areaHorz.atto = AT_BOTTOM; if (UF_BOTTOM != -1 && areaHorz.segm_main > 0) for (int i=0; i<elems[3].count(); i++) { int apt = c_height - 1 - ttr[AT_BOTTOM].c_size + 1 + elems[3][i].offset; areaHorz.atto_begin = apt; areaHorz.atto_end = apt + elems[3][i].length; areaHorz.mirrored = elems[3][i].miralg == MIRALG_IGNORE? elems[3][i].miralg == MIRALG_INVERT? true : false : elems[3][i].miralg == MIRALG_INVERT? !c_mirroredHorz : c_mirroredHorz; elems[3][i].pme->updateArea(areaHorz, UF_BOTTOM); } } void reupdateBars_oneSide(ATTACHED_TO atto) { int flags[] = { -1, -1, -1, -1 }; flags[atto] = MarginElement::UF_FORCED; reupdateBars(flags[0], flags[1], flags[2], flags[3]); } void reupdateBars_symmetric(ATTACHED_TO atto) { const int sym[] = { AT_RIGHT, AT_LEFT, AT_BOTTOM, AT_TOP }; int flags[] = { -1, -1, -1, -1 }; flags[atto] = MarginElement::UF_FORCED; flags[sym[atto]] = MarginElement::UF_FORCED; reupdateBars(flags[0], flags[1], flags[2], flags[3]); } void reupdateBars_forced() { reupdateBars(MarginElement::UF_FORCED, MarginElement::UF_FORCED, MarginElement::UF_FORCED, MarginElement::UF_FORCED); } void recalcTTRforBar(ATTACHED_TO atto, int* delta_summ=nullptr, int* delta_segm=nullptr) { int total=0, total_prev=0; int segm_min=-1; int maxsegm_pre=0, maxsegm_post=0; for (melem_iterator_t iter=elems[atto].begin(); iter!=elems[atto].end(); iter++) { #if 0 // old variant of shared area if (iter->shared && total != 0) { iter->offset = total_prev; iter->length = total - total_prev; } else { int atto_size, minsegm_main, cursegm_pre, cursegm_post; iter->pme->sizeHint(atto, &atto_size, &minsegm_main, &cursegm_pre, &cursegm_post); iter->offset = total; iter->length = atto_size; total_prev = total; total += atto_size; if (iter->ivbanned == false) { if (maxsegm_pre < cursegm_pre) maxsegm_pre = cursegm_pre; if (maxsegm_post < cursegm_post) maxsegm_post = cursegm_post; } } #else int atto_size, cursegm_main, cursegm_pre, cursegm_post; iter->pme->sizeHint(atto, &atto_size, &cursegm_main, &cursegm_pre, &cursegm_post); if (iter->shared && total != 0) { iter->length = atto_size; // if (total_prev < atto_size) // total_prev = atto_size; iter->offset = total_prev/* + iter->length*/; } else { iter->offset = total; iter->length = atto_size; total_prev = total; total += atto_size; if (segm_min < cursegm_main) segm_min = cursegm_main; if (iter->ivbanned == false) { if (maxsegm_pre < cursegm_pre) maxsegm_pre = cursegm_pre; if (maxsegm_post < cursegm_post) maxsegm_post = cursegm_post; } } #endif } if (delta_summ) *delta_summ = total - ttr[atto].summ; if (delta_segm) *delta_segm = segm_min - ttr[atto].segm_minimal; ttr[atto].summ = total; ttr[atto].segm_minimal = segm_min; ttr[atto].segm_pre = maxsegm_pre; ttr[atto].segm_post = maxsegm_post; updateTTR(); } bool excludeElement(MarginElement* me, ATTACHED_TO* atto=nullptr) { for (int d=0; d<4; d++) for (melem_iterator_t iter=elems[d].begin(); iter!=elems[d].end(); iter++) if (iter->pme == me) { if (atto) *atto = ATTACHED_TO(d); elems[d].erase(iter); return true; } return false; } public: // void setDefaultColors(QWidget* wdg) // { // QPalette pal; // wdg->setAutoFillBackground(true); // wdg->setPalette(pal); // clr_back = pal.color(QPalette::Window); // clr_front = pal.color(QPalette::WindowText); // } // void setColors(QWidget* wdg, const QColor& bckg, const QColor& frg) // { // QPalette pal; // pal.setColor(QPalette::Window, clr_back = bckg); // pal.setColor(QPalette::WindowText, clr_front = frg); //// pal.setBrush(QPalette::WindowText, //// wdg->setAutoFillBackground(true); // wdg->setPalette(pal); // } void updatePalette(QWidget* wdg, const QColor& clr_back, const QColor& clr_front) { QPalette pal(wdg->palette()); pal.setColor(QPalette::Window, clr_back); pal.setColor(QPalette::WindowText, clr_front); wdg->setPalette(pal); c_back_fill = true; c_back_brush = clr_back; c_front_brush = clr_front; c_front_pen = clr_front; } void updatePalette(QWidget* wdg, const QColor& clr_front, bool getback=false) { QPalette pal(wdg->palette()); pal.setColor(QPalette::WindowText, clr_front); wdg->setPalette(pal); c_back_fill = getback; if (c_back_fill) c_back_brush = pal.color(QPalette::Window); c_front_brush = clr_front; c_front_pen = clr_front; } void upbackPalette(QWidget* wdg) { c_back_fill = false; // c_back_brush = wdg->palette().color(QPalette::Window); QColor clr_front = wdg->palette().color(QPalette::WindowText); c_front_brush = clr_front; c_front_pen = clr_front; } }; #define COLOR3(clr) (clr) & 0xFF, (clr >> 8) & 0xFF, (clr >> 16) & 0xFF inline bool isDrawPaletteCP(int cp) { return cp == DrawBars::CP_FROM_DRAWBACK || cp == DrawBars::CP_FROM_DRAWPALETTE || cp == DrawBars::CP_FROM_DRAWPALETTE_INV; } DrawBars::DrawBars(DrawQWidget* pdraw, COLORS colorsPolicy, QWidget *parent) : QWidget(parent), pDraw(pdraw), pTool(nullptr) { this->setAutoFillBackground(false); pImpl = new DrawBars_impl(); setColorPolicy(colorsPolicy); // pImpl->rakoflag = false; pImpl->clearTTR(); pDraw->setParent(this); pDraw->move(pImpl->ttr[AT_LEFT].summ, pImpl->ttr[AT_TOP].summ); pDraw->show(); pImpl->c_mirroredHorz = orientationMirroredHorz(pDraw->orientation()); pImpl->c_mirroredVert = orientationMirroredVert(pDraw->orientation()); QSize sdraw = pDraw->size()/* * pDraw->devicePixelRatio()*/; pImpl->c_hint_draw_width = sdraw.width(); pImpl->c_hint_draw_height = sdraw.height(); pImpl->c_width = pImpl->c_height = 0; pImpl->c_margins = QMargins(0,0,0,0); pImpl->c_scalingHorz = pDraw->scalingHorz(); pImpl->c_scalingVert = pDraw->scalingVert(); #ifdef RAKOFLAG pImpl->rakoflag = true; #endif // setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } DrawBars::~DrawBars() { for (int d=0; d<4; d++) for (int i=0; i<pImpl->elems[d].count(); i++) delete pImpl->elems[d][i].pme; delete pImpl; } void DrawBars::setColorPolicy(DrawBars::COLORS cp) { pImpl->clr_policy = cp; if (isDrawPaletteCP(cp) && pDraw->dataPalette()!= nullptr) { const IPalette* ppal = pDraw->dataPalette(); unsigned int fc = ppal->first(), lc = ppal->last(); if (cp == CP_FROM_DRAWPALETTE_INV) qSwap(fc, lc); else if (cp == CP_FROM_DRAWBACK) fc = pDraw->colorBack(); pImpl->updatePalette(this, QColor(COLOR3(fc)), QColor(COLOR3(lc))); } else if (cp == CP_WHITE) pImpl->updatePalette(this, QColor(Qt::white)); else if (cp == CP_BLACK) pImpl->updatePalette(this, QColor(Qt::black)); else /// strict movement to default { pImpl->clr_policy = CP_DEFAULT; pImpl->upbackPalette(this); } } void DrawBars::setColors(const QColor& backgroundColor, const QColor& foregroundColor) { pImpl->clr_policy = -1; pImpl->updatePalette(this, backgroundColor, foregroundColor); } void DrawBars::setColors(unsigned int backgroundColor, unsigned int foregroundColor) { pImpl->clr_policy = -1; pImpl->updatePalette(this, QColor(COLOR3(backgroundColor)), QColor(COLOR3(foregroundColor))); } void DrawBars::setOpacity(float opacity) { pImpl->main_opacity = opacity; } void DrawBars::enableDrawBoundsUpdater(bool v) { pImpl->drawBoundsUpdater = v; } //void DrawBars::slot_setBackgroundColor(const QColor& color) //{ // setColors(color, pImpl->clr_front); //} void DrawBars::slot_setForegroundColor(const QColor& color) { // setColors(pImpl->clr_back, color); pImpl->updatePalette(this, color); } DrawQWidget* DrawBars::getDraw(){ return pDraw; } DrawQWidget* DrawBars::draw(){ return pDraw; } const DrawQWidget* DrawBars::getDraw() const { return pDraw; } const DrawQWidget* DrawBars::draw() const { return pDraw; } QRect DrawBars::getDrawGeometry() const { return QRect(pImpl->c_margins.left() + pImpl->ttr[AT_LEFT].c_size, pImpl->c_margins.top() + pImpl->ttr[AT_TOP].c_size, pDraw->width(), pDraw->height()); } DrawQWidget* DrawBars::replaceDraw(DrawQWidget* newdraw) { DrawQWidget* old = pDraw; pDraw = newdraw; update(); return old; } int DrawBars::barSize(ATTACHED_TO atto) const { return pImpl->ttr[atto].c_size; } #define PDRAWMOVE pDraw->move(pImpl->c_margins.left() + pImpl->ttr[AT_LEFT].c_size, pImpl->c_margins.top() + pImpl->ttr[AT_TOP].c_size); MEQWrapper* DrawBars::addMarginElement(ATTACHED_TO atto, MarginElement* pme, MEQWrapper* pwp, bool sharedWithPrev, bool interventBanned, int miralg) { // bool cttr_updated = true; ATTACHED_TO atto_was = atto; if (pImpl->excludeElement(pme, &atto_was)) pImpl->recalcTTRforBar(atto_was); pme->relatedInit(pDraw); pImpl->elems[int(atto)].push_back(DrawBars_impl::melem_t(pme, pwp, sharedWithPrev, interventBanned, miralg)); pImpl->recalcTTRforBar(atto); pImpl->reupdateBars_oneSide(atto); #ifdef RAKOFLAG if (pImpl->rakoflag == false) #endif { rollbackGeometry(); } if (pwp != nullptr) { pwp->m_pme = pme; pwp->m_premote = this; } // updateGeometry(); return pwp; } inline int countMaxNumbers(int marksLimit) { static int power[] = { 0, 10, 100, 1000, 10000, 100000, 1000000, 10000000 }; static const int pcount = sizeof(power)/sizeof(unsigned int); for (int i=0; i<pcount; i++) if (marksLimit < power[i]) return i; return -1; } #define MARG_OPTS_TEXT if (flags & _DBF_PRECISION_GROUP) \ { \ int pp = ((flags & _DBF_PRECISION_GROUP) >> 16) - 1; \ const int precision_relatives[] = { 1,2,-1,2 }; \ if (pp < 4) pmarg->numformatOffset(precision_relatives[pp]); \ else pmarg->numformatFix(pp - 4); \ } \ flags & DBF_POSTFIX_TO_PREFIX? pmarg->setPrefix(postfix) : pmarg->setPostfix(postfix); \ pmarg->setPostfixPositions(flags & DBF_POSTFIX_ONLYLAST? MarginTextformat::PEX_LAST : MarginTextformat::PEX_ALL); \ pmarg->setFont(this->font()); #define EXTRACT_MIRALG(f) ((f >> 1) & 0x3) #define DB_ROUNDING(flags) (flags & DBF_MARKS_ROUNDING_ON? 0 : flags & DBF_MARKS_ROUNDING_OFF_INC? 2 : 1) #define DB_NATIVE(flags) ((flags & 0xF00000) == DBF_NATIVE_DIV_10 ? 2: (flags & 0xF00000) == DBF_NATIVE_DIV_15_5_3 ? 1: 0) MEWLabel* DrawBars::addLabel(ATTACHED_TO atto, int flags, QString text, Qt::Alignment align, Qt::Orientation orient) { MarginLabel* pmarg = new MarginLabel(text, this->font(), flags & DBF_LABELAREA_FULLBAR, align, orient); return (MEWLabel*)addMarginElement(atto, pmarg, new MEWLabel, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWSpace* DrawBars::addSpace(ATTACHED_TO atto, int space) { MarginElement* pmarg = new MarginSpace(space); return (MEWSpace*)addMarginElement(atto, pmarg, new MEWSpace, false, false, 0); } MEWColoredSpace* DrawBars::addSpace(ATTACHED_TO atto, int space, QColor color, bool maxzone) { MarginElement* pmarg = new MarginColoredSpace(space, color, maxzone); return (MEWColoredSpace*)addMarginElement(atto, pmarg, new MEWColoredSpace, false, false, 0); } //MEWSpace*DrawBars::addStretch(ATTACHED_TO atto, int space, int stepSelf, int stepDraw) //{ //} MEWSpace* DrawBars::addContour(ATTACHED_TO atto, int space, bool maxzone) { MarginElement* pmarg = new MarginContour(space, maxzone); return (MEWSpace*)addMarginElement(atto, pmarg, new MEWSpace, false, false, 0); } MEWSpace*DrawBars::addContour(ATTACHED_TO atto, int space, QColor color, bool maxzone) { MarginElement* pmarg = new MarginContour(space, color, maxzone); return (MEWSpace*)addMarginElement(atto, pmarg, new MEWSpace, false, false, 0); } MEWPointer* DrawBars::addPointerRelativeOwnbounds(ATTACHED_TO atto, int flags, float pos, float LL, float HL, int marklen, float MOD, const char* postfix) { MarginPointer* pmarg = new MarginPointer(DB_ROUNDING(flags), marklen, pos, false, pDraw->orientation(), flags & DBF_NOTESINSIDE, Qt::AlignCenter); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); return (MEWPointer*)addMarginElement(atto, pmarg, new MEWPointer, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWPointer*DrawBars::addPointerAbsoluteOwnbounds(ATTACHED_TO atto, int flags, float pos, float LL, float HL, int marklen, float MOD, const char* postfix) { MarginPointer* pmarg = new MarginPointer(DB_ROUNDING(flags), marklen, pos, true, pDraw->orientation(), flags & DBF_NOTESINSIDE, Qt::AlignCenter); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); return (MEWPointer*)addMarginElement(atto, pmarg, new MEWPointer, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWPointer* DrawBars::addPointerRelativeDrawbounds(ATTACHED_TO atto, int flags, float pos, int marklen, float MOD, const char* postfix) { MarginPointer* pmarg = new MarginPointer(DB_ROUNDING(flags), marklen, pos, false, pDraw->orientation(), flags & DBF_NOTESINSIDE, Qt::AlignCenter); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); pImpl->elemsBoundDepended.push_back(pmarg); return (MEWPointer*)addMarginElement(atto, pmarg, new MEWPointer, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWPointer*DrawBars::addPointerAbsoluteDrawbounds(ATTACHED_TO atto, int flags, float pos, int marklen, float MOD, const char* postfix) { MarginPointer* pmarg = new MarginPointer(DB_ROUNDING(flags), marklen, pos, true, pDraw->orientation(), flags & DBF_NOTESINSIDE, Qt::AlignCenter); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); pImpl->elemsBoundDepended.push_back(pmarg); return (MEWPointer*)addMarginElement(atto, pmarg, new MEWPointer, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWPointer* DrawBars::addEPointer01Auto(ATTACHED_TO atto, int flags, float pos, int marklen, const char* postfix) { MarginPointer* pmarg = new MarginPointer(DB_ROUNDING(flags), marklen, pos, false, pDraw->orientation(), flags & DBF_NOTESINSIDE, Qt::AlignCenter); MARG_OPTS_TEXT int sizeDimm = BAR_VERT[atto]? int(pDraw->sizeDataVert() + 1) : int(pDraw->sizeDataHorz() + 1); pmarg->bdContentUpdate(RF_SETENUMERATE, relatedopts_t(sizeDimm-1, flags & DBF_ENUMERATE_FROMZERO? 0 : 1, -1)); // ????? return (MEWPointer*)addMarginElement(atto, pmarg, new MEWPointer, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } //////////////////////////// MEWScale* DrawBars::addScalePixstepEmpty(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, int miniPerMaxi) { MarginINMarks* pmarg = new MarginINMarks(); pmarg->init(DBMODE_STRETCHED, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*minSpacing; else pImpl->c_hint_draw_width = marksLimit*minSpacing; // updateGeometry(); } return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScaleSymmetricEmpty(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, int miniPerMaxi) { MarginINMarks* pmarg = new MarginINMarks(); pmarg->init(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*minSpacing; else pImpl->c_hint_draw_width = marksLimit*minSpacing; // updateGeometry(); } return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScaleRollingEmpty(ATTACHED_TO atto, int flags, int marksLimit, int pixStep, int miniPerMaxi) { MarginINMarks* pmarg = new MarginINMarks(); pmarg->init(DBMODE_STRETCHED_POW2, marksLimit, pixStep, DB_ROUNDING(flags), miniPerMaxi); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*pixStep; else pImpl->c_hint_draw_width = marksLimit*pixStep; // updateGeometry(); } return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNN* DrawBars::addScaleNativeOwnbounds(ATTACHED_TO atto, int flags, float LL, float HL, float minSTEP, float minSTEPbase, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginEXMarks* pmarg = new MarginEXMarks(flags & DBF_NOTESINSIDE); pmarg->init(marksLimit, minSTEP, minSTEPbase, minSpacing, DB_ROUNDING(flags), miniPerMaxi, DB_NATIVE(flags)); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*minSpacing; else pImpl->c_hint_draw_width = marksLimit*minSpacing; // updateGeometry(); } // pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScaleNN*)addMarginElement(atto, pmarg, new MEWScaleNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNN* DrawBars::addScalePixstepOwnbounds(ATTACHED_TO atto, int flags, float LL, float HL, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg; if (flags & DBF_NOTE_BORDERS_ONLY) pmarg = new MarginINMarks2only(flags & DBF_NOTESINSIDE); else pmarg = new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*minSpacing; else pImpl->c_hint_draw_width = marksLimit*minSpacing; // updateGeometry(); } // pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScaleNN*)addMarginElement(atto, pmarg, new MEWScaleNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNN* DrawBars::addScaleSymmetricOwnbounds(ATTACHED_TO atto, int flags, float LL, float HL, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg; if (flags & DBF_NOTE_BORDERS_ONLY) pmarg = new MarginINMarks2only(flags & DBF_NOTESINSIDE); else pmarg = new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*minSpacing; else pImpl->c_hint_draw_width = marksLimit*minSpacing; // updateGeometry(); } // pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScaleNN*)addMarginElement(atto, pmarg, new MEWScaleNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNN* DrawBars::addScaleRollingOwnbounds(ATTACHED_TO atto, int flags, float LL, float HL, int marksLimit, int pixStep, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg; if (flags & DBF_NOTE_BORDERS_ONLY) pmarg = new MarginINMarks2only(flags & DBF_NOTESINSIDE); else pmarg = new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STATIC, marksLimit, pixStep, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL), MOD)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*pixStep; else pImpl->c_hint_draw_width = marksLimit*pixStep; // updateGeometry(); } // pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScaleNN*)addMarginElement(atto, pmarg, new MEWScaleNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScaleNativeDrawbounds(ATTACHED_TO atto, int flags, float minSTEP, float minSTEPbase, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginEXMarks* pmarg = new MarginEXMarks(flags & DBF_NOTESINSIDE); pmarg->init(marksLimit, minSTEP, minSTEPbase, minSpacing, DB_ROUNDING(flags), miniPerMaxi, DB_NATIVE(flags)); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); if (flags & DBF_MINSIZE_BY_MINSPACING) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(minSpacing); else pImpl->c_hint_draw_width = marksLimit*(minSpacing); // updateGeometry(); } pImpl->elemsBoundDepended.push_back(/*(MarginCallback*)*/pmarg); pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScalePixstepDrawbounds(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); if (flags & DBF_MINSIZE_BY_MINSPACING) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(minSpacing); else pImpl->c_hint_draw_width = marksLimit*(minSpacing); // updateGeometry(); } pImpl->elemsBoundDepended.push_back(/*(MarginCallback*)*/pmarg); pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScaleSymmetricDrawbounds(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); if (flags & DBF_MINSIZE_BY_MINSPACING) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(minSpacing); else pImpl->c_hint_draw_width = marksLimit*(minSpacing); // updateGeometry(); } pImpl->elemsBoundDepended.push_back(/*(MarginCallback*)*/pmarg); pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addScaleRollingDrawbounds(ATTACHED_TO atto, int flags, int marksLimit, int pixStep, int miniPerMaxi, float MOD, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STATIC, marksLimit, pixStep, DB_ROUNDING(flags), miniPerMaxi); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(pDraw->bounds(), MOD)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(pixStep); else pImpl->c_hint_draw_width = marksLimit*(pixStep); // updateGeometry(); } pImpl->elemsBoundDepended.push_back(/*(MarginCallback*)*/pmarg); pImpl->elemsBoundsSetupDepended.push_back(pmarg); return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } //MEWScaleNM* DrawBars::addEScaleNativeOwnbounds(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, unsigned int step, const char* postfix) //{ // MarginEXMarks* pmarg = new MarginEXMarks(); // pmarg->init(marksLimit, step, 0, minSpacing, DB_ROUNDING(flags), 0); // flags & DBF_ENUMERATE_SHOWLAST, flags & DBF_DOCKTO_PREVMARK? 0 : flags & DBF_DOCKTO_NEXTMARK? 2 : 1); // MARG_OPTS_TEXT // pmarg->bdContentUpdate(RF_SETENUMERATE, relatedopts_t(countMaxNumbers(marksLimit-1), flags & DBF_ENUMERATE_FROMZERO? 0 : 1, -1)); // if (flags & DBF_MINSIZE_BY_PIXSTEP) // { // if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; // else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; //// updateGeometry(); // } // return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); //} MEWScaleNM* DrawBars::addEScalePixstepOwnbounds(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, unsigned int step, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); pmarg->init_wide(DBMODE_STRETCHED, marksLimit, minSpacing, step, DB_ROUNDING(flags), flags & DBF_ENUMERATE_SHOWLAST, flags & DBF_DOCKTO_PREVMARK? 0 : flags & DBF_DOCKTO_NEXTMARK? 2 : 1); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETENUMERATE, relatedopts_t(countMaxNumbers(marksLimit-1), flags & DBF_ENUMERATE_FROMZERO? 0 : 1, -1)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNM* DrawBars::addEScaleRollingOwnbounds(ATTACHED_TO atto, int flags, int marksLimit, int minSpacing, unsigned int step, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); pmarg->init_wide(DBMODE_STATIC, marksLimit, minSpacing, step, DB_ROUNDING(flags), flags & DBF_ENUMERATE_SHOWLAST, flags & DBF_DOCKTO_PREVMARK? 0 : flags & DBF_DOCKTO_NEXTMARK? 2 : 1); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETENUMERATE, relatedopts_t(countMaxNumbers(marksLimit-1), flags & DBF_ENUMERATE_FROMZERO? 0 : 1, -1)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScale* DrawBars::addEScalePixstepDrawbounds(ATTACHED_TO atto, int flags, int minSpacing, unsigned int step, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); MARG_OPTS_TEXT int sizeDimm = BAR_VERT[atto]? int(pDraw->sizeDataVert() + 1) : int(pDraw->sizeDataHorz() + 1); pmarg->init_wide(DBMODE_STRETCHED, sizeDimm, minSpacing, step, DB_ROUNDING(flags), flags & DBF_ENUMERATE_SHOWLAST, flags & DBF_DOCKTO_PREVMARK? DOCK_PREV : flags & DBF_DOCKTO_NEXTMARK? DOCK_NEXT : DOCK_BETWEEN); pmarg->bdContentUpdate(RF_SETENUMERATE, relatedopts_t(countMaxNumbers(sizeDimm-1), flags & DBF_ENUMERATE_FROMZERO? 0 : 1, -1)); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (sizeDimm-1)*(minSpacing); else pImpl->c_hint_draw_width = (sizeDimm)*(minSpacing); // updateGeometry(); } return (MEWScale*)addMarginElement(atto, pmarg, new MEWScale, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNN* DrawBars::addScalePixstepTapNN(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int minSpacing, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED, marksLimit, minSpacing, DB_ROUNDING(flags), 0); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(minSpacing); else pImpl->c_hint_draw_width = marksLimit*(minSpacing); // updateGeometry(); } return (MEWScaleTAPNN*)addMarginElement(atto, pmarg, new MEWScaleTAPNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNN* DrawBars::addScaleSymmetricTapNN(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int minSpacing, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, DB_ROUNDING(flags), 0); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(minSpacing); else pImpl->c_hint_draw_width = marksLimit*(minSpacing); // updateGeometry(); } return (MEWScaleTAPNN*)addMarginElement(atto, pmarg, new MEWScaleTAPNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNN* DrawBars::addScaleRollingTapNN(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int pixStep, const char* postfix) { MarginINMarks* pmarg = flags & DBF_NOTE_BORDERS_ONLY? (MarginINMarks*)new MarginINMarks2only(flags & DBF_NOTESINSIDE) : (MarginINMarks*)new MarginINMarksTextToMark(flags & DBF_NOTESINSIDE); pmarg->init(DBMODE_STATIC, marksLimit, pixStep, DB_ROUNDING(flags), 0); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = marksLimit*(pixStep); else pImpl->c_hint_draw_width = marksLimit*(pixStep); // updateGeometry(); } if ((flags & DBF_NO_RETAP_ON_SCROLL) == 0) pImpl->elemsScrollDepended.push_back(pmarg); return (MEWScaleTAPNN*)addMarginElement(atto, pmarg, new MEWScaleTAPNN, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addScalePixstepTapNM(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int minSpacing, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); pmarg->init_wide(DBMODE_STRETCHED, marksLimit, minSpacing, 1, DB_ROUNDING(flags), true, flags & DBF_DOCKTO_PREVMARK? DOCK_PREV : flags & DBF_DOCKTO_NEXTMARK? DOCK_NEXT : DOCK_BETWEEN); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addScaleSymmetricTapNM(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int minSpacing, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); pmarg->init_wide(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, 1, DB_ROUNDING(flags), true, flags & DBF_DOCKTO_PREVMARK? DOCK_PREV : flags & DBF_DOCKTO_NEXTMARK? DOCK_NEXT : DOCK_BETWEEN); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addScaleRollingTapNM(ATTACHED_TO atto, int flags, mtap_qstring_fn fn, int maxtextlen, const void* param, int marksLimit, int pixStep, const char* postfix) { MarginINMarksTextBetweenMark* pmarg = new MarginINMarksTextBetweenMark(); pmarg->init_wide(DBMODE_STATIC, marksLimit, pixStep, 1, DB_ROUNDING(flags), true, flags & DBF_DOCKTO_PREVMARK? DOCK_PREV : flags & DBF_DOCKTO_NEXTMARK? DOCK_NEXT : DOCK_BETWEEN); MARG_OPTS_TEXT pmarg->bdContentUpdate(RF_SETTAPS, relatedopts_t(fn, param, maxtextlen)); pmarg->setUpdateOnSetDimm(flags & DBF_RETAP_ON_RESIZE); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*pixStep; else pImpl->c_hint_draw_width = (marksLimit-1)*pixStep; // updateGeometry(); } if ((flags & DBF_NO_RETAP_ON_SCROLL) == 0) pImpl->elemsScrollDepended.push_back(pmarg); return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addWScalePixstepTapNM(ATTACHED_TO atto, int flags, mtap_qwidget_fn fn, int maxperpendiculardimm, void* param, int marksLimit, int minSpacing) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STRETCHED, marksLimit, minSpacing, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, fn, param, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addWScaleSymmetricTapNM(ATTACHED_TO atto, int flags, mtap_qwidget_fn fn, int maxperpendiculardimm, void* param, int marksLimit, int minSpacing) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STRETCHED_POW2, marksLimit, minSpacing, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, fn, param, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*minSpacing; else pImpl->c_hint_draw_width = (marksLimit-1)*minSpacing; // updateGeometry(); } return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleTAPNM* DrawBars::addWScaleRollingTapNM(ATTACHED_TO atto, int flags, mtap_qwidget_fn fn, int maxperpendiculardimm, void* param, int marksLimit, int pixStep) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STATIC, marksLimit, pixStep, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, fn, param, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksLimit-1)*pixStep; else pImpl->c_hint_draw_width = (marksLimit-1)*pixStep; // updateGeometry(); } return (MEWScaleTAPNM*)addMarginElement(atto, pmarg, new MEWScaleTAPNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNM* DrawBars::addWScalePixstepSetNM(ATTACHED_TO atto, int flags, int maxperpendiculardimm, int marksNwidgetsCount, QWidget* wdgs[], int minSpacing) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STRETCHED, marksNwidgetsCount, minSpacing, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, wdgs, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksNwidgetsCount-1)*minSpacing; else pImpl->c_hint_draw_width = (marksNwidgetsCount-1)*minSpacing; // updateGeometry(); } return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNM* DrawBars::addWScaleSymmetricSetNM(ATTACHED_TO atto, int flags, int maxperpendiculardimm, int marksNwidgetsCount, QWidget* wdgs[], int minSpacing) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STRETCHED_POW2, marksNwidgetsCount, minSpacing, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, wdgs, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksNwidgetsCount-1)*minSpacing; else pImpl->c_hint_draw_width = (marksNwidgetsCount-1)*minSpacing; // updateGeometry(); } return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } MEWScaleNM* DrawBars::addWScaleRollingSetNM(ATTACHED_TO atto, int flags, int maxperpendiculardimm, int marksNwidgetsCount, QWidget* wdgs[], int pixStep) { MarginINMarksWidgetBetween* pmarg = new MarginINMarksWidgetBetween(); pmarg->init_wide(DBMODE_STATIC, marksNwidgetsCount, pixStep, 1, DB_ROUNDING(flags), true, maxperpendiculardimm, wdgs, this); if (flags & DBF_MINSIZE_BY_PIXSTEP) { if (BAR_VERT[atto]) pImpl->c_hint_draw_height = (marksNwidgetsCount-1)*pixStep; else pImpl->c_hint_draw_width = (marksNwidgetsCount-1)*pixStep; // updateGeometry(); } return (MEWScaleNM*)addMarginElement(atto, pmarg, new MEWScaleNM, flags & DBF_SHARED, flags & DBF_INTERVENTBANNED, EXTRACT_MIRALG(flags)); } void DrawBars::retrieveMElement(MEQWrapper* mw, bool replaceWithEqSpace) { for (int d=0; d<4; d++) for (DrawBars_impl::melem_iterator_t iter=pImpl->elems[d].begin(); iter!=pImpl->elems[d].end(); iter++) if (iter->pwp == mw) { mw->m_premote = nullptr; if (replaceWithEqSpace) { int space=0, dly,segm_pre,segm_post; iter->pme->sizeHint(ATTACHED_TO(d), &space, &dly, &segm_pre, &segm_post); iter->pme = new MarginSpace(space); /// ntf! update(); } else { pImpl->elems[d].erase(iter); int delta_summ, delta_segm; pImpl->recalcTTRforBar(ATTACHED_TO(d), &delta_summ, &delta_segm); QSize pr = QSize(pImpl->c_width + (d == 0 || d == 1? delta_summ : 0) , pImpl->c_height + (d == 2 || d == 3? delta_summ : 0)); pImpl->c_width = pr.width(); pImpl->c_height = pr.height(); pImpl->reupdateBars_oneSide(ATTACHED_TO(d)); PDRAWMOVE; updateGeometry(); resize(pr); // update(); } return; } } void DrawBars::setMElementVisible(MEQWrapper* pwp, bool v, bool autoupdate) { for (int d=0; d<4; d++) for (DrawBars_impl::melem_iterator_t iter=pImpl->elems[d].begin(); iter!=pImpl->elems[d].end(); iter++) if (iter->pwp == pwp) { iter->visible = v; if (autoupdate) update(); return; } } void DrawBars::switchToAnotherSide(MEQWrapper* pwp) { ATTACHED_TO switched[] = { AT_RIGHT, AT_LEFT, AT_BOTTOM, AT_TOP }; for (int d=0; d<4; d++) for (DrawBars_impl::melem_iterator_t iter=pImpl->elems[d].begin(); iter!=pImpl->elems[d].end(); iter++) if (iter->pwp == pwp) { DrawBars_impl::melem_t elem = *iter; pImpl->elems[d].erase(iter); pImpl->recalcTTRforBar(ATTACHED_TO(d)); pImpl->elems[int(switched[d])].push_back(elem); pImpl->recalcTTRforBar(switched[d]); pImpl->reupdateBars_symmetric(ATTACHED_TO(d)); PDRAWMOVE; update(); return; } } //void DrawBars::changeColor(MEQWrapper* pwp, const QColor& clr) //{ //// for (int d=0; d<4; d++) //// for (DrawBars_impl::melem_iterator_t iter=pImpl->elems[d].begin(); iter!=pImpl->elems[d].end(); iter++) //// if (iter->pwp == pwp) //// { //// iter->pme->changeColor(clr); //// } //} void DrawBars::swapBars(ATTACHED_TO atto) { ATTACHED_TO switched[] = { AT_RIGHT, AT_LEFT, AT_BOTTOM, AT_TOP }; ATTACHED_TO atto_sw = switched[atto]; qSwap(pImpl->elems[atto], pImpl->elems[atto_sw]); pImpl->recalcTTRforBar(atto); pImpl->recalcTTRforBar(atto_sw); pImpl->reupdateBars_symmetric(atto); PDRAWMOVE; update(); } void DrawBars::removeAllMElements(bool squeeze) { for (int d=0; d<4; d++) { for (int i=0; i<pImpl->elems[d].count(); i++) delete pImpl->elems[d][i].pme; pImpl->elems[d].clear(); } if (squeeze) { pImpl->clearTTR(); rollbackGeometry(); // pDraw->Geometry(pImpl->c_margins.left(), pImpl->c_margins.top(), // this->width() - pImpl->c_margins.left() - pImpl->c_margins.right(), // this->height() - pImpl->c_margins.top() - pImpl->c_margins.bottom()); // updateGeometry(); } update(); } void DrawBars::mouseEvent(MarginElement::MOUSEEVENT mev, int x, int y) { if (x < pImpl->c_margins.left() || y < pImpl->c_margins.top()) return; x -= pImpl->c_margins.left(); y -= pImpl->c_margins.top(); if (x > pImpl->c_width || y > pImpl->c_height) return; bool doUpdate = false; if (x < pImpl->ttr[AT_LEFT].c_size) { int at = AT_LEFT; x = pImpl->ttr[AT_LEFT].c_size - 1 - x; for (int i=0; i<pImpl->elems[at].count(); i++) { if (pImpl->elems[at][i].visible && x >= pImpl->elems[at][i].offset && x < pImpl->elems[at][i].offset + pImpl->elems[at][i].length) pImpl->elems[at][i].pme->mouseEvent(mev, y, x - pImpl->elems[at][i].offset, pImpl->c_height, pImpl->elems[at][i].length, &doUpdate, pImpl->elems[at][i].pwp); } } if (x > pImpl->c_width - pImpl->ttr[AT_RIGHT].c_size) { int at = AT_RIGHT; x = x - (pImpl->c_width - pImpl->ttr[AT_RIGHT].c_size); for (int i=0; i<pImpl->elems[at].count(); i++) { if (pImpl->elems[at][i].visible && x >= pImpl->elems[at][i].offset && x < pImpl->elems[at][i].offset + pImpl->elems[at][i].length) pImpl->elems[at][i].pme->mouseEvent(mev, y, x - pImpl->elems[at][i].offset, pImpl->c_height, pImpl->elems[at][i].length, &doUpdate, pImpl->elems[at][i].pwp); } } if (y < pImpl->ttr[AT_TOP].c_size) { int at = AT_TOP; y = pImpl->ttr[AT_TOP].c_size - 1 - y; for (int i=0; i<pImpl->elems[at].count(); i++) { if (pImpl->elems[at][i].visible && y >= pImpl->elems[at][i].offset && y < pImpl->elems[at][i].offset + pImpl->elems[at][i].length) pImpl->elems[at][i].pme->mouseEvent(mev, x, y - pImpl->elems[at][i].offset, pImpl->c_width, pImpl->elems[at][i].length, &doUpdate, pImpl->elems[at][i].pwp); } } if (y > pImpl->c_height - pImpl->ttr[AT_BOTTOM].c_size) { int at = AT_BOTTOM; y = y - (pImpl->c_height - pImpl->ttr[AT_BOTTOM].c_size); for (int i=0; i<pImpl->elems[at].count(); i++) { if (pImpl->elems[at][i].visible && y >= pImpl->elems[at][i].offset && y < pImpl->elems[at][i].offset + pImpl->elems[at][i].length) pImpl->elems[at][i].pme->mouseEvent(mev, x, y - pImpl->elems[at][i].offset, pImpl->c_width, pImpl->elems[at][i].length, &doUpdate, pImpl->elems[at][i].pwp); } } if (doUpdate) update(); } void DrawBars::rollbackGeometry() { PDRAWMOVE; int height = pDraw->height(); int hsegm = qMax(pImpl->ttr[AT_LEFT].segm_minimal, pImpl->ttr[AT_RIGHT].segm_minimal); if (pImpl->c_hint_draw_height < hsegm) pImpl->c_hint_draw_height = hsegm; if (height < hsegm) height = hsegm; if (pImpl->c_hint_draw_height > height) pImpl->c_hint_draw_height = height; int width = pDraw->width(); int wsegm = qMax(pImpl->ttr[AT_TOP].segm_minimal, pImpl->ttr[AT_BOTTOM].segm_minimal); if (pImpl->c_hint_draw_width < wsegm) pImpl->c_hint_draw_width = wsegm; if (width < wsegm) width = wsegm; if (pImpl->c_hint_draw_width > width) pImpl->c_hint_draw_width = width; // updateGeometry(); // a nado li? setGeometry(0,0, pImpl->c_margins.left() + pImpl->ttr[AT_LEFT].c_size + width + pImpl->ttr[AT_RIGHT].c_size + pImpl->c_margins.right(), pImpl->c_margins.top() + pImpl->ttr[AT_TOP].c_size + height + pImpl->ttr[AT_BOTTOM].c_size + pImpl->c_margins.bottom()); } void DrawBars::elemSizeHintChanged(MarginElement* me) { for (int d=0; d<4; d++) for (DrawBars_impl::melem_iterator_t iter=pImpl->elems[d].begin(); iter!=pImpl->elems[d].end(); iter++) if (iter->pme == me) { int delta_summ, delta_segm; pImpl->recalcTTRforBar(ATTACHED_TO(d), &delta_summ, &delta_segm); // PDRAWMOVE; // if (delta > 0) // updateGeometry(); // else if (delta < 0) // resize(pImpl->ttr[AT_LEFT].c_size + pDraw->width() + pImpl->ttr[AT_RIGHT].c_size, // pImpl->ttr[AT_TOP].c_size + pDraw->height() + pImpl->ttr[AT_BOTTOM].c_size); pImpl->reupdateBars_oneSide(ATTACHED_TO(d)); rollbackGeometry(); return; } } QSize DrawBars::minimumSizeHint() const { // qDebug()<<pImpl->c_hint_draw_height<<pImpl->c_height_margins<<pImpl->ttr[AT_BOTTOM].c_size; // qDebug()<<pImpl->ottrLeft<<pImpl->ottrTop<<pImpl->ottrRight<<pImpl->ottrBottom; // return QSize(pImpl->c_width_margins + pImpl->ttr[AT_LEFT].c_size + pImpl->c_hint_draw_width + pImpl->ttr[AT_RIGHT].c_size, // pImpl->c_height_margins + pImpl->ttr[AT_TOP].c_size + pImpl->c_hint_draw_height + pImpl->ttr[AT_BOTTOM].c_size); int dw = qMax(pImpl->c_hint_draw_width, int(pDraw->minimumWidth()*pDraw->devicePixelRatio())); int dh = qMax(pImpl->c_hint_draw_height, int(pDraw->minimumHeight()*pDraw->devicePixelRatio())); return QSize(pImpl->c_margins.left() + pImpl->ttr[AT_LEFT].c_size + dw + pImpl->ttr[AT_RIGHT].c_size + pImpl->c_margins.right(), pImpl->c_margins.top() + pImpl->ttr[AT_TOP].c_size + dh + pImpl->ttr[AT_BOTTOM].c_size + pImpl->c_margins.bottom()); } //QSize DrawBars::sizeHint() const //{ // return pDraw->size() + QSize(pImpl->cttrLeft + pImpl->cttrRight, pImpl->cttrTop + pImpl->cttrBottom); //} void DrawBars::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); const QSize esize = event->size(); /***************************************************************************************************************/ QMargins margins = contentsMargins(); if (margins != pImpl->c_margins) { pImpl->c_margins = contentsMargins(); PDRAWMOVE; updateGeometry(); } int margins_width = margins.left() + margins.right(); int margins_height = margins.top() + margins.bottom(); QSize dsize = esize - QSize(pImpl->ttr[AT_LEFT].c_size + pImpl->ttr[AT_RIGHT].c_size, pImpl->ttr[AT_TOP].c_size + pImpl->ttr[AT_BOTTOM].c_size) - QSize(margins_width, margins_height); #ifdef RAKOFLAG bool resizeDrawWillAfterBars = pImpl->rakoflag || !pDraw->isVisible(); pImpl->rakoflag = false; #else bool resizeDrawWillAfterBars = !pDraw->isVisible(); #endif dcsizecd_t dcHorz, dcVert; if (resizeDrawWillAfterBars) { // dsize = dsize * pDraw->devicePixelRatio(); pDraw->fitSize(dsize.width(), dsize.height(), &dcHorz, &dcVert); } else { pDraw->resize(dsize); dcHorz = pDraw->sizeComponentsHorz(); dcVert = pDraw->sizeComponentsVert(); } // dsize = dsize / pDraw->devicePixelRatio(); // qDebug()<<pDraw->height()<<pDraw->sizeVert()<<pDraw->minimumHeight()<<dheight<<esize.height(); // if (this->accessibleName() == "Allo") // { // qDebug()<<"Allo "<<resizeDrawWillAfterBars<<event->size()<<dsize<<QSize(dwidth, dheight); // } pImpl->c_width = esize.width() - margins_width; pImpl->c_height = esize.height() - margins_height; if (/*isVisible() && */height() > 5 && width() > 5) { int dw = dsize.width() - length(dcHorz)/pDraw->devicePixelRatio(); if (dw < 0) dw = 0; int dh = dsize.height() - length(dcVert)/pDraw->devicePixelRatio(); if (dh < 0) dh = 0; pImpl->c_overheadRight = pDraw->rawResizeModeNoScaled()? 0 : dw; pImpl->c_overheadBottom = pDraw->rawResizeModeNoScaled()? 0 : dh; pImpl->c_scalingHorz = dcHorz.scaling; pImpl->c_scalingVert = dcVert.scaling; pImpl->reupdateBars(MarginElement::UF_RESIZE, MarginElement::UF_RESIZE, MarginElement::UF_RESIZE, MarginElement::UF_RESIZE); // qDebug()<<esize<<width()<<height(); } if (resizeDrawWillAfterBars) pDraw->resize(dsize); } void DrawBars::paintEvent(QPaintEvent* event) { QWidget::paintEvent(event); QPainter painter; painter.begin(this); // painter.setRenderHint(QPainter::NonCosmeticDefaultPen); if (pImpl->c_back_fill) painter.fillRect(rect(), pImpl->c_back_brush); painter.setRenderHint(QPainter::Antialiasing, false); // painter.setRenderHint(QPainter::Antialiasing, false); // painter.setRenderHint(QPainter::TextAntialiasing, false); // painter.setRenderHint(QPainter::SmoothPixmapTransform, false); // painter.setRenderHint(QPainter::HighQualityAntialiasing, false); // painter.setRenderHint(QPainter::NonCosmeticDefaultPen, false); // painter.setRenderHint(QPainter::Qt4CompatiblePainting, false); // QPen pp = painter.pen(); // pp.setWidth(0); // pp.setCapStyle(Qt::FlatCap); // pp.setJoinStyle(Qt::MiterJoin); // pp.setCosmetic(false); //// pp.setStyle(Qt::DashLine); // pp.setStyle(Qt::SolidLine); // painter.setPen(pp); // painter.drawPoint painter.setPen(pImpl->c_front_pen); painter.setBrush(pImpl->c_front_brush); if (pImpl->main_opacity > 0.0f) painter.setOpacity(1.0f - pImpl->main_opacity); painter.translate(QPoint(pImpl->c_margins.left(), pImpl->c_margins.top())); for (int d=0; d<4; d++) for (int i=0; i<pImpl->elems[d].count(); i++) { if (pImpl->elems[d][i].visible) pImpl->elems[d][i].pme->draw(painter); } painter.end(); } bool DrawBars::event(QEvent* ev) { if (ev->type() == QEvent::PaletteChange) { if (isDrawPaletteCP(pImpl->clr_policy)) ; else if (pImpl->clr_policy == CP_WHITE) pImpl->updatePalette(this, QColor(Qt::white)); else if (pImpl->clr_policy == CP_BLACK) pImpl->updatePalette(this, QColor(Qt::black)); else if (pImpl->clr_policy == CP_DEFAULT) /// not-strict movement! for not to lose -1 (manual) color_policy pImpl->upbackPalette(this); } else if (ev->type() == QEvent::LayoutRequest) /// child widget changed size implicitly { // qDebug()<<"EJ JO!"; updateGeometry(); } else { // if (this->objectName() == "VAU") // qDebug()<<ev->type(); } return QWidget::event(ev); } void DrawBars::mousePressEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton) this->mouseEvent(event->button() == Qt::LeftButton? MarginElement::ME_LPRESS : MarginElement::ME_RPRESS, event->x(), event->y()); } void DrawBars::mouseMoveEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton) this->mouseEvent(event->button() == Qt::LeftButton? MarginElement::ME_LMOVE: MarginElement::ME_RMOVE, event->x(), event->y()); } void DrawBars::mouseReleaseEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton) this->mouseEvent(event->button() == Qt::LeftButton? MarginElement::ME_LRELEASE: MarginElement::ME_RRELEASE, event->x(), event->y()); } void DrawBars::mouseDoubleClickEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton) { int x = event->x(), y = event->y(); bool inarea = false; float LL=0, HL=1; int precision=3; for (int i=0; i<pImpl->elemsBoundsSetupDepended.count(); i++) { bool inside = false; const MarginElement::uarea_t& area = pImpl->elemsBoundsSetupDepended[i]->mec_area(); switch (area.atto) { case AT_LEFT: { if (x > area.atto_end && x < area.atto_begin) inside = true; break; } case AT_RIGHT: { if (x > area.atto_begin && x < area.atto_end) inside = true; break; } case AT_TOP: { if (y > area.atto_end && y < area.atto_begin) inside = true; break; } case AT_BOTTOM: { if (y > area.atto_begin && y < area.atto_end) inside = true; break; } } if (inside) { int rtt = pImpl->elemsBoundsSetupDepended[i]->cachedRTexttype(); // const relatedopts_t& rdata = pImpl->elemsBoundsSetupDepended[i]->cachedRdata(); if (rtt == RF_SETBOUNDS) { relatedopts_t rdata = pImpl->elemsBoundsSetupDepended[i]->cachedRdata(); LL = rdata.rel_fixed.LL; HL = rdata.rel_fixed.HL; precision = pImpl->elemsBoundsSetupDepended[i]->precision() + 1; // for type digit after current value inarea = true; break; } } } if (!inarea && pImpl->drawBoundsUpdater) { // qDebug()<<"DCLK!"; // if (pDraw->rect().contains(x, y)) { LL = pDraw->boundLow(); HL = pDraw->boundHigh(); precision=3; inarea = true; } } if (inarea) { QWidget* focused=nullptr; QFrame* boundsSetup = new QFrame; boundsSetup->setFrameStyle(QFrame::Box); boundsSetup->setWindowFlags(Qt::Popup); boundsSetup->setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout* lay = new QVBoxLayout(); { float values[] = { HL, LL }; for (int i=0; i<2; i++) { QDoubleSpinBox* qle = new QDoubleSpinBox(); qle->setRange(-FLT_MAX, +FLT_MAX); qle->setDecimals(precision); qle->setValue(values[i]); qle->setAlignment(Qt::AlignRight); qle->setFixedWidth(120); if (i == 0) focused = qle; lay->addWidget(qle); if (i == 0) QObject::connect(qle, SIGNAL(valueChanged(double)), this, SLOT(toolUpdateBoundHigh(double))); else QObject::connect(qle, SIGNAL(valueChanged(double)), this, SLOT(toolUpdateBoundLow(double))); } } boundsSetup->setLayout(lay); boundsSetup->show(); boundsSetup->move(this->mapToGlobal(event->pos())); focused->setFocus(Qt::TabFocusReason); } } } void DrawBars::connectScrollBar(QScrollBar* qsb, bool staticView, bool setOrientation) { pDraw->connectScrollBar(qsb, staticView, setOrientation); QObject::connect(qsb, SIGNAL(valueChanged(int)), this, SLOT(scrollDataTo(int))); } void DrawBars::slot_setScalingA(int sh){ pDraw->slot_setScalingA(sh); } void DrawBars::slot_setScalingB(int sv){ pDraw->slot_setScalingB(sv); } void DrawBars::slot_setScalingH(int sh){ pDraw->slot_setScalingH(sh); } void DrawBars::slot_setScalingV(int sv){ pDraw->slot_setScalingV(sv); } void DrawBars::slot_setBounds(float low, float high){ pDraw->slot_setBounds(low, high); slot_updatedBounds(); } void DrawBars::slot_setBoundLow(float v){ pDraw->slot_setBoundLow(v); slot_updatedBounds(); } void DrawBars::slot_setBoundHigh(float v){ pDraw->slot_setBoundHigh(v); slot_updatedBounds(); } void DrawBars::slot_setBounds01(){ pDraw->slot_setBounds01(); slot_updatedBounds(); } void DrawBars::slot_setContrast(float k, float b){ pDraw->slot_setContrast(k, b); slot_updatedBounds(); } void DrawBars::slot_setContrastK(float v){ pDraw->slot_setContrastK(v); slot_updatedBounds(); } void DrawBars::slot_setContrastKinv(float v){ pDraw->slot_setContrastKinv(v); slot_updatedBounds(); } void DrawBars::slot_setContrastB(float v){ pDraw->slot_setContrastB(v); slot_updatedBounds(); } void DrawBars::slot_setDataTextureInterpolation(bool v){ pDraw->slot_setDataTextureInterpolation(v); } void DrawBars::slot_setDataPalette(const IPalette* v){ pDraw->slot_setDataPalette(v); slot_updatedDataPalette(); } void DrawBars::slot_setDataPaletteDiscretion(bool v){ pDraw->slot_setDataPaletteDiscretion(v); } void DrawBars::slot_setDataPaletteRangeStart(float v){ pDraw->setDataPaletteRangeStart(v); } void DrawBars::slot_setDataPaletteRangeStop(float v){ pDraw->setDataPaletteRangeStop(v); } void DrawBars::slot_setDataPaletteRange(float start, float stop){ pDraw->setDataPaletteRange(start, stop); } void DrawBars::slot_setData(const float* v){ pDraw->slot_setData(v); } void DrawBars::slot_setData(const QVector<float>& v){ pDraw->slot_setData(v); } void DrawBars::slot_fillData(float v){ pDraw->slot_fillData(v); } void DrawBars::slot_clearData(){ pDraw->slot_clearData(); } void DrawBars::slot_adjustBounds(){ pDraw->slot_adjustBounds(); slot_updatedBounds(); } void DrawBars::slot_adjustBounds(unsigned int portion){ pDraw->slot_adjustBounds(portion); slot_updatedBounds(); } void DrawBars::slot_adjustBounds(unsigned int start, unsigned int stop){ pDraw->slot_adjustBounds(start, stop); slot_updatedBounds(); } void DrawBars::slot_adjustBounds(unsigned int start, unsigned int stop, unsigned int portion){ pDraw->slot_adjustBounds(start, stop, portion); slot_updatedBounds(); } void DrawBars::slot_adjustBoundsWithSpacingAdd(float add2min, float add2max){ pDraw->slot_adjustBoundsWithSpacingAdd(add2min, add2max); slot_updatedBounds(); } void DrawBars::slot_adjustBoundsWithSpacingMul(float mul2min, float mul2max){ pDraw->slot_adjustBoundsWithSpacingMul(mul2min, mul2max); slot_updatedBounds(); } void DrawBars::slot_setMirroredHorz(){ pDraw->slot_setMirroredHorz(); slot_updatedOrientation(); } void DrawBars::slot_setMirroredVert(){ pDraw->slot_setMirroredVert(); slot_updatedOrientation(); } void DrawBars::slot_setPortionsCount(int count){ pDraw->slot_setPortionsCount(count); } void DrawBars::slot_enableAutoUpdate(bool v){ pDraw->slot_enableAutoUpdate(v); } void DrawBars::slot_disableAutoUpdate(bool v){ pDraw->slot_disableAutoUpdate(v); } void DrawBars::slot_enableAutoUpdateByData(bool v){ pDraw->slot_enableAutoUpdateByData(v); } void DrawBars::slot_disableAutoUpdateByData(bool v){ pDraw->slot_disableAutoUpdateByData(v); } //////////////////////////////////////////////////////////////////////// void DrawBars::slot_setBoundLow_dbl(double value){ pDraw->setBoundLow((float)value); slot_updatedBounds(); } void DrawBars::slot_setBoundHigh_dbl(double value){ pDraw->setBoundHigh((float)value); slot_updatedBounds(); } void DrawBars::slot_setContrast_dbl(double k, double b){ pDraw->setContrast((float)k, (float)b); slot_updatedBounds(); } void DrawBars::slot_setContrastK_dbl(double k){ pDraw->setContrastK((float)k); slot_updatedBounds(); } void DrawBars::slot_setContrastKinv_dbl(double k){ pDraw->setContrastKinv((float)k); slot_updatedBounds(); } void DrawBars::slot_setContrastB_dbl(double b){ pDraw->setContrastB((float)b); slot_updatedBounds(); } void DrawBars::slot_setDataPaletteRangeStart_dbl(double s){ pDraw->setDataPaletteRangeStart((float)s); } void DrawBars::slot_setDataPaletteRangeStop_dbl(double s){ pDraw->setDataPaletteRangeStart((float)s); } //////////////////////////////////////////////////////////////////////// void DrawBars::slot_swapBarsLR(){ swapBars(AT_LEFT); } void DrawBars::slot_swapBarsTB(){ swapBars(AT_TOP); } void DrawBars::slot_updatedDataPalette() { if (isDrawPaletteCP(pImpl->clr_policy)) { const IPalette* ppal = pDraw->dataPalette(); unsigned int fc = ppal->first(), lc = ppal->last(); if (pImpl->clr_policy == CP_FROM_DRAWPALETTE_INV) qSwap(fc, lc); else if (pImpl->clr_policy == CP_FROM_DRAWBACK) fc = pDraw->colorBack(); pImpl->updatePalette(this, QColor(COLOR3(fc)), QColor(COLOR3(lc))); } } void DrawBars::slot_updatedBounds() { bounds_t bnd = pDraw->bounds(); int cnt = pImpl->elemsBoundDepended.count(); if (cnt) { bool doupdate = false; for (int i=0; i<cnt; i++) doupdate |= pImpl->elemsBoundDepended[i]->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bnd), false); if (doupdate) { update(); // static int up1; // qDebug()<<"updated"<<up1++; } else { // static int up2; // qDebug()<<"banned"<<up2++; } } } void DrawBars::slot_updatedOrientation() { bool oldMH = pImpl->c_mirroredHorz, oldMV = pImpl->c_mirroredVert; ORIENTATION orient = pDraw->orientation(); pImpl->c_mirroredHorz = orientationMirroredHorz(orient); pImpl->c_mirroredVert = orientationMirroredVert(orient); if (pImpl->c_mirroredHorz != oldMH || pImpl->c_mirroredVert != oldMV) { pImpl->reupdateBars(MarginElement::UF_FORCED, MarginElement::UF_FORCED, MarginElement::UF_FORCED, MarginElement::UF_FORCED); update(); } } void DrawBars::scrollDataTo(int) { int cnt = pImpl->elemsScrollDepended.count(); if (cnt) { int sv = pDraw->scrollValue(); for (int i=0; i<cnt; i++) { pImpl->elemsScrollDepended[i]->setRelatedOffset(sv); // pImpl->elemsBoundDepended[i]->relatedTextup(); } update(); } } void DrawBars::toolUpdateBoundHigh(double v) { this->slot_setBoundHigh(v); if (pTool) pTool->bndUpdated(this->pDraw); } void DrawBars::toolUpdateBoundLow(double v) { this->slot_setBoundLow(v); if (pTool) pTool->bndUpdated(this->pDraw); } static void rectAlign(const QRect& area, Qt::Alignment alignment, QPoint* result, QPointF* sign) { QPoint pt; QPointF sg; //QPointF sp; if (alignment == Qt::AlignCenter) { pt = area.center(); sg = QPointF(-0.5, -0.5); } else if (alignment & Qt::AlignLeft) { if (alignment & Qt::AlignTop) { pt = QPoint(area.left(), area.top()); sg = QPointF(0, 0); } else if (alignment & Qt::AlignBottom) { pt = QPoint(area.left(), area.bottom()); sg = QPointF(0, -1); } else { pt = QPoint(area.left(), area.center().y()); sg = QPointF(0, -0.5); } } else if (alignment & Qt::AlignRight) { if (alignment & Qt::AlignTop) { pt = QPoint(area.right(), area.top()); sg = QPointF(-1, 0); } else if (alignment & Qt::AlignBottom) { pt = QPoint(area.right(), area.bottom()); sg = QPointF(-1, -1); } else { pt = QPoint(area.right(), area.center().y()); sg = QPointF(-1, -0.5); } } else { if (alignment & Qt::AlignTop) { pt = QPoint(area.center().x(), area.top()); sg = QPointF(-0.5, 0); } else if (alignment & Qt::AlignBottom) { pt = QPoint(area.center().x(), area.bottom()); sg = QPointF(-0.5, -1); } else { pt = area.center(); sg = QPointF(-0.5, -0.5); } } *result = pt; *sign = sg; } /************************************************************************************************/ void MEQWrapper::remoteUpdate() { // static int ctr; // if (checkneedredraw == false || m_pme->needredraw()) m_premote->update(); // else // qDebug()<<"Update banned by remote "<<ctr++; } void MEQWrapper::remoteRebound() { m_premote->elemSizeHintChanged(m_pme); remoteUpdate(); } MEQWrapper::MEQWrapper(): m_pme(nullptr), m_premote(nullptr) { } MEQWrapper::~MEQWrapper() { } void MEQWrapper::remove() { m_premote->retrieveMElement(this, false); } void MEQWrapper::removeAndLeftSpace() { m_premote->retrieveMElement(this, true); } void MEQWrapper::setVisible(bool visible) { m_premote->setMElementVisible(this, visible); } void MEQWrapper::setVisibleWithoutUpdate(bool visible) { m_premote->setMElementVisible(this, visible, false); } void MEQWrapper::moveToAnotherSide() { m_premote->switchToAnotherSide(this); } void MEQWrapper::changeColor(const QColor& clr) { m_pme->changeColor(clr); remoteUpdate(); } ///////////////////////////////////////////////////////////////////////////////////// void MEQWTexted::setFont(const QFont& m_font) { ((MarginLabel*)m_pme)->setFont(m_font); remoteUpdate(); } void MEWLabel::setText(const QString& text) { ((MarginLabel*)m_pme)->setText(text); remoteUpdate(); } void MEWSpace::setSpace(int space) { ((MarginSpace*)m_pme)->setSpace(space); remoteRebound(); } void MEWColoredSpace::setSpace(int space) { ((MarginColoredSpace*)m_pme)->setSpace(space); remoteRebound(); } /***/ class MEPointerReactor: public IOverlayReactor { MarginPointer* m_pme; DrawBars* m_premote; public: MEPointerReactor(MarginPointer* ptr, DrawBars* premote): m_pme(ptr), m_premote(premote) { if (m_premote) m_premote->update(); } MEPointerReactor(MarginPointer* ptr, DrawBars* premote, float x01, float y01): m_pme(ptr), m_premote(premote) { m_pme->setPosition(x01, y01); if (m_premote) m_premote->update(); } virtual ~MEPointerReactor(); virtual void overlayReactionVisible(bool v) { m_pme->setVisible(v); if (m_premote) m_premote->update(); } virtual bool overlayReactionMouse(OVL_REACTION_MOUSE oreact, const coordstriumv_t* ct, bool* /*doStop*/) { if (oreact == ORM_LMPRESS || oreact == ORM_LMMOVE) { // m_pme->setPosition(((const float*)dataptr)[0], ((const float*)dataptr)[1]); m_pme->setPosition(ct->fx_rel, ct->fy_rel); if (m_premote) m_premote->update(); } else if (oreact == ORM_RMPRESS) { m_pme->setVisible(false); if (m_premote) m_premote->update(); } return false; } }; MEPointerReactor::~MEPointerReactor(){} IOverlayReactor* MEWPointer::createReactor() { return new MEPointerReactor((MarginPointer*)m_pme, m_premote); } void MEWPointer::setPosition(float pos01) { ((MarginPointer*)m_pme)->setPosition(pos01); remoteUpdate(); } void MEWPointer::setPositionBifunc(float pos01, float posText) { ((MarginPointer*)m_pme)->setPositionBifunc(pos01, posText); remoteUpdate(); } void MEWPointer::setBounds(float LL, float HL) { if ( ((MarginPointer*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL))) ) remoteUpdate(); } void MEWPointer::setBoundLow(float LL) { if ( ((MarginPointer*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, ((MarginPointer*)m_pme)->cachedRdata().rel_fixed.HL))) ) remoteUpdate(); } void MEWPointer::setBoundHigh(float HL) { if ( ((MarginPointer*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(((MarginPointer*)m_pme)->cachedRdata().rel_fixed.LL, HL))) ) remoteUpdate(); } void MEWPointer::setBounds(double LL, double HL){ setBounds(float(LL), float(HL)); } void MEWPointer::setBoundLow(double LL){ setBoundLow(float(LL)); } void MEWPointer::setBoundHigh(double HL){ setBoundHigh(float(HL)); } ///////////////////////////////////////////////////////////////////////////////////// //void MEWScale::setPrefix(const char* str){ ((MarginMarksComplicated*)m_pme)->setPrefix(str); remoteUpdate(); } //void MEWScale::setPostfix(const char* str){ ((MarginMarksComplicated*)m_pme)->setPostfix(str); remoteUpdate(); } void MEWScale::updateTapParam(const void* param) { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate(RF_UPDATETAP_PARAM, relatedopts_t(nullptr, param, 0) ) ) remoteUpdate(); } void MEWScale::setFont(const QFont& m_font) { ((MarginMarksBase*)m_pme)->setFont(m_font); // remoteUpdate(); remoteRebound(); } void MEWScale::setMarkLen(int mlen) { ((MarginMarksBase*)m_pme)->setMarkLength(mlen); remoteRebound(); } void MEWScale::setMarkMiniLen(int mlen) { ((MarginMarksBase*)m_pme)->setMarkMiniLength(mlen); remoteRebound(); } //void MEWScale::scroll(int offset) //{ // ((MarginMarksTexted*)m_pme)->setRelatedOffset(offset, true); // remoteUpdate(); //} void MEWScaleNN::setBounds(float LL, float HL) { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, HL))) ) remoteUpdate(); } void MEWScaleNN::setBoundLow(float LL) { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(LL, ((MarginMarksBase*)m_pme)->cachedRdata().rel_fixed.HL))) ) remoteUpdate(); } void MEWScaleNN::setBoundHigh(float HL) { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate(RF_SETBOUNDS, relatedopts_t(bounds_t(((MarginMarksBase*)m_pme)->cachedRdata().rel_fixed.LL, HL))) ) remoteUpdate(); } void MEWScaleNN::setBounds(double LL, double HL){ setBounds(float(LL), float(HL)); } void MEWScaleNN::setBoundLow(double LL){ setBoundLow(float(LL)); } void MEWScaleNN::setBoundHigh(double HL){ setBoundHigh(float(HL)); } //void MEWScaleTAP::tap() //{ // if ( ((MarginMarksBase*)m_pme)->bdContentUpdate() ) // remoteUpdate(); //} void MEWScaleTAPNN::tap() { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate() ) remoteUpdate(); } void MEWScaleTAPNM::tap() { if ( ((MarginMarksBase*)m_pme)->bdContentUpdate() ) remoteUpdate(); } /* //class MarginPointer: public MarginElementCached, public MarginCallback //{ // int mlenmaxi, mwid; // memark_t mark; // ORIENTATION orient; // texts_t pointer; // Qt::Alignment alignment; // float position; // float c_value; //// Qt::Orientation orientation; //// QSize orient_size; //// QTransform ttransform; //// QPoint ttranspoint; // QFont m_font; // bool m_fontReplaced; // bool textInnerPlaced; // DSNumFormatter numfmt; // float LL, HL, MOD; //public: // MarginPointer(int _marklen, ORIENTATION _orient, Qt::Alignment align=Qt::AlignCenter, Qt::Orientation orient=Qt::Horizontal): // mlenmaxi(_marklen), mwid(_marklen? 1 : 0), // orient(_orient), alignment(align), position(-1.0f), c_value(-1.0f),orientation(orient), // m_fontReplaced(false), textInnerPlaced(true), LL(0.0f), HL(1.0f), MOD(0.0f) // { // } // MarginPointer(int _marklen, ORIENTATION _orient, const QFont& fnt, Qt::Alignment align=Qt::AlignCenter, Qt::Orientation orient=Qt::Horizontal): // mlenmaxi(_marklen), mwid(_marklen? 1 : 0), // orient(_orient),alignment(align), position(-1.0f), c_value(-1.0f), // m_font(fnt), m_fontReplaced(true), textInnerPlaced(true), LL(0.0f), HL(1.0f), MOD(0.0f) // { // } // float _update_value(float p){ c_value = LL + p*(HL-LL); if (MOD > 0.0f) c_value -= int(c_value/MOD)*MOD; return c_value; } // void setPosition(float pos01) // { // position = pos01; // assignText(&pointer, redact(numfmt(_update_value(position)))); // update_position(cached_area()); // pointer.visible = position >= 0.0f? 1 : 0; // } // void setPositionBifunc(float pos01, float posBi) // { // position = pos01; // assignText(&pointer, redact(numfmt(_update_value(posBi)))); // update_position(cached_area()); // pointer.visible = position >= 0.0f? 1 : 0; // } // void setPosition(float pos01_A, float pos01_B) // { //// setPosition(BAR_VERT[cached_area().atto]? pos01_y : pos01_x); // bool v = BAR_VERT[cached_area().atto]? orientationMirroredVert(orient) : orientationMirroredHorz(orient); // bool m = orientationTransposed(orient) ^ BAR_VERT[cached_area().atto]; // float pos01 = m? pos01_B : pos01_A; // setPositionBifunc( v ? 1.0f - pos01 : pos01, pos01); // } // void setVisible(bool visible) // { // if (visible) // { // if (position < 0) position = 0; // pointer.visible = 1; // } // else // pointer.visible = 0; //// needRedrawByPosition = true; // } // bool isVisible() const // { // return pointer.visible != 0; // } // void setFont(const QFont& fnt) // { // m_font = fnt; // m_fontReplaced = true; // assignText(&pointer, redact(numfmt(c_value)), fnt); // } // void setMarkLength(int length){ mlenmaxi = length; } // void setMarkWidth(int width){ mwid = width; } // void setMarkSize(int length, int width){ mlenmaxi = length; mwid = width; } //protected: // void update_position(const uarea_t& area) // { // const int& a1 = area.atto_end, &a2 = area.atto_begin; // int d = area.dlytotal - area.segm_pre - area.segm_post - area.segm_over - 1; // int dd = area.segm_pre + 1; // if (mlenmaxi) // { // if (BAR_VERT[area.atto]) // { // int d2 = area.mirrored? area.segm_pre : area.dlytotal - 1 - area.segm_post - area.segm_over; // int l1 = area.atto_begin; // int l2 = area.atto_begin + (area.atto == AT_LEFT? -(mlenmaxi-1) : (mlenmaxi-1)); // int offs = d2 - d2*position; // mark.anchor = QPoint(l1, offs); // if (area.atto == AT_LEFT) // mark.rect.setCoords(l2, offs, l1, offs); // else // mark.rect.setCoords(l1, offs, l2, offs); // } // else // { // int d2 = area.mirrored? area.dlytotal - 1 - area.segm_post - area.segm_over : area.segm_pre; // int l1 = area.atto_begin; // int l2 = area.atto_begin + (area.atto == AT_TOP? -(mlenmaxi-1) : (mlenmaxi-1)); // int offs = d2 + d2*position; // mark.anchor = QPoint(offs, l1); // if (area.atto == AT_TOP) // mark.rect.setCoords(offs, l2, offs, l1); // else // mark.rect.setCoords(offs, l1, offs, l2); // } // } //// pointer.uarea_pos = area.atto == AT_LEFT? QPoint(a1-2, dd + d - d*position) : //// area.atto == AT_RIGHT? QPoint(a2+2, dd + d - d*position) : //// area.atto == AT_TOP? QPoint(dd + d*position, a1): //// QPoint(dd + d*position, a2); // pointer.uarea_pos = area.atto == AT_LEFT? QPoint(a1, dd + d - d*position) : // area.atto == AT_RIGHT? QPoint(a2+2, dd + d - d*position) : // area.atto == AT_TOP? QPoint(dd + d*position, a1): // QPoint(dd + d*position, a2); // pointer.uarea_pos -= BAR_VERT[area.atto]? QPoint(0, pointer.uin_locsize.height()/2) : QPoint(pointer.uin_locsize.width()/2, 0); //// if (textInnerPlaced) //// { //// void (*luptp)(texts_t*, int) = area.mirrored? POSFUNC_NN_DOWN[area.atto] : POSFUNC_NN_UP[area.atto]; //// void (*luptp)(texts_t*, int) = area.mirrored? POSFUNC_NN_UP[area.atto] : POSFUNC_NN_DOWN[area.atto]; //// void (*luptp)(texts_t*, int) = POSFUNC_NN_MID[area.atto]; //// luptp(&pointer, 0); //// } // storeDimm(d); //// needRedrawByPosition = true; // } // virtual bool updateArea(const uarea_t& area, int UPDATEFOR) // { // if (MarginElementCached::updateArea(area, UPDATEFOR) == false) // return false; // update_position(area); //// if (pointer.visible == 0) //// pointer.visible = position >= 0.0f? 1 : 0; //// QPointF textOffsetSign; //// rectAlign(actualArea, alignment, &ttranspoint, &textOffsetSign); ////// if (orientation == Qt::Vertical) ////// textOffsetSign = QPointF(-(1.0 + textOffsetSign.y()), textOffsetSign.x()); ////// label.uarea_pos = QPoint(int(textOffsetSign.x()*label.uin_locsize.width()), int(textOffsetSign.y()*label.uin_locsize.height())); ////// pointer.uarea_pos = QPoint(pointer.uin_locsize.width(), pointer.uin_locsize.height()); //// pointer.uarea_pos = QPoint(int(textOffsetSign.x()*pointer.uin_locsize.width()), int(textOffsetSign.y()*pointer.uin_locsize.height())); //// pointer.visible = 1; // return true; // } //// virtual bool needredraw() const { return MarginElementCached::needredraw() | needRedrawByPosition; } // virtual void draw(QPainter& painter) // { //// MarginElementCached::draw(painter); // if (pointer.visible) // { // painter.fillRect(mark.rect, c_color); // if (m_fontReplaced) // { // painter.save(); // painter.setFont(m_font); // painter.drawStaticText(pointer.uarea_pos, pointer.uin_text); // painter.restore(); // } // else // painter.drawStaticText(pointer.uarea_pos, pointer.uin_text); //// painter.save(); //// painter.translate(ttranspoint); //// if (m_fontReplaced) //// painter.setFont(m_font); ////// if (ttransform.type() != QTransform::TxNone) ////// painter.setTransform(ttransform, true); //// painter.drawStaticText(pointer.uarea_pos, pointer.uin_text); //// painter.restore(); // } //// needRedrawByPosition = false; // } // virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const // { // QFontMetrics fm(m_font); // QSize meansize(5 + fm.averageCharWidth()*6, fm.height()); // *atto_size = (mlenmaxi? mlenmaxi + 2 : 0) + (BAR_VERT[atto]? meansize.width() : meansize.height()); // *minsegm_main = BAR_VERT[atto]? meansize.height() : meansize.width(); // int d_half_dly = textInnerPlaced? 0 : BAR_VERT[atto]? meansize.height()/2 : meansize.width()/2; // *minsegm_pre = d_half_dly; // *minsegm_post = d_half_dly; // } //protected: // virtual void bdContentUpdateBounds(float ll, float hl) // { // LL = ll; HL = hl; MOD = 0.0f; // if (!numfmt_locked) numfmt.autoFormat(LL, HL); // assignText(&pointer, redact(numfmt(_update_value(position)))); //// needRedrawByPosition = true; // } // virtual void bdContentUpdateBoundsMod(float ll, float hl, float mod) // { // LL = ll; HL = hl; MOD = mod; // if (!numfmt_locked) numfmt.autoFormat(LL, HL); // assignText(&pointer, redact(numfmt(_update_value(position)))); //// needRedrawByPosition = true; // } // virtual void bdContentUpdateTaps(QString& base, mtap_qstring_fn tapfn, const void* param, float relatedoffset, const tapcontent_t& tctt) // { // float LLof = LL + (HL-LL)*relatedoffset; // float HLof = HL + (HL-LL)*relatedoffset; // tapfn(LLof + position*(HLof-LLof), tctt.lmardimm, tctt.lmoffset, param, base); // assignText(&pointer, redact(base)); //// needRedrawByPosition = true; // } // virtual void bdContentUpdateEnumerate(int from, int count, int recycle, float relatedoffset) // { // LL = from; // HL = from + count; // MOD = 0.0f; // numfmt.numformatInteger(false); // assignText(&pointer, redact(numfmt(_update_value(position)))); // ntf: reloffset //// needRedrawByPosition = true; // } //}; */ //class MarginColoredSpace: public MarginElement //{ // int space; // QColor color; //public: // MarginColoredSpace(int space, QColor color) // { // this->space = space; // this->color = color; // } // void setSpace(int newspace) // { // space = newspace; // } //protected: // virtual bool updateArea(const uarea_t&, int){ return true; } // virtual void draw(QPainter& p){ } // virtual void sizeHint(ATTACHED_TO, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const // { // *atto_size = space; // *minsegm_main = *minsegm_pre = *minsegm_post = 0; // } // virtual void changeColor(const QColor& c){ this->color = c; } //}; //class MarginStretch: public MarginElement //{ // int space; // int stepSelf, stepDraw; // int c_space; //public: // MarginStretch(int _space, int _stepself, int _stepdraw): space(_space), stepSelf(_stepself), stepDraw(_stepdraw), // c_space(0) // { // } // void setSpace(int newspace) // { // space = newspace; // c_space = 0; // } //// void resize(int drawsize) // int spaceCurrent() const { return space + c_space; } //protected: // virtual bool updateArea(const uarea_t&, int){ return true; } //// virtual bool needredraw() const { return false; } // virtual void draw(QPainter&){} // virtual void sizeHint(ATTACHED_TO, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const // { // *atto_size = space + c_space; // *minsegm_main = *minsegm_pre = *minsegm_post = 0; // } // virtual void changeColor(const QColor&){} //}; /* class MarginLabel: public MarginElementCached { texts_t label; Qt::Alignment alignment; float orientation; double orient_sin, orient_cos; QSize orient_size; QTransform ttransform; QPoint ttranspoint; bool useneispace; QFont m_font; bool m_fontReplaced; //protected: // int c_width, c_height; private: void prepare() { QSizeF loc = label.uin_text.size(); label.uin_locsize = QSize(qRound(loc.width()), qRound(loc.height())); if (orientation == 0.0f) { if (m_fontReplaced) label.uin_text.prepare(QTransform(), m_font); orient_size = label.uin_locsize; } else { ttransform.rotate(-orientation); label.uin_text.prepare(ttransform, m_font); double rad = double(orientation)*3.1415927/180.0; orient_sin = sin(rad); orient_cos = cos(rad); orient_size = QSize(qRound(orient_sin*loc.height() + orient_cos*loc.width()), qRound(orient_cos*loc.height() + orient_sin*loc.width())); } } public: MarginLabel(const QString& text, bool useNeighborSpace=false, Qt::Alignment align=Qt::AlignCenter, float orientAngleGrad=0.0f): alignment(align), orientation(orientAngleGrad), useneispace(useNeighborSpace), m_fontReplaced(false) { setText(text); } MarginLabel(const QString& text, const QFont& fnt, bool useNeighborSpace=false, Qt::Alignment align=Qt::AlignCenter, float orientAngleGrad=0.0f): alignment(align), orientation(orientAngleGrad), useneispace(useNeighborSpace) { setText(text, fnt); } void setText(const QString& text) { label.uin_text.setText(text); prepare(); } void setText(const QString& text, const QFont& fnt) { label.uin_text.setText(text); m_font = fnt; m_fontReplaced = true; prepare(); } void setFont(const QFont& fnt) { m_font = fnt; m_fontReplaced = true; prepare(); } protected: virtual bool updateArea(const uarea_t& area, int UPDATEFOR) { if (MarginElementCached::updateArea(area, UPDATEFOR) == false) return false; int a1 = area.atto == AT_LEFT? area.atto_pt_shared != -1? area.atto_pt_shared : area.atto_pt - orient_size.width() : area.atto == AT_RIGHT? area.atto_pt_shared != -1? area.atto_pt_shared : area.atto_pt + orient_size.width() : area.atto == AT_TOP? area.atto_pt_shared != -1? area.atto_pt_shared : area.atto_pt - orient_size.height() : area.atto_pt_shared != -1? area.atto_pt_shared : area.atto_pt + orient_size.height(); int a2 = area.atto_pt; int d = useneispace? area.segment_full : area.segm_main; int dd = useneispace? 0 : area.segm_pre + 1; const QRect& actualArea = area.atto == AT_LEFT? QRect(a1, dd, a2 - a1, d) : area.atto == AT_RIGHT? QRect(a2, dd, a1 - a2, d) : area.atto == AT_TOP? QRect(dd, a1, d, a2 - a1) : QRect(dd, a2, d, a1 - a2); QPointF textOffsetSign; rectAlign(actualArea, alignment, &ttranspoint, &textOffsetSign); // if (orientation != 0.0f) // { // textOffsetSign = QPointF(orient_sin*textOffsetSign.x() + orient_cos*textOffsetSign.y(), // -orient_cos*textOffsetSign.y() + orient_sin*textOffsetSign.x()); //// textOffsetSign = QPointF(-(1.0 + textOffsetSign.y()), textOffsetSign.x()); // label.uarea_pos = QPoint(int(textOffsetSign.x()*locsize.height()), int(textOffsetSign.y()*locsize.width())); // } // else // label.uarea_pos = QPoint(int(textOffsetSign.x()*locsize.width()), int(textOffsetSign.y()*locsize.height())); QSize locsize = label.uin_locsize; if (orientation != 0.0f) { // textOffsetSign = QPointF(-(1.0 + textOffsetSign.y()), textOffsetSign.x()); // textOffsetSign = QPointF(-orient_sin - orient_sin*textOffsetSign.y(), // -orient_cos + orient_sin*textOffsetSign.x()); // qDebug()<<orient_cos<<orient_sin; // textOffsetSign = QPointF(orient_cos*textOffsetSign.x() - orient_sin - orient_sin*textOffsetSign.y(), // orient_sin*textOffsetSign.x() - orient_cos + orient_cos*textOffsetSign.y()); // qDebug()<<"TOS: "<<textOffsetSign; // textOffsetSign = QPointF(textOffsetSign.x() +1, (1.0 + textOffsetSign.y())); // label.uarea_pos = QPoint(int(textOffsetSign.x()*locsize.height()), int(textOffsetSign.y()*locsize.width())); // label.uarea_pos = QPoint((orient_cos*textOffsetSign.x() + orient_sin*textOffsetSign.y())*locsize.width() + (orient_sin*textOffsetSign.y() + orient_cos*textOffsetSign.x())*locsize.height() , // orient_sin*textOffsetSign.y()*locsize.width() + orient_cos*textOffsetSign.y()*locsize.height() ); double rad = double(orientation)*3.1415927/180.0; label.uarea_pos = QPoint(int(textOffsetSign.x()*locsize.width()), int(textOffsetSign.y()*locsize.height())); double hyp = 2.0*(sin(rad/2.0)*sqrt(locsize.width()*locsize.width()/4.0 + locsize.height()*locsize.height()/4.0)); double an1 = M_PI/2.0 - (M_PI - rad)/2.0; label.uarea_pos = QPoint(label.uarea_pos.x() + sin(an1)*hyp, label.uarea_pos.y() + cos(an1)*hyp); } else label.uarea_pos = QPoint(int(textOffsetSign.x()*locsize.width()), int(textOffsetSign.y()*locsize.height())); // locsize.transpose(); qDebug()<<"rc:"<<label.uarea_pos; label.visible = 1; return true; } virtual bool draw(QPainter& painter) { if (label.visible) { painter.save(); painter.translate(ttranspoint); if (m_fontReplaced) painter.setFont(m_font); if (ttransform.type() != QTransform::TxNone) painter.setTransform(ttransform, true); painter.drawStaticText(label.uarea_pos, label.uin_text); painter.restore(); } return true; } virtual void sizeHint(ATTACHED_TO atto, int* atto_size, int* minsegm_main, int* minsegm_pre, int* minsegm_post) const { // int size_horz = label.uin_locsize.width(); // int size_vert = label.uin_locsize.height(); // if (orientation == Qt::Vertical) // qSwap(size_horz, size_vert); if (BAR_VERT[atto]) { *atto_size = orient_size.width(); *minsegm_main = orient_size.height(); } else { *atto_size = orient_size.height(); *minsegm_main = orient_size.width(); } // qDebug()<<*atto_size<<*minsegm_main; *minsegm_pre = *minsegm_post = 0; } }; */
e30d2fd797eec1ccd73962c067ab0268ab0dd6b0
392aab7b6ac2a4612f5877152656dc794329200d
/include/gimgui/util/ref.hpp
031abebe8e65c55c58af2c058822126771dd7fb9
[ "MIT" ]
permissive
therocode/GimGui
328e912efc50254ff07b6cd0ec8fee3102ee2702
039e70ef2cb34726ead867eb1bc102f6a53b0df5
refs/heads/master
2020-12-24T15:22:19.786557
2016-01-17T01:10:02
2016-01-17T01:10:02
30,752,141
22
5
null
2015-10-30T10:26:50
2015-02-13T10:42:35
C++
UTF-8
C++
false
false
231
hpp
ref.hpp
#pragma once #include <functional> namespace gim { template <typename Type> using ref = std::reference_wrapper<Type>; template <typename Type> ref<Type> makeRef(Type& value); #include <gimgui/util/ref.inl> }
ed4a6b21e5f5883bbd42a28bc816b8eadea110c6
52cf7c2c95ae5d1af7ab94a99f2cc1c4855ad038
/main_controller/Scmd.cpp
41aa3f4cd298c8806fe1fa79094d418a58a341f0
[]
no_license
masakik/tt-robot
05f3bb6fbd8bd07e91c33cde033cf87fcf136ac8
7ac96925b39476ba0a9bb81d7e858ba61be8d97e
refs/heads/main
2023-04-23T08:08:07.809712
2021-05-07T14:17:27
2021-05-07T14:17:27
323,345,631
0
0
null
null
null
null
UTF-8
C++
false
false
2,261
cpp
Scmd.cpp
#include "Scmd.h" #include "Arduino.h" #include "Cmd.h" void sCmdSetup(Stream *str) { cmdInit(str); cmdAdd("help", cmdHelp); cmdAdd("pgm", cmdProgram); cmdAdd("freq", cmdFreq); cmdAdd("pause", cmdFeederPause); cmdAdd("cont", cmdFeederCont); cmdAdd("status", cmdStatus); cmdAdd("top", cmdTopSpin); cmdAdd("under", cmdUnderSpin); //cmdAdd("elev", cmdElevation); //cmdAdd("azim", cmdAzimute); } void cmdHelp(int arg_cnt, char **args) { Serial.println("status"); Serial.println("pgm 1..9"); Serial.println("pause"); Serial.println("cont"); sprintf(scmd_buffer, "freq %i..%i (bolas por minuto)", BALL_FREQ_MIN, BALL_FREQ_MAX); Serial.println(scmd_buffer); Serial.println("top 0..100 (%)"); Serial.println("under 0..100 (%)"); // futuros Serial.println("elev -30..30 (graus)"); Serial.println("azim -30..30 (graus)"); } void cmdProgram(int arg_cnt, char **args) { int pgm = 1; if (arg_cnt > 1) { pgm = cmdStr2Num(args[1], 10); } Serial.print("pgm "); Serial.println(pgm); } void cmdFreq(int arg_cnt, char **args) { if (arg_cnt > 1) { ball_freq = max(min(cmdStr2Num(args[1], 10), BALL_FREQ_MAX), BALL_FREQ_MIN); // limita entre BALL_FREQ_MIN e BALL_FREQ_MAX ball_interval = 60000 / ball_freq; } Serial.print("freq "); Serial.println(ball_freq); } void cmdTopSpin(int arg_cnt, char **args) { if (arg_cnt > 1) { top.write(max(min(cmdStr2Num(args[1], 10), 100), 0)); } sprintf(buffer, "Top %i%%", top.read()); Serial.println(buffer); } void cmdUnderSpin(int arg_cnt, char **args) { if (arg_cnt > 1) { under.write(max(min(cmdStr2Num(args[1], 10), 100), 0)); } sprintf(buffer, "Under %i%%", under.read()); Serial.println(buffer); } void cmdFeederPause(int arg_cnt, char **args) { ball_soft_pause = true; sound.pause(); } void cmdFeederCont(int arg_cnt, char **args) { ball_soft_pause = false; sound.pause(); } void cmdStatus(int arg_cnt, char **args) { vccMonitor(); sprintf(buffer, "run: %i; count %i; freq %i; top %i%%; under %i%%; vcc %i", !ball_soft_pause, ball_counter, ball_freq, top.read(), under.read(), vcc_monitor ); Serial.println(buffer); } void cmdStatus() { cmdStatus(0, 0); }
183cb7a55f0b302f25818ca1154a27dd48697943
64c7b1fa2debeffa693fb6d900e896ddcc34777e
/NCTUns-6.0/src/nctuns/module/wimax/mac/connection.cc
c21fff3854666b0c0a9589554922ebd0a27b234c
[ "LicenseRef-scancode-other-permissive" ]
permissive
knev/nctuns
6134250cac2c9430c63456b9f3000ab071538563
1da9012704c2cf88342c6229d1cf7ffea196d727
refs/heads/master
2021-01-18T15:02:36.747902
2015-04-24T04:51:27
2015-04-24T04:51:27
34,366,952
0
0
null
2015-04-22T03:42:16
2015-04-22T03:42:16
null
UTF-8
C++
false
false
17,836
cc
connection.cc
/* * Copyright (c) from 2000 to 2009 * * Network and System Laboratory * Department of Computer Science * College of Computer Science * National Chiao Tung University, Taiwan * All Rights Reserved. * * This source code file is part of the NCTUns 6.0 network simulator. * * Permission to use, copy, modify, and distribute this software and * its documentation is hereby granted (excluding for commercial or * for-profit use), provided that both the copyright notice and this * permission notice appear in all copies of the software, derivative * works, or modified versions, and any portions thereof, and that * both notices appear in supporting documentation, and that credit * is given to National Chiao Tung University, Taiwan in all publications * reporting on direct or indirect use of this code or its derivatives. * * National Chiao Tung University, Taiwan makes no representations * about the suitability of this software for any purpose. It is provided * "AS IS" without express or implied warranty. * * A Web site containing the latest NCTUns 6.0 network simulator software * and its documentations is set up at http://NSL.csie.nctu.edu.tw/nctuns.html. * * Project Chief-Technology-Officer * * Prof. Shie-Yuan Wang <shieyuan@csie.nctu.edu.tw> * National Chiao Tung University, Taiwan * * 09/01/2009 */ #include <packet.h> #include "structure.h" #include "library.h" #include "connection.h" #include "management_message.h" using namespace std; Connection::Connection(int cid, bool mesh) { DataCid = cid; CRCIndicator = 1; pduqlen = 0; if (mesh) Type = 0x20; else Type = 0x00; src_nid = 0; dst_nid = 0; FSN = 0; FC = frgNone; } /* * Build generic MAC header. * Note that we do not implement encryption and HCS. */ void Connection::BuildGenericHeader(char *buf, int len) { int crc, offset; struct hdr_generic *hg = (struct hdr_generic *) buf; hg->ht = 0; hg->ec = 0; // Not implemented hg->type = Type; if (FC != frgNone) hg->type |= 0x04; hg->rsv1 = 0; // Reserved hg->ci = CRCIndicator; hg->eks = 0; // Not implemented hg->rsv2 = 0; // Reserved hg->len_msb = len / 256; hg->len_lsb = len % 256; hg->cid_msb = DataCid / 256;; hg->cid_lsb = DataCid % 256; hg->hcs = hcs(reinterpret_cast <char*>(hg),sizeof(struct hdr_generic) - 1); offset = sizeof(hdr_generic); if (hg->type & 0x20) { //memcpy(buf + offset, &NodeID, 2); memcpy(buf + offset, &src_nid, 2); offset += 2; } if (hg->type & 0x04) { struct subhdr_fragment* p = reinterpret_cast<struct subhdr_fragment*> (buf+offset); p->fc = FC; p->fsn = FSN; p->rsv = 0; offset += 1; } if (CRCIndicator) { crc = crc32(0, (char *) buf, len - 4); memcpy((char *) buf + len - 4, &crc, 4); } FSN = (FSN + 1) % 8; if (FC == frgLast) FC = frgNone; } ManagementConnection::ManagementConnection(int cid, bool mesh) : Connection(cid, mesh) { } void ManagementConnection::Insert(const ManagementMessage* pdu) { PduQ.push_back(pdu); } int ManagementConnection::GetInformation(vector<int>* info) const { int totallen = 0; int len = 0; const ManagementMessage* mmsg = NULL; for (list<const void*>::const_iterator it = PduQ.begin(); it != PduQ.end(); it++) { mmsg = static_cast<const ManagementMessage*>(*it); len = GetHeaderLength() + mmsg->getLen(); if (CRCIndicator) // Padding CRC len += 4; if (info) info->push_back(len); totallen += len; //printf("\t(%d) SS msg: %d bytes ", getCID(), len); } return totallen; } int ManagementConnection::EncapsulateAll(char *dstbuf, size_t maxlen) { u_int sendlen = 0, len = 0, hlen; const ManagementMessage* mmsg; while (sendlen < maxlen && !PduQ.empty()) { mmsg = static_cast<const ManagementMessage*>(PduQ.front()); hlen = GetHeaderLength(); len = hlen + mmsg->getLen(); if (CRCIndicator) len += 4; if (sendlen + len > maxlen) break; PduQ.pop_front(); mmsg->copyTo((u_char *) dstbuf + sendlen + hlen); BuildGenericHeader(dstbuf + sendlen, len); delete mmsg; sendlen += len; } return sendlen; } BroadcastConnection::BroadcastConnection(int cid): ManagementConnection(cid, false) { Slot[0] = Slot[1] = Slot[2] = Slot[3] = Slot[4] = NULL; } void BroadcastConnection::Insert(const ManagementMessage* pdu) { ifmgmt *ifmm = (ifmgmt *) pdu; static int index[5] = { MG_DLMAP, MG_ULMAP, MG_DCD, MG_UCD, MG_CLKCMP }; for (int i = 0; i < 5; i++) { if (ifmm->getType() == index[i]) { if (Slot[i]) delete Slot[i]; Slot[i] = ifmm; break; } } } bool BroadcastConnection::Empty() { return !(Slot[0] || Slot[1] || Slot[2] || Slot[3] || Slot[4]); } int BroadcastConnection::GetInformation(vector<int>* info) const { ifmgmt *ifmm; int i, totallen = 0, len = 0; for (i = 0; i < 5; i++) { ifmm = (ifmgmt *) Slot[i]; if (ifmm) { len = GetHeaderLength() + ifmm->getLen(); if (CRCIndicator) len += 4; info->push_back(len); totallen += len; // printf("\t(%d) Broadcast msg: %d bytes\n", i, len); } } return totallen; } int BroadcastConnection::EncapsulateAll(char *dstbuf, size_t maxlen) { u_int len = 0, sendlen = 0, hlen, i; ifmgmt *ifmm; for (i = 0; i < 5; i++) { ifmm = Slot[i]; if (ifmm) { hlen = GetHeaderLength(); len = hlen + ifmm->getLen(); if (CRCIndicator) len += 4; if (sendlen + len > maxlen) break; Slot[i] = NULL; ifmm->copyTo((u_char *) (dstbuf + sendlen + hlen)); BuildGenericHeader(dstbuf + sendlen, len); delete ifmm; sendlen += len; } } return sendlen; } /* * Data Connection Class */ DataConnection::DataConnection(int cid, bool mesh) :Connection(cid, mesh) { _qPkt = NULL; _qLen = 0; } DataConnection::DataConnection(int cid, u_int16_t peer_nid ,bool mesh) :Connection(cid, mesh) { _qPkt = NULL; _qLen = 0; SetDstNodeID(peer_nid); } void DataConnection::Insert(const Packet* pdu) { pduqlen++; PduQ.push_back(pdu); } size_t DataConnection::nf_pending_packet() const { return PduQ.size(); } bool DataConnection::Empty() { if (_qPkt) return false; return PduQ.empty(); } int DataConnection::GetInformation(vector<int>* info) const { int totallen = 0; int padding; if (_qPkt) { int hlen = GetHeaderLength() + 1; int len = _qPkt->pkt_getlen() - _qLen; if (CRCIndicator) padding = 4; else padding = 0; if (info) info->push_back(hlen + len + padding); totallen = hlen + len + padding; //printf("\tData: (%d, %d, %d) bytes of %d qLen=%d ", hlen, len, padding, _qPkt->pkt_getlen()+11, _qLen); } for (list<const void*>::const_iterator it = PduQ.begin(); it != PduQ.end(); it++) { const Packet* pkt = (Packet*)*it; int hlen = GetHeaderLength(); int len = pkt->pkt_getlen(); if (CRCIndicator) padding = 4; else padding = 0; if (info) info->push_back(hlen + len + padding); totallen += hlen + len + padding; } //if( totallen ) // printf("Total: %d bytes (%d packets) CID(%d)\n", totallen, pduqlen, DataCid); return totallen; } int DataConnection::EncapsulateAll(char* dstbuf, size_t maxlen) { u_int padding = 0; if (CRCIndicator) padding = 4; u_int sendlen = 0; if (_qPkt) { u_int hlen = GetHeaderLength() + 1; if (hlen + padding >= maxlen) // No space enough to send any pdu return 0; u_int pdulen = hlen + _qPkt->pkt_getlen() - _qLen + padding; if (pdulen <= maxlen) { FC = frgLast; // last fragment memcpy(dstbuf + hlen, _qPkt->pkt_sget() + _qLen, pdulen - hlen - padding); delete _qPkt; _qPkt = NULL; _qLen = 0; } else { pdulen = maxlen; FC = frgMiddle; // middle fragment memcpy(dstbuf + hlen, _qPkt->pkt_sget() + _qLen, pdulen - hlen - padding); _qLen += pdulen - hlen - padding; } BuildGenericHeader(dstbuf, pdulen); sendlen = pdulen; } char* ptr = dstbuf + sendlen; while (!_qPkt && !PduQ.empty()) { Packet* pkt = (Packet*)PduQ.front(); u_int hlen = GetHeaderLength(); u_int pdulen = hlen + pkt->pkt_getlen() + padding; if (sendlen + pdulen <= maxlen) { memcpy(ptr + hlen, pkt->pkt_sget(), pkt->pkt_getlen()); // IP Packet FC = frgNone; // no fragment pduqlen--; PduQ.pop_front(); delete pkt; } else // Fragment { hlen++; // Fragment subheader pdulen = maxlen - sendlen; if (hlen + padding >= pdulen) // No space for payload break; _qPkt = pkt; pduqlen--; PduQ.pop_front(); _qLen = pdulen - hlen - padding; FC = frgFirst; // first fragment memcpy(ptr + hlen, pkt->pkt_sget(), _qLen); // IP Packet } BuildGenericHeader(ptr, pdulen); sendlen += pdulen; ptr += pdulen; if (maxlen <= sendlen + sizeof(struct hdr_generic) + padding) break; } return sendlen; } DataConnectionEthernet::DataConnectionEthernet(int cid, bool mesh) : DataConnection(cid, mesh) { } int DataConnectionEthernet::EncapsulateAll(char *dstbuf, size_t maxlen) { Packet *pkt; char *ptr; u_int pdulen, hlen, sendlen = 0, padding = 0; if (CRCIndicator) padding = 4; if (_qPkt) { hlen = GetHeaderLength() + 1; if (hlen + padding >= maxlen) // No space enough to send any pdu return 0; pdulen = hlen + _qPkt->pkt_getlen() - _qLen + padding; if (pdulen <= maxlen) { FC = frgLast; // last fragment if (_qLen < 14) { memcpy(dstbuf + hlen, _qPkt->pkt_get() + _qLen, 14 - _qLen); memcpy(dstbuf + hlen + 14 - _qLen, _qPkt->pkt_sget(), pdulen - hlen - (14 - _qLen) - padding); } else { memcpy(dstbuf + hlen, _qPkt->pkt_sget() + _qLen - 14, pdulen - hlen - padding); } delete _qPkt; _qPkt = NULL; _qLen = 0; } else { pdulen = maxlen; FC = frgMiddle; // middle fragment if (_qLen < 14) { if (14U - _qLen > pdulen - hlen - padding) { memcpy(dstbuf + hlen, _qPkt->pkt_get() + _qLen, pdulen - hlen - padding); _qLen += pdulen - hlen - padding; } else { memcpy(dstbuf + hlen, _qPkt->pkt_get() + _qLen, 14 - _qLen); memcpy(dstbuf + hlen + 14 - _qLen, _qPkt->pkt_sget(), pdulen - hlen - (14 - _qLen) - padding); _qLen += pdulen - hlen - padding; } } else { memcpy(dstbuf + hlen, _qPkt->pkt_sget() + _qLen - 14, pdulen - hlen - padding); _qLen += pdulen - hlen - padding; } } BuildGenericHeader(dstbuf, pdulen); sendlen = pdulen; } ptr = dstbuf + sendlen; while (!_qPkt && !PduQ.empty()) { pkt = (Packet *) PduQ.front(); hlen = GetHeaderLength(); pdulen = hlen + pkt->pkt_getlen() + padding; if (sendlen + pdulen <= maxlen) { memcpy(ptr + hlen, pkt->pkt_get(), 14); // Ether Header memcpy(ptr + hlen + 14, pkt->pkt_sget(), pkt->pkt_getlen() - 14); // IP Packet FC = frgNone; // no fragment pduqlen--; PduQ.pop_front(); delete pkt; } else // Fragment { hlen++; // Fragment subheader pdulen = maxlen - sendlen; if (hlen + padding >= pdulen) // No space for payload break; _qPkt = pkt; pduqlen--; PduQ.pop_front(); _qLen = pdulen - hlen - padding; FC = frgFirst; // first fragment if (_qLen >= 14) { memcpy(ptr + hlen, pkt->pkt_get(), 14); // Ether Header memcpy(ptr + hlen + 14, pkt->pkt_sget(), _qLen - 14); // IP Packet } else { memcpy(ptr + hlen, pkt->pkt_get(), _qLen); // Ether Header } } BuildGenericHeader(ptr, pdulen); sendlen += pdulen; ptr += pdulen; if (sendlen + sizeof(struct hdr_generic) + padding >= maxlen) break; } return sendlen; } ConnectionReceiver::ConnectionReceiver(u_int16_t pCid) { _cid = pCid; _src_nid = 0; _dst_nid = 0; _fsn = 0; _len = 0; _maxlen = 2048; _buffer = new char[_maxlen]; _state = NoData; _attrARQ = 0; } ConnectionReceiver::ConnectionReceiver(u_int16_t pCid, u_int16_t src_nid, u_int16_t dst_nid ) { _cid = pCid; _src_nid = src_nid; _dst_nid = dst_nid; _fsn = 0; _len = 0; _maxlen = 2048; _buffer = new char[_maxlen]; _state = NoData; _attrARQ = 0; } ConnectionReceiver::~ConnectionReceiver() { delete [] _buffer; } void ConnectionReceiver::insert(struct hdr_generic *hg, int len) { char *ptr = reinterpret_cast < char *>(hg + 1); int oh = 0; struct subhdr_fragment *fraghdr = NULL; if (hg->type & tyMesh) { ptr += 2; } if (hg->type & tyGrant) { ptr += 2; } if (hg->type & tyFragment) { fraghdr = reinterpret_cast<struct subhdr_fragment*>(ptr); if (hg->type & tyARQ) ptr += 2; else if (hg->type & tyExtend) ptr += 2; else { ptr += 1; if (fraghdr->fsn != (_fsn + 1) % 8) { drop(); } _fsn = fraghdr->fsn; } } if (hg->type & tyPacking) { if (hg->type & tyARQ) ptr += 3; else if (hg->type & tyExtend) ptr += 3; else ptr += 2; } oh = ptr - reinterpret_cast < char *>(hg); if (fraghdr) { switch (fraghdr->fc) { case frgNone: drop(); memcpy(_buffer, ptr, len - oh); _len = len - oh; _state = Complete; break; case frgLast: if (_state == NotComplete) { if (_len + len - oh > _maxlen) { _maxlen = _len + len - oh; char* p = new char[_maxlen]; memcpy(p, _buffer, _len); delete _buffer; _buffer = p; } memcpy(_buffer + _len, ptr, len - oh); _len += len - oh; _state = Complete; } break; case frgFirst: drop(); if (len - oh > _maxlen) { _maxlen = len - oh; delete _buffer; _buffer = new char[_maxlen]; } memcpy(_buffer, ptr, len - oh); _len = len - oh; _state = NotComplete; break; case frgMiddle: if (_state == NotComplete) { memcpy(_buffer + _len, ptr, len - oh); _len += len - oh; _state = NotComplete; } break; } } else { _external = ptr; _len = len - oh; _state = External; } } char *ConnectionReceiver::getPacket(int &len) { char *ret; if (_state == Complete) { ret = _buffer; len = _len; _state = NoData; _len = 0; return ret; } else if (_state == External) { len = _len; _len = 0; _state = NoData; return _external; } return NULL; } void ConnectionReceiver::drop() { if (_state != NoData) { printf("Drop fragment data status=%d %d\n", _state, _len); _state = NoData; _len = 0; } }
cff0419194dcf2708672ffbbb6819949cb8f0655
5671c626ee367c9aacb909cd76a06d2fadf941e2
/frameworks/core/components/tab_bar/tab_bar_item_element.h
abd53ffe63a4789688b97fbafeedf945178889f6
[ "Apache-2.0" ]
permissive
openharmony/ace_ace_engine
fa3f2abad9866bbb329524fb039fa89dd9517592
c9be21d0e8cb9662d5f4f93184fdfdb538c9d4e1
refs/heads/master
2022-07-21T19:32:59.377634
2022-05-06T11:18:20
2022-05-06T11:18:20
400,083,641
2
1
null
null
null
null
UTF-8
C++
false
false
2,053
h
tab_bar_item_element.h
/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TAB_BAR_TAB_BAR_ITEM_ELEMENT_H #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TAB_BAR_TAB_BAR_ITEM_ELEMENT_H #include "core/components/box/box_element.h" #include "core/focus/focus_node.h" namespace OHOS::Ace { class TabBarItemElement : public BoxElement, public FocusGroup { DECLARE_ACE_TYPE(TabBarItemElement, BoxElement, FocusGroup); public: void OnFocus() override { if (renderNode_) { renderNode_->ChangeStatus(RenderStatus::FOCUS); } FocusGroup::OnFocus(); } void OnBlur() override { if (renderNode_) { renderNode_->ChangeStatus(RenderStatus::BLUR); } FocusGroup::OnBlur(); } bool RequestNextFocus(bool vertical, bool reverse, const Rect& rect) override { return false; } bool IsFocusable() const override { return FocusNode::IsFocusable(); } bool AcceptFocusByRectOfLastFocus(const Rect& rect) override { return FocusNode::AcceptFocusByRectOfLastFocus(rect); } RefPtr<RenderNode> CreateRenderNode() override { auto tabBarItemComponent = AceType::DynamicCast<TabBarItemComponent>(component_); return tabBarItemComponent ? tabBarItemComponent->CreateRenderNode() : nullptr; } }; } // namespace OHOS::Ace #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TAB_BAR_TAB_BAR_ITEM_ELEMENT_H
de540bbe3d1c9ef3cade7e03400088112e189673
a7e98509498780da952ed12a9531a802fbaa1e46
/Bank.h
b2258d3af8f46b0b7b21ecb76aceaa04566a1829
[]
no_license
wzr0008/Self-bookkeeping-via-C-
9ac078dee877b45e9049e7fba11fd70d722cf66f
34f32f3588929c57129a10b4efc6e22698255110
refs/heads/main
2023-04-18T18:20:12.929689
2021-05-08T01:57:07
2021-05-08T01:57:07
365,336,609
0
0
null
null
null
null
UTF-8
C++
false
false
636
h
Bank.h
// // Bank.h // Wallet // // Created by rui wang on 4/26/21. // #ifndef Bank_h #define Bank_h #include <iostream> #include <fstream> #include <cstdlib> #include <vector> #include <map> #include "Account.h" using namespace std; class Bank:public Account{ private: map<long,Account> accounts; public: Bank(); Account OpenAccount(string fname,string lname,float balance); Account BalanceEnquiry(long accountNum); Account Deposit(long accountNum,float amount); Account Withdraw(long accountNum,float amount); void CloseAccount(long accountNum); void ShowAllAccount(); ~Bank(); }; #endif /* Bank_h */
8dd055571cd5b7ec30a539e8950aec3ed783e756
d5f95edd4568b07e474cc9b0e7a8ef57ee471153
/Day 9 (Recursion)/kth_permutation_sequence.cpp
8cf05868e0923890fc856396bfcb127028fb2459
[]
no_license
Aditya2150/SDE-Questions
c712208d5f4a774bb686af8f43ce9cfe31c21ddf
094d916d4608ed8d61173310e1ed559fe871805d
refs/heads/main
2023-06-21T16:40:48.370833
2021-07-27T10:29:29
2021-07-27T10:29:29
378,234,343
1
0
null
null
null
null
UTF-8
C++
false
false
950
cpp
kth_permutation_sequence.cpp
// The set [1, 2, 3, ..., n] contains a total of n! unique permutations. // By listing and labeling all of the permutations in order, we get the following sequence for n = 3: // "123" // "132" // "213" // "231" // "312" // "321" // Given n and k, return the kth permutation sequence. // Recursive (BAD Complexity) class Solution { public: void solve(int index,int n,int& k,string s, string& ans,int p[]) { if(k==0) return; if(index==n) { ans=s; k--; return; } for(int i=1;i<=n;i++) { if(p[i])continue; p[i]=1; s+='0'+i; solve(index+1,n,k,s,ans,p); s.pop_back(); p[i]=0; } } string getPermutation(int n, int k) { string ans; int p[n+1]; memset(p,0,sizeof(p)); solve(0,n,k,"",ans,p); return ans; } };
47d78b510d4faccbaf875be2865997eba808370e
2ed4b541c28a9621593df04c2ee3e9368b6304a7
/src/vulkan/vulkan_loader.cpp
17e9b629c4ab3a187acaa4edaf359e2616b9a4a3
[ "LicenseRef-scancode-warranty-disclaimer", "Zlib" ]
permissive
doitsujin/dxvk
ab07647fed6f6e960d225872fb752c572d7c5b0e
bbd1d84cd0e0a083a4d162c7207f81cf6604940d
refs/heads/master
2023-08-28T05:22:37.602631
2023-08-26T07:24:09
2023-08-26T08:43:42
106,558,568
11,382
1,055
Zlib
2023-09-13T21:29:26
2017-10-11T13:34:29
C++
UTF-8
C++
false
false
3,003
cpp
vulkan_loader.cpp
#include <tuple> #include "vulkan_loader.h" #include "../util/log/log.h" #include "../util/util_string.h" #include "../util/util_win32_compat.h" namespace dxvk::vk { static std::pair<HMODULE, PFN_vkGetInstanceProcAddr> loadVulkanLibrary() { static const std::array<const char*, 2> dllNames = {{ #ifdef _WIN32 "winevulkan.dll", "vulkan-1.dll", #else "libvulkan.so", "libvulkan.so.1", #endif }}; for (auto dllName : dllNames) { HMODULE library = LoadLibraryA(dllName); if (!library) continue; auto proc = GetProcAddress(library, "vkGetInstanceProcAddr"); if (!proc) { FreeLibrary(library); continue; } Logger::info(str::format("Vulkan: Found vkGetInstanceProcAddr in ", dllName, " @ 0x", std::hex, reinterpret_cast<uintptr_t>(proc))); return std::make_pair(library, reinterpret_cast<PFN_vkGetInstanceProcAddr>(proc)); } Logger::err("Vulkan: vkGetInstanceProcAddr not found"); return { }; } LibraryLoader::LibraryLoader() { std::tie(m_library, m_getInstanceProcAddr) = loadVulkanLibrary(); } LibraryLoader::LibraryLoader(PFN_vkGetInstanceProcAddr loaderProc) { m_getInstanceProcAddr = loaderProc; } LibraryLoader::~LibraryLoader() { if (m_library) FreeLibrary(m_library); } PFN_vkVoidFunction LibraryLoader::sym(VkInstance instance, const char* name) const { return m_getInstanceProcAddr(instance, name); } PFN_vkVoidFunction LibraryLoader::sym(const char* name) const { return sym(nullptr, name); } bool LibraryLoader::valid() const { return m_getInstanceProcAddr != nullptr; } InstanceLoader::InstanceLoader(const Rc<LibraryLoader>& library, bool owned, VkInstance instance) : m_library(library), m_instance(instance), m_owned(owned) { } PFN_vkVoidFunction InstanceLoader::sym(const char* name) const { return m_library->sym(m_instance, name); } DeviceLoader::DeviceLoader(const Rc<InstanceLoader>& library, bool owned, VkDevice device) : m_library(library) , m_getDeviceProcAddr(reinterpret_cast<PFN_vkGetDeviceProcAddr>( m_library->sym("vkGetDeviceProcAddr"))), m_device(device), m_owned(owned) { } PFN_vkVoidFunction DeviceLoader::sym(const char* name) const { return m_getDeviceProcAddr(m_device, name); } LibraryFn::LibraryFn() { } LibraryFn::LibraryFn(PFN_vkGetInstanceProcAddr loaderProc) : LibraryLoader(loaderProc) { } LibraryFn::~LibraryFn() { } InstanceFn::InstanceFn(const Rc<LibraryLoader>& library, bool owned, VkInstance instance) : InstanceLoader(library, owned, instance) { } InstanceFn::~InstanceFn() { if (m_owned) this->vkDestroyInstance(m_instance, nullptr); } DeviceFn::DeviceFn(const Rc<InstanceLoader>& library, bool owned, VkDevice device) : DeviceLoader(library, owned, device) { } DeviceFn::~DeviceFn() { if (m_owned) this->vkDestroyDevice(m_device, nullptr); } }
2300509c1e3c34bc0c7d62e26650f4a4ff8e42ba
6abb92d99ff4218866eafab64390653addbf0d64
/AtCoder/othercontests/old/nCircles.cpp
ecebd67bab4447a467f784cccb81649cd2b90ed3
[]
no_license
Johannyjm/c-pro
38a7b81aff872b2246e5c63d6e49ef3dfb0789ae
770f2ac419b31bb0d47c4ee93c717c0c98c1d97d
refs/heads/main
2023-08-18T01:02:23.761499
2023-08-07T15:13:58
2023-08-07T15:13:58
217,938,272
0
0
null
2023-06-25T15:11:37
2019-10-28T00:51:09
C++
UTF-8
C++
false
false
433
cpp
nCircles.cpp
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; int r[n]; rep(i, n) cin >> r[i]; sort(r, r+n, greater<int>()); double res = 0.; rep(i, n){ if(i%2) res -= r[i]*r[i]; else res += r[i]*r[i]; } printf("%.12f\n", res * M_PI); }
b12d785d3d35f7c2f103a57ae8ec499308e102bd
4a77516add7976e3623089ce2b38b647b5b68d16
/ONP_Codechef.cpp
f56fb66c56b01332da5bdd97ebd364193a21c259
[]
no_license
hardik20sharma/Codechef
251e1fc47e263efb451e39453ce3cf5a28dd31d4
c6d6d86417251c9177d23ae38517c2f78eb49b08
refs/heads/master
2023-05-25T11:10:56.016697
2021-06-14T17:18:49
2021-06-14T17:18:49
257,281,799
0
0
null
null
null
null
UTF-8
C++
false
false
1,365
cpp
ONP_Codechef.cpp
#include<bits/stdc++.h> using namespace std; int precedence(char c) { if(c == '^') return 3; else if(c == '*' || c == '/') return 2; else if(c == '+' || c == '-') return 1; else return -1; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while(t--) { string str; cin >> str; string res = ""; stack<char> s; s.push('X'); for(char c : str) if(isalpha(c)) res += c; else if(c == '(') s.push(c); else if(c == ')') { while(s.top() != 'X' && s.top() != '(') { res += s.top(); s.pop(); } if(s.top() == '(') s.pop(); } else { while(s.top() != 'X' && precedence(c) <= precedence(s.top()) ) { res += s.top(); s.pop(); } s.push(c); } while(s.top() != 'X') { res += s.top(); s.pop(); } cout << res << "\n"; } }
ee96a4e4515f87cd7a0609b370b1708d9ed7e6dc
dbbe9a044221f1c7677e1995fb663761e692329b
/sql2rollout/extract_rollouts.cpp
1bf15ed63ea4e0e67f8719b17955e686fae062b5
[ "MIT" ]
permissive
cepsdev/rollAut
9a46ab3fed7812b02d0b551955dfa141ebe1c72c
ba1b014e21f7dfc3d0d5c74fd051e65ae74a6a36
refs/heads/main
2023-05-31T18:26:35.113998
2021-07-08T01:47:09
2021-07-08T01:47:09
382,706,254
0
0
null
2021-07-03T20:55:11
2021-07-03T20:43:35
null
UTF-8
C++
false
false
4,462
cpp
extract_rollouts.cpp
/* MIT License Copyright (c) 2021 Tomas Prerovsky 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 <stdlib.h> #include <iostream> #include <ctype.h> #include <chrono> #include <sstream> #include <vector> #include <set> #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h> #include "rollout_serialization.h" static void print_usage(std::ostream& os,char * argv[]){ using namespace std; os << "Usage: " << argv[0] << " [-h HOSTNAME] [-u USER] [-p PASSWD] [-t TIMESTAMP] [-c] -s SAPCODE -j JOB_NAME" << endl; os << endl; os << "Checks MySQL Table 'rollouts' for entries younger than TIMESTAMP optionally returning the value of result_cd." << endl; os <<"-h name of host running MySQL server, default is 'localhost'." << endl; os <<"-u user name used for login to MySQL server, default is 'root'." << endl; os <<"-p passphraseused for login to MySQL server, default is the empty string." << endl; os <<"-t Timestamp used for filtering of relevant job entries, entries with result_ts older are ignored." << endl; os <<"-c name of host running MySQL server, default is 'localhost'." << endl; os << "For any obligatory parameter without a value a reasonable default will be chosen." << endl; } #include <climits> int main(int argc,char* argv[]) { using namespace std; std::string hostname = "localhost"; std::string user = "root"; std::string passwd = ""; std::string timestamp = ""; std::string sapcode; std::string database{"rollAut"}; std::string job_name{}; bool check_for_empty_resultset_only = true; int opt; for(; (opt = getopt(argc,argv,":h:u:p:t:d:j:s:c")) != -1 ;){ if (opt == '?' || opt == ':') { print_usage(cerr,argv); return - EXIT_FAILURE; } switch(opt){ case 'h' : hostname = optarg; break; case 'p' : passwd = optarg; break; case 'u' : user = optarg; break; case 't' : timestamp = optarg; break; case 'd' : database = optarg; break; case 'j' : job_name = optarg; break; case 's' : sapcode = optarg; break; case 'c' : check_for_empty_resultset_only=false; break; } } if (timestamp.length() == 0) timestamp = rollaut::db::mysql_timestamp(chrono::system_clock::now()); try { auto driver = get_driver_instance(); std::shared_ptr<sql::Connection> con { driver->connect("tcp://"+hostname, user, passwd) }; con->setSchema(database); std::map<int,rollaut::db::rollout::ceps::step_type_t> step_details; std::vector<std::tuple<std::uint64_t,std::string,std::string,time_t>> active_rollouts_result; rollaut::db::rollout::ceps::stores_t stores; rollaut::db::rollout::ceps::steps_t steps; rollaut::db::rollout::ceps::dump_step_types(cout,step_details,con); rollaut::db::rollout::ceps::dump_active_rollouts(con,timestamp,active_rollouts_result); rollaut::db::rollout::ceps::dump_active_rollout_stores(stores,con,timestamp); rollaut::db::rollout::ceps::dump_active_rollout_steps(steps,con,timestamp); } catch (sql::SQLException &e) { cerr << "***Fatal: " << e.what()<< " (MySQL error code: " << e.getErrorCode() << ", SQLState: " << e.getSQLState() << " )" << endl; return - EXIT_FAILURE; } return EXIT_SUCCESS; }
50bcd84d6c3a15c8e085144e8fe801df62ba3f62
19d6752c856a7a227d0bedee2456eec92a522409
/mainboard/firmware/buzzer.cpp
42d8faeae81b1e7950777675f8847ac6e641214c
[]
no_license
Rhoban/SSL-Electronics
e9c77e4a24b22ee704a4f7a28bb3ea7f41bf9a7c
283b7664574c2be35382687d3fd5dec2b5758640
refs/heads/master
2022-11-21T16:10:27.577835
2020-03-13T14:43:35
2020-03-13T14:43:35
108,429,172
1
0
null
null
null
null
UTF-8
C++
false
false
5,333
cpp
buzzer.cpp
#include <stdlib.h> #include <wirish/wirish.h> #include <terminal.h> #include "hardware.h" #include "watchdog.h" #include "buzzer.h" struct buzzer_note { unsigned int freq; unsigned int duration; }; // Config HardwareTimer timer(BUZZER_TIMER); // Partitions // static struct buzzer_note beethoven_boot[] = { // {440, 200}, // {0, 10}, // {440, 200}, // {0, 10}, // {440, 200}, // {0, 10}, // {392, 600}, // {0, 10}, // // {415, 300/2}, // // {415, 300/2}, // // {415, 300/2}, // // {370, 160/2}, // {0, 0} // }; static struct buzzer_note rickroll[] = { {B4b, 100}, {0, 20}, {C5, 100}, {0, 20}, {D5b, 100}, {0, 20}, {B4b, 100}, {0, 20}, {F5, 212}, {0, 20}, {F5, 212}, {0, 20}, {E5b, 312}, {0, 20}, {B4b, 100}, {0, 20}, {C5, 100}, {0, 20}, {D5b, 100}, {0, 20}, {B4b, 100}, {0, 20}, {E5b, 212}, {0, 20}, {E5b, 212}, {0, 20}, {D5b, 312}, {0, 20}, {B4b, 100}, {0, 20}, {C5, 100}, {0, 20}, {D5b, 100}, {0, 20}, {B4b, 100}, {0, 20}, {D5b, 212}, {0, 20}, {E5b, 212}, {0, 20}, {C5, 212}, {0, 212}, {A5b, 112}, {0, 20}, {E5b, 312}, {0, 20}, {D5b, 624}, {0, 20}, {0, 0} }; static struct buzzer_note chord_boot[] = { {C5, 50}, {E5, 50}, {G5, 50}, {C6, 200}, {0, 0} }; // static struct buzzer_note chord_boot_dev[] = { // {C5, 50}, // {E5b, 50}, // {G5, 50}, // {C6, 200}, // {0, 0} // }; static struct buzzer_note chord_boot_dev[] = { {C6, 50}, {G5, 50}, {E5, 50}, {C5, 200}, {0, 0} }; // static struct buzzer_note melody_boot[] = { // {523, 200/2}, // {659, 350/2}, // {523, 200/2}, // {698, 300/2}, // {659, 160/2}, // {0, 0} // }; static struct buzzer_note melody_alert[] = { {2000, 200}, {200, 200}, {2000, 200}, {200, 200}, {0, 0} }; static struct buzzer_note melody_alert_fast[] = { {2000, 100}, {200, 100}, {2000, 100}, {200, 100}, {2000, 100}, {200, 100}, {0, 0} }; static struct buzzer_note melody_warning[] = { {800, 200}, {400, 200}, {200, 0}, {200, 400}, {0, 0} }; static struct buzzer_note melody_begin[] = { {800, 200}, {1000, 200}, {0, 0}, }; static struct buzzer_note melody_end[] = { {1000, 200}, {800, 200}, {0, 0}, }; static struct buzzer_note melody_custom[] = { {0, 0}, {0, 0} }; // Status static struct buzzer_note *note_now; static struct buzzer_note *melody; static struct buzzer_note *melody_repeat; static int melody_st; void buzzer_init() { melody = NULL; pinMode(BUZZER_PIN, PWM); pwmWrite(BUZZER_PIN, 0); } void buzzer_play_note(int note, int power) { timer.pause(); timer.setPrescaleFactor(72000000 / (note * 100)); timer.setOverflow(100); if (note == 0) { pinMode(BUZZER_PIN, OUTPUT); digitalWrite(BUZZER_PIN, LOW); } else { timer.refresh(); timer.resume(); pinMode(BUZZER_PIN, PWM); pwmWrite(BUZZER_PIN, power); } } static void buzzer_enter(struct buzzer_note *note) { buzzer_play_note(note->freq); melody = note; melody_st = millis(); if (note->freq == 0 && note->duration == 0) { if (melody_repeat != NULL) { buzzer_enter(melody_repeat); } else { melody = NULL; } } } void buzzer_play(unsigned int melody_num, bool repeat) { struct buzzer_note *to_play = NULL; if (melody_num == MELODY_BOOT) { // to_play = &melody_boot[0]; to_play = &chord_boot[0]; } else if (melody_num == MELODY_ALERT) { to_play = &melody_alert[0]; } else if (melody_num == MELODY_ALERT_FAST) { to_play = &melody_alert_fast[0]; } else if (melody_num == MELODY_WARNING) { to_play = &melody_warning[0]; } else if (melody_num == MELODY_BEETHOVEN) { to_play = &chord_boot[0]; } else if (melody_num == MELODY_BEGIN) { to_play = &melody_begin[0]; } else if (melody_num == MELODY_END) { to_play = &melody_end[0]; } else if (melody_num == MELODY_CUSTOM) { to_play = &melody_custom[0]; }else if (melody_num == MELODY_BOOT_DEV) { to_play = &chord_boot_dev[0]; }else if (melody_num == RICKROLL) { to_play = &rickroll[0]; } else { melody = NULL; } if (to_play) { melody_repeat = repeat ? to_play : NULL; buzzer_enter(to_play); } } void buzzer_tick() { if (melody != NULL) { if (millis()-melody_st > melody->duration) { buzzer_enter(melody+1); } } } void buzzer_stop() { buzzer_play_note(0); melody = NULL; melody_repeat = NULL; } bool buzzer_is_playing() { return melody != NULL; } void buzzer_wait_play() { while (buzzer_is_playing()) { buzzer_tick(); watchdog_feed(); } } void buzzer_beep(unsigned int freq, unsigned int duration) { melody_custom[0].freq = freq; melody_custom[0].duration = duration; buzzer_play(MELODY_CUSTOM); } #ifdef HAS_TERMINAL TERMINAL_COMMAND(play, "Play a melody") { int melnum = atoi(argv[0]); terminal_io()->print("Playing melody "); terminal_io()->print(melnum); terminal_io()->println(); buzzer_play(melnum); } TERMINAL_COMMAND(beep, "Plays a beep") { if (argc == 2) { buzzer_beep(atoi(argv[0]), atoi(argv[1])); } else if (argc == 1) { buzzer_beep(atoi(argv[0]), 1000); } else { terminal_io()->println("Usage: beep freq [duration]"); } } #endif
e66039b06806073376b02593f764992aa0e50314
64d9ab766e87365dc3ca48d491f7b939aae8d0bf
/minspanningtree/PairingHeap.hpp
93e645783f3ee9683bcc7e95353e3b1626f8f151
[]
no_license
danstiner/college-assignments
021741052ed354c178368afc45353e104269ee74
750e4c36d36f2c49df710e42333880997672f2ef
refs/heads/master
2016-09-10T18:29:02.550679
2012-03-08T06:42:22
2012-03-08T06:42:22
3,309,926
0
1
null
null
null
null
UTF-8
C++
false
false
2,297
hpp
PairingHeap.hpp
/* * PairingHeap.h * * Created on: Feb 15, 2012 * Author: stiner */ #ifndef PAIRINGHEAP_H_ #define PAIRINGHEAP_H_ #include <stdlib.h> #include <list> namespace danielstiner { template<typename T> class PairingHeap { private: class Heap { public: Heap(T *value); std::list<Heap*> subheaps; T *value; }; Heap *root; Heap* MergePairs(std::list<Heap*> &heaps); Heap *Merge(Heap *heap1, Heap *heap2); void PrependSubheap(Heap *heap, Heap *to); void DeleteHeap(Heap *heap); public: PairingHeap(); ~PairingHeap(); T * FindMin(); T * ExtractMin(); void Insert(T *item); }; template<typename T> PairingHeap<T>::Heap::Heap(T *value) { this->value = value; } template<typename T> PairingHeap<T>::PairingHeap() { root = NULL; } template<typename T> PairingHeap<T>::~PairingHeap() { // TODO Auto-generated destructor stub } template<class ItemType> ItemType * PairingHeap<ItemType>::FindMin() { if (this->root == NULL) { // Handle empty tree // error return NULL; } else { return this->root->value; } } template<class ItemType> void PairingHeap<ItemType>::Insert(ItemType *item) { this->root = Merge(new Heap(item), root); } template<class ItemType> ItemType * PairingHeap<ItemType>::ExtractMin() { if (root == NULL) { // error out return NULL; } else { ItemType *ret = root->value; Heap *h = MergePairs(root->subheaps); delete root; root = h; return ret; } } template<typename ItemType> typename PairingHeap<ItemType>::Heap* PairingHeap<ItemType>::MergePairs(std::list<Heap*> &heaps) { if (heaps.size() == 0) return NULL; else if (heaps.size() == 1) { Heap *heap = heaps.front(); heaps.pop_front(); return heap; } else { Heap *heap1 = heaps.front(); heaps.pop_front(); Heap *heap2 = heaps.front(); heaps.pop_front(); return Merge(Merge(heap1, heap2), MergePairs(heaps)); } } template<typename T> typename PairingHeap<T>::Heap * PairingHeap<T>::Merge(Heap *heap1, Heap *heap2) { if (heap2 == NULL) return heap1; else if (heap1 == NULL) return heap2; else if (*heap1->value < *heap2->value) { heap1->subheaps.push_front(heap2); return heap1; } else { heap2->subheaps.push_front(heap1); return heap2; } } } /* namespace danielstiner */ #endif /* PAIRINGHEAP_H_ */
ed718357aaea34caa1532e3759249eb3bc3f4a8f
046acb997ee74ee28e10f0451e15638299185a1c
/W2ENT_QT/Translator.h
06e9406bb8c63dd608ffc632e8b2556f2cc4789c
[]
no_license
JLouis-B/RedTools
845bb94de1ebea65306bd4eaadd61a69390e7158
e6e2c4e613cbbafdbe51732ecbb30a37390374b1
refs/heads/master
2022-11-16T01:01:42.685006
2022-11-06T22:24:14
2022-11-06T22:24:14
115,371,143
73
12
null
2020-11-27T00:06:37
2017-12-26T00:41:13
C++
UTF-8
C++
false
false
380
h
Translator.h
#ifndef TRANSLATOR_H #define TRANSLATOR_H #include <QWidget> class Translator { static QWidget* _parent; static QMap<QString, QString> _trad; static QMap<QString, QString> loadLanguage(QString file); public: static void setParentWidget(QWidget *parent); static QString get(QString element); static void loadCurrentLanguage(); }; #endif // TRANSLATOR_H
90e256ad6f4f71045946c67e57394a2dcda9868a
6ae8dac71f401abe5393a26e82f5a9747ad4df0e
/ofxCvMarkers/lib/libdtouch/list.h
f3364f162d135d01891386f00e624ebb4fa93ad8
[]
no_license
connectthefuture/ofxPrimes
4565c2df0ded2b8315e08d7c98f4e29755fd19ca
8acd84cdcb04ed9cdb2953ed9b1d573b4bb6e4bc
refs/heads/master
2021-01-19T22:14:46.565208
2010-02-11T22:22:46
2010-02-11T22:22:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,881
h
list.h
/*************************************************************************** list.h - simple linked list defined with a template ------------------- begin : Mon Aug 26 2002 copyright : (C) 2002 by Enrico Costanza email : e.costanza@ieee.org ***************************************************************************/ /*************************************************************************** * * * 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 * * * ***************************************************************************/ /* Changes Code optimization by Jorge M Santiago */ #ifndef EC_LIST #define EC_LIST #define EC_LIST_GRAPH //#include <iostream> //#include <fstream> #ifndef __SYMBIAN32__ #include <cstring> #endif #ifdef __SYMBIAN32__ #include <string.h> #include <e32base.h> #endif //using namespace std; // TODO: if this is harmful, just rename List::check() #ifdef check #undef check #endif //#include <assert.h> // warning: the template definition seems to be different on visual c++ from Linux // (not 100% sure) template<class T> class List; //template<class T> class ListPool; //template<class T> class StaticPool; template <class T> class ListItem{ protected: ListItem *_next; T _data; //experimental: use at your own risk! //NOTE: used in listhash ListItem * _prev; public: T getData() const { return _data; } void setData(T const &d){ _data = d; } T& Data() { return _data; } ListItem<T> *getNext() const { return _next; } void setNext( ListItem<T> *n ){ _next = n; } ListItem<T> *getPrev(){ return _prev; } void setPrev( ListItem<T> *p ){ _prev = p; } //constructors ListItem() : _next(NULL) { } ListItem( T in_data) : _next(NULL), _data(in_data) { } ListItem( T in_data, ListItem *in_next ) : _next(in_next), _data(in_data) { } ~ListItem() { // delete _next; _next=NULL; } //bool deleted; /* void deleteCheck() { if( NULL!=_next && false==_next->deleted ){ _next->deleteCheck(); } deleted = true; } //*/ friend class List<T>; //friend class ListPool<T>; //friend class StaticPool<T>; }; template <class T> class List { protected: ListItem<T> * _first; ListItem<T> * _current; ListItem<T> * _last; int _size; // moveTo moves the current pointer to the first element in the List with value equal to target bool moveTo( const T target ){ if( _first == NULL ){ return false; } _current = _first; while( _current != NULL ) { if( _current->_data == target ){ return true; } _current = _current->_next; } return false; } // seek returns the pointer to the first element in the List with value equal to target ListItem<T> * seek( const T target ){ if( _first == NULL ){ return NULL; } ListItem<T> *ptr = _first; while( ptr != NULL ){ if( ptr->_data == target ){ return ptr; } ptr = ptr->_next; } return NULL; } List() { _current = _first = _last = NULL; _size=0; } public: // constuctors static List * newL(){ #ifndef __SYMBIAN32__ return new List(); #else return new (ELeave) List(); #endif } // destructor ~List() { // delete _first; _first = NULL; _current = _first; while( _current != NULL ){ ListItem<T> *tmp = _current; _current = _current->_next; delete tmp; } _current = _first = _last = NULL; _size=0; } void empty() { // delete _first; _first=NULL; _current = _first; while( _current != NULL ){ ListItem<T> *tmp = _current; _current = _current->_next; delete tmp; } _current = _first = _last = NULL; _size=0; } // i/o methods //void expand() { } const int &getSize(void) const { return _size; } //int size(void) { return _size; } ListItem<T> * getCurrent(void){ return _current; } T getData(void){ //assert( _current!=NULL ); return( _current->_data ); //if(_current!=NULL){ return( _current->_data ); } //else{ throw("\n\ngetData() called on a NULL pointer!!!\n\n"); } } T getFirstData(void){ return( _first->_data ); //if(_current!=NULL){ return( _current->_data ); } //else{ throw("\n\ngetData() called on a NULL pointer!!!\n\n"); } } void reset(void){ _current = _first; } void fwd(void){ if(_current != NULL){ _current = _current->_next; } } T fwdGet(void){ T result =_current->_data; _current = _current->_next; return result; //if(_current!=NULL){ _current = _current->_next; return _current->_data; } //else{ throw("\n\nfwdGet() called on a NULL pointer!!!\n\n"); } } bool nullTest( void ) const { return( _current == NULL ); } bool fwdNullTest( void ) const { if( _current == NULL ) { return true; } return( _current->_next == NULL ); } bool isNull( void ) const { return( _current == NULL ); } bool isEmpty( void ){ return( _first == NULL ); } void appendL( const T &in_data ){ // TODO: add handing _prev? if( _first == NULL ){ #ifndef __SYMBIAN32__ _first = new ListItem<T>(in_data); #else _first = new (ELeave) ListItem<T>(in_data); #endif _current = _first; _last = _first; } else{ #ifndef __SYMBIAN32__ _last->_next = new ListItem<T>( in_data, NULL ); #else _last->_next = new (ELeave) ListItem<T>( in_data, NULL ); #endif //if( _last->_next == NULL ){ throw( "\n\nList<T>::append: allocation failed!\n\n" ); } _last = _last->_next; // not sure about the following //_current = _last; } _size++; return; } void append( List<T> *src ){ if( src->isEmpty() ){ // do nothing return; } if( _first == NULL ){ _first = src->_first; _current = _first; _last = src->_last; } else{ _last->_next = src->_first; _last = src->_last; // not too sure about the following //_current = _last; } _size += src->_size; src->_size = 0; src->_first = NULL; src->_current = NULL; src->_last = NULL; // TODO: add handing _prev? return; } void remove( const T &data ){ if( _first == NULL ) { return; } if( _first->_data == data ){ ListItem<T> *toBeDeleted = _first; _first = _first->_next; toBeDeleted->_next = NULL; if( _current == toBeDeleted ){ _current = _first; } if( _last == toBeDeleted ){ _last = _first; } delete toBeDeleted; _size--; return; } ListItem<T> *prev = _first; ListItem<T> *toBeDeleted = _first->_next; while( toBeDeleted!=NULL ){ if( toBeDeleted->_data == data ){ prev->_next = toBeDeleted->_next; toBeDeleted->_next = NULL; if( _current == toBeDeleted ){ _current = prev; } if( _last == toBeDeleted ){ _last = prev; } delete toBeDeleted; _size--; return; } prev = toBeDeleted; toBeDeleted = toBeDeleted->_next; } return; } void replace( const T &data_in, const T &data_out ){ ListItem<T> *ptr = seek(data_out); // this is checked externally if( ptr!= NULL ){ ptr->_data = data_in; } } bool check( const T &target ){ if( _last!=NULL && _last->_data == target ){ return true; } ListItem<T> *ptr = _first; while( ptr != _last ){ if( ptr->_data == target ){ return true; } ptr = ptr->_next; } return false; } bool contains ( const T target ){ return (seek(target) != NULL); } // T * toArray(){ // T * result = new T[_size+1]; // *result = _size; // T * rPtr = result+1; // for(ListItem<T> ptr=_first; ptr!=NULL; ptr=ptr->_next){ *rPtr++ = ptr->_data } // //for(reset();!nullTest(); *rPtr++ = fwdGet()){} // //for(reset();!nullTest();fwd()){ // // *rPtr++ = getData(); // //} // return result; // } }; template <class T> bool operator == ( const List<T> &a, const List<T> &b ){ return false; } #endif
74a0910a21eb6b3b201783612892a887e992a43c
48c9f19149c93274f4625dbd3d5483af169c8bc4
/ver_development/Engine_System/BaseMessageDispatcher.cpp
3635f9bc2019ed5fde5d44c173abd9b0717f0e50
[]
no_license
freean2468/scrap_irons
6a39efb9a8bc2a8f3ca1a0de4faf7f2a4ea35a3b
b4c19fcc03958fe185e9f446af2d4d85e8228bcd
refs/heads/main
2023-01-31T16:49:24.987795
2020-12-14T11:00:37
2020-12-14T11:00:37
319,682,577
0
0
null
null
null
null
UHC
C++
false
false
2,016
cpp
BaseMessageDispatcher.cpp
#include "../BaseHeader.h" // 이 메소드는 하나의 엔티티가 다른 엔티티에게 메시지를 보낼 때 호출된다. void CBaseMessageDispatcher::DispatchMessage(double delay, int sender, int receiver, int msg, void* ExtraInfo){ // 메시지 발신자와 수신자를 가리키는 포인터를 얻어낸다. CBaseGameEntity* pSender = EntityDB->GetEntityFromID(sender); CBaseGameEntity* pReceiver = EntityDB->GetEntityFromID(receiver); // 전보를 생성한다. Telegram telegram(0, sender, receiver, msg, ExtraInfo); // 지연될 필요가 없다면, 그 전보를 당장 발송한다. if(delay <= SmallestDelay){ // 전보를 수신자에게 보낸다. Discharge(pReceiver, telegram); } else{ // 아니면 전보가 언제 발송되어야 하는지 그 시간을 계산한다. double CurrentTime = Clock->GetCurrentTime(); telegram.DispatchTime = CurrentTime + delay; // 그리고 큐에 집어 넣는다. PriorityQ.insert(telegram); } } void CBaseMessageDispatcher::Discharge(CBaseGameEntity* pReceiver, const Telegram& telegram){ if (!pReceiver->HandleMessage(telegram)){ //telegram could not be handled OutputDebugString("Message not handled"); } } void CBaseMessageDispatcher::DispatchDelayedMessages(){ // 우선 현재 시간을 가져온다. double CurrentTime = Clock->GetCurrentTime(); // 전송될 필요가 있는 전보가 있는지를 알아보기 위해, 큐를 들여다본다. // 시간상 유통기한이 지난 전보들을 큐의 앞부분부터 제거해 나간다. while((PriorityQ.begin()->DispatchTime < CurrentTime) && (PriorityQ.begin()->DispatchTime > 0)){ // 큐의 앞부분부터 전보를 읽어 나간다. Telegram telegram = *PriorityQ.begin(); // 수신자를 찾아낸다. CBaseGameEntity* pReceiver = EntityDB->GetEntityFromID(telegram.Receiver); // 수신자에게 전보를 보낸다. Discharge(pReceiver, telegram); // 그리고 큐로부터 제거한다. PriorityQ.erase(PriorityQ.begin()); } }
5455f94f02d0cbfe585750a3e7aed53f9e1fe6af
aca88d17175ee52d95cfd89ac65f2915c479aad1
/Sample03/MyEnumerableGenerator.h
9d39a7ae4b9afdaa1eaf33d51344a51ccbb7549d
[]
no_license
urasandesu/CppTroll
2075caae5c98da9144417dac2d845f852b1d1d69
050b84c810b7b3649ccf304e3c1c99dd9ec731d2
refs/heads/master
2021-01-22T11:37:25.537094
2012-02-26T03:16:01
2012-02-26T03:16:01
1,664,754
0
0
null
null
null
null
UTF-8
C++
false
false
2,365
h
MyEnumerableGenerator.h
// MyEnumerableGenerator.h : CMyEnumerableGenerator の宣言 #pragma once #include "resource.h" // メイン シンボル #include "Sample03_i.h" #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #error "DCOM の完全サポートを含んでいない Windows Mobile プラットフォームのような Windows CE プラットフォームでは、単一スレッド COM オブジェクトは正しくサポートされていません。ATL が単一スレッド COM オブジェクトの作成をサポートすること、およびその単一スレッド COM オブジェクトの実装の使用を許可することを強制するには、_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA を定義してください。ご使用の rgs ファイルのスレッド モデルは 'Free' に設定されており、DCOM Windows CE 以外のプラットフォームでサポートされる唯一のスレッド モデルと設定されていました。" #endif using Urasandesu::NAnonym::Collections::CComEnumerator; using Urasandesu::NAnonym::Collections::CComEnumerable; typedef std::vector<CAdapt<CComBSTR>> StrVector; typedef CComEnumerator<IEnumVARIANT, VARIANT, StrVector> StrEnumerator; typedef CComObject<StrEnumerator> StrEnumeratorObject; typedef CComEnumerable<IMyEnumerable, StrEnumeratorObject, StrVector> CMyEnumerable; typedef CComObject<CMyEnumerable> CMyEnumerableObject; // CMyEnumerableGenerator class ATL_NO_VTABLE CMyEnumerableGenerator : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CMyEnumerableGenerator, &CLSID_MyEnumerableGenerator>, public IDispatchImpl<IMyEnumerableGenerator, &IID_IMyEnumerableGenerator, &LIBID_Sample03Lib, /*wMajor =*/ 1, /*wMinor =*/ 0> { public: CMyEnumerableGenerator() { } DECLARE_REGISTRY_RESOURCEID(IDR_MYENUMERABLEGENERATOR) BEGIN_COM_MAP(CMyEnumerableGenerator) COM_INTERFACE_ENTRY(IMyEnumerableGenerator) COM_INTERFACE_ENTRY(IDispatch) END_COM_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() HRESULT FinalConstruct() { return S_OK; } void FinalRelease() { } public: STDMETHOD(CreateInstance)(IMyEnumerable** ppVal); }; OBJECT_ENTRY_AUTO(__uuidof(MyEnumerableGenerator), CMyEnumerableGenerator)
3f03138df72ffb3fb7a83da05501512ee0fa4b43
d93159d0784fc489a5066d3ee592e6c9563b228b
/HLTrigger/Timer/plugins/ThroughputService.cc
84b07625a690dddd3277cb3690daaf8f5f9e57bd
[]
permissive
simonecid/cmssw
86396e31d41a003a179690f8c322e82e250e33b2
2559fdc9545b2c7e337f5113b231025106dd22ab
refs/heads/CAallInOne_81X
2021-08-15T23:25:02.901905
2016-09-13T08:10:20
2016-09-13T08:53:42
176,462,898
0
1
Apache-2.0
2019-03-19T08:30:28
2019-03-19T08:30:24
null
UTF-8
C++
false
false
4,483
cc
ThroughputService.cc
// C++ headers #include <algorithm> #include <chrono> // boost headers #include <boost/format.hpp> // CMSSW headers #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" #include "ThroughputService.h" // describe the module's configuration void ThroughputService::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; desc.addUntracked<double>( "timeRange", 60000.0 ); desc.addUntracked<double>( "timeResolution", 10.0 ); desc.addUntracked<std::string>( "dqmPath", "HLT/Throughput" ); descriptions.add("ThroughputService", desc); } ThroughputService::ThroughputService(const edm::ParameterSet & config, edm::ActivityRegistry & registry) : m_stream_histograms(), // configuration m_time_range( config.getUntrackedParameter<double>("timeRange") ), m_time_resolution( config.getUntrackedParameter<double>("timeResolution") ), m_dqm_path( config.getUntrackedParameter<std::string>("dqmPath" ) ) { registry.watchPreallocate( this, & ThroughputService::preallocate ); registry.watchPreStreamBeginRun( this, & ThroughputService::preStreamBeginRun ); registry.watchPostStreamEndLumi( this, & ThroughputService::postStreamEndLumi ); registry.watchPostStreamEndRun( this, & ThroughputService::postStreamEndRun ); registry.watchPreSourceEvent( this, & ThroughputService::preSourceEvent ); registry.watchPostEvent( this, & ThroughputService::postEvent ); } ThroughputService::~ThroughputService() { } void ThroughputService::preallocate(edm::service::SystemBounds const & bounds) { m_startup = std::chrono::steady_clock::now(); m_stream_histograms.resize( bounds.maxNumberOfStreams() ); // assign a pseudo module id to the FastTimerService m_module_id = edm::ModuleDescription::getUniqueID(); } void ThroughputService::preStreamBeginRun(edm::StreamContext const & sc) { // if the DQMStore is available, book the DQM histograms if (edm::Service<DQMStore>().isAvailable()) { unsigned int sid = sc.streamID().value(); auto & stream = m_stream_histograms[sid]; std::string y_axis_title = (boost::format("events / %g s") % m_time_resolution).str(); unsigned int bins = std::round( m_time_range / m_time_resolution ); double range = bins * m_time_resolution; // define a callback that can book the histograms auto bookTransactionCallback = [&, this] (DQMStore::IBooker & booker) { booker.setCurrentFolder(m_dqm_path); stream.sourced_events = booker.book1D("throughput_sourced", "Throughput (sourced events)", bins, 0., range)->getTH1F(); stream.sourced_events ->SetXTitle("time [s]"); stream.sourced_events ->SetYTitle(y_axis_title.c_str()); stream.retired_events = booker.book1D("throughput_retired", "Throughput (retired events)", bins, 0., range)->getTH1F(); stream.retired_events ->SetXTitle("time [s]"); stream.retired_events ->SetYTitle(y_axis_title.c_str()); }; // book MonitorElement's for this stream edm::Service<DQMStore>()->bookTransaction(bookTransactionCallback, sc.eventID().run(), sid, m_module_id); } } void ThroughputService::postStreamEndLumi(edm::StreamContext const& sc) { if (edm::Service<DQMStore>().isAvailable()) edm::Service<DQMStore>()->mergeAndResetMEsLuminositySummaryCache(sc.eventID().run(), sc.eventID().luminosityBlock(), sc.streamID().value(), m_module_id); } void ThroughputService::postStreamEndRun(edm::StreamContext const & sc) { if (edm::Service<DQMStore>().isAvailable()) edm::Service<DQMStore>()->mergeAndResetMEsRunSummaryCache(sc.eventID().run(), sc.streamID().value(), m_module_id); } void ThroughputService::preSourceEvent(edm::StreamID sid) { auto timestamp = std::chrono::steady_clock::now(); m_stream_histograms[sid].sourced_events->Fill( std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count() ); } void ThroughputService::postEvent(edm::StreamContext const & sc) { unsigned int sid = sc.streamID().value(); auto timestamp = std::chrono::steady_clock::now(); m_stream_histograms[sid].retired_events->Fill( std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count() ); } // declare ThroughputService as a framework Service #include "FWCore/ServiceRegistry/interface/ServiceMaker.h" DEFINE_FWK_SERVICE(ThroughputService);
3d6fb456786f9609a757cb81eea59d06023f64ff
8fb2e531cde0190c75d9967dcabeb1313a637763
/maths/kids and table.cpp
e0e46e2b1460fc3d8afe033597da30f69ec152e6
[]
no_license
ayushsrivastav0811/30DaysDS-Algo
9a41a97f884de6399a3fa09a044028834b3449fa
7c546318afec4956ae139d9f5a5ca0fa1dbecec4
refs/heads/main
2023-05-07T18:49:31.844730
2021-05-16T18:07:08
2021-05-16T18:07:08
366,803,794
1
0
null
null
null
null
UTF-8
C++
false
false
195
cpp
kids and table.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { int i,n; cin>>n; for(i=1;i<=10;i++) { cout<<n*i; if(i<10) cout<<" -> "; } return 0; }
52f7dd26d21ef797b8323748d483cecf3006f237
27eb71e2fedf5668f73e4e10fec1d2b6e856871a
/VoidEngine/GeneratedFiles/ui_ProjectDialog.h
133184b2808adc1c7628c7e2a38b74b77970f9b7
[ "MIT" ]
permissive
mel-florance/VoidEngine
520981a12b1ec86f77b5566c1a04e210921e6341
997f330fc50a064048c7e5a42ae06ccf0e0364bf
refs/heads/master
2023-07-22T13:10:30.559264
2018-11-30T07:38:59
2018-11-30T07:38:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,739
h
ui_ProjectDialog.h
/******************************************************************************** ** Form generated from reading UI file 'ProjectDialog.ui' ** ** Created by: Qt User Interface Compiler version 5.11.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_PROJECTDIALOG_H #define UI_PROJECTDIALOG_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QFormLayout> #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QPushButton> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_ProjectDialogClass { public: QWidget *formLayoutWidget; QFormLayout *formLayout; QLineEdit *lineEdit; QLabel *label; QPushButton *pushButton; void setupUi(QWidget *ProjectDialogClass) { if (ProjectDialogClass->objectName().isEmpty()) ProjectDialogClass->setObjectName(QStringLiteral("ProjectDialogClass")); ProjectDialogClass->resize(399, 90); formLayoutWidget = new QWidget(ProjectDialogClass); formLayoutWidget->setObjectName(QStringLiteral("formLayoutWidget")); formLayoutWidget->setGeometry(QRect(0, 0, 401, 91)); formLayout = new QFormLayout(formLayoutWidget); formLayout->setSpacing(6); formLayout->setContentsMargins(11, 11, 11, 11); formLayout->setObjectName(QStringLiteral("formLayout")); formLayout->setContentsMargins(10, 10, 10, 10); lineEdit = new QLineEdit(formLayoutWidget); lineEdit->setObjectName(QStringLiteral("lineEdit")); formLayout->setWidget(1, QFormLayout::SpanningRole, lineEdit); label = new QLabel(formLayoutWidget); label->setObjectName(QStringLiteral("label")); formLayout->setWidget(0, QFormLayout::SpanningRole, label); pushButton = new QPushButton(formLayoutWidget); pushButton->setObjectName(QStringLiteral("pushButton")); formLayout->setWidget(2, QFormLayout::SpanningRole, pushButton); retranslateUi(ProjectDialogClass); QMetaObject::connectSlotsByName(ProjectDialogClass); } // setupUi void retranslateUi(QWidget *ProjectDialogClass) { ProjectDialogClass->setWindowTitle(QApplication::translate("ProjectDialogClass", "New Project", nullptr)); label->setText(QApplication::translate("ProjectDialogClass", "Name", nullptr)); pushButton->setText(QApplication::translate("ProjectDialogClass", "Create", nullptr)); } // retranslateUi }; namespace Ui { class ProjectDialogClass: public Ui_ProjectDialogClass {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_PROJECTDIALOG_H
5d12954f5dc0028ce7f1d000283750f91adba768
9eacc869fa1d8f8b2a2dfb6c3dba613e41992f72
/external/recovery/encryptedfs_provisioning.c
601c817de0826a20a82f1f28feb99330607a687c
[ "Apache-2.0" ]
permissive
hyperkin-game/hyperkin-gb
9093c4e29212924cdbb7492e7e13002105f33801
e333185e8a2a4f5c90e84dca515e335e62565a3b
refs/heads/main
2023-04-27T18:17:09.675136
2021-05-14T10:20:59
2021-05-14T10:20:59
331,823,448
6
1
null
null
null
null
UTF-8
C++
false
false
8,958
c
encryptedfs_provisioning.c
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mount.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include "encryptedfs_provisioning.h" #include "cutils/misc.h" #include "cutils/properties.h" #include "common.h" #include "mtdutils/mtdutils.h" #include "mtdutils/mounts.h" #include "roots.h" const char* encrypted_fs_enabled_property = "persist.security.secfs.enabled"; const char* encrypted_fs_property_dir = "/data/property/"; const char* encrypted_fs_system_dir = "/data/system/"; const char* encrypted_fs_key_file_name = "/data/fs_key.dat"; const char* encrypted_fs_salt_file_name = "/data/hash_salt.dat"; const char* encrypted_fs_hash_file_src_name = "/data/system/password.key"; const char* encrypted_fs_hash_file_dst_name = "/data/hash.dat"; const char* encrypted_fs_entropy_file_src_name = "/data/system/entropy.dat"; const char* encrypted_fs_entropy_file_dst_name = "/data/ported_entropy.dat"; void get_property_file_name(char *buffer, const char *property_name) { sprintf(buffer, "%s%s", encrypted_fs_property_dir, property_name); } int get_binary_file_contents(char *buffer, int buf_size, const char *file_name, int *out_size) { FILE *in_file; int read_bytes; in_file = fopen(file_name, "r"); if (in_file == NULL) { LOGE("Secure FS: error accessing key file."); return ENCRYPTED_FS_ERROR; } read_bytes = fread(buffer, 1, buf_size, in_file); if (out_size == NULL) { if (read_bytes != buf_size) { // Error or unexpected data fclose(in_file); LOGE("Secure FS: error reading conmplete key."); return ENCRYPTED_FS_ERROR; } } else { *out_size = read_bytes; } fclose(in_file); return ENCRYPTED_FS_OK; } int set_binary_file_contents(char *buffer, int buf_size, const char *file_name) { FILE *out_file; int write_bytes; out_file = fopen(file_name, "w"); if (out_file == NULL) { LOGE("Secure FS: error setting up key file."); return ENCRYPTED_FS_ERROR; } write_bytes = fwrite(buffer, 1, buf_size, out_file); if (write_bytes != buf_size) { // Error or unexpected data fclose(out_file); LOGE("Secure FS: error reading conmplete key."); return ENCRYPTED_FS_ERROR; } fclose(out_file); return ENCRYPTED_FS_OK; } int get_text_file_contents(char *buffer, int buf_size, char *file_name) { FILE *in_file; char *read_data; in_file = fopen(file_name, "r"); if (in_file == NULL) { LOGE("Secure FS: error accessing properties."); return ENCRYPTED_FS_ERROR; } read_data = fgets(buffer, buf_size, in_file); if (read_data == NULL) { // Error or unexpected data fclose(in_file); LOGE("Secure FS: error accessing properties."); return ENCRYPTED_FS_ERROR; } fclose(in_file); return ENCRYPTED_FS_OK; } int set_text_file_contents(char *buffer, char *file_name) { FILE *out_file; int result; out_file = fopen(file_name, "w"); if (out_file == NULL) { LOGE("Secure FS: error setting up properties."); return ENCRYPTED_FS_ERROR; } result = fputs(buffer, out_file); if (result != 0) { // Error or unexpected data fclose(out_file); LOGE("Secure FS: error setting up properties."); return ENCRYPTED_FS_ERROR; } fflush(out_file); fclose(out_file); return ENCRYPTED_FS_OK; } int read_encrypted_fs_boolean_property(const char *prop_name, int *value) { char prop_file_name[PROPERTY_KEY_MAX + 32]; char prop_value[PROPERTY_VALUE_MAX]; int result; get_property_file_name(prop_file_name, prop_name); result = get_text_file_contents(prop_value, PROPERTY_VALUE_MAX, prop_file_name); if (result < 0) { return result; } if (strncmp(prop_value, "1", 1) == 0) { *value = 1; } else if (strncmp(prop_value, "0", 1) == 0) { *value = 0; } else { LOGE("Secure FS: error accessing properties."); return ENCRYPTED_FS_ERROR; } return ENCRYPTED_FS_OK; } int write_encrypted_fs_boolean_property(const char *prop_name, int value) { char prop_file_name[PROPERTY_KEY_MAX + 32]; char prop_value[PROPERTY_VALUE_MAX]; int result; get_property_file_name(prop_file_name, prop_name); // Create the directory if needed mkdir(encrypted_fs_property_dir, 0755); if (value == 1) { result = set_text_file_contents("1", prop_file_name); } else if (value == 0) { result = set_text_file_contents("0", prop_file_name); } else { return ENCRYPTED_FS_ERROR; } if (result < 0) { return result; } return ENCRYPTED_FS_OK; } int read_encrypted_fs_info(encrypted_fs_info *encrypted_fs_data) { int result; int value; result = ensure_path_mounted("/data"); if (result != 0) { LOGE("Secure FS: error mounting userdata partition."); return ENCRYPTED_FS_ERROR; } // Read the pre-generated encrypted FS key, password hash and salt. result = get_binary_file_contents(encrypted_fs_data->key, ENCRYPTED_FS_KEY_SIZE, encrypted_fs_key_file_name, NULL); if (result != 0) { LOGE("Secure FS: error reading generated file system key."); return ENCRYPTED_FS_ERROR; } result = get_binary_file_contents(encrypted_fs_data->salt, ENCRYPTED_FS_SALT_SIZE, encrypted_fs_salt_file_name, &(encrypted_fs_data->salt_length)); if (result != 0) { LOGE("Secure FS: error reading file system salt."); return ENCRYPTED_FS_ERROR; } result = get_binary_file_contents(encrypted_fs_data->hash, ENCRYPTED_FS_MAX_HASH_SIZE, encrypted_fs_hash_file_src_name, &(encrypted_fs_data->hash_length)); if (result != 0) { LOGE("Secure FS: error reading password hash."); return ENCRYPTED_FS_ERROR; } result = get_binary_file_contents(encrypted_fs_data->entropy, ENTROPY_MAX_SIZE, encrypted_fs_entropy_file_src_name, &(encrypted_fs_data->entropy_length)); if (result != 0) { LOGE("Secure FS: error reading ported entropy."); return ENCRYPTED_FS_ERROR; } result = ensure_path_unmounted("/data"); if (result != 0) { LOGE("Secure FS: error unmounting data partition."); return ENCRYPTED_FS_ERROR; } return ENCRYPTED_FS_OK; } int restore_encrypted_fs_info(encrypted_fs_info *encrypted_fs_data) { int result; result = ensure_path_mounted("/data"); if (result != 0) { LOGE("Secure FS: error mounting userdata partition."); return ENCRYPTED_FS_ERROR; } // Write the pre-generated secure FS key, password hash and salt. result = set_binary_file_contents(encrypted_fs_data->key, ENCRYPTED_FS_KEY_SIZE, encrypted_fs_key_file_name); if (result != 0) { LOGE("Secure FS: error writing generated file system key."); return ENCRYPTED_FS_ERROR; } result = set_binary_file_contents(encrypted_fs_data->salt, encrypted_fs_data->salt_length, encrypted_fs_salt_file_name); if (result != 0) { LOGE("Secure FS: error writing file system salt."); return ENCRYPTED_FS_ERROR; } result = set_binary_file_contents(encrypted_fs_data->hash, encrypted_fs_data->hash_length, encrypted_fs_hash_file_dst_name); if (result != 0) { LOGE("Secure FS: error writing password hash."); return ENCRYPTED_FS_ERROR; } result = set_binary_file_contents(encrypted_fs_data->entropy, encrypted_fs_data->entropy_length, encrypted_fs_entropy_file_dst_name); if (result != 0) { LOGE("Secure FS: error writing ported entropy."); return ENCRYPTED_FS_ERROR; } // Set the secure FS properties to their respective values result = write_encrypted_fs_boolean_property(encrypted_fs_enabled_property, encrypted_fs_data->mode); if (result != 0) { return result; } result = ensure_path_unmounted("/data"); if (result != 0) { LOGE("Secure FS: error unmounting data partition."); return ENCRYPTED_FS_ERROR; } return ENCRYPTED_FS_OK; }
deb453f61f75fbe12b4124843e0591c31e93c113
1fb404b9ee72f1fe27c7c4166b53d31d156edc93
/src/main.cpp
844be5a48f4b607b74ed0506d2e8b3e7416f464d
[]
no_license
cconstantine/pixo_teensy
b2174eaa42682ee8bee12aecf637478c534f84a5
417b4dad4c3fe73754043de71d3f7cb63d288eec
refs/heads/master
2021-01-13T02:42:03.312289
2016-12-22T23:55:51
2016-12-22T23:55:51
77,183,349
0
0
null
null
null
null
UTF-8
C++
false
false
360
cpp
main.cpp
#include "WProgram.h" extern "C" int main(void) { pinMode(13, OUTPUT); while (1) { static unsigned long lastTick = millis(); unsigned long now = millis(); if (lastTick + 1000 < now) { Serial.write("Ping\n"); lastTick += 1000; static bool high; digitalWriteFast(13, (high = !high )? HIGH : LOW); } yield(); } }
e8305be86affab08603d178bc925640001d0def9
976c9b41eae22eba0f3bf1b7f202e9d2612a424d
/Solver.cpp
66aa18619e9f960b4488ca53dce15a0384e430d6
[]
no_license
brandon9772/naongramsBackTrack
08debff195576c6fe2e59e47481aa276b1e3926b
50618897a37b278c14e8b0def1e99b71a07cb406
refs/heads/master
2020-07-30T10:07:29.927785
2019-09-22T22:23:09
2019-09-22T22:23:09
210,185,856
0
0
null
null
null
null
UTF-8
C++
false
false
4,109
cpp
Solver.cpp
#include "Solver.h" #include <iostream> Solver::Solver() {} void Solver::updateNanogramsRemove(Nanograms* nanograms) { unsigned short int thisConditionSize = nanograms->rowCondition.at(currentRowIndex).at(currentRowConditionIndex); for (unsigned short int i = currentRowConditionStart; i < currentRowConditionStart + thisConditionSize; i++) { nanograms->filledAnswer.at(currentRowIndex).at(i) = false; } } bool Solver::isPotentiallyVaild(Nanograms* nanograms, unsigned short int colStart, unsigned short int colEnd) { if ((currentRowIndex == nanograms->rowSize - 1) & (currentRowConditionIndex == nanograms->rowCondition.at(currentRowIndex).size() - 1)) { colStart = 0; colEnd = nanograms->colSize; } for (unsigned short int i = colStart; i < colEnd; i++) { vector<unsigned short int> thisColStreak; unsigned short int streak = 0; for (unsigned short int j = 0; j < nanograms->rowSize; j++) { if (nanograms->filledAnswer.at(j).at(i)) { streak++; } else if (streak != 0) { thisColStreak.push_back(streak); streak = 0; } } if (streak != 0) { thisColStreak.push_back(streak); } if (currentRowIndex == nanograms->rowSize - 1) { if (thisColStreak.size() != nanograms->colCondition.at(i).size()) { return false; } for (unsigned short int j = 0; j < thisColStreak.size(); j++) { if (thisColStreak.at(j) != nanograms->colCondition.at(i).at(j)) { return false; } } } else { if (thisColStreak.size() > nanograms->colCondition.at(i).size()) { return false; } for (unsigned short int j = 0; j < thisColStreak.size(); j++) { if (thisColStreak.at(j) > nanograms->colCondition.at(i).at(j)) { return false; } } } } return true; } bool Solver::SolveNanograms(Nanograms* nanograms) { unsigned short int rowSize = nanograms->rowSize; unsigned short int rowSizeMinusOne = nanograms->rowSize - 1; unsigned short int lastIndex = nanograms->rowCondition.at(rowSize - 1).size(); int maxCounterRow = 0; while ((currentRowIndex < rowSizeMinusOne) | ((currentRowConditionIndex < lastIndex) & (currentRowIndex == rowSizeMinusOne))) { //nanograms->printVariable("filledAnswer"); updateNanogramsAdd(nanograms); if (maxCounterRow < currentRowIndex) { maxCounterRow = currentRowIndex; cout << currentRowIndex << endl; } if (isPotentiallyVaild(nanograms, currentRowConditionStart, currentRowConditionStart + nanograms->rowCondition.at(currentRowIndex).at(currentRowConditionIndex))) { nanograms->rowConditionStart.at(currentRowIndex).at(currentRowConditionIndex) = currentRowConditionStart; currentRowConditionStart += nanograms->rowCondition.at(currentRowIndex).at(currentRowConditionIndex) + 1; currentRowConditionIndex++; while (currentRowConditionIndex >= nanograms->rowCondition.at(currentRowIndex).size()) { currentRowConditionStart = 0; currentRowConditionIndex = 0; currentRowIndex++; if (currentRowIndex > rowSizeMinusOne) { return true; } } continue; } else { updateNanogramsRemove(nanograms); currentRowConditionStart++; while (currentRowConditionStart > nanograms->maxRowConditionStart.at(currentRowIndex).at(currentRowConditionIndex)) { while (currentRowConditionIndex == 0) { if (currentRowIndex == 0) { return false; } currentRowIndex--; currentRowConditionIndex = nanograms->rowCondition.at(currentRowIndex).size(); } currentRowConditionIndex--; currentRowConditionStart = nanograms->rowConditionStart.at(currentRowIndex).at(currentRowConditionIndex); updateNanogramsRemove(nanograms); currentRowConditionStart++; } continue; } } return false; } void Solver::updateNanogramsAdd(Nanograms* nanograms) { if (currentRowConditionStart == -1) { return; } unsigned short int thisConditionSize = nanograms->rowCondition.at(currentRowIndex).at(currentRowConditionIndex); for (unsigned short int i = currentRowConditionStart; i < currentRowConditionStart + thisConditionSize; i++) { nanograms->filledAnswer.at(currentRowIndex).at(i) = true; } }
2aa577fe958a5291a7cabe0086464b5e5947720e
392223bbc410168ba4e33845ebf945b94996a5b8
/global.h
fc59725ac7ea64c202d1be4a6372c7586f217fff
[]
no_license
jwes-dev/CPP-Switching-Server-Library
5687f51a5177d33218b392d69d698addd3b9e644
66e2e317d25761325b55780ad1805605c4c852a4
refs/heads/master
2020-04-16T03:47:42.585796
2019-01-11T13:14:31
2019-01-11T13:14:31
165,245,178
0
0
null
null
null
null
UTF-8
C++
false
false
326
h
global.h
// common #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> using namespace std; // server #include <sys/socket.h> #include <netinet/in.h> // app includes #include "Models/models.h" #include "Includes/references.h" char* global() { return (char*)"Global Header File V1.0"; }
5f6c91b4d89fd614620bf6560833b7f8fc0fa81e
7dffb0c9b086f1f1bd058377c56d5dc9b1ee92e1
/src/main.cpp
42fc0168cb13a1194e7db62d1b38b7105e88c736
[]
no_license
chrismtaormino/Recipes_App
8b80eaf5c1e82d8be5947a25df484bd6ef11244e
c83aa0f798640e3a2c09cddb9a0b1305f138e4ed
refs/heads/master
2020-04-21T05:53:49.996461
2019-02-06T04:10:55
2019-02-06T04:10:55
169,352,456
0
0
null
null
null
null
UTF-8
C++
false
false
158
cpp
main.cpp
// Main function for the Recipes app #include <string> #include <iostream> using namespace std; int main() { cout << "THIS IS THE APP"; return 0; }
856b390c78c5a0d8d9d398376afca5f38372b857
2dfc7d58e05dce450514cb55dacf965b7b630685
/Socket_Server/Socket_Server/thread_create_1.cpp
48110d39fe690de66d9f891fbbe00ce2830f10bc
[]
no_license
juhyupLee/Socket-Programming
bcedb8c0f023576a6a79393bdadeb839a380b46c
61712968d5a9974350314030d838543eb2d5bad3
refs/heads/master
2022-12-21T01:45:28.537149
2020-10-05T16:38:11
2020-10-05T16:38:11
216,176,788
0
0
null
null
null
null
UTF-8
C++
false
false
656
cpp
thread_create_1.cpp
#include "thread_create_1.h" #include <process.h> #include <Windows.h> #include <stdio.h> unsigned int WINAPI thread1(void* argc); int Thread_Create_1(int argc, char* argv[]) { HANDLE hThread; unsigned threadID; int param = 5; hThread =(HANDLE) _beginthreadex(nullptr, 0, thread1, (void*)&param, 0, (unsigned int*)&threadID); if (hThread == 0) { puts("_beginthreadex error"); return -1; } WaitForSingleObject(hThread, INFINITE); puts("Enf of Main"); return 0; } unsigned int WINAPI thread1(void* argc) { int count = *((int*)argc); for (int i = 0; i < count; ++i) { puts("Running Thread 1"); Sleep(1000); } return 0; }
64c1ee2ee7ab14bd8c15814bc5db10484df2725f
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/net/base/file_stream_unittest.cc
ef6f93008fdafcb2929f71be197316462bf3a4e4
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
30,912
cc
file_stream_unittest.cc
// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/base/file_stream.h" #include <string> #include <utility> #include "base/files/file.h" #include "base/files/file_util.h" #include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/synchronization/waitable_event.h" #include "base/task/current_thread.h" #include "base/task/single_thread_task_runner.h" #include "base/test/test_timeouts.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/log/test_net_log.h" #include "net/test/gtest_util.h" #include "net/test/test_with_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" using net::test::IsError; using net::test::IsOk; #if BUILDFLAG(IS_ANDROID) #include "base/test/test_file_util.h" #endif namespace net { namespace { constexpr char kTestData[] = "0123456789"; constexpr int kTestDataSize = std::size(kTestData) - 1; // Creates an IOBufferWithSize that contains the kTestDataSize. scoped_refptr<IOBufferWithSize> CreateTestDataBuffer() { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(kTestDataSize); memcpy(buf->data(), kTestData, kTestDataSize); return buf; } } // namespace class FileStreamTest : public PlatformTest, public WithTaskEnvironment { public: void SetUp() override { PlatformTest::SetUp(); base::CreateTemporaryFile(&temp_file_path_); base::WriteFile(temp_file_path_, kTestData); } void TearDown() override { // FileStreamContexts must be asynchronously closed on the file task runner // before they can be deleted. Pump the RunLoop to avoid leaks. base::RunLoop().RunUntilIdle(); EXPECT_TRUE(base::DeleteFile(temp_file_path_)); PlatformTest::TearDown(); } const base::FilePath temp_file_path() const { return temp_file_path_; } private: base::FilePath temp_file_path_; }; namespace { TEST_F(FileStreamTest, OpenExplicitClose) { TestCompletionCallback callback; FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); EXPECT_TRUE(stream.IsOpen()); EXPECT_THAT(stream.Close(callback.callback()), IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); EXPECT_FALSE(stream.IsOpen()); } TEST_F(FileStreamTest, OpenExplicitCloseOrphaned) { TestCompletionCallback callback; auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; int rv = stream->Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); EXPECT_TRUE(stream->IsOpen()); EXPECT_THAT(stream->Close(callback.callback()), IsError(ERR_IO_PENDING)); stream.reset(); // File isn't actually closed yet. base::RunLoop runloop; runloop.RunUntilIdle(); // The file should now be closed, though the callback has not been called. } // Test the use of FileStream with a file handle provided at construction. TEST_F(FileStreamTest, UseFileHandle) { int rv = 0; TestCompletionCallback callback; TestInt64CompletionCallback callback64; // 1. Test reading with a file handle. ASSERT_TRUE(base::WriteFile(temp_file_path(), kTestData)); int flags = base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ | base::File::FLAG_ASYNC; base::File file1(temp_file_path(), flags); // Seek to the beginning of the file and read. auto read_stream = std::make_unique<FileStream>( std::move(file1), base::SingleThreadTaskRunner::GetCurrentDefault()); ASSERT_THAT(read_stream->Seek(0, callback64.callback()), IsError(ERR_IO_PENDING)); ASSERT_EQ(0, callback64.WaitForResult()); // Read into buffer and compare. scoped_refptr<IOBufferWithSize> read_buffer = base::MakeRefCounted<IOBufferWithSize>(kTestDataSize); rv = read_stream->Read(read_buffer.get(), kTestDataSize, callback.callback()); ASSERT_EQ(kTestDataSize, callback.GetResult(rv)); ASSERT_EQ(0, memcmp(kTestData, read_buffer->data(), kTestDataSize)); read_stream.reset(); // 2. Test writing with a file handle. base::DeleteFile(temp_file_path()); flags = base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; base::File file2(temp_file_path(), flags); auto write_stream = std::make_unique<FileStream>( std::move(file2), base::SingleThreadTaskRunner::GetCurrentDefault()); ASSERT_THAT(write_stream->Seek(0, callback64.callback()), IsError(ERR_IO_PENDING)); ASSERT_EQ(0, callback64.WaitForResult()); scoped_refptr<IOBufferWithSize> write_buffer = CreateTestDataBuffer(); rv = write_stream->Write(write_buffer.get(), kTestDataSize, callback.callback()); ASSERT_EQ(kTestDataSize, callback.GetResult(rv)); write_stream.reset(); // Read into buffer and compare to make sure the handle worked fine. ASSERT_EQ(kTestDataSize, base::ReadFile(temp_file_path(), read_buffer->data(), kTestDataSize)); ASSERT_EQ(0, memcmp(kTestData, read_buffer->data(), kTestDataSize)); } TEST_F(FileStreamTest, UseClosedStream) { int rv = 0; TestCompletionCallback callback; TestInt64CompletionCallback callback64; FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); EXPECT_FALSE(stream.IsOpen()); // Try seeking... rv = stream.Seek(5, callback64.callback()); EXPECT_THAT(callback64.GetResult(rv), IsError(ERR_UNEXPECTED)); // Try reading... scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(10); rv = stream.Read(buf.get(), buf->size(), callback.callback()); EXPECT_THAT(callback.GetResult(rv), IsError(ERR_UNEXPECTED)); } TEST_F(FileStreamTest, Read) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(callback.GetResult(rv), IsOk()); int total_bytes_read = 0; std::string data_read; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream.Read(buf.get(), buf->size(), callback.callback()); rv = callback.GetResult(rv); EXPECT_LE(0, rv); if (rv <= 0) break; total_bytes_read += rv; data_read.append(buf->data(), rv); } EXPECT_EQ(file_size, total_bytes_read); EXPECT_EQ(kTestData, data_read); } TEST_F(FileStreamTest, Read_EarlyDelete) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream->Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream->Read(buf.get(), buf->size(), callback.callback()); stream.reset(); // Delete instead of closing it. if (rv < 0) { EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); // The callback should not be called if the request is cancelled. base::RunLoop().RunUntilIdle(); EXPECT_FALSE(callback.have_result()); } else { EXPECT_EQ(std::string(kTestData, rv), std::string(buf->data(), rv)); } } TEST_F(FileStreamTest, Read_FromOffset) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); TestInt64CompletionCallback callback64; const int64_t kOffset = 3; rv = stream.Seek(kOffset, callback64.callback()); ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); int64_t new_offset = callback64.WaitForResult(); EXPECT_EQ(kOffset, new_offset); int total_bytes_read = 0; std::string data_read; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream.Read(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LE(0, rv); if (rv <= 0) break; total_bytes_read += rv; data_read.append(buf->data(), rv); } EXPECT_EQ(file_size - kOffset, total_bytes_read); EXPECT_EQ(kTestData + kOffset, data_read); } TEST_F(FileStreamTest, Write) { FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(callback.GetResult(rv), IsOk()); int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(0, file_size); scoped_refptr<IOBuffer> buf = CreateTestDataBuffer(); rv = stream.Write(buf.get(), kTestDataSize, callback.callback()); rv = callback.GetResult(rv); EXPECT_EQ(kTestDataSize, rv); EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(kTestDataSize, file_size); std::string data_read; EXPECT_TRUE(base::ReadFileToString(temp_file_path(), &data_read)); EXPECT_EQ(kTestData, data_read); } TEST_F(FileStreamTest, Write_EarlyDelete) { auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream->Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(0, file_size); scoped_refptr<IOBufferWithSize> buf = CreateTestDataBuffer(); rv = stream->Write(buf.get(), buf->size(), callback.callback()); stream.reset(); if (rv < 0) { EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); // The callback should not be called if the request is cancelled. base::RunLoop().RunUntilIdle(); EXPECT_FALSE(callback.have_result()); } else { EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(file_size, rv); } } TEST_F(FileStreamTest, Write_FromOffset) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); TestInt64CompletionCallback callback64; const int64_t kOffset = kTestDataSize; rv = stream.Seek(kOffset, callback64.callback()); ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); int64_t new_offset = callback64.WaitForResult(); EXPECT_EQ(kTestDataSize, new_offset); int total_bytes_written = 0; scoped_refptr<IOBufferWithSize> buffer = CreateTestDataBuffer(); int buffer_size = buffer->size(); scoped_refptr<DrainableIOBuffer> drainable = base::MakeRefCounted<DrainableIOBuffer>(std::move(buffer), buffer_size); while (total_bytes_written != kTestDataSize) { rv = stream.Write(drainable.get(), drainable->BytesRemaining(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LT(0, rv); if (rv <= 0) break; drainable->DidConsume(rv); total_bytes_written += rv; } EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(file_size, kTestDataSize * 2); } TEST_F(FileStreamTest, BasicReadWrite) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream->Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); int64_t total_bytes_read = 0; std::string data_read; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream->Read(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LE(0, rv); if (rv <= 0) break; total_bytes_read += rv; data_read.append(buf->data(), rv); } EXPECT_EQ(file_size, total_bytes_read); EXPECT_TRUE(data_read == kTestData); int total_bytes_written = 0; scoped_refptr<IOBufferWithSize> buffer = CreateTestDataBuffer(); int buffer_size = buffer->size(); scoped_refptr<DrainableIOBuffer> drainable = base::MakeRefCounted<DrainableIOBuffer>(std::move(buffer), buffer_size); while (total_bytes_written != kTestDataSize) { rv = stream->Write(drainable.get(), drainable->BytesRemaining(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LT(0, rv); if (rv <= 0) break; drainable->DidConsume(rv); total_bytes_written += rv; } stream.reset(); EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(kTestDataSize * 2, file_size); } TEST_F(FileStreamTest, BasicWriteRead) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream->Open(temp_file_path(), flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); TestInt64CompletionCallback callback64; rv = stream->Seek(file_size, callback64.callback()); ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); int64_t offset = callback64.WaitForResult(); EXPECT_EQ(offset, file_size); int total_bytes_written = 0; scoped_refptr<IOBufferWithSize> buffer = CreateTestDataBuffer(); int buffer_size = buffer->size(); scoped_refptr<DrainableIOBuffer> drainable = base::MakeRefCounted<DrainableIOBuffer>(std::move(buffer), buffer_size); while (total_bytes_written != kTestDataSize) { rv = stream->Write(drainable.get(), drainable->BytesRemaining(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LT(0, rv); if (rv <= 0) break; drainable->DidConsume(rv); total_bytes_written += rv; } EXPECT_EQ(kTestDataSize, total_bytes_written); rv = stream->Seek(0, callback64.callback()); ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); offset = callback64.WaitForResult(); EXPECT_EQ(0, offset); int total_bytes_read = 0; std::string data_read; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream->Read(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LE(0, rv); if (rv <= 0) break; total_bytes_read += rv; data_read.append(buf->data(), rv); } stream.reset(); EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(kTestDataSize * 2, file_size); EXPECT_EQ(kTestDataSize * 2, total_bytes_read); const std::string kExpectedFileData = std::string(kTestData) + std::string(kTestData); EXPECT_EQ(kExpectedFileData, data_read); } class TestWriteReadCompletionCallback { public: TestWriteReadCompletionCallback(FileStream* stream, int* total_bytes_written, int* total_bytes_read, std::string* data_read) : stream_(stream), total_bytes_written_(total_bytes_written), total_bytes_read_(total_bytes_read), data_read_(data_read), drainable_( base::MakeRefCounted<DrainableIOBuffer>(CreateTestDataBuffer(), kTestDataSize)) {} TestWriteReadCompletionCallback(const TestWriteReadCompletionCallback&) = delete; TestWriteReadCompletionCallback& operator=( const TestWriteReadCompletionCallback&) = delete; int WaitForResult() { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; base::RunLoop().Run(); waiting_for_result_ = false; } have_result_ = false; // auto-reset for next callback return result_; } CompletionOnceCallback callback() { return base::BindOnce(&TestWriteReadCompletionCallback::OnComplete, base::Unretained(this)); } void ValidateWrittenData() { TestCompletionCallback callback; int rv = 0; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream_->Read(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) { rv = callback.WaitForResult(); } EXPECT_LE(0, rv); if (rv <= 0) break; *total_bytes_read_ += rv; data_read_->append(buf->data(), rv); } } private: void OnComplete(int result) { DCHECK_LT(0, result); *total_bytes_written_ += result; int rv; if (*total_bytes_written_ != kTestDataSize) { // Recurse to finish writing all data. int total_bytes_written = 0, total_bytes_read = 0; std::string data_read; TestWriteReadCompletionCallback callback( stream_, &total_bytes_written, &total_bytes_read, &data_read); rv = stream_->Write( drainable_.get(), drainable_->BytesRemaining(), callback.callback()); DCHECK_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); drainable_->DidConsume(total_bytes_written); *total_bytes_written_ += total_bytes_written; *total_bytes_read_ += total_bytes_read; *data_read_ += data_read; } else { // We're done writing all data. Start reading the data. TestInt64CompletionCallback callback64; EXPECT_THAT(stream_->Seek(0, callback64.callback()), IsError(ERR_IO_PENDING)); { EXPECT_LE(0, callback64.WaitForResult()); } } result_ = *total_bytes_written_; have_result_ = true; if (waiting_for_result_) base::RunLoop::QuitCurrentWhenIdleDeprecated(); } int result_ = 0; bool have_result_ = false; bool waiting_for_result_ = false; raw_ptr<FileStream> stream_; raw_ptr<int> total_bytes_written_; raw_ptr<int> total_bytes_read_; raw_ptr<std::string> data_read_; scoped_refptr<DrainableIOBuffer> drainable_; }; TEST_F(FileStreamTest, WriteRead) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback open_callback; int rv = stream->Open(temp_file_path(), flags, open_callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(open_callback.WaitForResult(), IsOk()); TestInt64CompletionCallback callback64; EXPECT_THAT(stream->Seek(file_size, callback64.callback()), IsError(ERR_IO_PENDING)); EXPECT_EQ(file_size, callback64.WaitForResult()); int total_bytes_written = 0; int total_bytes_read = 0; std::string data_read; { // `callback` can't outlive `stream`. TestWriteReadCompletionCallback callback(stream.get(), &total_bytes_written, &total_bytes_read, &data_read); scoped_refptr<IOBufferWithSize> buf = CreateTestDataBuffer(); rv = stream->Write(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) { rv = callback.WaitForResult(); } EXPECT_LT(0, rv); EXPECT_EQ(kTestDataSize, total_bytes_written); callback.ValidateWrittenData(); } stream.reset(); EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(kTestDataSize * 2, file_size); EXPECT_EQ(kTestDataSize * 2, total_bytes_read); const std::string kExpectedFileData = std::string(kTestData) + std::string(kTestData); EXPECT_EQ(kExpectedFileData, data_read); } class TestWriteCloseCompletionCallback { public: TestWriteCloseCompletionCallback(FileStream* stream, int* total_bytes_written) : stream_(stream), total_bytes_written_(total_bytes_written), drainable_( base::MakeRefCounted<DrainableIOBuffer>(CreateTestDataBuffer(), kTestDataSize)) {} TestWriteCloseCompletionCallback(const TestWriteCloseCompletionCallback&) = delete; TestWriteCloseCompletionCallback& operator=( const TestWriteCloseCompletionCallback&) = delete; int WaitForResult() { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; base::RunLoop().Run(); waiting_for_result_ = false; } have_result_ = false; // auto-reset for next callback return result_; } CompletionOnceCallback callback() { return base::BindOnce(&TestWriteCloseCompletionCallback::OnComplete, base::Unretained(this)); } private: void OnComplete(int result) { DCHECK_LT(0, result); *total_bytes_written_ += result; int rv; if (*total_bytes_written_ != kTestDataSize) { // Recurse to finish writing all data. int total_bytes_written = 0; TestWriteCloseCompletionCallback callback(stream_, &total_bytes_written); rv = stream_->Write( drainable_.get(), drainable_->BytesRemaining(), callback.callback()); DCHECK_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); drainable_->DidConsume(total_bytes_written); *total_bytes_written_ += total_bytes_written; } result_ = *total_bytes_written_; have_result_ = true; if (waiting_for_result_) base::RunLoop::QuitCurrentWhenIdleDeprecated(); } int result_ = 0; bool have_result_ = false; bool waiting_for_result_ = false; raw_ptr<FileStream> stream_; raw_ptr<int> total_bytes_written_; scoped_refptr<DrainableIOBuffer> drainable_; }; TEST_F(FileStreamTest, WriteClose) { int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); auto stream = std::make_unique<FileStream>( base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback open_callback; int rv = stream->Open(temp_file_path(), flags, open_callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(open_callback.WaitForResult(), IsOk()); TestInt64CompletionCallback callback64; EXPECT_THAT(stream->Seek(file_size, callback64.callback()), IsError(ERR_IO_PENDING)); EXPECT_EQ(file_size, callback64.WaitForResult()); int total_bytes_written = 0; { // `callback` can't outlive `stream`. TestWriteCloseCompletionCallback callback(stream.get(), &total_bytes_written); scoped_refptr<IOBufferWithSize> buf = CreateTestDataBuffer(); rv = stream->Write(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) { total_bytes_written = callback.WaitForResult(); } EXPECT_LT(0, total_bytes_written); EXPECT_EQ(kTestDataSize, total_bytes_written); } stream.reset(); EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(kTestDataSize * 2, file_size); } TEST_F(FileStreamTest, OpenAndDelete) { base::Thread worker_thread("StreamTest"); ASSERT_TRUE(worker_thread.Start()); base::ScopedDisallowBlocking disallow_blocking; auto stream = std::make_unique<FileStream>(worker_thread.task_runner()); int flags = base::File::FLAG_OPEN | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; TestCompletionCallback open_callback; int rv = stream->Open(temp_file_path(), flags, open_callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); // Delete the stream without waiting for the open operation to be // complete. Should be safe. stream.reset(); // Force an operation through the worker. auto stream2 = std::make_unique<FileStream>(worker_thread.task_runner()); TestCompletionCallback open_callback2; rv = stream2->Open(temp_file_path(), flags, open_callback2.callback()); EXPECT_THAT(open_callback2.GetResult(rv), IsOk()); stream2.reset(); // open_callback won't be called. base::RunLoop().RunUntilIdle(); EXPECT_FALSE(open_callback.have_result()); } // Verify that Write() errors are mapped correctly. TEST_F(FileStreamTest, WriteError) { // Try opening file as read-only and then writing to it using FileStream. uint32_t flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; base::File file(temp_file_path(), flags); ASSERT_TRUE(file.IsValid()); auto stream = std::make_unique<FileStream>( std::move(file), base::SingleThreadTaskRunner::GetCurrentDefault()); scoped_refptr<IOBuffer> buf = base::MakeRefCounted<IOBuffer>(1); buf->data()[0] = 0; TestCompletionCallback callback; int rv = stream->Write(buf.get(), 1, callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LT(rv, 0); stream.reset(); base::RunLoop().RunUntilIdle(); } // Verify that Read() errors are mapped correctly. TEST_F(FileStreamTest, ReadError) { // Try opening file for write and then reading from it using FileStream. uint32_t flags = base::File::FLAG_OPEN | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; base::File file(temp_file_path(), flags); ASSERT_TRUE(file.IsValid()); auto stream = std::make_unique<FileStream>( std::move(file), base::SingleThreadTaskRunner::GetCurrentDefault()); scoped_refptr<IOBuffer> buf = base::MakeRefCounted<IOBuffer>(1); TestCompletionCallback callback; int rv = stream->Read(buf.get(), 1, callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LT(rv, 0); stream.reset(); base::RunLoop().RunUntilIdle(); } #if BUILDFLAG(IS_WIN) // Verifies that a FileStream will close itself if it receives a File whose // async flag doesn't match the async state of the underlying handle. TEST_F(FileStreamTest, AsyncFlagMismatch) { // Open the test file without async, then make a File with the same sync // handle but with the async flag set to true. uint32_t flags = base::File::FLAG_OPEN | base::File::FLAG_READ; base::File file(temp_file_path(), flags); base::File lying_file(file.TakePlatformFile(), true); ASSERT_TRUE(lying_file.IsValid()); FileStream stream(std::move(lying_file), base::SingleThreadTaskRunner::GetCurrentDefault()); ASSERT_FALSE(stream.IsOpen()); TestCompletionCallback callback; scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); int rv = stream.Read(buf.get(), buf->size(), callback.callback()); EXPECT_THAT(callback.GetResult(rv), IsError(ERR_UNEXPECTED)); } #endif #if BUILDFLAG(IS_ANDROID) // TODO(https://crbug.com/894599): flaky on both android and cronet bots. TEST_F(FileStreamTest, DISABLED_ContentUriRead) { base::FilePath test_dir; base::PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); test_dir = test_dir.AppendASCII("net"); test_dir = test_dir.AppendASCII("data"); test_dir = test_dir.AppendASCII("file_stream_unittest"); ASSERT_TRUE(base::PathExists(test_dir)); base::FilePath image_file = test_dir.Append(FILE_PATH_LITERAL("red.png")); // Insert the image into MediaStore. MediaStore will do some conversions, and // return the content URI. base::FilePath path = base::InsertImageIntoMediaStore(image_file); EXPECT_TRUE(path.IsContentUri()); EXPECT_TRUE(base::PathExists(path)); int64_t file_size; EXPECT_TRUE(base::GetFileSize(path, &file_size)); EXPECT_LT(0, file_size); FileStream stream(base::SingleThreadTaskRunner::GetCurrentDefault()); int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; TestCompletionCallback callback; int rv = stream.Open(path, flags, callback.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback.WaitForResult(), IsOk()); int total_bytes_read = 0; std::string data_read; for (;;) { scoped_refptr<IOBufferWithSize> buf = base::MakeRefCounted<IOBufferWithSize>(4); rv = stream.Read(buf.get(), buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); EXPECT_LE(0, rv); if (rv <= 0) break; total_bytes_read += rv; data_read.append(buf->data(), rv); } EXPECT_EQ(file_size, total_bytes_read); } #endif } // namespace } // namespace net
4674ac67cb84ea84c6afbec3f25003f441decd5a
99e7b44cf4e1e5f3c15a6ec21ffff52aa697a6c0
/RootExam/create_data.cpp
e71d8a933a765c2e6ff9b7306f4c1ae6cac30998
[]
no_license
Catofes/RootScript
d0d158749a2bcec3ba765698b1246bf46feefe3e
60fe080ef201d9df54fae698ec7580b390239710
refs/heads/master
2021-01-17T20:50:44.154119
2018-05-21T11:36:38
2018-05-21T11:36:38
62,697,772
0
0
null
null
null
null
UTF-8
C++
false
false
767
cpp
create_data.cpp
#include <TTree.h> #include <TFile.h> #include <TRandom.h> #include <iostream> using namespace std; int main() { TFile *f = new TFile("input_data.root", "RECREATE"); TTree *t = new TTree("Data", "Data"); vector<double> x, y, z, weight; cout << "a"; t->Branch("x", &x); t->Branch("y", &y); t->Branch("z", &z); t->Branch("weight", &weight); TRandom random; for (int j = 0; j < 100; j++) { x.clear(); y.clear(); z.clear(); weight.clear(); for (int i = 0; i < 100; i++) { x.push_back(random.Rndm()); y.push_back(random.Rndm()); z.push_back(random.Rndm()); weight.push_back(random.Rndm()); } t->Fill(); } f->Write(); }
5c66aa236b3da1825436adbcfd46dab7bdb544fa
71f0bc221632ca165ab173ce58e59cda2095e9a3
/Lista 9 (PONTEIROS)/Exercicio_19.cpp
8f5fedb57a9cbbafc932ca5111c59bc5adbff4a7
[]
no_license
GuAntunes/excercises-language-C
696a3a40c7e98aba80e1d8ae68e49158cbb6c3d1
e76b70ee1965b8a3d773744a03633a8e1131ee38
refs/heads/master
2022-04-17T21:18:03.444720
2020-04-17T00:35:42
2020-04-17T00:35:42
256,359,742
0
0
null
null
null
null
ISO-8859-1
C++
false
false
661
cpp
Exercicio_19.cpp
#include <stdio.h> #include <stdlib.h> #include <locale.h> #include <iostream> using namespace std; void func(int *n, int *m, int *vezes){ for(int cont=0;cont<9;cont++){ if(cont==0){ *m=n[cont]; *vezes=1; continue; } if(*m==n[cont]){ *vezes = *vezes + 1; continue; } if(*m<n[cont]){ *vezes=1; *m=n[cont]; } } return; } int main(){ setlocale(LC_ALL,"portuguese"); int vet[9] = {5, 5, 15, 3, 7, 15, 8, 6, 15},maior=0,ocorrencia=0; func(vet,&maior,&ocorrencia); printf("Maior número: %d",maior); printf("\nOcorrencia: %d",ocorrencia); getchar(); return 0; }
7aca40cbde10aca764f75cba5ea592a97085bef2
c293843012465429aab76bd6e69849168c66f2b1
/Scripting/scriptSigning.cpp
bdc03d9a1d3b7375bd0e3f4e8aa5a77d18b8ff7a
[]
no_license
evoskuil/LibbitcoinTutorial
8854aa7994420b8212a3e19081d2ccafce47a38a
f90711b9920a5648e2b560c11f57ee5806884c65
refs/heads/master
2022-03-08T02:42:46.369070
2017-04-26T07:50:15
2017-04-26T07:50:15
90,121,200
0
3
null
2017-05-03T07:33:17
2017-05-03T07:33:17
null
UTF-8
C++
false
false
3,502
cpp
scriptSigning.cpp
#include <bitcoin/bitcoin.hpp> #include "HD_walletTESTNET.cpp" #include <string.h> using namespace bc; using namespace bc::wallet; using namespace bc::machine; using namespace bc::chain; int main() { std::string Mnemonic1 = ""; std::string Mnemonic2 = ""; std::string Mnemonic3 = ""; HD_Wallet wallet1(split(Mnemonic1)); HD_Wallet wallet2(split(Mnemonic2)); HD_Wallet wallet3(split(Mnemonic3)); data_chunk pubkey1 = to_chunk(wallet1.childPublicKey(1).point()); data_chunk pubkey2 = to_chunk(wallet2.childPublicKey(1).point()); data_chunk pubkey3 = to_chunk(wallet3.childPublicKey(1).point()); wallet1.displayAddress(1); operation::list opList {operation(opcode(82)), operation(opcode(33)), operation(pubkey1), operation(opcode(33)), operation(pubkey2), operation(opcode(33)), operation(pubkey3), operation(opcode(83)), operation(opcode(175))}; script multisigScript(opList); if(multisigScript.is_valid()) { std::cout << "Script is Valid!\n" << std::endl; }else{ std::cout << "Script Invalid! \n" << std::endl; } std::cout << "Redeeem Script: \n" << std::endl; std::cout << multisigScript.to_string(0) << "\n" << std::endl; std::cout << encode_base16(multisigScript.to_data(0)) << "\n" <<std::endl; short_hash scriptHash = bitcoin_short_hash(multisigScript.to_data(0)); script pay2ScriptHash = script(multisigScript.to_pay_script_hash_pattern(scriptHash)); std::cout << "Locking Script: " << std::endl; std::cout << pay2ScriptHash.to_string(0xffffffff) << "\n" << std::endl; payment_address multsigAddress(multisigScript, 0xc4); std::cout << "Payment Address: " << std::endl; std::cout << multsigAddress.encoded() << "\n" << std::endl; std::cout << payment_address(scriptHash, 0xc4).encoded() << "\n" << std::endl; //transaction old(txHash); transaction tx = transaction(); script unlocking = script(); unlocking = unlocking.to_pay_key_hash_pattern(bitcoin_short_hash(pubkey1)); std::cout << unlocking.to_string(0xffffffff) << std:: endl; hash_digest prevOutHash = hash_literal("3b2c02693ef047ad8b8898fbc09fc17391e3d101913b7ea1161034928e1c48ca"); output_point prevOut(prevOutHash, 0u); input input1 = input(); //input1.set_script(unlocking); input1.set_previous_output(prevOut); input1.set_sequence(0xffffffff); if(input1.is_valid()) { std::cout<< "Valid! " << std::endl; } else { std::cout << "Invalid! " << std::endl; } output output1(819940000, pay2ScriptHash); tx.inputs().push_back(input1); tx.outputs().push_back(output1); endorsement endorsed; if(unlocking.create_endorsement(endorsed, wallet1.childPrivateKey(1).secret(), unlocking, tx, 0u, all)) { std::cout << encode_base16(endorsed) << std::endl; } operation::list sigScript; sigScript.push_back(operation(endorsed)); sigScript.push_back(operation(pubkey1)); unlocking = script(sigScript); //input1.set_script(unlocking); //tx.inputs().push_back(input1); tx.inputs()[0].set_script(unlocking); std::cout << unlocking.to_string(0xffffffff) << "\n" << std::endl; if(unlocking.is_sign_key_hash_pattern(unlocking.operations())) { std::cout << "Sign Key Pattern" << std::endl; }else{ std::cout << "Nope" << std::endl; } if(tx.is_valid()) { std::cout << "TX: Valid! " << std::endl; } else { std::cout << "TX: Invalid! " << std::endl; } std::cout << tx.total_input_value() << std::endl; std::cout << tx.total_output_value() << std::endl; std::cout << tx.is_overspent() << std::endl; std::cout << encode_base16(tx.to_data()) << std::endl; }
4dbd7025a23ac287d387c363e012e9441e016613
485591f8c6a20555f3246e38c0e4c79bf063bdb4
/Source/AlphaEngine/AlphaEngine/Graphics3D/Scene/CameraNode.h
ea901442aaf725b42f0bfc089a32e4d2e55a7bde
[]
no_license
Aidanv1/Alpha-GameEngine
254104600ec0a8db5df25785dc18b15404322052
d8345435def0dc8169c136c19929be3618082452
refs/heads/master
2023-09-04T16:29:10.608739
2021-11-03T19:53:11
2021-11-03T19:53:11
424,164,606
0
0
null
null
null
null
UTF-8
C++
false
false
2,642
h
CameraNode.h
#pragma once #include "../../AlphaStd.h" #include "SceneNode.h" #include "../../EventManager/EventManager.h" #include "../GraphicsEvents.h" #include "../../Actor/Components/GraphicsComponent.h" #include "../../Actor/RoleSystem.h" #include "../Geometry/Geometry.h" //======================================================================== enum CameraMode { FlyAround_Mode, Orbital_Mode, FirstPerson_Mode }; //======================================================================== class CameraNode : public SceneNode { struct CameraParameters { float m_fieldOfView; float m_aspectRatio; float m_nearClip; float m_farClip; CameraParameters(float fovy, float aspectR, float nearClip, float farClip) : m_fieldOfView(fovy), m_aspectRatio(aspectR), m_nearClip(nearClip), m_farClip(farClip) { } CameraParameters() : m_fieldOfView(0), m_aspectRatio(0), m_nearClip(0), m_farClip(0) { } }; public: //Set camera parameters and optional target CameraNode(); ~CameraNode(); void SetParameters(float fovy, float aspectR, float nearClip, float farClip); SceneNode* GetCameraTarget() const { return m_targetNode; } void GetProjectionMatrix(mat4& projMat) const { projMat = m_projectionMatrix; } void GetViewMatrix(mat4& viewMat) const { viewMat = m_viewMatrix; }; void GetViewMatrix(Matrix4x4& viewMat) const { viewMat = m_viewMatrix; }; void GetTranslationMatrix(mat4& transMat) const { transMat = m_translationMatrix; } void GetRotationMatrix(mat4& rotMat) const { rotMat = m_rotationMatrix; } void SetCameraTarget(SceneNode* targetNode); CameraMode GetMode() const { return m_mode; } void SetMode(CameraMode mode); CameraParameters GetCameraParameters() const{ return m_camParam; } Frustum GetFrustum() const { return m_frustum; } //Scene Node functions virtual bool VInitNode() override; void VUpdateNode(Scene* scene, float deltaMs) override; virtual bool VConfigureXmlNodeData(TiXmlElement* pElement) override; //Look event delegate listens reacts to lookevents ie. any camera movement void LookEventDelegate(StrongEventPtr e); private: void LookAtTarget(); private: mat4 m_projectionMatrix; mat4 m_translationMatrix; mat4 m_rotationMatrix; mat4 m_viewMatrix; SceneNode* m_targetNode; vec3 m_rotation; //for orbital mode float m_orbitalRadius; float m_orbitalMax; float m_orbitalMin; // CameraParameters m_camParam; CameraMode m_mode; Frustum m_frustum; //for first person mode vec3 m_offset; }; //========================================================================
dd39209769551382f470697ed11772255fbff6d5
0ec609ad68a2eae91069d5a9817e4a02c537c021
/Modules/Learning/DempsterShafer/test/otbMassOfBeliefDSApplied.cxx
e5cf242f77df25d0f2ca21f8e0759da58b70fe16
[ "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "AGPL-3.0-only", "GPL-3.0-only", "MIT", "LGPL-3.0-only", "Zlib", "BSD-3-Clause", "CECILL-B", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Pandinosaurus/OTB
895ff78d0dab62c68f3ef903d383b82de29fd29d
d74ab47d4308591db4ed5a5ea3b820cef73a39fe
refs/heads/develop
2023-07-20T12:31:53.392294
2023-07-19T08:37:29
2023-07-19T08:37:29
122,958,025
2
0
Apache-2.0
2023-07-20T05:45:27
2018-02-26T11:06:04
GLSL
UTF-8
C++
false
false
3,797
cxx
otbMassOfBeliefDSApplied.cxx
/* * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES) * * This file is part of Orfeo Toolbox * * https://www.orfeo-toolbox.org/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "otbMassOfBelief.h" #include "otbFuzzyVariable.h" #include "otbJointMassOfBeliefFilter.h" #include "otbMacro.h" typedef float PrecisionType; typedef otb::FuzzyVariable<std::string, PrecisionType> FuzzyVarType; typedef otb::MassOfBelief<std::string> MassOfBeliefFunctionType; typedef otb::JointMassOfBeliefFilter<MassOfBeliefFunctionType> JointMassOfBeliefFilterType; int otbMassOfBeliefDSApplied(int itkNotUsed(argc), char* argv[]) { const char* hyp_1 = argv[1]; const char* hyp_2 = argv[2]; double desc1Val = atof(argv[3]); double desc2Val = atof(argv[4]); // Descriptors and associated fuzzy variables FuzzyVarType::Pointer desc1 = FuzzyVarType::New(); FuzzyVarType::Pointer desc2 = FuzzyVarType::New(); desc1->SetMembership("H1", 0, 0, 0.1, 0.5, 0, 0.8); desc1->SetMembership("H1_", 0.5, 0.8, 1.0, 1.0, 0, 0.8); desc2->SetMembership("H2", 0, 0, 0.58, 0.68, 0, 0.99); desc2->SetMembership("H2_", 0.68, 0.98, 1.0, 1.0, 0, 0.99); // Corresponding masses MassOfBeliefFunctionType::Pointer mass1 = MassOfBeliefFunctionType::New(); MassOfBeliefFunctionType::Pointer mass2 = MassOfBeliefFunctionType::New(); MassOfBeliefFunctionType::Pointer jointMass = MassOfBeliefFunctionType::New(); MassOfBeliefFunctionType::LabelSetType H1, H1_, H2, H2_, universe, Hyp; // Defining universe universe.insert("H1"); universe.insert("H1_"); universe.insert("H2"); universe.insert("H2_"); // Studied hypothesis Hyp.insert(hyp_1); Hyp.insert(hyp_2); // Initialize masses mass1->InitializePowerSetMasses(universe); mass2->InitializePowerSetMasses(universe); H1.insert("H1"); H1_.insert("H1_"); mass1->SetMass(H1, desc1->GetMembership("H1", desc1Val)); mass1->SetMass(H1_, desc1->GetMembership("H1_", desc1Val)); mass1->EstimateUncertainty(); H2.insert("H2"); H2_.insert("H2_"); mass2->SetMass(H2, desc2->GetMembership("H2", desc2Val)); mass2->SetMass(H2_, desc2->GetMembership("H2_", desc2Val)); mass2->EstimateUncertainty(); JointMassOfBeliefFilterType::Pointer jointMassFilter = JointMassOfBeliefFilterType::New(); // Compute joint mass jointMassFilter->PushBackInput(mass1); jointMassFilter->PushBackInput(mass2); jointMassFilter->Update(); jointMass = jointMassFilter->GetOutput(); otbLogMacro(Debug, << "Mass 1:" << mass1); otbLogMacro(Debug, << "Mass 2:" << mass2); otbLogMacro(Debug, << "Joint mass :" << jointMass); std::ostringstream oss; MassOfBeliefFunctionType::PrintLabelSet(oss, Hyp); otbLogMacro(Info, << "Considered Hypothesis : " << oss.str()); otbLogMacro(Info, << "Belief(Hyp) : " << jointMass->GetBelief(Hyp)); otbLogMacro(Info, << "Plausibility(Hyp) : " << jointMass->GetPlausibility(Hyp)); otbLogMacro(Info, << "Score(Hyp) : " << (jointMass->GetBelief(Hyp) + jointMass->GetPlausibility(Hyp)) / 2.0); if (jointMass->GetBelief(Hyp) > jointMass->GetPlausibility(Hyp)) { otbLogMacro(Warning, << "Belief > Plausibility"); return EXIT_FAILURE; } else { return EXIT_SUCCESS; } }
2a9a660727eec92a96b49ac4a8fa56115a13c190
6d7f632f69405270380159f856e463b2a0efc0f3
/dipcc/dipcc/tests/consts.h
bec43b454a4a388bec0da5730c64d21b352b82ae
[ "MIT" ]
permissive
codeaudit/diplomacy_searchbot
e22061aa35cf9057cef5f84c30fa484148606209
d212d380ecc5a724f2ec36c13dfef1202d8252cf
refs/heads/master
2023-05-08T00:29:19.961607
2021-05-04T02:23:50
2021-05-28T00:05:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
229
h
consts.h
/* Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ #pragma once namespace dipcc {} // namespace dipcc
c38644e7c6ab12a54b147b95b1ce8c40b0507254
3986006d95933a04ad41fe791a5c83c20c8c5ddb
/src/lib/functions/NativeFunction.cpp
15aa33f0728bc6af01f673e143c07ba8622ee7db
[ "Apache-2.0" ]
permissive
FlightBlaze/Malix
b1305f8e898b82593a421b6b8d4e04b87b2a95e0
250425909e722f184eb5a838d1689a5fd6b7691d
refs/heads/master
2020-06-04T00:04:14.724803
2019-06-10T06:44:18
2019-06-10T06:44:18
191,786,870
0
0
null
2019-06-13T15:16:54
2019-06-13T15:16:53
null
UTF-8
C++
false
false
201
cpp
NativeFunction.cpp
#include "NativeFunction.h" std::string NativeFunction::getName() { return name; } Value NativeFunction::invoke(std::vector<Value> values) { return (* function_ptr)(this, values, pointer); }
2f1c3f102569877d8bf5b4d56ca2c7f1a3b312cd
6f96b4781f22ca578544a4fff013c81047849694
/Injected/Objects/GameObject.hpp
4995d217a3ed0b13d58754d83dc558c2f7f8c18e
[]
no_license
LarryBotter/vanillaunlock
1848a5bc2c882ec2fd90cdb7f958eeb587bb6e7f
536ffff33062d069e72b42a06a92f9e39af2fadb
refs/heads/master
2021-01-22T20:45:14.334392
2017-03-18T01:12:13
2017-03-18T01:12:13
85,355,174
1
0
null
null
null
null
UTF-8
C++
false
false
774
hpp
GameObject.hpp
#pragma once #include "Object.hpp" class GameObject : public Object { public: GameObject(int pointer) :Object(pointer) {} auto CreatedBy(){ return GetDescriptor<uint64>(OBJECT_FIELD_CREATED_BY); } auto Hooked() const { return *(byte*)(addr + 0x27C); } auto DisplayId(){ return GetDescriptor<int>(GAMEOBJECT_DISPLAYID); } auto Flags(){ return GetDescriptor<int>(GAMEOBJECT_FLAGS); } auto Faction(){ return GetDescriptor<int>(GAMEOBJECT_FACTION); } auto Level(){ return GetDescriptor<int>(GAMEOBJECT_LEVEL); } auto Locked(){ return (Flags() & GO_FLAG_LOCKED) > 0; } auto InUse(){ return (Flags() & GO_FLAG_IN_USE) > 0; } auto IsTransport(){ return (Flags() & GO_FLAG_TRANSPORT) > 0; } auto CreatedByMe(){ return CreatedBy() == GetLocalPlayerGuid(); } };
2e26b9a927c67b1c2551a952e24bb7088ca36a09
82164463fa9f99222697d1ceb326a44e5d30f2cb
/src/api_manager/service_control/aggregated.h
a4c2882cc8303fd217c49e18e6dc031f1cfa51b5
[ "BSD-2-Clause" ]
permissive
cloudendpoints/esp
3f845c516e4c1e39700ff4480e28a85237cce73f
1b02c011f071a8d400dbbbc08b512700b69ae519
refs/heads/master
2023-08-13T05:41:39.003658
2023-06-23T16:00:57
2023-06-23T16:00:57
60,128,592
287
128
BSD-2-Clause
2023-06-21T22:16:50
2016-05-31T22:43:02
C++
UTF-8
C++
false
false
7,222
h
aggregated.h
/* Copyright (C) Extensible Service Proxy Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef API_MANAGER_SERVICE_CONTROL_AGGREGATED_H_ #define API_MANAGER_SERVICE_CONTROL_AGGREGATED_H_ #include "google/api/service.pb.h" #include "google/api/servicecontrol/v1/quota_controller.pb.h" #include "google/api/servicecontrol/v1/service_controller.pb.h" #include "include/api_manager/env_interface.h" #include "include/service_control_client.h" #include "src/api_manager/auth/service_account_token.h" #include "src/api_manager/cloud_trace/cloud_trace.h" #include "src/api_manager/proto/server_config.pb.h" #include "src/api_manager/service_control/interface.h" #include "src/api_manager/service_control/proto.h" #include "src/api_manager/service_control/url.h" #include <list> #include <mutex> namespace google { namespace api_manager { namespace service_control { // The function prototype to set the latest rollout id // from Check and Report response. typedef std::function<void(const std::string& rollout_id)> SetRolloutIdFunc; // This implementation uses service-control-client-cxx module. class Aggregated : public Interface { public: static Interface* Create(const ::google::api::Service& service, const proto::ServerConfig* server_config, ApiManagerEnvInterface* env, auth::ServiceAccountToken* sa_token, SetRolloutIdFunc set_rollout_id_func); virtual ~Aggregated(); void SendEmptyReport() override; virtual utils::Status Report(const ReportRequestInfo& info); virtual void Check( const CheckRequestInfo& info, cloud_trace::CloudTraceSpan* parent_span, std::function<void(utils::Status, const CheckResponseInfo&)> on_done); virtual void Quota(const QuotaRequestInfo& info, cloud_trace::CloudTraceSpan* parent_span, std::function<void(utils::Status)> on_done); virtual utils::Status Init(); virtual utils::Status Close(); virtual utils::Status GetStatistics(Statistics* stat) const; private: // A timer object to wrap PeriodicTimer class ApiManagerPeriodicTimer : public ::google::service_control_client::PeriodicTimer { public: ApiManagerPeriodicTimer( std::unique_ptr<::google::api_manager::PeriodicTimer> esp_timer) : esp_timer_(std::move(esp_timer)) {} // Cancels the timer. virtual void Stop() { if (esp_timer_) esp_timer_->Stop(); } private: std::unique_ptr<::google::api_manager::PeriodicTimer> esp_timer_; }; // The protobuf pool to reuse protobuf. Performance tests showed that reusing // protobuf is faster than allocating a new protobuf. template <class Type> class ProtoPool { public: // Allocates a protobuf. If there is one in the pool, uses it, otherwise // creates a new one. std::unique_ptr<Type> Alloc(); // Frees a protobuf. If pool did not reach maximum size, stores it in the // pool, otherwise frees it. void Free(std::unique_ptr<Type> item); private: // Protobuf pool to store used protobufs. std::list<std::unique_ptr<Type>> pool_; // Mutex to protect the protobuf pool. std::mutex mutex_; }; friend class AggregatedTestWithMockedClient; // Constructor for unit-test only. Aggregated( const std::set<std::string>& logs, ApiManagerEnvInterface* env, std::unique_ptr<::google::service_control_client::ServiceControlClient> client); // The constructor. Aggregated(const ::google::api::Service& service, const proto::ServerConfig* server_config, ApiManagerEnvInterface* env, auth::ServiceAccountToken* sa_token, const std::set<std::string>& logs, const std::set<std::string>& metrics, const std::set<std::string>& labels, SetRolloutIdFunc set_rollout_id_func); // Initialize HttpRequest used timeout and retry values. void InitHttpRequestTimeoutRetries(); // Calls to service control server. template <class RequestType, class ResponseType> void Call(const RequestType& request, ResponseType* response, ::google::service_control_client::TransportDoneFunc on_done, cloud_trace::CloudTraceSpan* parent_span); // Returns API request url based on RequestType template <class RequestType> const std::string& GetApiRequestUrl(); // Returns API request timeout in ms based on RequestType template <class RequestType> int GetHttpRequestTimeout(); // Returns API request number of retries based on RequestType template <class RequestType> int GetHttpRequestRetries(); // Returns API request auth token based on RequestType template <class RequestType> const std::string& GetAuthToken(); template <class ResponseType> void HandleResponse(const ResponseType& response); // the service config. const ::google::api::Service* service_; // the server config. const proto::ServerConfig* server_config_; // The Api Manager environment interface. ApiManagerEnvInterface* env_; // service account token. auth::ServiceAccountToken* sa_token_; // The object to fill service control Check and Report protobuf. Proto service_control_proto_; // Stores service control urls. Url url_; // The service control client instance. std::unique_ptr<::google::service_control_client::ServiceControlClient> client_; // The protobuf pool to reuse AllocateQuotaRequest protobuf. ProtoPool<::google::api::servicecontrol::v1::AllocateQuotaRequest> quota_pool_; // The protobuf pool to reuse CheckRequest protobuf. ProtoPool<::google::api::servicecontrol::v1::CheckRequest> check_pool_; // The protobuf pool to reuse ReportRequest protobuf. ProtoPool<::google::api::servicecontrol::v1::ReportRequest> report_pool_; // Mismatched config ID received for a check request std::string mismatched_check_config_id_; // Mismatched config ID received for a report request std::string mismatched_report_config_id_; // Maximum report size send to server. uint64_t max_report_size_; // the configurable timeouts int check_timeout_ms_; int report_timeout_ms_; int quota_timeout_ms_; // the configurable retries int check_retries_; int report_retries_; int quota_retries_; // network fail policy, default to false bool network_fail_open_{}; // The callback function to set the latest rollout id // from Check and Report response SetRolloutIdFunc set_rollout_id_func_; }; } // namespace service_control } // namespace api_manager } // namespace google #endif // API_MANAGER_SERVICE_CONTROL_AGGREGATED_H_
329df3928ce8db278b151b185cfb50bbc74a4841
f551f4cbfb15c31a23df37757094aada26409f51
/include/voxel/voxelSpace.hpp
2bff9dedc18c9f55c1a11f79e2c86ceab2370ef2
[]
no_license
TheCandianVendingMachine/VulkanVoxelRenderer
46434b84d938fe469a553ce37a50137b816c2b4b
39a1a9e020fecc6c85f22e79f35589bb9adff0ce
refs/heads/master
2023-02-08T16:44:50.137441
2020-12-26T11:52:34
2020-12-26T11:52:34
292,184,298
1
0
null
null
null
null
UTF-8
C++
false
false
4,897
hpp
voxelSpace.hpp
// voxelSpace.hpp // Defines a space for a voxel subset. #pragma once #include "voxel/voxelChunk.hpp" #include "graphics/vulkan/vulkanBuffer.hpp" #include "graphics/vertexBuffer.hpp" #include "graphics/indexBuffer.hpp" #include "graphics/quad.hpp" #include <glm/gtx/hash.hpp> #include <glm/gtc/quaternion.hpp> #include <glm/mat4x4.hpp> #include <vector> #include <unordered_map> #include "FastNoise.h" class descriptorSet; class taskGraph; class voxelSpace { private: struct chunkVoxelData { std::vector<quad> m_quads; std::vector<vertex> m_vertices; std::vector<fe::index> m_indices; void *m_vertexStagingBuffer = nullptr; void *m_indexStagingBuffer = nullptr; std::size_t m_vertexCount = 0; std::size_t m_indexCount = 0; }; struct chunkData { voxelChunk m_chunk; std::vector<chunkVoxelData> m_voxelData; voxelChunk::sizeType m_sizeX = 0; voxelChunk::sizeType m_sizeY = 0; voxelChunk::sizeType m_sizeZ = 0; voxelChunk::sizeType m_positionX = 0; voxelChunk::sizeType m_positionY = 0; voxelChunk::sizeType m_positionZ = 0; voxelChunk::sizeType m_subSize = 0; unsigned int m_indexOffset = 0; unsigned int m_vertexCount = 0; unsigned int m_indexCount = 0; }; struct localBuffer { vulkanBuffer m_masterBuffer; vulkanBuffer m_masterStagingBuffer; void *m_cpuStagingBuffer = nullptr; unsigned int m_maxVertexCount = 0; unsigned int m_maxIndexCount = 0; unsigned int m_bufferSize = 0; bool m_needUpdate = false; bool m_exists = false; void create(unsigned int vertexCount, unsigned int indexCount); void destroy(); }; static constexpr voxelChunk::sizeType c_chunkSubSize = 32; static constexpr glm::ivec3 c_chunkSize = { 64, 32, 64 }; static constexpr float c_voxelSize = 1.0f; localBuffer m_localBuffer; std::unordered_map<glm::ivec3, chunkData> m_loadedChunks; glm::mat4 m_translation; glm::quat m_quaternion; friend void buildChunkMesh(const chunkData &chunkData, chunkVoxelData &voxelData, voxelChunk::sizeType &x, voxelChunk::sizeType &y, voxelChunk::sizeType &z); friend void buildChunkMesh(chunkData &chunkData); friend unsigned int buildGeometry(glm::vec3 offset, chunkVoxelData &voxelData, unsigned int indexOffset); void updateSubChunkMemory(chunkVoxelData &chunk); void updateChunkMemory(chunkData &chunk); void updateChunkMemory(chunkData &chunk, void *stagingBuffer, unsigned long long vertexBufferOffset, int &vertexOffset, int &indexOffset); void updateMemory(); void createChunk(chunkData &chunk, const voxelChunk::sizeType sizeX, const voxelChunk::sizeType sizeY, const voxelChunk::sizeType sizeZ, const voxelChunk::sizeType posX, const voxelChunk::sizeType posY, const voxelChunk::sizeType posZ); void buildChunk(chunkData &chunk, unsigned int &totalIndexOffset); void destroyChunk(chunkData &chunk); void buildSlice(chunkData &chunk, unsigned int y, const FastNoise &noise); void transformSpace(glm::vec3 globalPosition, glm::ivec3 &chunkPos, glm::vec3 &localPos) const; void transformChunkSpace(glm::vec3 globalPosition, glm::ivec3 &chunkPos) const; void transformLocalSpace(glm::vec3 globalPosition, glm::vec3 &localPos) const; public: voxelSpace() = default; ~voxelSpace(); void create(); void destroy(); void createWorld(taskGraph *graph); glm::mat4 getModelTransformation() const; glm::vec<3, int> raycast(const glm::vec3 origin, const glm::vec3 direction); void updateBuffers(vulkanCommandBuffer &commandBuffer); bool needsUpdate() const; vulkanBuffer &getBufferMemory(); VkDeviceSize getVertexMemoryOffset() const; VkDeviceSize getIndexBufferSize() const; VkDeviceSize getVertexBufferSize() const; unsigned int getVertexCount() const; unsigned int getIndexCount() const; const voxelType &at(glm::vec3 position) const; void setAt(glm::vec3 position, voxelType type); };
6037cf193588513284d51992aebccd0f6f2abba5
2249ea163713b21f14fdf8784ba3ef3c0b540d1a
/include/mockturtle/algorithms/resubstitution.hpp
e5cfecd623f5926ddca3240d891a75a802358d05
[ "MIT" ]
permissive
lsils/mockturtle
58c106fc957f17206e062b5428055778c68b4a69
82fce07b7204b14fc4c53fd35c284b7ea68f05fd
refs/heads/master
2023-08-31T04:18:37.954364
2023-08-24T12:05:37
2023-08-24T12:05:37
131,001,448
159
80
MIT
2023-08-24T09:43:55
2018-04-25T12:15:49
C++
UTF-8
C++
false
false
28,200
hpp
resubstitution.hpp
/* mockturtle: C++ logic network library * Copyright (C) 2018-2022 EPFL * * 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. */ /*! \file resubstitution.hpp \brief Generic resubstitution framework \author Eleonora Testa \author Heinz Riener \author Mathias Soeken \author Shubham Rai \author Siang-Yun (Sonia) Lee */ #pragma once #include "../traits.hpp" #include "../utils/progress_bar.hpp" #include "../utils/stopwatch.hpp" #include "../views/depth_view.hpp" #include "../views/fanout_view.hpp" #include "detail/resub_utils.hpp" #include "dont_cares.hpp" #include "reconv_cut.hpp" #include <vector> namespace mockturtle { /*! \brief Parameters for resubstitution. * * The data structure `resubstitution_params` holds configurable parameters with * default arguments for `resubstitution`. */ struct resubstitution_params { /*! \brief Maximum number of PIs of reconvergence-driven cuts. */ uint32_t max_pis{ 8 }; /*! \brief Maximum number of divisors to consider. */ uint32_t max_divisors{ 150 }; /*! \brief Maximum number of nodes added by resubstitution. */ uint32_t max_inserts{ 2 }; /*! \brief Maximum fanout of a node to be considered as root. */ uint32_t skip_fanout_limit_for_roots{ 1000 }; /*! \brief Maximum fanout of a node to be considered as divisor. */ uint32_t skip_fanout_limit_for_divisors{ 100 }; /*! \brief Show progress. */ bool progress{ false }; /*! \brief Be verbose. */ bool verbose{ false }; /****** window-based resub engine ******/ /*! \brief Use don't cares for optimization. Only used by window-based resub engine. */ bool use_dont_cares{ false }; /*! \brief Window size for don't cares calculation. Only used by window-based resub engine. */ uint32_t window_size{ 12u }; /*! \brief Whether to prevent from increasing depth. Currently only used by window-based resub engine. */ bool preserve_depth{ false }; /****** simulation-based resub engine ******/ /*! \brief Whether to use pre-generated patterns stored in a file. * If not, by default, 1024 random pattern + 1x stuck-at patterns will be generated. Only used by simulation-based resub engine. */ std::optional<std::string> pattern_filename{}; /*! \brief Whether to save the appended patterns (with CEXs) into file. Only used by simulation-based resub engine. */ std::optional<std::string> save_patterns{}; /*! \brief Maximum number of clauses of the SAT solver. Only used by simulation-based resub engine. */ uint32_t max_clauses{ 1000 }; /*! \brief Conflict limit for the SAT solver. Only used by simulation-based resub engine. */ uint32_t conflict_limit{ 1000 }; /*! \brief Random seed for the SAT solver (influences the randomness of counter-examples). Only used by simulation-based resub engine. */ uint32_t random_seed{ 1 }; /*! \brief Whether to utilize ODC, and how many levels. 0 = no. -1 = Consider TFO until PO. Only used by simulation-based resub engine. */ int32_t odc_levels{ 0 }; /*! \brief Maximum number of trials to call the resub functor. Only used by simulation-based resub engine. */ uint32_t max_trials{ 100 }; /* k-resub engine specific */ /*! \brief Maximum number of divisors to consider in k-resub engine. Only used by `abc_resub_functor` with simulation-based resub engine. */ uint32_t max_divisors_k{ 50 }; }; /*! \brief Statistics for resubstitution. * * The data structure `resubstitution_stats` provides data collected by running * `resubstitution`. */ struct resubstitution_stats { /*! \brief Total runtime. */ stopwatch<>::duration time_total{ 0 }; /*! \brief Accumulated runtime of the divisor collector. */ stopwatch<>::duration time_divs{ 0 }; /*! \brief Accumulated runtime of the resub engine. */ stopwatch<>::duration time_resub{ 0 }; /*! \brief Accumulated runtime of the callback function. */ stopwatch<>::duration time_callback{ 0 }; /*! \brief Total number of divisors. */ uint64_t num_total_divisors{ 0 }; /*! \brief Total number of gain. */ uint64_t estimated_gain{ 0 }; /*! \brief Initial network size (before resubstitution). */ uint64_t initial_size{ 0 }; void report() const { // clang-format off fmt::print( "[i] <Top level>\n" ); fmt::print( "[i] ======== Stats ========\n" ); fmt::print( "[i] #divisors = {:8d}\n", num_total_divisors ); fmt::print( "[i] est. gain = {:8d} ({:>5.2f}%)\n", estimated_gain, ( 100.0 * estimated_gain ) / initial_size ); fmt::print( "[i] ======== Runtime ========\n" ); fmt::print( "[i] total : {:>5.2f} secs\n", to_seconds( time_total ) ); fmt::print( "[i] DivCollector: {:>5.2f} secs\n", to_seconds( time_divs ) ); fmt::print( "[i] ResubEngine : {:>5.2f} secs\n", to_seconds( time_resub ) ); fmt::print( "[i] callback : {:>5.2f} secs\n", to_seconds( time_callback ) ); fmt::print( "[i] =========================\n\n" ); // clang-format on } }; namespace detail { template<typename Ntk> bool substitute_fn( Ntk& ntk, typename Ntk::node const& n, typename Ntk::signal const& g ) { ntk.substitute_node( n, g ); return true; } template<typename Ntk> bool report_fn( Ntk& ntk, typename Ntk::node const& n, typename Ntk::signal const& g ) { fmt::print( "[i] Substitute node {} with signal {}{}\n", n, ntk.is_complemented( g ) ? "!" : "", ntk.get_node( g ) ); return false; } struct default_collector_stats { /*! \brief Total number of leaves. */ uint64_t num_total_leaves{ 0 }; /*! \brief Accumulated runtime for cut computation. */ stopwatch<>::duration time_cuts{ 0 }; /*! \brief Accumulated runtime for mffc computation. */ stopwatch<>::duration time_mffc{ 0 }; /*! \brief Accumulated runtime for divisor computation. */ stopwatch<>::duration time_divs{ 0 }; void report() const { // clang-format off fmt::print( "[i] <DivCollector: default_divisor_collector>\n" ); fmt::print( "[i] #leaves = {:6d}\n", num_total_leaves ); fmt::print( "[i] ======== Runtime ========\n" ); fmt::print( "[i] reconv. cut : {:>5.2f} secs\n", to_seconds( time_cuts ) ); fmt::print( "[i] MFFC : {:>5.2f} secs\n", to_seconds( time_mffc ) ); fmt::print( "[i] divs collect: {:>5.2f} secs\n", to_seconds( time_divs ) ); fmt::print( "[i] =========================\n\n" ); // clang-format on } }; /*! \brief Prepare the three public data members `leaves`, `divs` and `mffc` * to be ready for usage. * * `leaves`: sufficient support for all divisors * `divs`: divisor nodes that can be used for resubstitution * `mffc`: MFFC nodes which are needed to do simulation from * `leaves`, through `divs` and `mffc` until the root node, * but should be excluded from resubstitution. * The last element of `mffc` is always the root node. * * `divs` and `mffc` are in topological order. * * \param MffcMgr Manager class to compute the potential gain if a * resubstitution exists (number of MFFC nodes when the cost function is circuit size). * \param MffcRes Typename of the return value of `MffcMgr`. * \param cut_comp Manager class to compute reconvergence-driven cuts. */ template<class Ntk, class MffcMgr = node_mffc_inside<Ntk>, typename MffcRes = uint32_t, typename cut_comp = detail::reconvergence_driven_cut_impl<Ntk>> class default_divisor_collector { public: using stats = default_collector_stats; using mffc_result_t = MffcRes; using node = typename Ntk::node; using cut_comp_parameters_type = typename cut_comp::parameters_type; using cut_comp_statistics_type = typename cut_comp::statistics_type; public: explicit default_divisor_collector( Ntk const& ntk, resubstitution_params const& ps, stats& st ) : ntk( ntk ), ps( ps ), st( st ), cuts( ntk, cut_comp_parameters_type{ ps.max_pis }, cuts_st ) { } bool run( node const& n, mffc_result_t& potential_gain ) { /* skip nodes with many fanouts */ if ( ntk.fanout_size( n ) > ps.skip_fanout_limit_for_roots ) { return false; } /* compute a reconvergence-driven cut */ leaves = call_with_stopwatch( st.time_cuts, [&]() { return cuts.run( { n } ).first; } ); st.num_total_leaves += leaves.size(); /* collect the MFFC */ MffcMgr mffc_mgr( ntk ); potential_gain = call_with_stopwatch( st.time_mffc, [&]() { return mffc_mgr.run( n, leaves, mffc ); } ); /* collect the divisor nodes in the cut */ bool div_comp_success = call_with_stopwatch( st.time_divs, [&]() { return collect_divisors( n ); } ); if ( !div_comp_success ) { return false; } return true; } private: void collect_divisors_rec( node const& n ) { /* skip visited nodes */ if ( ntk.visited( n ) == ntk.trav_id() ) { return; } ntk.set_visited( n, ntk.trav_id() ); ntk.foreach_fanin( n, [&]( const auto& f ) { collect_divisors_rec( ntk.get_node( f ) ); } ); /* collect the internal nodes */ if ( ntk.value( n ) == 0 && n != 0 ) /* ntk.fanout_size( n ) */ { divs.emplace_back( n ); } } bool collect_divisors( node const& root ) { auto max_depth = std::numeric_limits<uint32_t>::max(); if ( ps.preserve_depth ) { max_depth = ntk.level( root ) - 1; } /* add the leaves of the cuts to the divisors */ divs.clear(); ntk.incr_trav_id(); for ( const auto& l : leaves ) { divs.emplace_back( l ); ntk.set_visited( l, ntk.trav_id() ); } /* mark nodes in the MFFC */ for ( const auto& t : mffc ) { ntk.set_value( t, 1 ); } /* collect the cone (without MFFC) */ collect_divisors_rec( root ); /* unmark the current MFFC */ for ( const auto& t : mffc ) { ntk.set_value( t, 0 ); } /* check if the number of divisors is not exceeded */ if ( divs.size() + mffc.size() - leaves.size() > ps.max_divisors - ps.max_pis ) { return false; } uint32_t limit = ps.max_divisors - ps.max_pis - mffc.size() + leaves.size(); /* explore the fanouts, which are not in the MFFC */ bool quit = false; for ( auto i = 0u; i < divs.size(); ++i ) { auto const d = divs.at( i ); if ( ntk.fanout_size( d ) > ps.skip_fanout_limit_for_divisors ) { continue; } if ( divs.size() >= limit ) { break; } /* if the fanout has all fanins in the set, add it */ ntk.foreach_fanout( d, [&]( node const& p ) { if ( ntk.visited( p ) == ntk.trav_id() || ntk.level( p ) > max_depth ) { return true; /* next fanout */ } bool all_fanins_visited = true; ntk.foreach_fanin( p, [&]( const auto& g ) { if ( ntk.visited( ntk.get_node( g ) ) != ntk.trav_id() ) { all_fanins_visited = false; return false; /* terminate fanin-loop */ } return true; /* next fanin */ } ); if ( !all_fanins_visited ) return true; /* next fanout */ bool has_root_as_child = false; ntk.foreach_fanin( p, [&]( const auto& g ) { if ( ntk.get_node( g ) == root ) { has_root_as_child = true; return false; /* terminate fanin-loop */ } return true; /* next fanin */ } ); if ( has_root_as_child ) { return true; /* next fanout */ } divs.emplace_back( p ); ntk.set_visited( p, ntk.trav_id() ); /* quit computing divisors if there are too many of them */ if ( divs.size() >= limit ) { quit = true; return false; /* terminate fanout-loop */ } return true; /* next fanout */ } ); if ( quit ) { break; } } /* note: different from the previous version, now we do not add MFFC nodes into divs */ assert( root == mffc.at( mffc.size() - 1u ) ); /* note: this assertion makes sure window_simulator does not go out of bounds */ assert( divs.size() + mffc.size() - leaves.size() <= ps.max_divisors - ps.max_pis ); return true; } private: Ntk const& ntk; resubstitution_params ps; stats& st; cut_comp cuts; cut_comp_statistics_type cuts_st; public: std::vector<node> leaves; std::vector<node> divs; std::vector<node> mffc; }; template<typename ResubFnSt> struct window_resub_stats { /*! \brief Number of successful resubstitutions. */ uint32_t num_resub{ 0 }; /*! \brief Time for simulation. */ stopwatch<>::duration time_sim{ 0 }; /*! \brief Time for don't-care computation. */ stopwatch<>::duration time_dont_care{ 0 }; /*! \brief Time of the resub functor. */ stopwatch<>::duration time_compute_function{ 0 }; ResubFnSt functor_st; void report() const { // clang-format off fmt::print( "[i] <ResubEngine: window_based_resub_engine>\n" ); fmt::print( "[i] #resub = {:6d}\n", num_resub ); fmt::print( "[i] ======== Runtime ========\n" ); fmt::print( "[i] simulation: {:>5.2f} secs\n", to_seconds( time_sim ) ); fmt::print( "[i] don't care: {:>5.2f} secs\n", to_seconds( time_dont_care ) ); fmt::print( "[i] functor : {:>5.2f} secs\n", to_seconds( time_compute_function ) ); fmt::print( "[i] ======== Details ========\n" ); functor_st.report(); fmt::print( "[i] =========================\n\n" ); // clang-format on } }; /*! \brief Window-based resubstitution engine. * * This engine computes the complete truth tables of nodes within a window * with the leaves as inputs. It does not verify the resubstitution candidates * given by the resubstitution functor. This engine requires the divisor * collector to prepare three data members: `leaves`, `divs` and `mffc`. * * Required interfaces of the resubstitution functor: * - Constructor: `resub_fn( Ntk const& ntk, Simulator const& sim,` * `std::vector<node> const& divs, uint32_t num_divs, ResubFnSt& st )` * - A public `operator()`: `std::optional<signal> operator()` * `( node const& root, TTdc care, uint32_t required, uint32_t max_inserts,` * `MffcRes potential_gain, uint32_t& last_gain ) const` * * Compatible resubstitution functors implemented: * - `default_resub_functor` * - `aig_resub_functor` * - `mig_resub_functor` * - `xmg_resub_functor` * - `xag_resub_functor` * - `mig_resyn_functor` * * \param TTsim Truth table type for simulation. * \param TTdc Truth table type for don't-care computation. * \param ResubFn Resubstitution functor to compute the resubstitution. * \param MffcRes Typename of `potential_gain` needed by the resubstitution functor. */ template<class Ntk, class TTsim, class TTdc = kitty::dynamic_truth_table, class ResubFn = default_resub_functor<Ntk, window_simulator<Ntk, TTsim>, TTdc>, typename MffcRes = uint32_t> class window_based_resub_engine { public: static constexpr bool require_leaves_and_mffc = true; using stats = window_resub_stats<typename ResubFn::stats>; using mffc_result_t = MffcRes; using node = typename Ntk::node; using signal = typename Ntk::signal; explicit window_based_resub_engine( Ntk& ntk, resubstitution_params const& ps, stats& st ) : ntk( ntk ), ps( ps ), st( st ), sim( ntk, ps.max_divisors, ps.max_pis ) { } void init() {} void update() {} std::optional<signal> run( node const& n, std::vector<node> const& leaves, std::vector<node> const& divs, std::vector<node> const& mffc, mffc_result_t potential_gain, uint32_t& last_gain ) { /* simulate the collected divisors */ call_with_stopwatch( st.time_sim, [&]() { simulate( leaves, divs, mffc ); } ); auto care = kitty::create<TTdc>( ps.max_pis ); call_with_stopwatch( st.time_dont_care, [&]() { if ( ps.use_dont_cares ) { care = ~satisfiability_dont_cares( ntk, leaves, ps.window_size ); } else { care = ~care; } } ); ResubFn resub_fn( ntk, sim, divs, divs.size(), st.functor_st ); auto res = call_with_stopwatch( st.time_compute_function, [&]() { auto max_depth = std::numeric_limits<uint32_t>::max(); if ( ps.preserve_depth ) { max_depth = ntk.level( n ) - 1; } return resub_fn( n, care, max_depth, ps.max_inserts, potential_gain, last_gain ); } ); if ( res ) { ++st.num_resub; } return res; } private: void simulate( std::vector<node> const& leaves, std::vector<node> const& divs, std::vector<node> const& mffc ) { sim.resize(); for ( auto i = 0u; i < divs.size() + mffc.size(); ++i ) { const auto d = i < divs.size() ? divs.at( i ) : mffc.at( i - divs.size() ); /* skip constant 0 */ if ( d == 0 ) continue; /* assign leaves to variables */ if ( i < leaves.size() ) { sim.assign( d, i + 1 ); continue; } /* compute truth tables of inner nodes */ sim.assign( d, i - uint32_t( leaves.size() ) + ps.max_pis + 1 ); std::vector<TTsim> tts; ntk.foreach_fanin( d, [&]( const auto& s ) { tts.emplace_back( sim.get_tt( ntk.make_signal( ntk.get_node( s ) ) ) ); /* ignore sign */ } ); auto const tt = ntk.compute( d, tts.begin(), tts.end() ); sim.set_tt( i - uint32_t( leaves.size() ) + ps.max_pis + 1, tt ); } /* normalize truth tables */ sim.normalize( divs ); sim.normalize( mffc ); } private: Ntk& ntk; resubstitution_params const& ps; stats& st; window_simulator<Ntk, TTsim> sim; }; /* window_based_resub_engine */ /*! \brief The top-level resubstitution framework. * * \param ResubEngine The engine that computes the resubtitution for a given root * node and divisors. One can choose from `window_based_resub_engine` which * does complete simulation within small windows, or `simulation_based_resub_engine` * which does partial simulation on the whole circuit. * * \param DivCollector Collects divisors near a given root node, and compute * the potential gain (MFFC size or its variants). * Currently only `default_divisor_collector` is implemented, but * a frontier-based approach may be integrated in the future. * When using `window_based_resub_engine`, the `DivCollector` should prepare * three public data members: `leaves`, `divs`, and `mffc` (see documentation * of `default_divisor_collector` for details). When using `simulation_based_resub_engine`, * only `divs` is needed. */ template<class Ntk, class ResubEngine = window_based_resub_engine<Ntk, kitty::dynamic_truth_table>, class DivCollector = default_divisor_collector<Ntk>> class resubstitution_impl { public: using engine_st_t = typename ResubEngine::stats; using collector_st_t = typename DivCollector::stats; using node = typename Ntk::node; using signal = typename Ntk::signal; using resub_callback_t = std::function<bool( Ntk&, node const&, signal const& )>; using mffc_result_t = typename ResubEngine::mffc_result_t; /*! \brief Constructor of the top-level resubstitution framework. * * \param ntk The network to be optimized. * \param ps Resubstitution parameters. * \param st Top-level resubstitution statistics. * \param engine_st Statistics of the resubstitution engine. * \param collector_st Statistics of the divisor collector. * \param callback Callback function when a resubstitution is found. */ explicit resubstitution_impl( Ntk& ntk, resubstitution_params const& ps, resubstitution_stats& st, engine_st_t& engine_st, collector_st_t& collector_st ) : ntk( ntk ), ps( ps ), st( st ), engine_st( engine_st ), collector_st( collector_st ) { static_assert( std::is_same_v<typename ResubEngine::mffc_result_t, typename DivCollector::mffc_result_t>, "MFFC result type of the engine and the collector are different" ); st.initial_size = ntk.num_gates(); register_events(); } ~resubstitution_impl() { ntk.events().release_add_event( add_event ); ntk.events().release_modified_event( modified_event ); ntk.events().release_delete_event( delete_event ); } void run( resub_callback_t const& callback = substitute_fn<Ntk> ) { stopwatch t( st.time_total ); /* start the managers */ DivCollector collector( ntk, ps, collector_st ); ResubEngine resub_engine( ntk, ps, engine_st ); call_with_stopwatch( st.time_resub, [&]() { resub_engine.init(); } ); progress_bar pbar{ ntk.size(), "resub |{0}| node = {1:>4} cand = {2:>4} est. gain = {3:>5}", ps.progress }; auto const size = ntk.num_gates(); ntk.foreach_gate( [&]( auto const& n, auto i ) { if ( i >= size ) { return false; /* terminate */ } pbar( i, i, candidates, st.estimated_gain ); /* compute cut, collect divisors, compute MFFC */ mffc_result_t potential_gain; const auto collector_success = call_with_stopwatch( st.time_divs, [&]() { return collector.run( n, potential_gain ); } ); if ( !collector_success ) { return true; /* next */ } /* update statistics */ last_gain = 0; st.num_total_divisors += collector.divs.size(); /* try to find a resubstitution with the divisors */ auto g = call_with_stopwatch( st.time_resub, [&]() { if constexpr ( ResubEngine::require_leaves_and_mffc ) /* window-based */ { return resub_engine.run( n, collector.leaves, collector.divs, collector.mffc, potential_gain, last_gain ); } else /* simulation-based */ { return resub_engine.run( n, collector.divs, potential_gain, last_gain ); } } ); if ( !g ) { return true; /* next */ } /* update progress bar */ candidates++; st.estimated_gain += last_gain; /* update network */ bool updated = call_with_stopwatch( st.time_callback, [&]() { return callback( ntk, n, *g ); } ); if ( updated ) { resub_engine.update(); } return true; /* next */ } ); } private: void register_events() { auto const update_level_of_new_node = [&]( const auto& n ) { ntk.resize_levels(); update_node_level( n ); }; auto const update_level_of_existing_node = [&]( node const& n, const auto& old_children ) { (void)old_children; ntk.resize_levels(); update_node_level( n ); }; auto const update_level_of_deleted_node = [&]( const auto& n ) { ntk.set_level( n, -1 ); }; add_event = ntk.events().register_add_event( update_level_of_new_node ); modified_event = ntk.events().register_modified_event( update_level_of_existing_node ); delete_event = ntk.events().register_delete_event( update_level_of_deleted_node ); } /* maybe should move to depth_view */ void update_node_level( node const& n, bool top_most = true ) { uint32_t curr_level = ntk.level( n ); uint32_t max_level = 0; ntk.foreach_fanin( n, [&]( const auto& f ) { auto const p = ntk.get_node( f ); auto const fanin_level = ntk.level( p ); if ( fanin_level > max_level ) { max_level = fanin_level; } } ); ++max_level; if ( curr_level != max_level ) { ntk.set_level( n, max_level ); /* update only one more level */ if ( top_most ) { ntk.foreach_fanout( n, [&]( const auto& p ) { update_node_level( p, false ); } ); } } } private: Ntk& ntk; resubstitution_params const& ps; resubstitution_stats& st; engine_st_t& engine_st; collector_st_t& collector_st; /* temporary statistics for progress bar */ uint32_t candidates{ 0 }; uint32_t last_gain{ 0 }; /* events */ std::shared_ptr<typename network_events<Ntk>::add_event_type> add_event; std::shared_ptr<typename network_events<Ntk>::modified_event_type> modified_event; std::shared_ptr<typename network_events<Ntk>::delete_event_type> delete_event; }; } /* namespace detail */ /*! \brief Window-based Boolean resubstitution with default resub functor (only div0). */ template<class Ntk> void default_resubstitution( Ntk& ntk, resubstitution_params const& ps = {}, resubstitution_stats* pst = nullptr ) { static_assert( is_network_type_v<Ntk>, "Ntk is not a network type" ); static_assert( has_clear_values_v<Ntk>, "Ntk does not implement the clear_values method" ); static_assert( has_fanout_size_v<Ntk>, "Ntk does not implement the fanout_size method" ); static_assert( has_foreach_fanin_v<Ntk>, "Ntk does not implement the foreach_fanin method" ); static_assert( has_foreach_gate_v<Ntk>, "Ntk does not implement the foreach_gate method" ); static_assert( has_foreach_node_v<Ntk>, "Ntk does not implement the foreach_node method" ); static_assert( has_get_constant_v<Ntk>, "Ntk does not implement the get_constant method" ); static_assert( has_get_node_v<Ntk>, "Ntk does not implement the get_node method" ); static_assert( has_is_complemented_v<Ntk>, "Ntk does not implement the is_complemented method" ); static_assert( has_is_pi_v<Ntk>, "Ntk does not implement the is_pi method" ); static_assert( has_make_signal_v<Ntk>, "Ntk does not implement the make_signal method" ); static_assert( has_set_value_v<Ntk>, "Ntk does not implement the set_value method" ); static_assert( has_set_visited_v<Ntk>, "Ntk does not implement the set_visited method" ); static_assert( has_size_v<Ntk>, "Ntk does not implement the size method" ); static_assert( has_substitute_node_v<Ntk>, "Ntk does not implement the substitute_node method" ); static_assert( has_value_v<Ntk>, "Ntk does not implement the value method" ); static_assert( has_visited_v<Ntk>, "Ntk does not implement the visited method" ); using resub_view_t = fanout_view<depth_view<Ntk>>; depth_view<Ntk> depth_view{ ntk }; resub_view_t resub_view{ depth_view }; if ( ps.max_pis == 8 ) { using truthtable_t = kitty::static_truth_table<8>; using truthtable_dc_t = kitty::dynamic_truth_table; using resub_impl_t = detail::resubstitution_impl<resub_view_t, typename detail::window_based_resub_engine<resub_view_t, truthtable_t, truthtable_dc_t>>; resubstitution_stats st; typename resub_impl_t::engine_st_t engine_st; typename resub_impl_t::collector_st_t collector_st; resub_impl_t p( resub_view, ps, st, engine_st, collector_st ); p.run(); if ( ps.verbose ) { st.report(); collector_st.report(); engine_st.report(); } if ( pst ) { *pst = st; } } else { using resub_impl_t = detail::resubstitution_impl<resub_view_t>; resubstitution_stats st; typename resub_impl_t::engine_st_t engine_st; typename resub_impl_t::collector_st_t collector_st; resub_impl_t p( resub_view, ps, st, engine_st, collector_st ); p.run(); if ( ps.verbose ) { st.report(); collector_st.report(); engine_st.report(); } if ( pst ) { *pst = st; } } } } /* namespace mockturtle */
646864a84875d13589050874e4e6b953a5f579cc
701c92b679d1d69d8eebcc6fbf13b970d86bcd78
/datanode.cpp
0104dbcc21ae9b5a9209907e924534c24386511f
[]
no_license
sun98/Mini-DFS
2fcda1ed65323ba1f0bf470c0eda481e1c7a2c46
a21ef819bb7072bfdf72cf134c93266c15e5bf05
refs/heads/master
2023-02-22T21:01:13.582849
2021-01-26T02:05:42
2021-01-26T02:05:42
332,942,202
2
0
null
null
null
null
UTF-8
C++
false
false
2,586
cpp
datanode.cpp
#include <thread> #include <sys/stat.h> #include <dirent.h> #include <fstream> #include <iostream> #include <algorithm> #include "datanode.h" int chunkSize = 2 * 1024 * 1024; DataServer::DataServer(const std::string &name) : name_(name), buf(nullptr), finish(true) { std::string cmd = "mkdir -p " + name_; system(cmd.c_str()); } void DataServer::operator()() { while (true) { std::unique_lock<std::mutex> lk(mtx); cv.wait(lk, [&]() { return !this->finish; }); if (cmd == "up") { size_ += bufSize / 1024.0 / 1024.0; put(); } else if (cmd == "down") read(); else if (cmd == "loc") locate(); else if (cmd == "down_id") fetch(); this->finish = true; lk.unlock(); cv.notify_all(); } } void DataServer::put() { int start = 0; std::ofstream os; while (start < bufSize) { int offset = start / chunkSize; std::string filePath = name_ + "/" + std::to_string(fid) + " " + std::to_string(offset); os.open(filePath); if (!os) std::cerr << "Failed in creating file in data server: " << filePath << std::endl; os.write(&buf[start], std::min(chunkSize, bufSize - start)); start += chunkSize; os.close(); } } void DataServer::read() { int start = 0; buf = new char[bufSize]; while (start < bufSize) { int offset = start / chunkSize; std::string filePath = name_ + "/" + std::to_string(fid) + " " + std::to_string(offset); std::ifstream is(filePath); // file not found in this server. if (!is) { delete[] buf; bufSize = 0; break; } is.read(&buf[start], std::min(chunkSize, bufSize - start)); start += chunkSize; } } void DataServer::fetch() { buf = new char[chunkSize]; std::string filePath = name_ + "/" + std::to_string(fid) + " " + std::to_string(offset); std::ifstream is(filePath); // file not found in this server. if (!is) { delete[] buf; bufSize = 0; } else { is.read(buf, std::min(chunkSize, bufSize - chunkSize * offset)); bufSize = is.tellg(); } } void DataServer::locate() { std::string filePath = name_ + "/" + std::to_string(fid) + " " + std::to_string(offset); std::ifstream is(filePath); if (is) bufSize = 1; else bufSize = 0; } std::string DataServer::get_name() const { return name_; }
e95fe53275115c4117dc235c62141a1492d59d52
71a780963dba464b2b62a661566e062b78c4eb3d
/gimage.cpp
613602ac12526606c5400949588217162541c00f
[]
no_license
yodamaster/gimage
b3264e4e26ba28635d1fd7c0f3a725171a71404f
9954de1a4f571ab3325f60b7c7684207d05e9ace
refs/heads/master
2020-03-19T21:51:09.319177
2017-12-24T16:16:05
2017-12-24T16:16:05
136,952,150
1
0
null
2018-06-11T16:23:38
2018-06-11T16:23:38
null
UTF-8
C++
false
false
78,453
cpp
gimage.cpp
 #include "gimage/gimage.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <exception> #include <algorithm> #include <sstream> #include <omp.h> #include <exception> #include "rawimage.h" #include "jpegimage.h" #include "tiffimage.h" #include "gimage/strutil.h" #define PI 3.14159265358979323846 //Range 0.0-255.0 constants //#define SCALE_16BIT 256.0 //#define SCALE_8BIT 1.0 //#define SCALE_CURVE 1.0 //Range 0.0-1.0 constants #define SCALE_16BIT 65536.0 #define SCALE_8BIT 256.0 #define SCALE_CURVE 256.0 const char * gImageVersion() { return VERSION; } std::string gImage::profilepath = ""; //Constructors/Destructor: gImage::gImage() { w=0; h=0; profile = NULL; lasterror = GIMAGE_OK; } gImage::gImage(const gImage &o) { w = o.w; h = o.h; c = o.c; b = o.b; imginfo = o.imginfo; image = o.image; lasterror = GIMAGE_OK; if (o.profile) { profile = new char[o.profile_length]; memcpy(profile, o.profile, o.profile_length); profile_length = o.profile_length; } else profile = NULL; } gImage::gImage(char *imagedata, unsigned width, unsigned height, unsigned colors, BPP bits, std::map<std::string,std::string> imageinfo, char * icc_profile, unsigned icc_profile_length) { image.resize(width*height); w=width; h=height; c=colors; b=bits; lasterror = GIMAGE_OK; if (bits ==BPP_16) { unsigned short * src = (unsigned short *) imagedata; if (colors == 1) { //turn into a three-color grayscale for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; image[pos].r = (unsigned short) src[0]/SCALE_16BIT; image[pos].g = (unsigned short) src[0]/SCALE_16BIT; image[pos].b = (unsigned short) src[0]/SCALE_16BIT; src += 1; } } c = 3; } else if (colors == 3) { for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; image[pos].r = (unsigned short) src[0]/SCALE_16BIT; image[pos].g = (unsigned short) src[1]/SCALE_16BIT; image[pos].b = (unsigned short) src[2]/SCALE_16BIT; src += 3; } } } else { w = 0; h = 0; return; } } else if (bits == BPP_8) { char * src = (char *) imagedata; if (colors == 1) { //turn into a three-color grayscale for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; image[pos].r = (unsigned char) src[0]/SCALE_8BIT; image[pos].g = (unsigned char) src[0]/SCALE_8BIT; image[pos].b = (unsigned char) src[0]/SCALE_8BIT; src += 1; } } c = 3; } else if (colors == 3) { for (unsigned y=0; y<height; y++) { for (unsigned x=0; x<width; x++) { unsigned pos = x + y*w; image[pos].r = (unsigned char) src[0]/SCALE_8BIT; image[pos].g = (unsigned char) src[1]/SCALE_8BIT; image[pos].b = (unsigned char) src[2]/SCALE_8BIT; src += 3; } } } else { w = 0; h = 0; return; } } else if (bits == BPP_FP) { float * src = (float *) imagedata; if (colors == 1) { //turn into a three-color grayscale for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; image[pos].r = src[0]; image[pos].g = src[0]; image[pos].b = src[0]; src += 1; } } c = 3; } else if (colors == 3) { for (unsigned y=0; y<height; y++) { for (unsigned x=0; x<width; x++) { unsigned pos = x + y*w; image[pos].r = src[0]; image[pos].g = src[1]; image[pos].b = src[2]; src += 3; } } } else { w = 0; h = 0; return; } } else { w = 0; h = 0; return; } imginfo = imageinfo; if (icc_profile) { profile = new char[icc_profile_length]; memcpy(profile, icc_profile, icc_profile_length); //delete [] icc_profile; profile_length = icc_profile_length; } else { profile = NULL; profile_length = 0; } } gImage::gImage(unsigned width, unsigned height, unsigned colors, std::map<std::string,std::string> imageinfo) { image.resize(width*height); w=width; h=height; c=colors; b=BPP_FP; lasterror = GIMAGE_OK; for (unsigned y=0; y<height; y++) { for (unsigned x=0; x<width; x++) { unsigned pos = x + y*w; image[pos].r = 0.0; image[pos].g = 0.0; image[pos].b = 0.0; } } imginfo = imageinfo; profile = NULL; profile_length = 0; } gImage::~gImage() { if (profile) delete [] profile; } //Getters: std::string gImage::getRGBCharacteristics() { std::string charac; if (sizeof(PIXTYPE) == 2) charac.append("half, "); if (sizeof(PIXTYPE) == 4) charac.append("float, "); if (sizeof(PIXTYPE) == 8) charac.append("double, "); if (SCALE_CURVE == 1.0) charac.append("0.0 - 255.0"); if (SCALE_CURVE == 256.0) charac.append("0.0 - 1.0"); return charac; } pix gImage::getPixel(unsigned x, unsigned y) { pix nullpix = {(PIXTYPE) 0.0, (PIXTYPE) 0.0, (PIXTYPE) 0.0}; int i = x + y*w; if ((x < w) && (y < h)) return image[i]; else return nullpix; } std::vector<float> gImage::getPixelArray(unsigned x, unsigned y) { int i = x + y*w; std::vector<float> pixel; pixel.resize(3); if (!image.empty()) { if (i < w * h) { if (i < image.size()) { pixel[0] = (float) image[i].r; pixel[1] = (float) image[i].g; pixel[2] = (float) image[i].b; } } } else { pixel[0] = 0.0; pixel[1] = 0.0; pixel[2] = 0.0; } return pixel; } //structs for making raw images struct cpix { char r, g, b; }; struct uspix { unsigned short r, g, b; }; struct fpix { float r, g, b; }; //Lets LittleCMS do both the profile transform and data type conversion: char * gImage::getTransformedImageData(BPP bits, cmsHPROFILE profile, cmsUInt32Number intent) { cmsHPROFILE hImgProfile; cmsUInt32Number informat, outformat; cmsHTRANSFORM hTransform; char * imagedata; pix* img = image.data(); if (sizeof(PIXTYPE) == 2) informat = TYPE_RGB_HALF_FLT; if (sizeof(PIXTYPE) == 4) informat = TYPE_RGB_FLT; if (sizeof(PIXTYPE) == 8) informat = TYPE_RGB_DBL; hImgProfile = cmsOpenProfileFromMem(getProfile(), getProfileLength()); if (hImgProfile != NULL & profile != NULL) { if (bits == BPP_16) { imagedata = new char[w*h*c*2]; outformat = TYPE_RGB_16; uspix * imgdata = (uspix *) imagedata; hTransform = cmsCreateTransform(hImgProfile, informat, profile, outformat, intent, 0); #pragma omp parallel for for (unsigned y=0; y<h; y++) { unsigned pos = y*w; cmsDoTransform(hTransform, &img[pos], &imgdata[pos], w); } } else if (bits == BPP_8) { imagedata = new char[w*h*c]; outformat = TYPE_RGB_8; cpix * imgdata = (cpix *) imagedata; hTransform = cmsCreateTransform(hImgProfile, informat, profile, outformat, intent, 0); #pragma omp parallel for for (unsigned y=0; y<h; y++) { unsigned pos = y*w; cmsDoTransform(hTransform, &img[pos], &imgdata[pos], w); } } else if (bits == BPP_FP) { imagedata = new char[w*h*c*sizeof(float)]; outformat = TYPE_RGB_FLT; fpix * imgdata = (fpix *) imagedata; hTransform = cmsCreateTransform(hImgProfile, informat, profile, outformat, intent, 0); #pragma omp parallel for for (unsigned y=0; y<h; y++) { unsigned pos = y*w; cmsDoTransform(hTransform, &img[pos], &imgdata[pos], w); } } else return NULL; } return imagedata; } float * gImage::getImageDataFloat(bool unbounded, cmsHPROFILE profile, cmsUInt32Number intent) { cmsHPROFILE hImgProfile; cmsUInt32Number format; cmsHTRANSFORM hTransform; //float * imagedata; unsigned imagesize = w*h; fpix * imagedata = new fpix[imagesize]; pix * img = image.data(); if (unbounded) #pragma omp parallel for for (unsigned i=0; i<imagesize; i++) { imagedata[i].r = (float) img[i].r; imagedata[i].g = (float) img[i].g; imagedata[i].b = (float) img[i].b; } else #pragma omp parallel for for (unsigned i=0; i<imagesize; i++) { imagedata[i].r = fmin(fmax(img[i].r,0.0),1.0); imagedata[i].g = fmin(fmax(img[i].g,0.0),1.0); imagedata[i].b = fmin(fmax(img[i].b,0.0),1.0); } if (profile) { hImgProfile = cmsOpenProfileFromMem(getProfile(), getProfileLength()); if (hImgProfile != NULL & profile != NULL) { hTransform = cmsCreateTransform(hImgProfile, TYPE_RGB_FLT, profile, TYPE_RGB_FLT, intent, 0); cmsCloseProfile(hImgProfile); cmsDoTransform(hTransform, imagedata, imagedata, imagesize); } } return (float *) imagedata; } //Converts the data to the specified BPP integer format, then performs the profile transform: char * gImage::getImageData(BPP bits, cmsHPROFILE profile, cmsUInt32Number intent) { cmsHPROFILE hImgProfile; cmsUInt32Number format; cmsHTRANSFORM hTransform; char * imagedata; if (bits == BPP_16) imagedata = new char[w*h*c*sizeof(unsigned short)]; else if (bits == BPP_FP) imagedata = new char[w*h*c*sizeof(float)]; else if (bits == BPP_8) imagedata = new char[w*h*c]; else return NULL; if (bits == BPP_16) { uspix * dst = (uspix *) imagedata; #pragma omp parallel for for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; dst[pos].r = (unsigned short) lrint(fmin(fmax(image[pos].r*SCALE_16BIT,0.0),65535.0)); dst[pos].g = (unsigned short) lrint(fmin(fmax(image[pos].g*SCALE_16BIT,0.0),65535.0)); dst[pos].b = (unsigned short) lrint(fmin(fmax(image[pos].b*SCALE_16BIT,0.0),65535.0)); } } format = TYPE_RGB_16; } if (bits == BPP_8) { cpix * dst = (cpix *) imagedata; #pragma omp parallel for for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; dst[pos].r = (unsigned char) lrint(fmin(fmax(image[pos].r*SCALE_8BIT,0.0),255.0)); dst[pos].g = (unsigned char) lrint(fmin(fmax(image[pos].g*SCALE_8BIT,0.0),255.0)); dst[pos].b = (unsigned char) lrint(fmin(fmax(image[pos].b*SCALE_8BIT,0.0),255.0)); } } format = TYPE_RGB_8; } if (bits == BPP_FP) { fpix * dst = (fpix *) imagedata; #pragma omp parallel for for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned pos = x + y*w; dst[pos].r = fmin(fmax(image[pos].r,0.0),1.0); dst[pos].g = fmin(fmax(image[pos].g,0.0),1.0); dst[pos].b = fmin(fmax(image[pos].b,0.0),1.0); } } format = TYPE_RGB_FLT; } if (profile) { hImgProfile = cmsOpenProfileFromMem(getProfile(), getProfileLength()); if (hImgProfile != NULL & profile != NULL) { hTransform = cmsCreateTransform(hImgProfile, format, profile, format, intent, 0); cmsCloseProfile(hImgProfile); cmsDoTransform(hTransform, imagedata, imagedata, w*h); } } return imagedata; } std::vector<pix>& gImage::getImageData() { return image; } pix* gImage::getImageDataRaw() { return image.data(); } unsigned gImage::getWidth() { return w; } unsigned gImage::getHeight() { return h; } unsigned gImage::getColors() { return c; } BPP gImage::getBits() { return b; } std::string gImage::getBitsStr() { switch (b) { case BPP_FP: return "internal floating point"; case BPP_8: return "8"; case BPP_16: return "16"; } } GIMAGE_ERROR gImage::getLastError() { return lasterror; } std::string gImage::getLastErrorMessage() { if (lasterror == GIMAGE_OK) return "GIMAGE_OK"; if (lasterror == GIMAGE_EXCEPTION) return "GIMAGE_EXCEPTION"; if (lasterror == GIMAGE_UNSUPPORTED_PIXELFORMAT) return "GIMAGE_UNSUPPORTED_PIXELFORMAT"; if (lasterror == GIMAGE_UNSUPPORTED_FILEFORMAT) return "GIMAGE_UNSUPPORTED_FILEFORMAT"; if (lasterror == GIMAGE_APPLYCOLORSPACE_BADPROFILE) return "GIMAGE_APPLYCOLORSPACE_BADPROFILE"; if (lasterror == GIMAGE_APPLYCOLORSPACE_BADINTENT) return "GIMAGE_APPLYCOLORSPACE_BADINTENT"; if (lasterror == GIMAGE_APPLYCOLORSPACE_BADTRANSFORM) return "GIMAGE_APPLYCOLORSPACE_BADTRANSFORM"; if (lasterror == GIMAGE_ASSIGNCOLORSPACE_BADTRANSFORM) return "GIMAGE_ASSIGNCOLORSPACE_BADTRANSFORM"; return "(none)"; } std::map<std::string,std::string> gImage::getInfo() { return imginfo; } std::string gImage::getInfoValue(std::string name) { if (imginfo.find(name) != imginfo.end()) return imginfo[name]; else return ""; } char * gImage::getProfile() { return profile; } unsigned gImage::getProfileLength() { return profile_length; } std::string gImage::getProfilePath() { return profilepath; } std::map<std::string,std::string> gImage::getInfo(const char * filename) { unsigned width, height, colors, bpp, icclength; char * iccprofile; std::map<std::string, std::string> imgdata; GIMAGE_FILETYPE ftype = gImage::getFileType(filename); if (ftype == FILETYPE_TIFF) _loadTIFFInfo(filename, &width, &height, &colors, &bpp, imgdata); if (ftype == FILETYPE_RAW) _loadRAWInfo(filename, &width, &height, &colors, &bpp, imgdata); if (ftype == FILETYPE_JPEG) _loadJPEGInfo(filename, &width, &height, &colors, imgdata); return imgdata; } //Check the file type of an existing image file; is it suitable for opening? GIMAGE_FILETYPE gImage::getFileType(const char * filename) { std::string fname = filename; std::vector<std::string> fpieces = split(fname, "."); std::string ext = fpieces.back(); if (ext.compare("tif") == 0 | ext.compare("tiff") == 0) if (_checkTIFF(filename)) return FILETYPE_TIFF; if ((ext.compare("jpg") == 0) | (ext.compare("JPG") == 0)) if (_checkJPEG(filename)) return FILETYPE_JPEG; if (_checkRAW(filename)) return FILETYPE_RAW; return FILETYPE_UNKNOWN; } //Check the file type of an image file name; is it suitable to use for saving? GIMAGE_FILETYPE gImage::getFileNameType(const char * filename) { std::string fname = filename; std::vector<std::string> fpieces = split(fname, "."); std::string ext = fpieces.back(); if (ext.compare("tif") == 0 | ext.compare("tiff") == 0) return FILETYPE_TIFF; if ((ext.compare("jpg") == 0) | (ext.compare("JPG") == 0)) return FILETYPE_JPEG; return FILETYPE_UNKNOWN; } std::string gImage::Version() { return VERSION; } std::string gImage::LibraryVersions() { std::string verstring; verstring.append("JPEG: "); verstring.append(jpegVersion()); verstring.append("\nTIFF: "); std::string tiffver(tiffVersion()); verstring.append(tiffver.substr(0,tiffver.find_first_of("\n"))); verstring.append("\nLibRaw: "); verstring.append(librawVersion()); verstring.append("\nLittleCMS2: "); std::ostringstream s; s << (int) cmsGetEncodedCMMversion(); verstring.append(s.str()); //verstring.append("\n"); return verstring; } int gImage::ThreadCount() { #if defined(_OPENMP) return omp_get_max_threads(); #else return 1; #endif } // Setters: void gImage::setInfo(std::string name, std::string value) { imginfo[name] = value; } void gImage::setProfile(char * prof, unsigned proflength) { if (profile) delete [] profile; profile = prof; profile_length = proflength; } void gImage::deleteProfile() { if (profile) delete [] profile; profile = NULL; profile_length = 0; } void gImage::setProfilePath(std::string ppath) { profilepath = ppath; } //Image Operations: // //This is a compendium of basic image operations, kept simple for //ease of understanding while maintaining basic image quality //Convolution Kernels and Sharpening // //Credit: Various // //Changing a pixel depending on the values of its neighbors is probably the //second fundamental image transformation to understand, after so-called //curve-based lookup tables. Particularly, there are a set of matrices //describing weights of the center pixel and its neigbors that produce //various effects, such as blurring and edge highlighting. The general //algorith traverses the image and calculates a new value for each pixel //based on the sum of the weighted values of its neighbors. // //In the ConvolutionKernal algorithm presented below, the inner kx and ky //loops do the collection of the weighted neighbor pixel values using the //kernel parameter, which is hard-coded to be a 3x3 matrix of doubles. //Larger matrices are discussed elsewhere for more control and 'quality', //but the simple 3x3 matrix is quite suitable for what I consider to be the //most useful convolution kernel application - sharpening downsized images. // //The Sharpen method below defines a kernel specific to image sharpening, //or more specifically, the enhancement of edge contrast. The kernel is //described in numerous places, usually as a moderate application: // // 0 -1 0 //-1 5 -1 // 0 -1 0 // //So, if you multiply the source pixel by 5, and each of the surrounding //pixels by the corresponding values, and then sum it all up, you get a //new value for the source pixel that will present more 'edge contrast', //or acutance. The method actually implements a range of sharpening by //computing a matrix based on a linear 'strength', 0=no sharpening, //10=ludicrous sharpening. The matrix values are calculated from //the strength number, preserving the relationship expressed in the //matrix described above. // //There are more complex algorithms available for 'sharpening', as it //were, but I find the simple 3x3 convolution kernel to work nicely //for re-introducing acutance lost in down-sizing an image for web //publication. The application for that purpose is most valuable //going from 0 to 1 in strength, for ~640x480 images; 2 and above //start to introduce the halos and ringing that most find offensive. // void gImage::ApplyConvolutionKernel(double kernel[3][3], int threadcount) { std::vector<pix> src = image; #pragma omp parallel for num_threads(threadcount) for(int y = 1; y < h-1; y++) { for(int x = 1; x < w-1; x++) { int pos = x + y*w; double R=0.0; double G=0.0; double B=0.0; for (int kx=0; kx<3; kx++) { for (int ky=0; ky<3; ky++) { int kpos = w*(y-1+ky) + (x-1+kx); R += src[kpos].r * kernel[kx][ky]; G += src[kpos].g * kernel[kx][ky]; B += src[kpos].b * kernel[kx][ky]; } } image[pos].r = R; image[pos].g = G; image[pos].b = B; } } } void gImage::ApplySharpen(int strength, int threadcount) { double kernel[3][3] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; //build a kernel corresponding to the specified strength double x = -((strength)/4.0); kernel[0][1] = x; kernel[1][0] = x; kernel[1][2] = x; kernel[2][1] = x; kernel[1][1] = strength+1; ApplyConvolutionKernel(kernel, threadcount); } //Rotate // //Credit: Alan Paeth, "A Fast Algorithm for General Raster Rotation", Graphics Interface '86 // http://supercomputingblog.com/graphics/coding-bilinear-interpolation/ // //Image rotation is a deceivingly complex operation. One would think it to be sufficient to //apply the sine and cosine of the rotation angle to each pixel coordinate, but you also have to //manage the new image boundary, and the image can develop blocky aliasing in the edges. //I started my exploration of image rotation with such an approach, and I've left it in //commented-out. // //These days, a lot of image rotation is done using Paeth's approach, which is the //application of three shears, one in the X direction, one in the Y direction, and a final //one in the X direction to produce the rotation. One wonders about the thinking required //to determine such transformations would produce the desired result. // //Three methods are presented to perform Paeth roatation: XShear and YShear, and a Rotate //method to use them in the proscribed order. Not implemented at this writing is an //intelligent adjustment of the rotated pixel to reflect its changed relationship with //adjunct pixels. This does not seem to be an egregious issue with large out-of-camera //images at small angles of rotation. I've replaced my shear implementation of ApplyRotate, //but I've left the code in, commented-out, for the time being (1/29/2017) // //After messing around with interpolation in shears, I decided to switch back to a sin-cos //rotation approach. The key consideration was straightforward application of bilinear //interpolation, which requires sampling the pixels comprising the "destination" pixel from //the reverse rotation. This hurt my head for a bit, but all came clear when I built the //loop around the new (resized) destination image. My bilinear interpolation is a copy-paste //from the supercomputingblog.com code, so here's the compliance comment for its use: /* This code is brought to you by the supercomputingblog.com You may use this code for any purpose. However, you may redistribute this code only if this comment remains intact. */ //There's no name I can find on the blog site to which to attribute the source; thanks, whomever //you are... #define ROTATE_BILINEAR_INTERPOLATION // sin-cos rotate, with bilnear interpolation adapted from // http://supercomputingblog.com/graphics/coding-bilinear-interpolation/ // Comment out the #define of ROTATE_BILINEAR_INTERPOLATION, recompile, and see the difference... void gImage::ApplyRotate(double angle, bool crop, int threadcount) { std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; double rangle = -(-angle * PI / 180.0); // negate for destination interpolation double cosine = cos(rangle); double sine = sin(rangle); int width = w; int height = h; double cX = (double)width/2.0f; double cY = (double)height/2.0f; double brangle = (-angle * PI / 180.0); double bcosine = cos(brangle); double bsine = sin(brangle); //compute bounding box: int x = 0; int y = 0; int x1 = cX+(x-cX)*bcosine+(y-cY)*bsine; int y1 = cY-(x-cX)*bsine+(y-cY)*bcosine; x = w; y = 0; int x2 = cX+(x-cX)*bcosine+(y-cY)*bsine; int y2 = cY-(x-cX)*bsine+(y-cY)*bcosine; x = 0; y = h; int x3 = cX+(x-cX)*bcosine+(y-cY)*bsine; int y3 = cY-(x-cX)*bsine+(y-cY)*bcosine; x = w; y = h; int x4 = cX+(x-cX)*bcosine+(y-cY)*bsine; int y4 = cY-(x-cX)*bsine+(y-cY)*bcosine; int minx = std::min(x1, std::min(x2, std::min(x3,x4))); int maxx = std::max(x1, std::max(x2, std::max(x3,x4))); int miny = std::min(y1, std::min(y2, std::min(y3,y4))); int maxy = std::max(y1, std::max(y2, std::max(y3,y4))); int nw = maxx-minx; int nh = maxy-miny; // variables for coordinate translation: int dw = nw - w; int dh = nh - h ; int tx = nw/2; int ty = nh/2; //prep image for rotated result: image.resize(nw*nh); #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<nh; y++) { for (unsigned x=0; x<nw; x++) { int ux = x - tx; int uy = y - ty; double du = ( cosine * ux + sine * uy); double dv = (-sine * ux + cosine * uy); int u = du + tx - dw/2; int v = dv + ty - dh/2; if (u < 0 | u >= w | v < 0 | v >= h) { image[x + y*nw].r = 0.0; image[x + y*nw].g = 0.0; image[x + y*nw].b = 0.0; } else { #ifdef ROTATE_BILINEAR_INTERPOLATION //The following makes more sense when studied with the graphic on page 1 //of the supercomputingblog.com post double xPrime = du + double(tx) - double(dw)/2.0; double yPrime = dv + double(ty) - double(dh)/2.0; int q12x = (int)floor(xPrime); int q12y = (int)floor(yPrime); q12x = std::max(0, q12x); q12y = std::max(0, q12y); q12x = std::min(width-1, q12x); q12y = std::min(height-1, q12y); int q22x = (int)ceil(xPrime); int q22y = q12y; q22x = std::min(width-1, q22x); q22x = std::max(0, q22x); int q11x = q12x; int q11y = (int)ceil(yPrime); q11y = std::min(height-1, q11y); q11y = std::max(0, q11y); int q21x = q22x; int q21y = q11y; pix q11 = src[q11y*w + q11x]; pix q12 = src[q12y*w + q12x]; pix q21 = src[q21y*w + q21x]; pix q22 = src[q22y*w + q22x]; double factor1; double factor2; if ( q21x == q11x ) // special case to avoid divide by zero { factor1 = 1; // They're at the same X coordinate, so just force the calculatione to one point factor2 = 0; } else { factor1 = (((double)q21x - (double)xPrime)/((double)q21x - (double)q11x)); factor2 = (((double)xPrime - (double)q11x)/((double)q21x - (double)q11x)); } double R1r = factor1 * (double)q11.r + factor2*(double)q21.r; double R1g = factor1 * (double)q11.g + factor2*(double)q21.g; double R1b = factor1 * (double)q11.b + factor2*(double)q21.b; double R2r = factor1 * (double)q12.r + factor2*(double)q22.r; double R2g = factor1 * (double)q12.g + factor2*(double)q22.g; double R2b = factor1 * (double)q12.b + factor2*(double)q22.b; double factor3; double factor4; if (q12y == q11y) // special case to avoid divide by zero { factor3 = 1; factor4 = 0; } else { factor3 = ((double) q12y - yPrime)/((double)q12y - (double)q11y); factor4 = (yPrime - (double)q11y)/((double)q12y - (double)q11y); } //remainder modified to use the gImage pix struct: pix finalpix; finalpix.r = ((factor3 * R1r) + (factor4*R2r)); finalpix.g = ((factor3 * R1g) + (factor4*R2g)); finalpix.b = ((factor3 * R1b) + (factor4*R2b)); image[x + y*nw] = finalpix; #else //Plain old nearest-source to destination copy operation image[x + y*nw] = src[u + v*w]; #endif //ROTATE_BILINEAR_INTERPOLATION } } } w = nw; h = nh; delete s; if (crop) { if (rangle < 0) ApplyCrop(x3+dw/2, y1+dh/2, x2+dw/2, y4+dh/2, threadcount); else ApplyCrop(x1+dw/2, y2+dh/2, x4+dw/2, y3+dh/2, threadcount); } } //Trivial Rotate, 90, 180, and 270 degrees // //I was only going to implement the interpolation-based +/-45 degree rotate, //but it turns out the 'cardinal' rotations are needed to accommodate the silliness //of the EXIF Orientation tag. When you turn your camera off-axis to shoot portrait //or somesuch, the camera probably doesn't rotate the image. Instead, it sets the Orientation //tag to a corresponding code, thinking that all downstream software will use it to //properly orient your image for display. Well, no, not all do that, and further, //some programs that actually modify your image with the appropriate rotation neglect //to set the Orientation tag accordingly, which further confuses software that wants //to use it. Geesh. // //So, here are the needed transforms for 'really intelligent' software to modify-rotate //the image to the intended orientation, and pray that the Orientation flag will be //set to 0 to make the world right... // void gImage::ApplyRotate180(int threadcount) { std::vector<pix> src = image; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned spos = x + y*w; unsigned dpos = (w-x-1) + (h-y-1)*w; image[dpos] = src[spos]; } } } void gImage::ApplyRotate90(int threadcount) { std::vector<pix> src = image; unsigned dw = h; unsigned dh = w; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned spos = x + y*w; unsigned dpos = (dw-y-1) + (dh-x-1)*dw; image[dpos] = src[spos]; } } w = dw; h = dh; } void gImage::ApplyRotate270(int threadcount) { std::vector<pix> src = image; unsigned dw = h; unsigned dh = w; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned spos = x + y*w; unsigned dpos = y + (dh-x-1)*dw; image[dpos] = src[spos]; } } w = dw; h = dh; } void gImage::ApplyHorizontalMirror(int threadcount) { std::vector<pix> src = image; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned spos = x + y*w; unsigned dpos = (w-x-1) + y*w; image[dpos] = src[spos]; } } } void gImage::ApplyVerticalMirror(int threadcount) { std::vector<pix> src = image; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned spos = x + y*w; unsigned dpos = x + (h-y-1)*w; image[dpos] = src[spos]; } } } /* Rotate by three Shears: void gImage::ApplyRotate(double angle, int threadcount) { //gImage I, J, K, L; unsigned x1, x2, y1, y2; unsigned cx1, cx2, cy1, cy2; double rangle = angle * PI / 180.0; ApplyXShear(rangle,threadcount); ApplyYShear(rangle,threadcount); ApplyXShear(rangle,threadcount); ImageBounds(&x1, &x2, &y1, &y2); //ImageBounds(&cx1, &cx2, &cy1, &cy2, true); ApplyCrop(x1, y1, x2, y2,threadcount); //ApplyCrop(cx1, cy1, cx2, cy2,threadcount); } */ /* original shears, use these if you just want to try the method without slinging code: void gImage::ApplyXShear(double rangle, int threadcount) { //double sine = sin(rangle); double tangent = tan(rangle/2.0); int dw = tangent * (double) h; unsigned nw = w+abs(dw); //nearest neighbor stuff: double ddw = tangent * (double) h; double lw = ddw - (double) dw; double rw = 1.0 - lw; std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; image.resize(nw*h); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dw < 0) dw = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned u = (x - tangent * y) + dw; unsigned v = y; if (u >= nw) continue; if (v >= h) continue; unsigned dpos =u + v*nw; unsigned spos = x + y*w; image[dpos].r = src[spos].r; image[dpos].g = src[spos].g; image[dpos].b = src[spos].b; } } w = nw; delete s; } void gImage::ApplyYShear(double rangle, int threadcount) { double sine = sin(rangle); int dh = sine * (double) w; unsigned nh = h+abs(dh); unsigned dw = w; //nearest neighbor stuff: double ddh = sine * (double) (w); double lw = ddh - (double) dh; double rw = 1.0 - lw; std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; std::vector<pix>& dst = getImageData(); dst.resize(w*nh); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dh < 0) dh = -dh; else dh = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned u = x; unsigned v = (y + sine * x) + dh; if (u >= w) continue; if (v >= nh) continue; unsigned dpos = u + v*dw; unsigned spos = x + y*w; dst[dpos].r = src[spos].r; dst[dpos].g = src[spos].g; dst[dpos].b = src[spos].b; } } h = nh; delete s; } */ //end original shears //second generation shears, not working... /* void gImage::ApplyXShear(double rangle, int threadcount) { double tangent = tan(rangle/2.0); int dw = tangent * (double) h; unsigned nw = w+abs(dw); //nearest neighbor stuff: double ddw = tangent * (double) h; double lw = ddw - (double) dw; double rw = 1.0 - lw; std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; image.resize(nw*h); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dw < 0) dw = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { for (unsigned x=0; x<w; x++) { unsigned u = (x - tangent * y) + dw; unsigned v = y; if (u >= nw) continue; if (v >= h) continue; unsigned dpos =u + v*nw; unsigned spos = x + y*w; unsigned spos1 = spos+1; if (spos1 >=w) spos1--; image[dpos].r = ((src[spos].r*lw)+(src[spos1].r*rw)); image[dpos].g = ((src[spos].g*lw)+(src[spos1].g*rw)); image[dpos].b = ((src[spos].b*lw)+(src[spos1].b*rw)); } } w = nw; delete s; } void gImage::ApplyYShear(double rangle, int threadcount) { double sine = sin(rangle); int dh = sine * (double) w; unsigned nh = h+abs(dh); unsigned dw = w; //nearest neighbor stuff: double ddh = sine * (double) (w); double lw = ddh - (double) dh; double rw = 1.0 - lw; std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; std::vector<pix>& dst = getImageData(); dst.resize(w*nh); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dh < 0) dh = -dh; else dh = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned u = x; unsigned v = (y + sine * x) + dh; if (u >= w) continue; if (v >= nh) continue; unsigned dpos = u + v*dw; unsigned spos = x + y*w; unsigned spos1 = spos; if (y < h-1) unsigned spos1 = x + (y+1)*h; image[dpos].r = ((src[spos].r*lw)+(src[spos1].r*rw)); image[dpos].g = ((src[spos].g*lw)+(src[spos1].g*rw)); image[dpos].b = ((src[spos].b*lw)+(src[spos1].b*rw)); } } h = nh; delete s; } */ //end second generation shears /* Paeth's shears, kinda... void gImage::ApplyXShear(double rangle, int threadcount) { double tangent = tan(rangle/2.0); int dw = tangent * (double) h; unsigned nw = w+abs(dw); std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; image.resize(nw*h); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dw < 0) dw = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { //double skew = tangent * (y + 0.5); double skew = (tangent >= 0)? tangent * (y + 0.5) : tangent * (double(y) - h + 0.5); double skewi = floor(skew); double skewf = skew - double(skewi); pix left, oleft; oleft.r = 0.0; oleft.g = 0.0; oleft.b = 0.0; for (unsigned x=0; x<w; x++) { unsigned u = (x - tangent * y) + dw; unsigned v = y; if (u >= nw) continue; if (v >= h) continue; unsigned dpos =u + v*nw; unsigned spos = x + y*w; left.r = src[spos].r * skewf; left.g = src[spos].g * skewf; left.b = src[spos].b * skewf; image[dpos].r = src[spos].r - left.r + oleft.r; image[dpos].g = src[spos].g - left.g + oleft.g; image[dpos].b = src[spos].b - left.b + oleft.b; oleft = left; } } w = nw; delete s; } void gImage::ApplyYShear(double rangle, int threadcount) { double sine = sin(rangle); int dh = sine * (double) w; unsigned nh = h+abs(dh); unsigned dw = w; std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; std::vector<pix>& dst = getImageData(); dst.resize(w*nh); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } if (dh < 0) dh = -dh; else dh = 0; #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { //double skew = sine * (x + 0.5); double skew = (sine >= 0)? sine * (x + 0.5) : sine * (double(x) - w + 0.5); double skewi = floor(skew); double skewf = skew - double(skewi); pix left, oleft; oleft.r = 0.0; oleft.g = 0.0; oleft.b = 0.0; for (unsigned y=0; y<h; y++) { unsigned u = x; unsigned v = (y + sine * x) + dh; if (u >= w) continue; if (v >= nh) continue; unsigned dpos = u + v*dw; unsigned spos = x + y*w; left.r = src[spos].r * skewf; left.g = src[spos].g * skewf; left.b = src[spos].b * skewf; image[dpos].r = src[spos].r - left.r + oleft.r; image[dpos].g = src[spos].g - left.g + oleft.g; image[dpos].b = src[spos].b - left.b + oleft.b; oleft = left; } } h = nh; delete s; } */ //end Paeth's shears /* I used ImageBounds to shrink the resulting image of three shears to its minimum size. Not much use beyond that... void gImage::ImageBounds(unsigned *x1, unsigned *x2, unsigned *y1, unsigned *y2, bool cropbounds) { *x1 = 0; *x2 = w; *y1 = 0; *y2 = h; std::vector<pix>& src = getImageData(); for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { unsigned pos = x + y*w; if (src[pos].r + src[pos].g + src[pos].b > 0.0) { if (cropbounds) *y1 = y; else *x1 = x; goto endx1; } } } endx1: for (int x=w-1; x>0; x--) { for (int y=0; y<h; y++) { unsigned pos = x + y*w; if (src[pos].r + src[pos].g + src[pos].b > 0.0) { if (cropbounds) *y2 = y; else *x2 = x; goto endx2; } } } endx2: for (int y=0; y<h; y++) { for (int x=0; x<w; x++) { unsigned pos = x + y*w; if (src[pos].r + src[pos].g + src[pos].b > 0.0) { if (cropbounds) *x1 = x; else *y1 = y; goto endy1; } } } endy1: for (int y=h-1; y>0; y--) { for (int x=0; x<w; x++) { unsigned pos = x + y*w; if (src[pos].r + src[pos].g + src[pos].b > 0.0) { if (cropbounds) *x2 = x; else *y2 = y; goto endy2; } } } endy2: return; } */ //Crop // //Credit: me // //Cropping an image is trivial. This method uses a left-top and right-bottom bound to //extricate the portion of the image of interest. // void gImage::ApplyCrop(unsigned x1, unsigned y1, unsigned x2, unsigned y2, int threadcount) { if (x1>w | y1>h | x2>w | y2>h) return; if (x1>=x2 | y1>=y2) return; unsigned dw = x2-x1; unsigned dh = y2-y1; std::vector<pix> src = image; image.resize(dw * dh); #pragma omp parallel for num_threads(threadcount) for (unsigned i = 0; i<image.size(); i++) { image[i].r = 0.0; image[i].g = 0.0; image[i].b = 0.0; } #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<dw; x++) { for (unsigned y=0; y<dh; y++) { unsigned dpos = x + y*dw; unsigned spos = x1+x + ((y+y1) * w); image[dpos].r = src[spos].r; image[dpos].g = src[spos].g; image[dpos].b = src[spos].b; } } w=dw; h=dh; } //Curve // //Credit: Tino Kluge, http://kluge.in-chemnitz.de/opensource/spline/, GPLV2 // //The so-called curve is an extremely useful construct for manipulating image attributes. //Really, the concept is that of a lookup-table, where a tone or color is looked up to //determine a new value, based on some previously computed translation to produce the //table. The curve notion provides an intuitive (well, to some) paradigm for building //these lookup tables. When you want to boost the tone of shadows, for instance, you //want to manage the transition from that transform into the highlights, or the image //will show the manipulation quite obviously. A spline-based graph used to produce //the lookup table helps to manage the 'budget' of tones when you go to make a transform. // //The algorithm implemented below uses a C++ spline library published by Tino Kluge. Its //input is a list of 'control points', through which a smooth curve is posited, and its //output is a Y value for a specified X coordinate at any point on the curve. A //challenge is presented in gimage by using floating point RGB values, in that a //lookup table for distinct values is impractical. Accordingly, the actual transformation //is not a table lookup but instead the actual spline coordinate computation. This makes //the curve application computationally-intensive, and correspondingly slower than its //lookup equivalent. // //I added the selection of an individual channel to facilitate playing with such things //as manual white balance correction and grayscale tinting. // //Also presented with ApplyCurve is an ApplyLine method, presented in the notion that //a number of useful 'curves' are really just straight lines, such as those used for //contrast, brightness, and black-white point adjustment, and should require just a simple //slope calculation rather than the spline interpolation. At this writing, the benefit //is not clear. // void gImage::ApplyToneCurve(std::vector<cp> ctpts, int threadcount) { Curve c; c.setControlPoints(ctpts); c.scalepoints(1.0/SCALE_CURVE); #pragma omp parallel for num_threads(threadcount) for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { int pos = x + y*w;; image[pos].r = c.getpoint(image[pos].r); image[pos].g = c.getpoint(image[pos].g); image[pos].b = c.getpoint(image[pos].b); } } } void gImage::ApplyToneCurve(std::vector<cp> ctpts, GIMAGE_CHANNEL channel, int threadcount) { Curve c; c.setControlPoints(ctpts); c.scalepoints(1.0/SCALE_CURVE); if (channel == CHANNEL_RGB) { #pragma omp parallel for num_threads(threadcount) for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { int pos = x + y*w;; image[pos].r = c.getpoint(image[pos].r); image[pos].g = c.getpoint(image[pos].g); image[pos].b = c.getpoint(image[pos].b); } } } else if (channel == CHANNEL_RED) { #pragma omp parallel for num_threads(threadcount) for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { int pos = x + y*w;; image[pos].r = c.getpoint(image[pos].r); } } } else if (channel == CHANNEL_GREEN) { #pragma omp parallel for num_threads(threadcount) for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { int pos = x + y*w;; image[pos].g = c.getpoint(image[pos].g); } } } else if (channel == CHANNEL_BLUE) { #pragma omp parallel for num_threads(threadcount) for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { int pos = x + y*w;; image[pos].b = c.getpoint(image[pos].b); } } } } void gImage::ApplyToneLine(double low, double high, int threadcount) { double slope = 255.0 / (high-low); #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; image[pos].r = image[pos].r * slope; image[pos].g = image[pos].g * slope; image[pos].b = image[pos].b * slope; } } } //White Balance // //Credit: Guillermo Luijk, dcraw Tutorial, //http://www.guillermoluijk.com/tutorial/dcraw/index_en.htm // //Guillermo demonstrates using single channel curves to manually apply white balance //multipliers, and this is automatically implemented below using a tone line //akin to ApplyToneLine() above. The multipliers should be percentages of the //largest channel value of a selected neutral pixel, e,g, for a RGB triplet of //165,172,204, the RGB multipliers should be 0.8088,0.8431,1.00 // void gImage::ApplyWhiteBalance(double redmult, double greenmult, double bluemult, int threadcount) { double rslope = 255.0 / (255.0*redmult); double gslope = 255.0 / (255.0*greenmult); double bslope = 255.0 / (255.0*bluemult); #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; image[pos].r = image[pos].r * rslope; image[pos].g = image[pos].g * gslope; image[pos].b = image[pos].b * bslope; } } } //Saturation // //Credit: Darel Rex Finley, http://alienryderflex.com/saturation.html, public domain // //This is a simple HSL saturation routine. There are better ways to //manipulate color, but this one is self-contained to a RGB color space. //Maybe later... // #define Pr .299 #define Pg .587 #define Pb .114 void gImage::ApplySaturate(double saturate, int threadcount) { #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; double R = image[pos].r; double G = image[pos].g; double B = image[pos].b; double P=sqrt( R*R*Pr+ G*G*Pg+ B*B*Pb ) ; image[pos].r=P+(R-P)*saturate; image[pos].g=P+(G-P)*saturate; image[pos].b=P+(B-P)*saturate; } } } //Exposure Compensation // //Multiplies each R, G, and B value of each pixel by 2**ev // void gImage::ApplyExposureCompensation(double ev, int threadcount) { double mult = pow(2.0,ev); #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; image[pos].r *= mult; image[pos].g *= mult; image[pos].b *= mult; } } } //Tint // //Credit: // //Tint allows the addition or subtraction of a single value from a single //channel. My use case is to introduce tint to grayscale images. //A better approach would be to modify ApplyCurve to do individual channels. A //subject of a subsequent version... // void gImage::ApplyTint(double red,double green,double blue, int threadcount) { #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; image[pos].r += red; image[pos].g += green; image[pos].b += blue; } } } //Grayscaling // //Credit: Various // //Grayscaling an image is essentially computing a single tone value from the red, green, and blue //components of each pixel. This is typically done by giving each component a percentage weight //in a sum; the typical percentages used are red=0.21, green=0.72, and blue=0.07; see //https://en.wikipedia.org/wiki/Grayscale for a discussion. // //The algorithm implemented allows for individual specification of the percentages. It does not //produce a single-valued image matrix; it loads the same gray tone in all three channels. My //thought would be to make an option to convert to, say, an 8-bit grayscale image when saving. //Retaining the three-channel image allows subsequent manipulation of the channels to introduce //tint. void gImage::ApplyGray(double redpct, double greenpct, double bluepct, int threadcount) { #pragma omp parallel for num_threads(threadcount) for (unsigned x=0; x<w; x++) { for (unsigned y=0; y<h; y++) { unsigned pos = x + y*w; //double G = floor(image[pos].r*redpct + image[pos].g*greenpct + image[pos].b*bluepct)+0.5; double G = image[pos].r*redpct + image[pos].g*greenpct + image[pos].b*bluepct; image[pos].r=G; image[pos].g=G; image[pos].b=G; } } } //NLMeans Denoise // //Credit: Antoni Buades, et.al., and David Tschumperlé, principal programmer of GMIC, non-commercial use // //Denoising an image removes the "speckle" produced usually by low exposure values, where //the light signal is not too far from the noise signal inherent in the sensor. The //essential operation is to 'average' surrounding pixels as the result value for the //source pixel. In that regard, a 'blur' operation reduces noise, but at the expense of //image detail because the average doesn't recognize edges. // //The Non-Local Means algorithm, first described by Antoni Buades, Bartomeu Coll and //Jean-Michel Morel in the IPOL Journal attempts to address this expense by recognizing similar //toned pixels in the group, and giving them more weight in the average. The implementation //below is a simplistic but straightforward interpretation of the algorithm presented as a //GMIC script by David Tschumperlé in his blog at http://gmic.eu // void gImage::ApplyNLMeans(double sigma, int local, int patch, int threadcount) { std::vector<pix> *s = new std::vector<pix>(image); std::vector<pix> &src = *s; std::vector<pix>& dst = getImageData(); unsigned spitch = w; unsigned dpitch = w; unsigned iw = w; unsigned ih = h; double sigma2 = pow(2*(sigma/SCALE_CURVE),2); //UI sigmas are relevant to 0-255 //y|x upper|lower bound computations, used to offset patch to avoid out-of-image references unsigned yplb = patch+local+1; unsigned ypub = ih-yplb; unsigned xplb = yplb; unsigned xpub = iw-xplb; #pragma omp parallel for num_threads(threadcount) for(unsigned y = local; y < ih-local; y++) { unsigned py = y; if (py<yplb) py = yplb; if (py>ypub) py = ypub; for(unsigned x = local; x < iw-local; x++) { unsigned px = x; if (px<xplb) px = xplb; if (px>xpub) px = xpub; unsigned wdstpix = dpitch*y + x; double valueR = 0.0; double valueG = 0.0; double valueB = 0.0; double sum_weightsR = 0.0; double sum_weightsG = 0.0; double sum_weightsB = 0.0; for (int q = -local; q<=local; ++q) { for (int p = -local; p<=local; ++p) { double diffR = 0.0; double diffG = 0.0; double diffB = 0.0; for (int s = -patch; s<=patch; ++s) { for (int r = -patch; r<=patch; ++r) { unsigned ppix = spitch*(py+q+s) + (px+p+r); unsigned lpix = spitch*(py+s) + (px+r); diffR += pow((src[ppix].r - src[lpix].r),2); diffG += pow((src[ppix].g - src[lpix].g),2); diffB += pow((src[ppix].b - src[lpix].b),2); //gmic: diff += pow(i[x+p+r,y+q+s] - i[x+r,y+s],2); } } double weightR = exp(-diffR/sigma2); double weightG = exp(-diffG/sigma2); double weightB = exp(-diffB/sigma2); unsigned localpix = spitch*(y+q) + (x+p); valueR += weightR*src[localpix].r; valueG += weightG*src[localpix].g; valueB += weightB*src[localpix].b; //gmic: value += weight*i(x+p,y+q); sum_weightsR += weightR; sum_weightsG += weightG; sum_weightsB += weightB; } } dst[wdstpix].r = (valueR/(1e-5 + sum_weightsR)); dst[wdstpix].g = (valueG/(1e-5 + sum_weightsG)); dst[wdstpix].b = (valueB/(1e-5 + sum_weightsB)); } } delete s; } //Resizing // //Credit: Graphics Gems III: Schumacher, Dale A., General Filtered Image Rescaling, p. 8-16 //https://github.com/erich666/GraphicsGems/blob/master/gemsiii/filter.c, public domain // //Resizing an image is either an interpolation (reduction) or extrapolation (expansion) of an image's //dimensions. In the former case, it is the summarization of a group of pixels into one; in the //latter, it is essentially the creation of information not captured in the original image. This //endeavor has to be well-formed in order to render a pleasing result. // //The essential operation of resize has two parts: 1) reduction/expansion in one dimension, then //2) reduction/expansion of the intermediate image in the other dimension. So, the inter/extrapolation //of a pixel is peformed with its row or column neighbors. The amalgamation of neighbor pixels is //performed with a filter algorithm, essentially a lookup of an equation based on distance from the //source pixel. Numerous filters have been presented in the literature; a representative sample is //included in this library. // //The resize algorithm presented by Schumacher in Graphics Gems optimizes the application of a filter in //four steps: 1) for the destination image size in one dimension, calculate the filter contributions //for each pixel in one row/colum of that dimension; 2) apply those contributions to the source image to //produce an intermediate image changed in size for that dimension; 3) calculate the filter contributions //for each pixel in one row/colum of the other dimension; 4) apply those contributions to the //intermediate image to produce the destination image. // //The relevant code below are the functions for each of the filters, followed by the Resize method //programmed in the pattern describe above. You'll recognize a lot of Schumacher's code; the //contribution collection loops and data structures are pasted verbatim, as well as the filter //functions. // double sinc(double x) { x *= PI; if(x != 0) return(sin(x) / x); return(1.0); } #define Lanczos3_support (3.0) double Lanczos3_filter(double t) { if(t < 0) t = -t; if(t < 3.0) return(sinc(t) * sinc(t/3.0)); return(0.0); } #define CatmullRom_support (2.0) double CatmullRom_filter(double t) { if(t < -2) return 0; if(t < -1) return (0.5*(4 + t*(8 + t*(5 + t)))); if(t < 0) return (0.5*(2 + t*t*(-5 - 3*t))); if(t < 1) return (0.5*(2 + t*t*(-5 + 3*t))); if(t < 2) return (0.5*(4 + t*(-8 + t*(5 - t)))); return 0; } #define Bspline_support (2.0) double Bspline_filter(double t) { double tt; if(t < 0) t = -t; if(t < 1) { tt = t * t; return((.5 * tt * t) - tt + (2.0 / 3.0)); } else if(t < 2) { t = 2 - t; return((1.0 / 6.0) * (t * t * t)); } return(0.0); } #define Bicubic_support (2.0) #define B (1.0 / 3.0) #define C (1.0 / 3.0) double Bicubic_filter(double t) { double tt; tt = t * t; if(t < 0) t = -t; if(t < 1.0) { t = (((12.0 - 9.0 * B - 6.0 * C) * (t * tt)) + ((-18.0 + 12.0 * B + 6.0 * C) * tt) + (6.0 - 2 * B)); return(t / 6.0); } else if(t < 2.0) { t = (((-1.0 * B - 6.0 * C) * (t * tt)) + ((6.0 * B + 30.0 * C) * tt) + ((-12.0 * B - 48.0 * C) * t) + (8.0 * B + 24 * C)); return(t / 6.0); } return(0.0); } #define bilinear_support (1.0) double bilinear_filter(double t) { if(t < 0.0) t = -t; if(t < 1.0) return(1.0 - t); return(0.0); } #define box_support (0.5) double box_filter(double t) { if((t > -0.5) & (t <= 0.5)) return(1.0); return(0.0); } void gImage::ApplyResize(unsigned width, unsigned height, RESIZE_FILTER filter, int threadcount) { typedef struct { int pixel; double weight; } CONTRIB; typedef struct { int n; // number of contributors CONTRIB *p; // pointer to list of contributions } CLIST; CLIST *contrib; // array of contribution lists double xscale, yscale; // zoom scale factors int i, j, k; // loop variables int n; // pixel number double center, left, right; // filter calculation variables double wi, fscale, weight; // filter calculation variables double fwidth; double (*filterf)(double); switch (filter) { case FILTER_BOX: fwidth = box_support; filterf = box_filter; break; case FILTER_BILINEAR: fwidth = bilinear_support; filterf = bilinear_filter; break; case FILTER_BSPLINE: fwidth = Bspline_support; filterf = Bspline_filter; break; case FILTER_BICUBIC: fwidth = Bicubic_support; filterf = Bicubic_filter; break; case FILTER_CATMULLROM: fwidth = CatmullRom_support; filterf = CatmullRom_filter; break; case FILTER_LANCZOS3: fwidth = Lanczos3_support; filterf = Lanczos3_filter; break; } xscale = (double) width / (double) w; yscale = (double) height / (double) h; std::vector<pix>& src = getImageData(); std::vector<pix> *t = new std::vector<pix>(image); std::vector<pix> &tmp = *t; tmp.resize(width*h); std::vector<pix>&dst = getImageData(); // Compute row contributions: contrib = new CLIST[width]; if(xscale < 1.0) { wi = fwidth / xscale; fscale = 1.0 / xscale; for(i = 0; i < width; ++i) { contrib[i].n = 0; contrib[i].p = new CONTRIB[(int) (wi * 2 + 1)]; center = (double) i / xscale; left = ceil(center - wi); right = floor(center + wi); for(j = (int)left; j <= (int)right; ++j) { weight = center - (double) j; weight = (*filterf)(weight / fscale) / fscale; if(j < 0) { n = -j; } else if(j >= w) { n = (w - j) + w - 1; } else { n = j; } k = contrib[i].n++; contrib[i].p[k].pixel = n; contrib[i].p[k].weight = weight; } } } else { for(i = 0; i < width; ++i) { contrib[i].n = 0; contrib[i].p = new CONTRIB[(int) (fwidth * 2 + 1)]; center = (double) i / xscale; left = ceil(center - fwidth); right = floor(center + fwidth); for(j = (int)left; j <= (int)right; ++j) { weight = center - (double) j; weight = (*filterf)(weight); if(j < 0) { n = -j; } else if(j >= w) { n = (w - j) + w - 1; } else { n = j; } k = contrib[i].n++; contrib[i].p[k].pixel = n; contrib[i].p[k].weight = weight; } } } //dumpContrib(contrib,width); // Apply row contributions: #pragma omp parallel for num_threads(threadcount) for(unsigned y = 0; y < h; ++y) { unsigned raster = w*y; for(unsigned x = 0; x < width; ++x) { unsigned pos = x + width*y; double weightr = 0.0; double weightg = 0.0; double weightb = 0.0; for(unsigned j = 0; j < contrib[x].n; ++j) { unsigned rpos = raster+contrib[x].p[j].pixel; weightr += image[rpos].r * contrib[x].p[j].weight; weightg += image[rpos].g * contrib[x].p[j].weight; weightb += image[rpos].b * contrib[x].p[j].weight; } tmp[pos].r = weightr; tmp[pos].g = weightg; tmp[pos].b = weightb; } } //delete the memory allocated for horizontal filter weights: for(i = 0; i < width; ++i) { delete contrib[i].p; } delete[] contrib; // Compute column contributions: contrib = new CLIST[height]; if(yscale < 1.0) { wi = fwidth / yscale; fscale = 1.0 / yscale; for(i = 0; i < height; ++i) { contrib[i].n = 0; contrib[i].p = new CONTRIB[(int) (wi * 2 + 1)]; center = (double) i / yscale; left = ceil(center - wi); right = floor(center + wi); for(j = (int)left; j <= (int)right; ++j) { weight = center - (double) j; weight = (*filterf)(weight / fscale) / fscale; if(j < 0) { n = -j; } else if(j >= h) { n = (h - j) + h - 1; } else { n = j; } k = contrib[i].n++; contrib[i].p[k].pixel = n; contrib[i].p[k].weight = weight; } } } else { for(i = 0; i < height; ++i) { contrib[i].n = 0; contrib[i].p = new CONTRIB[(int) (fwidth * 2 + 1)]; center = (double) i / yscale; left = ceil(center - fwidth); right = floor(center + fwidth); for(j = (int)left; j <= (int)right; ++j) { weight = center - (double) j; weight = (*filterf)(weight); if(j < 0) { n = -j; } else if(j >= h) { n = (h - j) + h - 1; } else { n = j; } k = contrib[i].n++; contrib[i].p[k].pixel = n; contrib[i].p[k].weight = weight; } } } dst.resize(width*height); w = width; h = height; // Apply column contributions: #pragma omp parallel for num_threads(threadcount) for(unsigned x = 0; x < width; ++x) { for(unsigned y = 0; y < height; ++y) { unsigned pos = x + y*width; double weightr = 0.0; double weightg = 0.0; double weightb = 0.0; for(unsigned j = 0; j < contrib[y].n; ++j) { unsigned cpos = x+(width*contrib[y].p[j].pixel); weightr += tmp[cpos].r * contrib[y].p[j].weight; weightg += tmp[cpos].g * contrib[y].p[j].weight; weightb += tmp[cpos].b * contrib[y].p[j].weight; } dst[pos].r = weightr; dst[pos].g = weightg; dst[pos].b = weightb; } } //delete the memory allocated for vertical filter weights: for(i = 0; i < height; ++i) { delete contrib[i].p; } delete[] contrib; delete t; } //Redeye // //I started with an algorithm that walked concentric rings out from the specified center //point of the red eye, but the rectangular corners were evident in a pixel-peep. My second //try, below is a simple walk of the rectangular patch, doing a distance check of each //pixel to the center and moving on if it was farther than the limit. I put the omp //pragma on the outside loop; each eye gets its own thread. The whole thing isn't very onerous, //but my max test has been four eyes (two people...) //The essential algorithm is to calculate the red intensity proportionate to the averaged //green and blue intensities; if greater than the threshold, the red value is replaced //with the average of the green and blue. This means that things like light reflections //(white highlights) and other "non-red" pixels are not touched, leaving a well-formed eye. //If the center point is centered well and the limit is just larger than the red spot, it //can be hard to tell the pixels were touched. // //I also added a desaturate option, converts each pixel to it's grayscale equivalent. This //seemed necessary to handle non-symmetric color spaces like ProPhoto, in which the original //treatment rendered a green cast. // inline unsigned sqr(const unsigned x) { return x*x; } void gImage::ApplyRedeye(std::vector<coord> points, double threshold, unsigned limit, bool desaturate, double desaturatepercent, int threadcount) { #pragma omp parallel for num_threads(threadcount) for (int i=0; i< points.size(); i++) { if (points[i].x > w) continue; if (points[i].y > h) continue; unsigned cx = points[i].x - limit; unsigned cy = points[i].y - limit; for (unsigned y=cy; y<cy+limit*2; y++) { for (unsigned x=cx; x<cx+limit*2; x++) { unsigned pos = x + y*w; if (pos > w*h) continue; unsigned d = sqrt(sqr(x - points[i].x) + sqr(y - points[i].y)); if (d > limit) continue; double ri = image[pos].r / ((image[pos].g + image[pos].b) /2.0); if (ri > threshold) { image[pos].r = (image[pos].g + image[pos].b) / 2.0; if (desaturate) { double d = ((image[pos].r +image[pos].g +image[pos].b)/3) * desaturatepercent; image[pos].r = d; image[pos].g = d; image[pos].b = d; } } } } } } GIMAGE_ERROR gImage::ApplyColorspace(std::string iccfile, cmsUInt32Number intent, bool blackpointcomp, int threadcount) { cmsUInt32Number format; cmsHTRANSFORM hTransform; cmsUInt32Number dwFlags = 0; if (profile == NULL) {lasterror = GIMAGE_APPLYCOLORSPACE_BADPROFILE; return lasterror;} if (blackpointcomp) dwFlags = cmsFLAGS_BLACKPOINTCOMPENSATION; if (sizeof(PIXTYPE) == 2) format = TYPE_RGB_HALF_FLT; if (sizeof(PIXTYPE) == 4) format = TYPE_RGB_FLT; if (sizeof(PIXTYPE) == 8) format = TYPE_RGB_DBL; cmsHPROFILE gImgProf = cmsOpenProfileFromMem(profile, profile_length); cmsHPROFILE hImgProf = cmsOpenProfileFromFile(iccfile.c_str(), "r"); if (!cmsIsIntentSupported(gImgProf, intent, LCMS_USED_AS_INPUT)) {lasterror = GIMAGE_APPLYCOLORSPACE_BADINTENT; return lasterror;} if (!cmsIsIntentSupported(hImgProf, intent, LCMS_USED_AS_OUTPUT)) {lasterror = GIMAGE_APPLYCOLORSPACE_BADINTENT; return lasterror;} if (gImgProf) { if (hImgProf) { hTransform = cmsCreateTransform(gImgProf, format, hImgProf, format, intent, dwFlags); if (hTransform == NULL) {lasterror = GIMAGE_APPLYCOLORSPACE_BADTRANSFORM; return lasterror;} pix* img = image.data(); #pragma omp parallel for num_threads(threadcount) for (unsigned y=0; y<h; y++) { unsigned pos = y*w; cmsDoTransform(hTransform, &img[pos], &img[pos], w); } char * prof; cmsUInt32Number proflen; gImage::makeICCProfile(hImgProf, prof, proflen); setProfile(prof, proflen); } } {lasterror = GIMAGE_OK; return lasterror;} } bool gImage::AssignColorspace(std::string iccfile) { cmsHPROFILE hImgProf = cmsOpenProfileFromFile(iccfile.c_str(), "r"); if (hImgProf) { char * prof; cmsUInt32Number proflen; gImage::makeICCProfile(hImgProf, prof, proflen); setProfile(prof, proflen); lasterror = GIMAGE_OK; return lasterror; } else { lasterror = GIMAGE_ASSIGNCOLORSPACE_BADTRANSFORM; return lasterror; } } // End of Image Manipulations //Image Information: std::string gImage::Stats() { double rmin, rmax, gmin, gmax, bmin, bmax, tmin, tmax; rmin = image[0].r; rmax = image[0].r; gmin=image[0].g; gmax = image[0].g; bmin = image[0].b; bmax = image[0].b; tmin = SCALE_CURVE; tmax = 0.0; int iter = 0; for(unsigned y = 1; y < h; y++) { for(unsigned x = 1; x < w; x++) { unsigned pos = x + y*w; if (image[pos].r > rmax) rmax = image[pos].r; if (image[pos].g > gmax) gmax = image[pos].g; if (image[pos].b > bmax) bmax = image[pos].b; if (image[pos].r < rmin) rmin = image[pos].r; if (image[pos].g < gmin) gmin = image[pos].g; if (image[pos].b < bmin) bmin = image[pos].b; double tone = (image[pos].r + image[pos].g + image[pos].b) / 3.0; if (tone > tmax) tmax = tone; if (tone < tmin) tmin = tone; iter++; } } return string_format("rmin: %f\trmax: %f\ngmin: %f\tgmax: %f\nbmin: %f\tbmax: %f\n\ntonemin: %f\ttonemax: %f\n", rmin, rmax, gmin, gmax, bmin, bmax, tmin, tmax); } //simple grayscale histogram: std::vector<long> gImage::Histogram() { std::vector<long> histogram(256, 0); for(unsigned y = 0; y < h; y++) { for(unsigned x = 0; x < w; x++) { unsigned pos = x + y*w; double t = ((image[pos].r + image[pos].g + image[pos].b) / 3.0) * SCALE_CURVE; if (t < 0.0) t = 0.0; if (t > 255.0) t = 255.0; histogram[floor(t+0.5)]++; } } return histogram; } //rgb histogram, scale=number of buckets, 256 or 65536... std::vector<histogramdata> gImage::Histogram(unsigned scale) { histogramdata zerodat = {0,0,0}; std::vector<histogramdata> histogram(scale, zerodat); #pragma omp parallel { std::vector<unsigned> pr(scale,0); std::vector<unsigned> pg(scale,0); std::vector<unsigned> pb(scale,0); #pragma omp for for(unsigned y = 0; y < h; y++) { for(unsigned x = 0; x < w; x++) { unsigned pos = x + y*w; pr[(unsigned) lrint(fmin(fmax(image[pos].r*scale,0.0),scale-1))]++; pg[(unsigned) lrint(fmin(fmax(image[pos].g*scale,0.0),scale-1))]++; pb[(unsigned) lrint(fmin(fmax(image[pos].b*scale,0.0),scale-1))]++; } } #pragma omp critical { for (unsigned i=0; i<scale; i++) { histogram[i].r += pr[i]; histogram[i].g += pg[i]; histogram[i].b += pb[i]; } } } return histogram; } //single-channel histogram, OBE... std::vector<long> gImage::Histogram(unsigned channel, unsigned &hmax) { unsigned scale; if (b == BPP_16) scale = 65536; else scale = 256; hmax = 0; std::vector<long> hdata(scale,0); //#pragma omp parallel for for(unsigned y = 0; y < h; y++) { for(unsigned x = 0; x < w; x++) { unsigned pos = x + y*w; unsigned d; if (channel == CHANNEL_RED) d = (unsigned) fmin(fmax(image[pos].r*scale,0.0),scale-1); if (channel == CHANNEL_GREEN) d = (unsigned) fmin(fmax(image[pos].g*scale,0.0),scale-1); if (channel == CHANNEL_BLUE) d = (unsigned) fmin(fmax(image[pos].b*scale,0.0),scale-1); hdata[d]++; if (hmax < hdata[d]) hmax = hdata[d]; } } return hdata; } //Loaders: gImage gImage::loadImageFile(const char * filename, std::string params) { GIMAGE_FILETYPE ext = gImage::getFileType(filename); if (ext == FILETYPE_TIFF) return gImage::loadTIFF(filename, params); else if (ext == FILETYPE_JPEG) return gImage::loadJPEG(filename, params); else return gImage::loadRAW(filename, params); } std::map<std::string,std::string> gImage::loadImageFileInfo(const char * filename) { unsigned width, height, bpp, colors, icclength; BPP bits; char * iccprofile; std::map<std::string,std::string> imgdata; std::string params = ""; GIMAGE_FILETYPE ext = gImage::getFileType(filename); if (ext == FILETYPE_TIFF) { _loadTIFFInfo(filename, &width, &height, &colors, &bpp, imgdata); } else if (ext == FILETYPE_JPEG) { _loadJPEGInfo(filename, &width, &height, &colors, imgdata); } else { _loadRAWInfo(filename, &width, &height, &colors, &bpp, imgdata); } return imgdata; } gImage gImage::loadRAW(const char * filename, std::string params) { unsigned width, height, bpp, colors, icclength; BPP bits; char * iccprofile; std::map<std::string,std::string> imgdata; char * image = _loadRAW(filename, &width, &height, &colors, &bpp, imgdata, params, &iccprofile, &icclength); if (image == NULL) return gImage(); switch (bpp) { case 8: bits = BPP_8; break; case 16: bits = BPP_16; break; } gImage I(image, width, height, colors, bits, imgdata, iccprofile, icclength); delete [] image; if (icclength && iccprofile) delete [] iccprofile; return I; } gImage gImage::loadJPEG(const char * filename, std::string params) { unsigned width, height, colors, bpp, icclength; char * iccprofile; std::map<std::string,std::string> imgdata; char * image = _loadJPEG(filename, &width, &height, &colors, imgdata, "", &iccprofile, &icclength); gImage I(image, width, height, colors, BPP_8, imgdata, iccprofile, icclength); delete [] image; if (icclength && iccprofile != NULL) delete [] iccprofile; return I; } gImage gImage::loadTIFF(const char * filename, std::string params) { unsigned width, height, colors, bpp, icclength; BPP bits; char * iccprofile; std::map<std::string,std::string> imgdata; char * image = _loadTIFF(filename, &width, &height, &colors, &bpp, imgdata, params, &iccprofile, &icclength); switch (bpp) { case 8: bits = BPP_8; break; case 16: bits = BPP_16; break; case 32: bits = BPP_FP; break; default: return gImage(); } gImage I(image, width, height, colors, bits, imgdata, iccprofile, icclength); delete [] image; if (icclength && iccprofile != NULL) delete [] iccprofile; return I; } //Savers: GIMAGE_ERROR gImage::saveImageFile(const char * filename, std::string params, cmsHPROFILE profile, cmsUInt32Number intent) { BPP bitfmt = BPP_8; std::map<std::string, std::string> p = parseparams(params); if (p.find("channelformat") != p.end()) { if (p["channelformat"] == "8bit") bitfmt = BPP_8; if (p["channelformat"] == "16bit") bitfmt = BPP_16; if (p["channelformat"] == "float") bitfmt = BPP_FP; } GIMAGE_FILETYPE ftype = gImage::getFileNameType(filename); if (ftype == FILETYPE_TIFF) { if (profile) return saveTIFF(filename, bitfmt, profile, intent); else return saveTIFF(filename, bitfmt); } if (ftype == FILETYPE_JPEG) { if (profile) return saveJPEG(filename, bitfmt, params, profile, intent); else return saveJPEG(filename, bitfmt, params); } lasterror = GIMAGE_UNSUPPORTED_FILEFORMAT; return lasterror; } GIMAGE_ERROR gImage::saveJPEG(const char * filename, BPP bits, std::string params, cmsHPROFILE profile, cmsUInt32Number intent) { unsigned b = 8; if (bits == BPP_8) b = 8; else {lasterror = GIMAGE_UNSUPPORTED_PIXELFORMAT; return lasterror;} if (profile) { char * iccprofile; cmsUInt32Number iccprofilesize; makeICCProfile(profile, iccprofile, iccprofilesize); try { //Pick one, getTransformedImageData() seems to produce less noise, but is slower: _writeJPEG(filename, getTransformedImageData(BPP_8, profile, intent), w, h, c, b, imginfo, params, iccprofile, iccprofilesize); //_writeJPEG(filename, getImageData(BPP_8, profile), w, h, c, imginfo, params); } catch (std::exception &e) { lasterror = GIMAGE_EXCEPTION; delete iccprofile; return lasterror; } delete iccprofile; } else { if (this->profile) _writeJPEG(filename, getImageData(BPP_8), w, h, c, b, imginfo, params, this->profile, profile_length); else _writeJPEG(filename, getImageData(BPP_8), w, h, c, b, imginfo, params); } lasterror = GIMAGE_OK; return lasterror; } GIMAGE_ERROR gImage::saveTIFF(const char * filename, BPP bits, cmsHPROFILE profile, cmsUInt32Number intent) { unsigned b = 0; if (bits == BPP_16) b = 16; else if (bits == BPP_8) b = 8; else if (bits == BPP_FP) b = 32; else {lasterror = GIMAGE_UNSUPPORTED_PIXELFORMAT; return lasterror;} if (profile) { char * iccprofile; cmsUInt32Number iccprofilesize; makeICCProfile(profile, iccprofile, iccprofilesize); try { //Pick one, getTransformedImageData() seems to produce less noise, but is slower: _writeTIFF(filename, getTransformedImageData(bits, profile, intent), w, h, c, b, imginfo, iccprofile, iccprofilesize); //_writeTIFF(filename, getImageData(bits, profile), w, h, c, b, imginfo, iccprofile, iccprofilesize); } catch (std::exception &e) { lasterror = GIMAGE_EXCEPTION; delete iccprofile; return lasterror; } delete iccprofile; } else { if (this->profile) _writeTIFF(filename, getImageData(bits), w, h, c, b, imginfo, this->profile, profile_length); else _writeTIFF(filename, getImageData(bits), w, h, c, b, imginfo); } lasterror = GIMAGE_OK; return lasterror; } //ICC Profiles: // //Primaries and black/white points from Elle Stone's make-elles-profiles.c, //https://github.com/ellelstone/elles_icc_profiles, GPL V2 // cmsCIExyY d50_romm_spec= {0.3457, 0.3585, 1.0}; cmsCIEXYZ d50_romm_spec_media_whitepoint = {0.964295676, 1.0, 0.825104603}; cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0}; cmsCIEXYZ d65_media_whitepoint = {0.95045471, 1.0, 1.08905029}; cmsCIExyYTRIPLE aces_primaries_prequantized = { {0.734704192222, 0.265298276252, 1.0}, {-0.000004945077, 0.999992850272, 1.0}, {0.000099889199, -0.077007518685, 1.0} }; cmsCIExyYTRIPLE romm_primaries = { {0.7347, 0.2653, 1.0}, {0.1596, 0.8404, 1.0}, {0.0366, 0.0001, 1.0} }; cmsCIExyYTRIPLE widegamut_pascale_primaries = { {0.7347, 0.2653, 1.0}, {0.1152, 0.8264, 1.0}, {0.1566, 0.0177, 1.0} }; cmsCIExyYTRIPLE adobe_primaries_prequantized = { {0.639996511, 0.329996864, 1.0}, {0.210005295, 0.710004866, 1.0}, {0.149997606, 0.060003644, 1.0} }; cmsCIExyYTRIPLE srgb_primaries_pre_quantized = { {0.639998686, 0.330010138, 1.0}, {0.300003784, 0.600003357, 1.0}, {0.150002046, 0.059997204, 1.0} }; cmsCIExyYTRIPLE identity_primaries = { {1.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, {0.0, 0.0, 1.0} }; cmsHPROFILE gImage::makeLCMSProfile(const std::string name, float gamma) { cmsHPROFILE profile; cmsCIExyYTRIPLE c; if (name == "srgb") c = srgb_primaries_pre_quantized; else if (name == "wide") c = widegamut_pascale_primaries; else if (name == "adobe") c = adobe_primaries_prequantized; else if (name == "prophoto") c = romm_primaries; else if (name == "identity") c = identity_primaries; else return NULL; cmsToneCurve *curve[3], *tonecurve; tonecurve = cmsBuildGamma (NULL, gamma); curve[0] = curve[1] = curve[2] = tonecurve; profile = cmsCreateRGBProfile ( &d65_srgb_adobe_specs, &c, curve); std::string descr = "rawproc D65-"+name+", Primaries and black/white points from Elle Stone's make-elles-profiles.c, https://github.com/ellelstone/elles_icc_profiles"; cmsMLU *description; description = cmsMLUalloc(NULL, 1); cmsMLUsetASCII(description, "en", "US", descr.c_str()); cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); cmsMLUfree(description); std::string copyrt = "GPL V2"; cmsMLU *copyright; copyright = cmsMLUalloc(NULL, 1); cmsMLUsetASCII(copyright, "en", "US", copyrt.c_str()); cmsWriteTag(profile, cmsSigCopyrightTag, copyright); cmsMLUfree(copyright); return profile; } struct icc_entry { cmsCIExyY white; cmsCIExyY black; cmsCIExyYTRIPLE primaries; }; icc_entry dcraw_icc_table[5] = { //adobe:*/ { {0.950455,1.000000,1.089050}, {0.000000,0.000000,0.000000}, { {0.609787,0.311142,0.019485}, {0.205246,0.625656,0.060898}, {0.149200,0.063217,0.744675} } }, //prophoto: { {0.950455,1.000000,1.089050}, {0.000000,0.000000,0.000000}, { {0.797745,0.288071,0.000000}, {0.135178,0.711868,0.000031}, {0.031311,0.000061,0.825027} } }, //srgb: { {0.950455,1.000000,1.089050}, {0.000000,0.000000,0.000000}, { {0.436081,0.222504,0.013931}, {0.385086,0.716888,0.097092}, {0.143051,0.060608,0.714020} } }, //wide: { {0.950455,1.000000,1.089050}, {0.000000,0.000000,0.000000}, { {0.716156,0.258209,0.000000}, {0.100906,0.724930,0.051788}, {0.147156,0.016861,0.773254} } }, //xyz: { {0.950455,1.000000,1.089050}, {0.000000,0.000000,0.000000}, { {1.047836,0.029556,-0.009216}, {0.022903,0.990479,0.015045}, {-0.050125,-0.017044,0.752029} } } }; cmsHPROFILE gImage::makeLCMSdcrawProfile(const std::string name, float gamma) { cmsHPROFILE profile; cmsCIExyYTRIPLE c; int profileid; if (name == "adobe") profileid = 0; else if (name == "prophoto") profileid = 1; else if (name == "srgb") profileid = 2; else if (name == "wide") profileid = 3; else if (name == "xyz") profileid = 4; else return NULL; c = dcraw_icc_table[profileid].primaries; cmsToneCurve *curve[3], *tonecurve; tonecurve = cmsBuildGamma (NULL, gamma); curve[0] = curve[1] = curve[2] = tonecurve; profile = cmsCreateRGBProfile ( &d65_srgb_adobe_specs, &c, curve); std::string descr = "dcraw D65-"+name+", gamma "+tostr((double) gamma)+", extracted for use in rawproc"; cmsMLU *description; description = cmsMLUalloc(NULL, 1); cmsMLUsetASCII(description, "en", "US", descr.c_str()); cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); cmsMLUfree(description); std::string copyrt = "GPL V2"; cmsMLU *copyright; copyright = cmsMLUalloc(NULL, 1); cmsMLUsetASCII(copyright, "en", "US", copyrt.c_str()); cmsWriteTag(profile, cmsSigCopyrightTag, copyright); cmsMLUfree(copyright); return profile; } void gImage::makeICCProfile(cmsHPROFILE hProfile, char *& profile, cmsUInt32Number &profilesize) { cmsSaveProfileToMem(hProfile, NULL, &profilesize); profile = new char[profilesize]; cmsSaveProfileToMem(hProfile, profile, &profilesize); }
2eecf1f40937713069b481be7c4fb89e3e18cf0a
901512f73a7ffc83849c787ab44376520a713ac1
/narb-sw/rce/pcen_test.hh
ae82f5903a3c5410380e78e8de200ccda499bf46
[ "BSD-3-Clause" ]
permissive
penguin2005/NARB
3e33316d3f378c2f9f1a660c917bdd42cac88d34
a2fd5e01904581f91f4558f0f41ad52bbcd1ce82
refs/heads/master
2020-06-23T02:19:24.434895
2010-02-04T22:07:55
2010-02-04T22:07:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,838
hh
pcen_test.hh
/* * Copyright (c) 2008 * DRAGON Project. * University of Southern California/Information Sciences Institute. * All rights reserved. * * Created by Xi Yang 2004-2008 * * 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 the project 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 PROJECT 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 PROJECT 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 __RCE_TEST_HH__ #define __RCE_TEST_HH__ #include <iostream> #include <vector> #include <list> #include "rce_pcen.hh" #include "pcen_ksp.hh" using namespace std; class PathT; class PCENNode; class PCEN_TEST: public PCEN_KSP { protected: list<PCENLink*> links_backup; public: PCEN_TEST(in_addr src, in_addr dest, u_int8_t sw_type_ingress, u_int8_t encoding_ingress, float bw_ingress, u_int8_t sw_type_egress, u_int8_t encoding_egress, float bw_egress, u_int32_t opts, u_int32_t ucid, u_int32_t msg_seqnum, u_int32_t lspb_id = 0, u_int32_t tag = 0, u_int32_t hopback = 0, u_int32_t src_lclid = 0, u_int32_t dest_lclid = 0, narb_lsp_vtagmask_tlv* vtm = NULL): PCEN_KSP(src, dest, sw_type_ingress, encoding_ingress, bw_ingress, sw_type_egress, encoding_egress, bw_egress,opts, ucid, msg_seqnum, lspb_id, tag, hopback, src_lclid, dest_lclid, vtm) {} virtual ~PCEN_TEST() {} virtual bool PostBuildTopology(); virtual void Run(); PathT* SearchUpperLayerPath(PCENNode* src_node, PCENNode* dest_node); PathT* SearchLowerLayerPath(PCENNode* src_node, PCENNode* dest_node); }; #endif
ba88a1292c3d5fa932b48f86d62a469ef07c8603
10153439249767c3b4e9d2e0a7f19d0d28cbfeb0
/Codechef/Easy/SUBINC.cpp
251e316abc86f4835c0f6e77654257a0853a3685
[]
no_license
Aarth-Tandel/DataStructures
d1adc6db4e7e960b7ede121d2a3f8bfdb3cc2ae9
ea35d32b615bf7db48a535e3f4570585bf009079
refs/heads/master
2021-01-01T20:13:40.841133
2018-05-12T05:40:13
2018-05-12T05:40:13
98,791,031
0
0
null
null
null
null
UTF-8
C++
false
false
618
cpp
SUBINC.cpp
#include <iostream> #include <algorithm> using namespace std; typedef long long int lli; lli fact(lli j) { if(j==2) return 1; if(j<2) return 0; return (j*(j-1))/2; } int main() { lli t; cin>>t; while(t--){ lli n,count=0,j=0; cin>>n; count=n; int a[n]; for(lli i=0;i<n;i++){ cin>>a[i]; if(j==0){ j++; } else { if(a[i]>=a[i-1]) j++; else{ count+=fact(j); //cout <<"sub seq " << fact(j) << endl; j=1; } } } cout<<count+fact(j)<<endl; } return 0; }
9912d46ca3059f86c80e08490d4774564aa08042
9b5312cf92ed6ed2fff4eea02a4cb3fba0164ba5
/QueryMatcher/QueryMatcher.cpp
2ce709f45a0e20c770371d3c1f2acc3b1bb7dcff
[]
no_license
samueltenka/SNCT
2244c70c34435e1da5f5f5e28840d76cf9a5c310
3b8667d231a27b217e92c05450dbb0a05e839ea9
refs/heads/master
2016-09-05T13:13:46.480628
2014-12-11T19:09:48
2014-12-11T19:09:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
407
cpp
QueryMatcher.cpp
#include "QueryMatcher.h" #include "TextScanner.h""" list<string> find_relevant_sentences(string knowledgebase, list<string> queries) { list<int> match_indices = locate_mentions_of(knowledgebase, queries); return expand_to_surrounding_sentences(knowledgebase, match_indices); } string generate_consensus(list<string> relevant_sentences) { return *(relevant_sentences.begin()); // FILL IN }
5fa672259f5944eac2886e41cbfc22eeef75a922
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/squid/old_hunk_5572.cpp
146f3e5ec3d943db3b873be60e5faace7fcf9ce3
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
61
cpp
old_hunk_5572.cpp
statCounter.aborted_requests++; storeAbort(entry); }
d9f0f34e688e6fe0531f6f101e1e59bcfaddc031
751bb2f0742a4c1651e8c6a044d0e6fe18abebc0
/basic algo/sort_stack.cpp
e9b7382a9926af58924893fff77b0eccb03d95fa
[]
no_license
yash0311/competitive-coding
bd563792c8ffd5292c36303c84a781b9907cc6c2
bc4922b9d6e5d96c11a15455ed511f5d22a5bf70
refs/heads/master
2020-03-27T09:16:29.163899
2018-09-28T17:18:50
2018-09-28T17:18:50
146,326,792
1
0
null
2018-08-27T17:43:43
2018-08-27T16:49:49
C++
UTF-8
C++
false
false
948
cpp
sort_stack.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long int #define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define T() int t; cin>>t; while(t--) #define pb push_back void act_sort(stack<ll> *s,ll elem){ if(s->empty()) { //cout<<" empty= "<<elem<<endl; s->push(elem); return ; } ll top=s->top(); //cout<<"top= "<< top<<" elem= "<<elem<<endl; if(elem>=top){ s->push(elem); return ; } else{ s->pop(); act_sort(s,elem); s->push(top); return ; } } void srt(stack<ll> *s){ if(s->empty()) return ; ll x=s->top(); s->pop(); //cout<<x<<" "<<endl; srt(s); //cout<<"after srt "<<x<<" "<<endl; if(s->empty()) { s->push(x); //cout<<x<<endl; return; } act_sort(s,x); } int main() { stack<ll> s; s.push(30); s.push(-5); s.push(18); s.push(14); s.push(-3); srt(&s); while(!s.empty()){ ll x=s.top(); cout<<x<<endl; s.pop(); } return 0; }
493b344095eaa5cc3f2e8979fa1cf312b65d6eab
cef20e617747de545f2b1ed8d7af394bc8e5e2d1
/geographicLibrary.h
502a114c7b91dc3a7f15f7518c3208c48108bc20
[]
no_license
Krisequ/FastWGS2CartesianTransformationLib
66995ca26a3aeb87161af19d22a97041b8a5b7a2
3f73b4357b17d3974b029305bf221a470b829834
refs/heads/main
2023-04-29T02:42:10.731132
2021-05-11T13:47:26
2021-05-11T13:47:26
365,299,310
0
0
null
null
null
null
UTF-8
C++
false
false
6,266
h
geographicLibrary.h
// // Created by Krzysztof Gromada on 10.05.2021. // #ifndef GEOGRAPHICLIBRARY_H #define GEOGRAPHICLIBRARY_H #include <cmath> constexpr double EarthRadius=6'367'450; ///< Average earth radius (according to WGS84)- in meters 6378100+6356800 /2 constexpr double MetersPerLatitudeDegree=6'367'450*2*M_PI/360; ///< Meters per degree approximation constexpr double LatitudeDegreePerMeter=1/MetersPerLatitudeDegree; ///< Degrees per meter approximation inline double rad2deg(const double &rad) { constexpr double mult = 180.0 / M_PI; return rad * mult; } inline double deg2rad(const double &deg) { constexpr double mult = M_PI/180.0; return deg * mult; } struct point2d{ double x, y; point2d(const point2d &in):x(in.x),y(in.y){} explicit point2d(const double &x=NAN, const double &y=NAN):x(x),y(y){} }; namespace fastGeoCalc{ /// Returns azimuth angle from ptIn to ptOut. Assumption of spheroid earth is taken /// /// eauation taken tan(azimuth) = sin(L) / (cos(p1)&tan(p2)-sin(p1)cos(L), /// where ptIn=(Lon = 0,Lat = p1), ptOut = (Lon = L, Lat = p2) /// /// so the following equation can be deduced: /// /// azimuth = atan( sin(l2-l1) / (cos(p1)&tan(p2)-sin(p1)cos(l2-l1) ) /// /// \param ptIn - angular position on earth (degrees) /// \param ptOut - angular position on earth (degrees) /// \return float angle from north (RADIANS) inline double getAzimuthRads(const point2d &ptIn, const point2d &ptOut){ double l1 = deg2rad(ptIn.x), p1 = deg2rad( ptIn.y ), l2 = deg2rad( ptOut.x ), p2 = deg2rad( ptOut.y ); double output = atan2(sin(l2-l1), cos(p1)*tan(p2)-sin(p1)*cos(l2-l1)); if(output<0){/// <-pi, pi> to <0, 2pi> return 2*M_PI+output; } return output; } /// Return approximate azimuth angle between 2 points on earth surface - accurate for short distances /// Using this algorithm: http://zasoby.open.agh.edu.pl/~11sjjurek/azymut.html /// \param ptIn - angular position on earth (degrees) /// \param ptOut - angular position on earth (degrees) /// \return double angle from north (RADIANS) - can be change to float due to low accuracy inline double getRapidAzimuthRads(const point2d &ptIn, const point2d &ptOut){ auto dy = (ptOut.y-ptIn.y); auto dx = ((ptOut.x-ptIn.x)*cos(deg2rad((ptIn.y+ptOut.y)/2))); //scaling the X axis double output = atan2(dx,dy); // not dy, dx due to different coordinate system (angle from y not x) if(output<0){ return 2*M_PI+output; /// <-pi, pi> to <0, 2pi> } return output; } /// Interface for Haversine formula - returns distance between 2 points on the ground /// \param ptIn - angular position on earth (degrees) /// \param ptOut - angular position on earth (degrees) /// \return distance in meters inline double getDistanceMeters(const point2d &ptIn, const point2d &ptOut){ double lat1 = deg2rad(ptIn.y), lat2=deg2rad(ptOut.y); return 2.*EarthRadius*(sqrt( pow(sin((lat2-lat1)/2.),2) + cos(lat2)*cos(lat1)*pow(sin(deg2rad(ptOut.x-ptIn.x)/2.),2) )); //używany jest zapis oparty o sinusy a nie cosinusy w celu zmniejszenie błędów numerycznych } // /////////////////////// Geo to XYZ /////////////////////// /// Funkcja pozwalająca na zmianę układu współrzędnych punktu. /// pozycji NW na kołowy układ współrzędnych XY (opis w postaci kątu azymutu i odległości). Pierwszy punkt określa środek układu współrzędnych. /// /// Zgodnie z testami dla 100km odległości dokładność powinna być na poziomie +/- 500m. Dla 200km może przekraczać 1.5km. /// /// @param zeroWptDegs - środek układu współrzędnych względem którego będą liczone pozycje (najpewniej wsp. samolotu) /// @param wptDegs - współrzędne punktu rzucanego /// @return zwraca punkt we współrzędnych XY inline point2d movePointToXYcs(const point2d &zeroWptDegs, const point2d &wptDegs){ double azimuthAngleDegs = getAzimuthRads(zeroWptDegs, wptDegs); double r = getDistanceMeters(zeroWptDegs,wptDegs); return point2d(sin(rad2deg(azimuthAngleDegs))*r,cos(rad2deg(azimuthAngleDegs))*r); } // /////////////////////// XYZ to Geo /////////////////////// /// Reverse function to "movePointToXYcs" changes XY position to global coordinate system. inline point2d findPointInDistanceUnderAzimuth (const point2d& startingWptDegs, const double groundDistanceInMeters, double azimuthInDegs){ double dx = groundDistanceInMeters*sin(deg2rad(azimuthInDegs))*LatitudeDegreePerMeter/cos(deg2rad(startingWptDegs.y)), dy = groundDistanceInMeters*cos(deg2rad(azimuthInDegs))*LatitudeDegreePerMeter; return point2d(startingWptDegs.x+dx, startingWptDegs.y+dy); } } /////////////////////// For Lighter version comment all the code below /////////////////////// #include <boost/geometry/core/cs.hpp> #include <boost/geometry/strategies/spherical/distance_haversine.hpp> #include <boost/geometry/algorithms/distance.hpp> namespace bg = boost::geometry; typedef bg::cs::geographic<bg::degree> geoCS; typedef bg::strategy::distance::haversine<double> stratLinDist; typedef bg::strategy::azimuth::geographic<> stratAzimuth; namespace boostInterface { /// Boost::Geometry equivalent to the function proposed above inline double getAzimuthRads(const bg::model::point<double,2,geoCS> &ptIn, const bg::model::point<double,2,geoCS> &ptOut){ double output = 0, output2 = 0; stratAzimuth().apply( deg2rad(bg::get<0>(ptIn)), deg2rad(bg::get<1>(ptIn)), deg2rad(bg::get<0>(ptOut)), deg2rad(bg::get<1>(ptOut)), output,output2); return output; } /// Boost::Geometry equivalent to the function proposed above inline double getDistanceMeters(const bg::model::point<double,2,geoCS> &ptIn, const bg::model::point<double,2,geoCS> &ptOut){ return bg::distance(ptIn, ptOut, stratLinDist()) * EarthRadius ; } }; #endif //GEOGRAPHICLIBRARY_H
212693a822312eb60e71921e3307e7711374060c
3077cbea0c703423e812578f4d30dccacf9163a7
/src/uci.cc
f6cd2e71bb159919ee60bfe583fb5226724c1a53
[]
no_license
kuratlij/parallel-chess
f0ebc91639270cb9f224479c7c39188a0c634c01
c983c2704f9e10f93080e025bf14c997960c2e80
refs/heads/master
2021-05-01T16:34:25.960605
2017-01-20T16:40:14
2017-01-20T16:40:14
72,529,978
0
0
null
null
null
null
UTF-8
C++
false
false
6,731
cc
uci.cc
/* * uci.cc * * Created on: Nov 4, 2016 * Author: jonathan */ #include "uci.h" #include "general/test.h" namespace { std::vector<std::string> &splits(const std::string &s, char delimeter, std::vector<std::string> &elements) { std::stringstream string_stream(s); std::string item; while (std::getline(string_stream, item, delimeter)) { elements.push_back(item); } return elements; } std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> elems; splits(s, delim, elems); return elems; } const std::string kEngineIsReady = "readyok"; const std::string kEngineNamePrefix = "id name "; const std::string kEngineAuthorPrefix = "id author "; const std::string kOk = "uciok"; struct Timer { Timer() { for (Color color = kWhite; color <= kBlack; color++) { time[color] = 0; inc[color] = 0; } movetime = 0; moves_to_go = 0; search_depth = 0; } int time[2], inc[2], movetime; Depth moves_to_go, search_depth; }; int maxtime(int time) { return std::max((9 * time) / 10, time - 100); } Move Go(Board &board, Timer timer) { if (timer.search_depth != 0) { return search::DepthSearch(board, timer.search_depth); } if (timer.movetime != 0) { Milliseconds duration = Milliseconds(maxtime(timer.movetime)); return search::TimeSearch(board, duration); } if (timer.moves_to_go == 0) { timer.moves_to_go = 40; } Color color = board.get_turn(); int time = (timer.time[color] / timer.moves_to_go) + timer.inc[color]; Milliseconds duration = Milliseconds(maxtime(time)); return search::TimeSearch(board, duration); } } namespace uci { bool Equals(std::string string_a, std::string string_b) { return string_a.compare(string_b) == 0; } void Reply(std::string message) { std::cout << message << std::endl; } void Loop() { Board board; while (true) { std::string in; std::getline(std::cin, in); std::vector<std::string> tokens = split(in, ' '); unsigned int index = 0; std::string command = tokens[index++]; if (Equals(command, "quit")) { break; } else if (Equals(command, "isready")) { Reply(kEngineIsReady); } else if (Equals(command, "print")) { board.Print(); } else if (Equals(command, "uci")) { Reply(kEngineNamePrefix + settings::engine_name + " " + settings::engine_version); Reply(kEngineAuthorPrefix + settings::engine_author); Reply(kOk); } else if (Equals(command, "print_moves")) { std::vector<Move> moves = board.GetMoves(); for (unsigned int i = 0; i < moves.size(); i++) { std::cout << parse::MoveToString(moves[i]) << std::endl; } } else if (Equals(command, "position")) { if (index < tokens.size()) { std::string arg = tokens[index++]; if (Equals(arg, "startpos")) { board.SetStartBoard(); } else if (Equals(arg, "fen")) { if(index < tokens.size()+2) { std::string fen_pos = tokens[index++]; std::string turn = tokens[index++]; std::string castling_rights = tokens[index++]; board.SetBoard(fen_pos, turn, castling_rights); } } if (index < tokens.size()){ arg = tokens[index++]; while (Equals(arg,"-") && index < tokens.size()) { arg = tokens[index++]; } if (Equals(arg, "moves")) { while (index < tokens.size()) { Move move = parse::StringToMove(tokens[index++]); std::vector<Move> moves = board.GetMoves(); for (unsigned int i = 0; i < moves.size(); i++) { if (GetMoveSource(moves[i]) == GetMoveSource(move) && GetMoveDestination(moves[i]) == GetMoveDestination(move) && (GetMoveType(moves[i]) < kQueenPromotion || GetMoveType(moves[i]) == GetMoveType(move))) { board.Make(moves[i]); break; } } } } } } } else if (Equals(command, "go")) { Move move = 0; if (tokens.size() >= index+2) { Timer timer; while (tokens.size() >= index+2) { std::string arg = tokens[index++]; if(Equals(arg, "depth")){ timer.search_depth = atoi(tokens[index++].c_str()); } else if(Equals(arg, "movetime")){ timer.movetime = atoi(tokens[index++].c_str()); } else if(Equals(arg, "wtime")){ timer.time[kWhite] = atoi(tokens[index++].c_str()); } else if(Equals(arg, "btime")){ timer.time[kBlack] = atoi(tokens[index++].c_str()); } else if(Equals(arg, "winc")){ timer.inc[kWhite] = atoi(tokens[index++].c_str()); } else if(Equals(arg, "binc")){ timer.inc[kBlack] = atoi(tokens[index++].c_str()); } else if(Equals(arg, "movestogo")){ timer.moves_to_go = atoi(tokens[index++].c_str()); } } move = Go(board, timer); } else { move = search::DepthSearch(board, 6); } board.Make(move); std::cout << "bestmove " << parse::MoveToString(move) << std::endl; } else if (Equals(command, "perft")) { Depth depth = atoi(tokens[index++].c_str()); std::vector<Move> moves = board.GetMoves(); long sum = 0; for (Move move : moves) { board.Make(move); long perft_result = search::Perft(board, depth-1); board.UnMake(); std::cout << parse::MoveToString(move) << " depth: " << (depth-1) << " perft: " << perft_result << std::endl; sum += perft_result; } std::cout << "depth: " << depth << " perft: " << sum << std::endl; } else if (Equals(command, "parallel")) { int run_parallel = atoi(tokens[index++].c_str()); settings::set_run_parallel(run_parallel == 1); } else if (Equals(command, "testplay")) { int run_parallel = atoi(tokens[index++].c_str()); settings::set_run_parallel(run_parallel == 1); int game_nr_or_fens = atoi(tokens[index++].c_str()); int desired_depth = -1; if(tokens.size() > 2){ desired_depth = atoi(tokens[index++].c_str()); } Test test; // test.run(game_nr, 5); // test.test_fens(16,5,game_nr_or_fens, desired_depth); test.big_test(1, game_nr_or_fens, desired_depth); } else { Reply("Received unknown command: " + command); } } } }
2e4bcbe0ba0d11f3fe88de2dd5b46207c317e1a1
49c469e4b3f53698a0910fdad3677972f6e415f0
/prime-table.h
eb68013550e09e1507429a03ecc8f514a46f2c55
[]
no_license
mrdomino/primes
07ede17b40ee1738bbf386934c71e9a9451f400e
657e776c8b1501c91c1278154cf09445239b1064
refs/heads/master
2016-09-06T21:38:17.783275
2014-08-21T08:02:45
2014-08-21T08:02:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
424
h
prime-table.h
#ifndef _PRIME_TABLE_H_ #define _PRIME_TABLE_H_ #include <iostream> #include "primes.h" #include "print-table.h" namespace fc { namespace _ { template <typename T> T square(T const& x) { return x * x; } } void primeTable(std::ostream& os, size_t n) { if (n > 0) { auto ps = primes(n); auto biggest = _::square(*ps->rbegin()); printTable(os, *ps, 1 + widthOf(biggest)); } } } // namespace fc #endif
f734111f3f28f03983d00e9796d9b808a0a5dd84
8c3b16c89409566edb71510dfe75a8a8c9beedea
/nf3x/src/dialogs/DialogApplyCommand.cpp
ef3c2a292a7a06fa1def7c79c563aee3e03ad8ee
[]
no_license
jcshaw/namedfolders
3a09736dc09b66da6922296d88d8e61c3db33af0
ccc4d466d1d20b9f16bcd8bb54f7e16ee04b5858
refs/heads/master
2021-01-10T09:00:22.393541
2014-01-20T03:29:05
2014-01-20T03:29:05
54,491,456
0
0
null
null
null
null
UTF-8
C++
false
false
904
cpp
DialogApplyCommand.cpp
/* * Far Named Folders 3.x * Copyright (c) 2002-2011 by Victor Derevyanko * www: http://code.google.com/p/namedfolders/ * e-mail: dvpublic0@gmail.com */ #include "StdAfx.h" #include "DialogApplyCommand.h" #include "settings.h" #include "Kernel.h" using namespace nf; CDialogApplyCommand::CDialogApplyCommand(void) : dialogT(nf::NF_DIALOG_APPLY_COMMAND, DIALOG_WIDTH, DIALOG_HEIGHT, g_PluginInfo, 10, L"DialogExecuteCommand") { SetDialogItems(); } CDialogApplyCommand::~CDialogApplyCommand(void) { } UINT CDialogApplyCommand::ShowModal() { intptr_t nChoosedItem; if (Execute(nChoosedItem)) { if (nChoosedItem != ID_CANCEL) { m_Command = this->GetDialogItemValue(ID_EDIT); return 1; } } return 0; } bool CDialogApplyCommand::IsUseHistory() const { return (CSettings::GetInstance().GetValue(nf::ST_HISTORY_IN_DIALOG_APPLY_COMMAND)) != 0; }
d07d8abac82fc4dfdd4b6cc66f3d1f11bea19547
021b185b9a335bcc31a28816ae88c3720bb65f54
/Delta-dungeons/Engine/TransitionStrategy.h
e8899b3901e20942a21007634f6b1b1b76f17911
[]
no_license
MarijnOomensAvans/project-swa-delta
98fe6c9b54539d54460d6f712f2043126ddf7da9
cf01d4472166fb463c28fd056efcfff1fb475b51
refs/heads/master
2023-02-18T01:53:57.863329
2021-01-06T14:19:10
2021-01-06T14:19:10
292,813,746
0
1
null
null
null
null
UTF-8
C++
false
false
342
h
TransitionStrategy.h
#pragma once #include "CollisionStrategy.h" #include "GameObject.h" class TransitionStrategy : public CollisionStrategy { public: ENGINE_API TransitionStrategy(){} ENGINE_API ~TransitionStrategy(){} ENGINE_API void actCollision(std::shared_ptr<BehaviourObject> collider, int x, int y, KeyCodes direction) override; private: };
e7cc517742766e194b06c571ab93b438044e60e3
6cce0d1fbaf63d686a39a2c6ea0f7255e2be7963
/XcodeMLtoCXX/src/CodeBuilder.cpp
a77f2738acd488e66bc741a2c913cf06d1c4534c
[]
no_license
omni-compiler/ClangXcodeML
8bc3345b576f5d280eeddc01e71814b391d2fd5c
90aa8bd4bd3faf065d5e4866f717f975bb10afc3
refs/heads/master
2021-08-08T07:23:18.915508
2020-04-24T05:04:20
2020-04-24T05:04:20
61,346,810
5
4
null
2018-07-24T12:46:26
2016-06-17T05:03:36
C++
UTF-8
C++
false
false
28,626
cpp
CodeBuilder.cpp
#include <algorithm> #include <functional> #include <iostream> #include <sstream> #include <memory> #include <map> #include <cassert> #include <vector> #include <libxml/tree.h> #include <libxml/xpath.h> #include "llvm/ADT/Optional.h" #include "llvm/Support/Casting.h" #include "XMLString.h" #include "XMLWalker.h" #include "AttrProc.h" #include "Stream.h" #include "StringTree.h" #include "Util.h" #include "XcodeMlNns.h" #include "XcodeMlName.h" #include "XcodeMlOperator.h" #include "XcodeMlType.h" #include "XcodeMlTypeTable.h" #include "XcodeMlUtil.h" #include "NnsAnalyzer.h" #include "TypeAnalyzer.h" #include "SourceInfo.h" #include "CodeBuilder.h" #include "ClangDeclHandler.h" #include "ClangNestedNameSpecHandler.h" #include "ClangStmtHandler.h" #include "ClangTypeLocHandler.h" #include "LibXMLUtil.h" namespace cxxgen = CXXCodeGen; using cxxgen::StringTreeRef; using cxxgen::makeTokenNode; using cxxgen::makeInnerNode; using cxxgen::makeNewLineNode; using cxxgen::makeVoidNode; using cxxgen::insertNewLines; using cxxgen::separateByBlankLines; using XcodeMl::makeOpNode; namespace { XcodeMl::CodeFragment makeNestedNameSpec(const XcodeMl::NnsRef &nns, const SourceInfo &src) { return nns->makeDeclaration(src.typeTable, src.nnsTable); } XcodeMl::CodeFragment makeNestedNameSpec(const std::string &ident, const SourceInfo &src) { const auto nns = getOrNull(src.nnsTable, ident); if (!nns.hasValue()) { std::cerr << "In makeNestedNameSpec:" << std::endl << "Undefined NNS: '" << ident << "'" << std::endl; std::abort(); } return makeNestedNameSpec(*nns, src); } std::vector<XcodeMl::CodeFragment> createNodes(xmlNodePtr node, const char *xpath, const CodeBuilder &w, SourceInfo &src) { std::vector<XcodeMl::CodeFragment> vec; const auto targetNodes = findNodes(node, xpath, src.ctxt); for (auto &&targetNode : targetNodes) { vec.push_back(w.walk(targetNode, src)); } return vec; } /*! * \brief Arguments to be passed to CodeBuilder::Procedure. */ #define CB_ARGS \ const CodeBuilder &w __attribute__((unused)), \ xmlNodePtr node __attribute__((unused)), \ SourceInfo &src __attribute__((unused)) /*! * \brief Define new CodeBuilder::Procedure named \c name. */ #define DEFINE_CB(name) StringTreeRef name(CB_ARGS) DEFINE_CB(NullProc) { return CXXCodeGen::makeVoidNode(); } DEFINE_CB(EmptyProc) { return makeInnerNode(w.walkChildren(node, src)); } DEFINE_CB(walkChildrenWithInsertingNewLines) { return foldWithSemicolon(w.walkChildren(node, src)); } CodeBuilder::Procedure handleBrackets(std::string opening, std::string closing, CodeBuilder::Procedure mainProc) { return [opening, closing, mainProc](CB_ARGS) { return makeTokenNode(opening) + mainProc(w, node, src) + makeTokenNode(closing); }; } CodeBuilder::Procedure handleBracketsLn(std::string opening, std::string closing, CodeBuilder::Procedure mainProc) { return [opening, closing, mainProc](CB_ARGS) { return makeTokenNode(opening) + mainProc(w, node, src) + makeTokenNode(closing) + makeNewLineNode(); }; } /*! * \brief Make a procedure that handles binary operation. * \param Operator Spelling of binary operator. */ CodeBuilder::Procedure showBinOp(std::string Operator) { return [Operator](CB_ARGS) { xmlNodePtr lhs = findFirst(node, "*[1]", src.ctxt), rhs = findFirst(node, "*[2]", src.ctxt); return makeTokenNode("(") + w.walk(lhs, src) + makeTokenNode(Operator) + w.walk(rhs, src) + makeTokenNode(")"); }; } const CodeBuilder::Procedure EmptySNCProc = []( CB_ARGS) { return makeTokenNode(XMLString(xmlNodeGetContent(node))); }; /*! * \brief Make a procedure that outputs text content of a given * XML element. * \param prefix Text to output before text content. * \param suffix Text to output after text content. */ CodeBuilder::Procedure showNodeContent(std::string prefix, std::string suffix) { return handleBrackets(prefix, suffix, EmptySNCProc); } /*! * \brief Make a procedure that processes the first child element of * a given XML element (At least one element should exist in it). * \param prefix Text to output before traversing descendant elements. * \param suffix Text to output after traversing descendant elements. */ CodeBuilder::Procedure showChildElem(std::string prefix, std::string suffix) { return handleBrackets(prefix, suffix, EmptyProc); } /*! * \brief Make a procedure that handles unary operation. * \param Operator Spelling of unary operator. */ CodeBuilder::Procedure showUnaryOp(std::string Operator) { return showChildElem(std::string("(") + Operator + "(", "))"); } DEFINE_CB(postIncrExprProc) { return makeTokenNode("(") + makeInnerNode(w.walkChildren(node, src)) + makeTokenNode("++)"); } DEFINE_CB(postDecrExprProc) { return makeTokenNode("(") + makeInnerNode(w.walkChildren(node, src)) + makeTokenNode("--)"); } DEFINE_CB(castExprProc) { const auto dtident = getProp(node, "type"); const auto Tstr = makeDecl( src.typeTable.at(dtident), makeVoidNode(), src.typeTable, src.nnsTable); const auto child = makeInnerNode(w.walkChildren(node, src)); return wrapWithParen(wrapWithParen(Tstr) + wrapWithParen(child)); } CodeBuilder::Procedure handleIndentation(const CodeBuilder::Procedure mainProc) { return [mainProc](CB_ARGS) { return mainProc(w, node, src); }; } const CodeBuilder::Procedure handleScope = handleBracketsLn( "{", "}", handleIndentation(walkChildrenWithInsertingNewLines)); DEFINE_CB(functionDefinitionProc) { const auto paramNames = getParamNames(node, src); auto acc = makeFunctionDeclHead(node, paramNames, src, true); if (auto ctorInitList = findFirst(node, "constructorInitializerList", src.ctxt)) { acc = acc + w.walk(ctorInitList, src); } auto body = findFirst(node, "body", src.ctxt); assert(body); acc = acc + makeTokenNode("{") + makeNewLineNode(); acc = acc + w.walk(body, src); acc = acc + makeTokenNode("}"); return wrapWithLangLink(acc, node, src); } DEFINE_CB(functionDeclProc) { const auto fnDtident = getProp(node, "type"); const auto fnType = llvm::cast<XcodeMl::Function>(src.typeTable[fnDtident].get()); auto decl = makeFunctionDeclHead(node, fnType->argNames(), src); decl = decl + makeTokenNode(";"); return wrapWithLangLink(decl, node, src); } DEFINE_CB(varProc) { const auto name = makeTokenNode(getContent(node)); const auto nnsident = getPropOrNull(node, "nns"); if (!nnsident.hasValue()) { return name; } return makeNestedNameSpec(*nnsident, src) + name; } DEFINE_CB(emitInlineMemberFunctionDefinition) { const auto paramNames = getParamNames(node, src); auto acc = makeVoidNode(); if (isTrueProp(node, "is_virtual", false)) { acc = acc + makeTokenNode("virtual"); } if (isTrueProp(node, "is_static", false)) { acc = acc + makeTokenNode("static"); } acc = acc + makeFunctionDeclHead(node, paramNames, src); if (auto ctorInitList = findFirst(node, "constructorInitializerList", src.ctxt)) { acc = acc + ProgramBuilder.walk(ctorInitList, src); } auto body = findFirst(node, "body", src.ctxt); assert(body); acc = acc + makeTokenNode("{"); acc = acc + ProgramBuilder.walk(body, src); acc = acc + makeTokenNode("}"); return acc; } DEFINE_CB(emitMemberFunctionDecl) { const auto fnDtident = getProp(node, "type"); const auto fnType = llvm::cast<XcodeMl::Function>(src.typeTable[fnDtident].get()); auto decl = makeVoidNode(); if (isTrueProp(node, "is_virtual", false)) { decl = decl + makeTokenNode("virtual"); } if (isTrueProp(node, "is_static", false)) { decl = decl + makeTokenNode("static"); } decl = decl + makeFunctionDeclHead(node, fnType->argNames(), src); if (isTrueProp(node, "is_pure", false)) { decl = decl + makeTokenNode("=") + makeTokenNode("0"); } decl = decl + makeTokenNode(";"); return wrapWithLangLink(decl, node, src); } XcodeMl::CodeFragment getNameFromMemberRefNode(xmlNodePtr node, const SourceInfo &src) { /* If the <memberRef> element has two children, use the second child. */ const auto memberName = findFirst(node, "name", src.ctxt); if (memberName) { const auto name = getUnqualIdFromNameNode(memberName); return name->toString(src.typeTable, src.nnsTable); } /* Otherwise, it must have `member` attribute. */ const auto name = getProp(node, "member"); return makeTokenNode(name); } DEFINE_CB(memberRefProc) { const auto name = getNameFromMemberRefNode(node, src); return makeInnerNode(w.walkChildren(node, src)) + makeTokenNode("->") + name; } DEFINE_CB(memberAddrProc) { return makeTokenNode("&") + memberRefProc(w, node, src); } DEFINE_CB(memberPointerRefProc) { return makeInnerNode(w.walkChildren(node, src)) + makeTokenNode(".*") + makeTokenNode(getProp(node, "name")); } DEFINE_CB(compoundValueProc) { return makeTokenNode("{") + makeInnerNode(w.walkChildren(node, src)) + makeTokenNode("}"); } DEFINE_CB(thisExprProc) { return makeTokenNode("this"); } DEFINE_CB(arrayRefExprProc) { auto arr = findFirst(node, "*[1]", src.ctxt), index = findFirst(node, "*[2]", src.ctxt); return w.walk(arr, src) + makeTokenNode("[") + w.walk(index, src) + makeTokenNode("]"); } const auto compoundStatementProc = handleScope; DEFINE_CB(whileStatementProc) { auto cond = findFirst(node, "condition", src.ctxt), body = findFirst(node, "body", src.ctxt); return makeTokenNode("while") + makeTokenNode("(") + w.walk(cond, src) + makeTokenNode(")") + handleScope(w, body, src); } DEFINE_CB(doStatementProc) { auto cond = findFirst(node, "condition", src.ctxt), body = findFirst(node, "body", src.ctxt); return makeTokenNode("do") + handleScope(w, body, src) + makeTokenNode("while") + makeTokenNode("(") + w.walk(cond, src) + makeTokenNode(")") + makeTokenNode(";"); } DEFINE_CB(forStatementProc) { auto init = findFirst(node, "init", src.ctxt), cond = findFirst(node, "condition", src.ctxt), iter = findFirst(node, "iter", src.ctxt), body = findFirst(node, "body", src.ctxt); auto acc = makeTokenNode("for") + makeTokenNode("("); if (init) { acc = acc + w.walk(init, src); } acc = acc + makeTokenNode(";"); if (cond) { acc = acc + w.walk(cond, src); } acc = acc + makeTokenNode(";"); if (iter) { acc = acc + w.walk(iter, src); } acc = acc + makeTokenNode(")"); return acc + handleScope(w, body, src); } DEFINE_CB(ifStatementProc) { auto cond = findFirst(node, "condition", src.ctxt), thenpart = findFirst(node, "then", src.ctxt), elsepart = findFirst(node, "else", src.ctxt); auto acc = makeTokenNode("if") + makeTokenNode("("); if (cond) { acc = acc + w.walk(cond, src); } acc = acc + makeTokenNode(") {"); if (thenpart) { acc = acc + handleScope(w, thenpart, src); } if (elsepart) { acc = acc + makeTokenNode("} else {"); acc = acc + handleScope(w, elsepart, src); } acc = acc + makeTokenNode("}"); return acc; } DEFINE_CB(switchStatementProc) { auto cond = findFirst(node, "value", src.ctxt); auto body = findFirst(node, "body", src.ctxt); return makeTokenNode("switch") + wrapWithParen(w.walk(cond, src)) + makeTokenNode("{") + insertNewLines(w.walkChildren(body, src)) + makeTokenNode("}"); } DEFINE_CB(caseLabelProc) { auto value = findFirst(node, "value", src.ctxt); return makeTokenNode("case") + makeInnerNode(w.walkChildren(value, src)) + makeTokenNode(":"); } DEFINE_CB(defaultLabelProc) { return makeTokenNode("default") + makeTokenNode(":"); } DEFINE_CB(returnStatementProc) { xmlNodePtr child = xmlFirstElementChild(node); if (child) { return makeTokenNode("return") + w.walk(child, src) + makeTokenNode(";"); } else { return makeTokenNode("return") + makeTokenNode(";"); } } DEFINE_CB(exprStatementProc) { const auto showChild = showChildElem("", ";"); return showChild(w, node, src); } DEFINE_CB(functionCallProc) { xmlNodePtr arguments = findFirst(node, "arguments", src.ctxt); if (const auto opNode = findFirst(node, "operator", src.ctxt)) { const auto op = makeOpNode(opNode); return makeTokenNode("operator") + op + w.walk(arguments, src); } xmlNodePtr function = findFirst(node, "function|memberFunction", src.ctxt); if (!function) { std::cerr << "error: callee not found" << getXcodeMlPath(node) << std::endl; std::abort(); } const auto callee = findFirst(function, "*", src.ctxt); return w.walk(callee, src) + w.walk(arguments, src); } DEFINE_CB(memberFunctionCallProc) { const auto function = findFirst(node, "*[1]", src.ctxt); const auto arguments = findFirst(node, "arguments", src.ctxt); return w.walk(function, src) + w.walk(arguments, src); } DEFINE_CB(valueProc) { const auto child = findFirst(node, "*", src.ctxt); if (getName(child) == "value") { // aggregate (See {#sec:program.value}) const auto grandchildren = w.walkChildren(child, src); return wrapWithBrace(join(",", grandchildren)); } return w.walk(child, src); } DEFINE_CB(newExprProc) { const auto type = src.typeTable.at(getProp(node, "type")); // FIXME: Support scalar type const auto pointeeT = llvm::cast<XcodeMl::Pointer>(type.get())->getPointee(src.typeTable); const auto NewTypeId = pointeeT->makeDeclaration(makeVoidNode(), src.typeTable, src.nnsTable); /* Ref: [new.expr]/4 * new int(*[10])(); // error * new (int(*[10])()); // OK * new int; // OK * new (int); // OK * new ((int)); // error */ const auto arguments = findFirst(node, "arguments", src.ctxt); return makeTokenNode("new") + (hasParen(pointeeT, src.typeTable) ? wrapWithParen(NewTypeId) : NewTypeId) + (arguments ? w.walk(arguments, src) : makeVoidNode()); } DEFINE_CB(newArrayExprProc) { const auto type = src.typeTable.at(getProp(node, "type")); const auto pointeeT = llvm::cast<XcodeMl::Pointer>(type.get())->getPointee(src.typeTable); const auto size_expr = w.walk(findFirst(node, "size", src.ctxt), src); const auto decl = pointeeT->makeDeclaration( wrapWithSquareBracket(size_expr), src.typeTable, src.nnsTable); return makeTokenNode("new") + wrapWithParen(decl); /* new int(*[10])(); // error * new (int(*[10])()); // OK */ } DEFINE_CB(argumentsProc) { auto acc = makeTokenNode("("); bool alreadyPrinted = false; for (xmlNodePtr arg = node->children; arg; arg = arg->next) { if (arg->type != XML_ELEMENT_NODE) { continue; } if (alreadyPrinted) { acc = acc + makeTokenNode(","); } acc = acc + w.walk(arg, src); alreadyPrinted = true; } return acc + makeTokenNode(")"); } DEFINE_CB(condExprProc) { xmlNodePtr prd = findFirst(node, "*[1]", src.ctxt), second = findFirst(node, "*[2]", src.ctxt), third = findFirst(node, "*[3]", src.ctxt); if (third) { return makeTokenNode("(") + w.walk(prd, src) + makeTokenNode("?") + w.walk(second, src) + makeTokenNode(":") + w.walk(third, src) + makeTokenNode(")"); } else { return makeTokenNode("(") + w.walk(prd, src) + makeTokenNode("?:") + w.walk(second, src) + makeTokenNode(")"); } } DEFINE_CB(addrOfExprProc) { if (isTrueProp(node, "is_expedient", false)) { auto expr = findFirst(node, "*[1]", src.ctxt); return w.walk(expr, src); } const auto wrap = showUnaryOp("&"); return wrap(w, node, src); } } // namespace XcodeMl::CodeFragment declareClassTypeInit( const CodeBuilder &w, xmlNodePtr ctorExpr, SourceInfo &src) { auto copySrc = findFirst( ctorExpr, "clangStmt[@class='MaterializeTemporaryExpr']", src.ctxt); if (copySrc) { /* Use `=` to reduce ambiguity. * A a(A()); // function * A a = A(); // class */ return makeTokenNode("=") + w.walk(copySrc, src); } const auto args = w.walkChildren(ctorExpr, src); /* * X a(); // function ([dcl.init]/6) * X a; // class */ return args.empty() ? makeVoidNode() : wrapWithParen(cxxgen::join(",", args)); } namespace { DEFINE_CB(varDeclProc) { const auto nameNode = findFirst(node, "name", src.ctxt); const auto name = getUnqualIdFromNameNode(nameNode); const auto dtident = getProp(node, "type"); const auto type = src.typeTable.at(dtident); auto acc = makeVoidNode(); acc = acc + makeDecl(type, name->toString(src.typeTable, src.nnsTable), src.typeTable, src.nnsTable); xmlNodePtr valueElem = findFirst(node, "value", src.ctxt); if (!valueElem) { return wrapWithLangLink(acc + makeTokenNode(";"), node, src); } auto ctorExpr = findFirst(valueElem, "clangStmt[@class='CXXConstructExpr']", src.ctxt); if (ctorExpr) { const auto decl = acc + declareClassTypeInit(w, ctorExpr, src) + makeTokenNode(";"); return wrapWithLangLink(decl, node, src); } acc = acc + makeTokenNode("=") + w.walk(valueElem, src) + makeTokenNode(";"); return wrapWithLangLink(acc, node, src); } DEFINE_CB(emitDataMemberDecl) { const auto nameNode = findFirst(node, "name", src.ctxt); const auto name = getUnqualIdFromNameNode(nameNode); const auto dtident = getProp(node, "type"); const auto type = src.typeTable.at(dtident); auto acc = makeVoidNode(); if (isTrueProp(node, "is_static_data_member", false)) { acc = acc + makeTokenNode("static"); } acc = acc + makeDecl(type, name->toString(src.typeTable, src.nnsTable), src.typeTable, src.nnsTable); xmlNodePtr valueElem = findFirst(node, "value", src.ctxt); if (!valueElem) { return wrapWithLangLink(acc + makeTokenNode(";"), node, src); } auto ctorExpr = findFirst(valueElem, "clangStmt[@class='CXXConstructExpr']", src.ctxt); if (ctorExpr) { const auto decl = acc + declareClassTypeInit(w, ctorExpr, src) + makeTokenNode(";"); return wrapWithLangLink(decl, node, src); } acc = acc + makeTokenNode("=") + ProgramBuilder.walk(valueElem, src) + makeTokenNode(";"); return wrapWithLangLink(acc, node, src); } XcodeMl::CodeFragment getCtorInitName(xmlNodePtr node, const XcodeMl::TypeTable &env) { const auto dataMember = getPropOrNull(node, "member"); if (dataMember.hasValue()) { return makeTokenNode(*dataMember); } const auto base = getType(node); // parampack.src.cpp error const auto T = env[base]; const auto classT = llvm::dyn_cast<XcodeMl::ClassType>(T.get()); XcodeMl::CodeFragment name = makeVoidNode(); if(classT) name = name + classT->name(); // const auto name = classT->name(); return name; } DEFINE_CB(ctorInitProc) { const auto member = getCtorInitName(node, src.typeTable); const auto expr = findFirst(node, "clangStmt[1]", src.ctxt); if (!expr) { return member + wrapWithParen(makeVoidNode()); } if (auto constructExpr = findFirst(node, "clangStmt[@class='CXXConstructExpr']", src.ctxt)) { const auto constructExprParams = createNodes(constructExpr, "clangStmt", w, src); return member + wrapWithParen(join(",", constructExprParams)); } return member + makeTokenNode("(") + w.walk(expr, src) + makeTokenNode(")"); } DEFINE_CB(accessToAnonRecordExprProc) { const auto baseName = getProp(node, "member"); const auto nnsident = getPropOrNull(node, "nns"); return (nnsident.hasValue() ? makeNestedNameSpec(*nnsident, src) : makeVoidNode()) + makeTokenNode(baseName); } DEFINE_CB(clangStmtProc) { return ClangStmtHandler.walk(node, w, src); } DEFINE_CB(clangDeclProc) { return ClangDeclHandler.walk(node, w, src); } DEFINE_CB(classScopeClangDeclProc) { return ClangDeclHandlerInClass.walk(node, w, src); } DEFINE_CB(clangTypeLocProc) { const auto T = src.typeTable.at(getType(node)); return T->makeDeclaration( CXXCodeGen::makeVoidNode(), src.typeTable, src.nnsTable); } DEFINE_CB(clangNestedNameSpecProc) { return ClangNestedNameSpecHandler.walk(node, src); } } // namespace const CodeBuilder ProgramBuilder("ProgramBuilder", makeInnerNode, { std::make_tuple("typeTable", NullProc), std::make_tuple("functionDefinition", functionDefinitionProc), std::make_tuple("functionDecl", functionDeclProc), std::make_tuple("intConstant", EmptySNCProc), std::make_tuple("floatConstant", EmptySNCProc), std::make_tuple("moeConstant", EmptySNCProc), std::make_tuple("booleanConstant", EmptySNCProc), std::make_tuple("funcAddr", EmptySNCProc), std::make_tuple("stringConstant", showNodeContent("\"", "\"")), std::make_tuple("Var", varProc), std::make_tuple("varAddr", showNodeContent("(&", ")")), std::make_tuple("pointerRef", showUnaryOp("*")), std::make_tuple("memberRef", memberRefProc), std::make_tuple("memberAddr", memberAddrProc), std::make_tuple("memberPointerRef", memberPointerRefProc), std::make_tuple("compoundValue", compoundValueProc), std::make_tuple("compoundStatement", compoundStatementProc), std::make_tuple("whileStatement", whileStatementProc), std::make_tuple("doStatement", doStatementProc), std::make_tuple("forStatement", forStatementProc), std::make_tuple("ifStatement", ifStatementProc), std::make_tuple("switchStatement", switchStatementProc), std::make_tuple("caseLabel", caseLabelProc), std::make_tuple("defaultLabel", defaultLabelProc), std::make_tuple("thisExpr", thisExprProc), std::make_tuple("arrayRef", arrayRefExprProc), std::make_tuple("assignExpr", showBinOp(" = ")), std::make_tuple("plusExpr", showBinOp(" + ")), std::make_tuple("minusExpr", showBinOp(" - ")), std::make_tuple("mulExpr", showBinOp(" * ")), std::make_tuple("divExpr", showBinOp(" / ")), std::make_tuple("modExpr", showBinOp(" % ")), std::make_tuple("LshiftExpr", showBinOp(" << ")), std::make_tuple("RshiftExpr", showBinOp(" >> ")), std::make_tuple("logLTExpr", showBinOp(" < ")), std::make_tuple("logGTExpr", showBinOp(" > ")), std::make_tuple("logLEExpr", showBinOp(" <= ")), std::make_tuple("logGEExpr", showBinOp(" >= ")), std::make_tuple("logEQExpr", showBinOp(" == ")), std::make_tuple("logNEQExpr", showBinOp(" != ")), std::make_tuple("bitAndExpr", showBinOp(" & ")), std::make_tuple("bitXorExpr", showBinOp(" ^ ")), std::make_tuple("bitOrExpr", showBinOp(" | ")), std::make_tuple("logAndExpr", showBinOp(" && ")), std::make_tuple("logOrExpr", showBinOp(" || ")), std::make_tuple("asgMulExpr", showBinOp(" *= ")), std::make_tuple("asgDivExpr", showBinOp(" /= ")), std::make_tuple("asgPlusExpr", showBinOp(" += ")), std::make_tuple("asgMinusExpr", showBinOp(" -= ")), std::make_tuple("asgLshiftExpr", showBinOp(" <<= ")), std::make_tuple("asgRshiftExpr", showBinOp(" >>= ")), std::make_tuple("asgBitAndExpr", showBinOp(" &= ")), std::make_tuple("asgBitOrExpr", showBinOp(" |= ")), std::make_tuple("asgBitXorExpr", showBinOp(" ^= ")), std::make_tuple("unaryPlusExpr", showUnaryOp("+")), std::make_tuple("unaryMinusExpr", showUnaryOp("-")), std::make_tuple("preIncrExpr", showUnaryOp("++")), std::make_tuple("preDecrExpr", showUnaryOp("--")), std::make_tuple("postIncrExpr", postIncrExprProc), std::make_tuple("postDecrExpr", postDecrExprProc), std::make_tuple("castExpr", castExprProc), std::make_tuple("AddrOfExpr", addrOfExprProc), std::make_tuple("pointerRef", showUnaryOp("*")), std::make_tuple("bitNotExpr", showUnaryOp("~")), std::make_tuple("logNotExpr", showUnaryOp("!")), std::make_tuple("sizeOfExpr", showUnaryOp("sizeof")), std::make_tuple("newExpr", newExprProc), std::make_tuple("newArrayExpr", newArrayExprProc), std::make_tuple("functionCall", functionCallProc), std::make_tuple("memberFunctionCall", memberFunctionCallProc), std::make_tuple("arguments", argumentsProc), std::make_tuple("condExpr", condExprProc), std::make_tuple("exprStatement", exprStatementProc), std::make_tuple("returnStatement", returnStatementProc), std::make_tuple("varDecl", varDeclProc), std::make_tuple("value", valueProc), /* out of specification */ std::make_tuple( "xcodemlAccessToAnonRecordExpr", accessToAnonRecordExprProc), /* for elements defined by clang */ std::make_tuple("clangStmt", clangStmtProc), std::make_tuple("clangDecl", clangDeclProc), std::make_tuple("clangTypeLoc", clangTypeLocProc), std::make_tuple("clangNestedNameSpecifier", clangNestedNameSpecProc), std::make_tuple("clangConstructorInitializer", ctorInitProc), /* for CtoXcodeML */ std::make_tuple("Decl_Record", NullProc), // Ignore Decl_Record (structs are already emitted) }); namespace { Language getSourceLanguage(xmlNodePtr rootNode, xmlXPathContextPtr ctxt) { const auto topNode = findFirst(rootNode, "/*", ctxt); const auto lang = getPropOrNull(topNode, "language"); if (!lang.hasValue()) { // The default value of `language` attribute is "C++" return Language::CPlusPlus; } if (*lang == "C++") { return Language::CPlusPlus; } else if (*lang == "C") { return Language::C; } else { return Language::Invalid; } } } // namespace const CodeBuilder ClassDefinitionBuilder("ClassDefinitionBuilder", makeInnerNode, { std::make_tuple("functionDecl", emitMemberFunctionDecl), std::make_tuple( "functionDefinition", emitInlineMemberFunctionDefinition), std::make_tuple("varDecl", emitDataMemberDecl), /* for elements defined by clang */ std::make_tuple("clangDecl", classScopeClangDeclProc), std::make_tuple("clangStmt", clangStmtProc), }); namespace { void readXcodeProgram( xmlNodePtr rootNode, xmlXPathContextPtr ctxt, std::stringstream &ss) { xmlNodePtr typeTableNode = findFirst(rootNode, "/XcodeProgram/typeTable", ctxt); xmlNodePtr nnsTableNode = findFirst(rootNode, "/XcodeProgram/nnsTable", ctxt); SourceInfo src(ctxt, parseTypeTable(typeTableNode, ctxt, ss), analyzeNnsTable(nnsTableNode, ctxt), getSourceLanguage(rootNode, ctxt)); cxxgen::Stream out; xmlNodePtr globalDeclarations = findFirst(rootNode, "/XcodeProgram/globalDeclarations", src.ctxt); separateByBlankLines(ProgramBuilder.walkChildren(globalDeclarations, src)) ->flush(out); ss << out.str(); } void readClangAST( xmlNodePtr rootNode, xmlXPathContextPtr ctxt, std::stringstream &ss) { xmlNodePtr typeTableNode = findFirst(rootNode, "/clangAST/clangDecl/xcodemlTypeTable", ctxt); xmlNodePtr nnsTableNode = findFirst(rootNode, "/clangAST/clangDecl/xcodemlNnsTable", ctxt); SourceInfo src(ctxt, parseTypeTable(typeTableNode, ctxt, ss), analyzeNnsTable(nnsTableNode, ctxt), getSourceLanguage(rootNode, ctxt)); cxxgen::Stream out; if (src.language == Language::CPlusPlus) { out << "template<typename T>" "struct __xcodeml_identity { typedef T t; };" << CXXCodeGen::newline; } xmlNodePtr decl = findFirst(rootNode, "/clangAST/clangDecl", src.ctxt); const auto program = ClangDeclHandler.walk(decl, ProgramBuilder, src); program->flush(out); ss << out.str(); } } // namespace /*! * \brief Traverse an XcodeML document and generate C++ source code. * \param[in] doc XcodeML document. * \param[out] ss Stringstream to flush C++ source code. */ void buildCode( xmlNodePtr rootNode, xmlXPathContextPtr ctxt, std::stringstream &ss) { const auto docType = getName(rootNode); if (std::equal(docType.cbegin(), docType.cend(), "XcodeProgram")) { readXcodeProgram(rootNode, ctxt, ss); return; } else if (std::equal(docType.cbegin(), docType.cend(), "clangAST")) { readClangAST(rootNode, ctxt, ss); } else { std::cerr << "error: unknown document type" << std::endl; std::abort(); } }
0d4707bbbba97b2a9003ef3d2f0dfff274841042
0e0ab6f0f1af2543ce117d927fd1c920d8bd4125
/Source/platform/graphics/gpu/DrawingBuffer.h
23c7471d478f0e7d5db946afa63642a0c3a4467b
[ "BSD-3-Clause" ]
permissive
nwjs/blink
f59203f7dea96e421682e156eebfb4da8927d18b
27b680078f32e59d6aabcbd63747e164997d3dd2
refs/heads/nw12
2023-08-31T13:04:22.913202
2015-06-25T05:21:30
2015-06-25T06:09:46
10,447,469
91
57
NOASSERTION
2019-11-10T13:15:00
2013-06-03T05:07:00
HTML
UTF-8
C++
false
false
13,035
h
DrawingBuffer.h
/* * Copyright (c) 2010, Google Inc. 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 Google Inc. 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 DrawingBuffer_h #define DrawingBuffer_h #include "platform/PlatformExport.h" #include "platform/geometry/IntSize.h" #include "platform/graphics/GraphicsTypes3D.h" #include "platform/graphics/gpu/WebGLImageConversion.h" #include "public/platform/WebExternalTextureLayerClient.h" #include "public/platform/WebExternalTextureMailbox.h" #include "public/platform/WebGraphicsContext3D.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" #include "wtf/OwnPtr.h" #include "wtf/PassOwnPtr.h" namespace blink { class Extensions3DUtil; class ImageBuffer; class WebExternalBitmap; class WebExternalTextureLayer; class WebGraphicsContext3D; class WebLayer; // Abstract interface to allow basic context eviction management class PLATFORM_EXPORT ContextEvictionManager : public RefCounted<ContextEvictionManager> { public: virtual ~ContextEvictionManager() {}; virtual void forciblyLoseOldestContext(const String& reason) = 0; virtual IntSize oldestContextSize() = 0; }; // Manages a rendering target (framebuffer + attachment) for a canvas. Can publish its rendering // results to a WebLayer for compositing. class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public WebExternalTextureLayerClient { // If we used CHROMIUM_image as the backing storage for our buffers, // we need to know the mapping from texture id to image. struct TextureInfo { Platform3DObject textureId; WGC3Duint imageId; TextureInfo() : textureId(0) , imageId(0) { } }; struct MailboxInfo : public RefCounted<MailboxInfo> { WebExternalTextureMailbox mailbox; TextureInfo textureInfo; IntSize size; // This keeps the parent drawing buffer alive as long as the compositor is // referring to one of the mailboxes DrawingBuffer produced. The parent drawing buffer is // cleared when the compositor returns the mailbox. See mailboxReleased(). RefPtr<DrawingBuffer> m_parentDrawingBuffer; }; public: enum PreserveDrawingBuffer { Preserve, Discard }; static PassRefPtr<DrawingBuffer> create(PassOwnPtr<WebGraphicsContext3D>, const IntSize&, PreserveDrawingBuffer, WebGraphicsContext3D::Attributes requestedAttributes, PassRefPtr<ContextEvictionManager>); virtual ~DrawingBuffer(); // Destruction will be completed after all mailboxes are released. void beginDestruction(); // Issues a glClear() on all framebuffers associated with this DrawingBuffer. The caller is responsible for // making the context current and setting the clear values and masks. Modifies the framebuffer binding. void clearFramebuffers(GLbitfield clearMask); // Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget. static IntSize adjustSize(const IntSize& desiredSize, const IntSize& curSize, int maxTextureSize); bool reset(const IntSize&); void bind(); IntSize size() const { return m_size; } // Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound. void commit(long x = 0, long y = 0, long width = -1, long height = -1); // commit should copy the full multisample buffer, and not respect the // current scissor bounds. Track the state of the scissor test so that it // can be disabled during calls to commit. void setScissorEnabled(bool scissorEnabled) { m_scissorEnabled = scissorEnabled; } // The DrawingBuffer needs to track the texture bound to texture unit 0. // The bound texture is tracked to avoid costly queries during rendering. void setTexture2DBinding(Platform3DObject texture) { m_texture2DBinding = texture; } // The DrawingBuffer needs to track the currently bound framebuffer so it // restore the binding when needed. void setFramebufferBinding(Platform3DObject fbo) { m_framebufferBinding = fbo; } // Track the currently active texture unit. Texture unit 0 is used as host for a scratch // texture. void setActiveTextureUnit(GLint textureUnit) { m_activeTextureUnit = textureUnit; } bool multisample() const; Platform3DObject framebuffer() const; bool discardFramebufferSupported() const { return m_discardFramebufferSupported; } void markContentsChanged(); void setBufferClearNeeded(bool); bool bufferClearNeeded() const; void setIsHidden(bool); void setFilterLevel(SkPaint::FilterLevel); WebLayer* platformLayer(); WebGraphicsContext3D* context(); // Returns the actual context attributes for this drawing buffer which may differ from the // requested context attributes due to implementation limits. WebGraphicsContext3D::Attributes getActualAttributes() const { return m_actualAttributes; } // WebExternalTextureLayerClient implementation. virtual bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override; virtual void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource = false) override; // Destroys the TEXTURE_2D binding for the owned context bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawingBuffer); void setPackAlignment(GLint param); void paintRenderingResultsToCanvas(ImageBuffer*); PassRefPtr<Uint8ClampedArray> paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer); int sampleCount() const { return m_sampleCount; } bool explicitResolveOfMultisampleData() const { return m_multisampleMode == ExplicitResolve; }; protected: // For unittests DrawingBuffer( PassOwnPtr<WebGraphicsContext3D>, PassOwnPtr<Extensions3DUtil>, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported, bool discardFramebufferSupported, PreserveDrawingBuffer, WebGraphicsContext3D::Attributes requestedAttributes, PassRefPtr<ContextEvictionManager>); bool initialize(const IntSize&); private: void mailboxReleasedWithoutRecycling(const WebExternalTextureMailbox&); unsigned createColorTexture(); // Create the depth/stencil and multisample buffers, if needed. void createSecondaryBuffers(); bool resizeFramebuffer(const IntSize&); bool resizeMultisampleFramebuffer(const IntSize&); void resizeDepthStencil(const IntSize&); // Bind to the m_framebufferBinding if it's not 0. void restoreFramebufferBinding(); void clearPlatformLayer(); PassRefPtr<MailboxInfo> recycledMailbox(); PassRefPtr<MailboxInfo> createNewMailbox(const TextureInfo&); void deleteMailbox(const WebExternalTextureMailbox&); void freeRecycledMailboxes(); // Updates the current size of the buffer, ensuring that s_currentResourceUsePixels is updated. void setSize(const IntSize& size); // Calculates the difference in pixels between the current buffer size and the proposed size. static int pixelDelta(const IntSize& newSize, const IntSize& curSize); // Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget // Returns true if the buffer will only fit if the oldest WebGL context is forcibly lost IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*); // This is the order of bytes to use when doing a readback. enum ReadbackOrder { ReadbackRGBA, ReadbackSkia }; // Helper function which does a readback from the currently-bound // framebuffer into a buffer of a certain size with 4-byte pixels. void readBackFramebuffer(unsigned char* pixels, int width, int height, ReadbackOrder, WebGLImageConversion::AlphaOp); // Helper function to flip a bitmap vertically. void flipVertically(uint8_t* data, int width, int height); // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. // By default, alignment is 4, the OpenGL default setting. void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint alignment = 4); // Allocate buffer storage to be sent to compositor using either texImage2D or CHROMIUM_image based on available support. void allocateTextureMemory(TextureInfo*, const IntSize&); void deleteChromiumImageForTexture(TextureInfo*); PreserveDrawingBuffer m_preserveDrawingBuffer; bool m_scissorEnabled; Platform3DObject m_texture2DBinding; Platform3DObject m_framebufferBinding; GLenum m_activeTextureUnit; OwnPtr<WebGraphicsContext3D> m_context; OwnPtr<Extensions3DUtil> m_extensionsUtil; IntSize m_size; WebGraphicsContext3D::Attributes m_requestedAttributes; bool m_multisampleExtensionSupported; bool m_packedDepthStencilExtensionSupported; bool m_discardFramebufferSupported; Platform3DObject m_fbo; // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buffer. TextureInfo m_colorBuffer; struct FrontBufferInfo { TextureInfo texInfo; WebExternalTextureMailbox mailbox; }; FrontBufferInfo m_frontColorBuffer; // This is used when we have OES_packed_depth_stencil. Platform3DObject m_depthStencilBuffer; // These are used when we don't. Platform3DObject m_depthBuffer; Platform3DObject m_stencilBuffer; // For multisampling. Platform3DObject m_multisampleFBO; Platform3DObject m_multisampleColorBuffer; // True if our contents have been modified since the last presentation of this buffer. bool m_contentsChanged; // True if commit() has been called since the last time markContentsChanged() had been called. bool m_contentsChangeCommitted; bool m_bufferClearNeeded; enum MultisampleMode { None, ImplicitResolve, ExplicitResolve, }; MultisampleMode m_multisampleMode; WebGraphicsContext3D::Attributes m_actualAttributes; unsigned m_internalColorFormat; unsigned m_colorFormat; unsigned m_internalRenderbufferFormat; int m_maxTextureSize; int m_sampleCount; int m_packAlignment; bool m_destructionInProgress; bool m_isHidden; SkPaint::FilterLevel m_filterLevel; OwnPtr<WebExternalTextureLayer> m_layer; // All of the mailboxes that this DrawingBuffer has ever created. Vector<RefPtr<MailboxInfo> > m_textureMailboxes; // Mailboxes that were released by the compositor can be used again by this DrawingBuffer. Deque<WebExternalTextureMailbox> m_recycledMailboxQueue; RefPtr<ContextEvictionManager> m_contextEvictionManager; // If the width and height of the Canvas's backing store don't // match those that we were given in the most recent call to // reshape(), then we need an intermediate bitmap to read back the // frame buffer into. This seems to happen when CSS styles are // used to resize the Canvas. SkBitmap m_resizingBitmap; // Used to flip a bitmap vertically. Vector<uint8_t> m_scanline; }; } // namespace blink #endif // DrawingBuffer_h
7f82d833d2995c749be9110a1cb60d06e0066e2b
215111e92a3dfc535ce1c1ce25a35fb6003ab575
/cf/cf_629/b.cpp
acbc5fd3daf3f9fd8747756c1c839e3ef46ae058
[]
no_license
emanueljuliano/Competitive_Programming
6e65aa696fb2bb0e2251e5a68657f4c79cd8f803
86fefe4d0e3ee09b5766acddc8c78ed8b60402d6
refs/heads/master
2023-06-23T04:52:43.910062
2021-06-26T11:34:42
2021-06-26T11:34:42
299,115,304
0
0
null
null
null
null
UTF-8
C++
false
false
793
cpp
b.cpp
#include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' #define f first #define s second #define pb push_back typedef long long ll; typedef pair<int, int> ii; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; int main(){ _ int t; cin >>t ; vector<ll> v; v.pb(0); v.pb(1); for(ll i=2; i<=(ll)2e5; i++){ v.pb(v[i-1] + i); } while(t--){ ll n, k; cin >> n>> k; int at = lower_bound(v.begin(), v.end(), k) - v.begin(); ll x = v[at]-k; string ans; ans.pb('b'); for(int i=at+1; i<n; i++){ ans.pb('a'); } string ans2; for(int j=0; j<at; j++){ if(j==x) ans2.pb('b'); else ans2.pb('a'); } reverse(ans.begin(), ans.end()); ans += ans2; cout << ans << endl; } exit(0); }
a477e695cae4879ec37880fb031f4525344c80f0
c5a1fcec90e6145e02a32621c0367d3b6fd291b2
/BookCode/design_pattern_HeadFirst_c++/07Adapter/02FacadePattern/TheaterLights.h
d190fa1b64d18d31b52521a189c101ef67a8236d
[]
no_license
xinpo66/MyProject
00f7a52c8cc708dfd206771a5279c7368f9f4d59
e5af98e61afe306d270b64302b9ea1690a060b3a
refs/heads/master
2021-01-19T02:30:43.175176
2016-06-10T15:07:52
2016-06-10T15:07:52
54,212,614
0
0
null
null
null
null
UTF-8
C++
false
false
282
h
TheaterLights.h
#ifndef THEATERLIGHTS_H_ #define THEATERLIGHTS_H_ #include <stdio.h> class TheaterLights { public: TheaterLights(){} ~TheaterLights(){} void Dim(int D) { printf("TheaterLights Dim:%d\n",D); } void On() { printf("TheaterLights On \n"); } }; #endif//THEATERLIGHTS_H_