hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
260
max_issues_repo_name
stringlengths
5
109
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
260
max_forks_repo_name
stringlengths
5
109
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
61c78ea61184822f676bb69404c5393c92ad3933
4,621
h
C
old-software/kpixSw/gui/KpixGuiTop.h
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
null
null
null
old-software/kpixSw/gui/KpixGuiTop.h
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
3
2021-04-06T08:33:01.000Z
2021-04-30T16:16:33.000Z
old-software/kpixSw/gui/KpixGuiTop.h
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
1
2020-12-12T22:58:44.000Z
2020-12-12T22:58:44.000Z
//----------------------------------------------------------------------------- // File : KpixGuiTop.h // Author : Ryan Herbst <rherbst@slac.stanford.edu> // Created : 09/25/2008 // Project : SID Electronics API - GUI //----------------------------------------------------------------------------- // Description : // Class for graphical representation of the KPIX ASICs // This is a class which builds off of the class created in // KpixGuiTopForm.ui //----------------------------------------------------------------------------- // Copyright (c) 2009 by SLAC. All rights reserved. // Proprietary and confidential to SLAC. //----------------------------------------------------------------------------- // Modification history : // 07/02/2008: created // 03/05/2009: Added rate limit function. // 04/29/2009: Added thread to handle IO functions // 06/22/2009: Changed structure to support sidApi namespaces. // 06/23/2009: Removed namespace. //----------------------------------------------------------------------------- #ifndef __KPIX_GUI_TOP_H__ #define __KPIX_GUI_TOP_H__ #include "KpixGuiTopForm.h" #include <qthread.h> #include <string> #include "../sidApi/offline/KpixConfigXml.h" // Forward declarations class KpixAsic; class KpixFpga; class KpixRunRead; class KpixRunVar; class KpixConfigXml; class SidLink; class KpixGuiError; class KpixGuiMain; class KpixGuiFpga; class KpixGuiConfig; class KpixGuiTiming; class KpixGuiStatus; class KpixGuiTrig; class KpixGuiInject; class KpixGuiRegTest; class KpixGuiCalibrate; class KpixGuiThreshScan; class KpixGuiRun; class KpixGuiTop : public KpixGuiTopForm, public QThread { // ASIC & FPGA Containers unsigned int asicCnt; unsigned int asicVersion; unsigned int defClkPeriod; unsigned int cmdType; KpixAsic *asic[33]; KpixFpga *fpga; KpixRunRead *runRead; SidLink *sidLink; KpixGuiError *errorMsg; // Widgets In the Tabs KpixGuiMain *kpixGuiMain; KpixGuiFpga *kpixGuiFpga; KpixGuiConfig *kpixGuiConfig; KpixGuiTiming *kpixGuiTiming; KpixGuiStatus *kpixGuiStatus; KpixGuiTrig *kpixGuiTrig; KpixGuiInject *kpixGuiInject; KpixGuiRegTest *kpixGuiRegTest; KpixGuiCalibrate *kpixGuiCalibrate; KpixGuiThreshScan *kpixGuiThreshScan; KpixGuiRun *kpixGuiRun; // Object for class that sets default values from XML file KpixConfigXml *kpixConfigXml; // Constants for command type static const unsigned int CmdReadStatus = 1; static const unsigned int CmdClearCounters = 2; static const unsigned int CmdReadConfig = 3; static const unsigned int CmdWriteConfig = 4; static const unsigned int CmdSetDefaults = 5; static const unsigned int CmdRescanKpix = 6; static const unsigned int CmdLoadSettings = 7; public: // Creation Class KpixGuiTop ( SidLink *sidLink, unsigned int clkPeriod, unsigned int version, std::string baseDir, std::string calString, unsigned int rateLimit, QWidget *parent=0 ); // Delete ~KpixGuiTop ( ); // Control Enable Of Buttons/Edits void setEnabled ( bool enable ); // Get Run Description std::string getRunDescription(); // Get Base Directory std::string getBaseDir(); // Get Run Variable List KpixRunVar **getRunVarList(unsigned int *count); // Get rate limit value, zero for none unsigned int getRateLimit(); // Get Calibration/Settings File Name std::string getCalFile (); // Window was closed void closeEvent(QCloseEvent *e); protected: void run(); private slots: void customEvent ( QCustomEvent *event ); void kpixReScan_pressed(); void calibMenu_pressed(); void threshScanMenu_pressed(); void regTest_pressed(); void runMenu_pressed(); void readStatus_pressed(); void clearCounters_pressed(); void writeConfig_pressed(); void kpixAsicDebug_toggled( bool ); void kpixFpgaDebug_toggled( bool ); void sidLinkDebug_toggled( bool ); void calEnable_toggled( ); void dumpSettings_pressed( ); void setDefaults_pressed( ); void baseDirBrowse_pressed(); void calSetBrowse_pressed(); void clearFile_pressed(); void loadSettings_pressed(); public slots: // update display void readConfig_pressed(); void updateDisplay(); }; #endif
30.202614
85
0.612854
[ "object" ]
61c9383706dc3bda7fb1674a0a6e779707fb3caf
450
h
C
game/task/BaseGameTask.h
Tait4198/yys_fz
052c3f849fa6d0cde9aa8f7c1769e56354d1d258
[ "MIT" ]
null
null
null
game/task/BaseGameTask.h
Tait4198/yys_fz
052c3f849fa6d0cde9aa8f7c1769e56354d1d258
[ "MIT" ]
null
null
null
game/task/BaseGameTask.h
Tait4198/yys_fz
052c3f849fa6d0cde9aa8f7c1769e56354d1d258
[ "MIT" ]
null
null
null
#ifndef YYS_FZ_BASEGAMETASK_H #define YYS_FZ_BASEGAMETASK_H #include "GameTask.h" #include <json/json.h> #include <functional> class BaseGameTask : public GameTask { public: BaseGameTask(GameClient *client, CompareManager *compareManager); protected: static void initConfig(const std::string& configJsonStr, const std::function<void(Json::Value*)>& callback); bool openBuff(std::vector<int>& buff); }; #endif //YYS_FZ_BASEGAMETASK_H
23.684211
112
0.762222
[ "vector" ]
61cfd2d1f880988f3a3b7cd6a613f12254fd9b5e
1,621
h
C
src/sim/Shader/ShaderStateInfo.h
attila-sim/attila-sim
a64b57240b4e10dc4df7f21eff0232b28df09532
[ "BSD-3-Clause" ]
23
2016-01-14T04:47:13.000Z
2022-01-13T14:02:08.000Z
src/sim/Shader/ShaderStateInfo.h
attila-sim/attila-sim
a64b57240b4e10dc4df7f21eff0232b28df09532
[ "BSD-3-Clause" ]
2
2018-03-25T14:39:20.000Z
2022-03-18T05:11:21.000Z
src/sim/Shader/ShaderStateInfo.h
attila-sim/attila-sim
a64b57240b4e10dc4df7f21eff0232b28df09532
[ "BSD-3-Clause" ]
17
2016-02-13T05:35:35.000Z
2022-03-24T16:05:40.000Z
/************************************************************************** * * Copyright (c) 2002 - 2011 by Computer Architecture Department, * Universitat Politecnica de Catalunya. * All rights reserved. * * The contents of this file may not be disclosed to third parties, * copied or duplicated in any form, in whole or in part, without the * prior permission of the authors, Computer Architecture Department * and Universitat Politecnica de Catalunya. * * $RCSfile: ShaderStateInfo.h,v $ * $Revision: 1.2 $ * $Author: cgonzale $ * $Date: 2005-04-26 17:29:02 $ * * Shader State Info definition file. * */ #ifndef _SHADERSTATEINFO_ #define _SHADERSTATEINFO_ #include "DynamicObject.h" #include "ShaderFetch.h" /** * * This class defines a container for the state signals * that the shader sends to the Streamer. * Inherits from Dynamic Object that offers dynamic memory * support and tracing capabilities. * */ namespace gpu3d { class ShaderStateInfo : public DynamicObject { private: ShaderState state; /**< The Shader state. */ public: /** * * Creates a new ShaderStateInfo object. * * @param state The Shader state carried by this * shader state info object. * * @return A new initialized ShaderStateInfo object. * */ ShaderStateInfo(ShaderState state); /** * * Returns the shader state carried by the shader * state info object. * * @return The shader state carried in the object. * */ ShaderState getState(); }; } // namespace gpu3d #endif
21.051948
75
0.628624
[ "object" ]
61d836cf8a532f99904924be6bf92ef0b121bcdc
19,611
c
C
core-vm/src/native/java/io/ObjectStreamClass.c
kifferltd/open-mika
079bcf51dce9442deee2cc728ee1d4a303f738ed
[ "ICU" ]
41
2015-05-14T12:03:18.000Z
2021-11-28T20:18:59.000Z
core-vm/src/native/java/io/ObjectStreamClass.c
kifferltd/open-mika
079bcf51dce9442deee2cc728ee1d4a303f738ed
[ "ICU" ]
11
2015-04-11T10:45:33.000Z
2020-12-14T18:08:58.000Z
core-vm/src/native/java/io/ObjectStreamClass.c
kifferltd/open-mika
079bcf51dce9442deee2cc728ee1d4a303f738ed
[ "ICU" ]
9
2016-05-05T15:19:17.000Z
2021-07-13T11:35:45.000Z
/************************************************************************** * Parts copyright (c) 2001, 2002, 2003 by Punch Telematix. * * All rights reserved. * * Parts copyright (c) 2004, 2005, 2006, 2007, 2008 by Chris Gray, * * /k/ Embedded Java Solutions. All rights reserved. * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * 1. Redistributions of source code must retain the above copyright * * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * 3. Neither the name of Punch Telematix or of /k/ Embedded Java Solutions* * nor the names of other contributors may be used to endorse or promote* * products derived from this software without specific prior written * * permission. * * * * THIS SOFTWARE IS PROVIDED ``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 PUNCH TELEMATIX, /K/ EMBEDDED JAVA SOLUTIONS OR OTHER * * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * **************************************************************************/ #include <string.h> #include "core-classes.h" #include "checks.h" #include "clazz.h" #include "arrays.h" #include "exception.h" #include "fields.h" #include "heap.h" #include "loading.h" #include "threads.h" #include "methods.h" #include "wstrings.h" #define IO_LEVEL 6 w_instance ObjectStreamClass_createObjectStreamClass(JNIEnv *env, w_instance ObjectStreamClass, w_instance Class) { w_thread thread = JNIEnv2w_thread(env); w_clazz clazz; w_instance newOSC = NULL; if (mustBeInitialized(clazzMethod) == CLASS_LOADING_FAILED) { return NULL; } if(Class == NULL){ throwNullPointerException(thread); return NULL; } clazz = Class2clazz(Class); if(isAssignmentCompatible(clazz, clazzSerializable)){ w_int flags; enterUnsafeRegion(thread); newOSC = allocInstance(thread, clazzObjectStreamClass); enterSafeRegion(thread); if(newOSC == NULL){ return NULL; } if(isAssignmentCompatible(clazz, clazzExternalizable)){ flags = 0x0c; } else { //setup writeObject jmethodID jmid = (*env)->GetMethodID(env, Class, "writeObject", "(Ljava/io/ObjectOutputStream;)V"); flags = 0x02; if(jmid != NULL){ if(jmid->spec.declaring_clazz == clazz) { w_instance Method; enterUnsafeRegion(thread); Method = allocInstance(thread, clazzMethod); enterSafeRegion(thread); if(Method){ w_method method = (w_method) jmid; w_int acc_flags = method->flags & 0x0000ffff; if(acc_flags & ACC_PRIVATE){ setReferenceField(newOSC, Method, F_ObjectStreamClass_writeObject); setWotsitField(Method, F_Method_wotsit, jmid); setBooleanField(Method, F_AccessibleObject_accessible, WONKA_TRUE); flags |= 0x01; } } else { return NULL; } } } else { (*env)->ExceptionClear(env); } } //Setup suid ... { w_field jid = NULL; w_field flds = clazz->own_fields; w_word stop = clazz->numStaticFields; w_long* suid = (w_long*)wordFieldPointer(newOSC, F_ObjectStreamClass_suid); w_string name = cstring2String("serialVersionUID", 16); w_word i; if (!name) { wabort(ABORT_WONKA, "Unable to create name\n"); } for(i = 0 ; i < stop ; i++){ w_field f = flds+i; if(f->name == name){ if(f->value_clazz == clazz_long || isSet(f->flags, ACC_PRIVATE | ACC_FINAL | ACC_STATIC)){ jid = f; } break; } } deregisterString(name); if(jid != NULL){ woempa(IO_LEVEL, "hardCoded suid found for %k\n",clazz); *suid =(*env)->GetStaticLongField(env, Class, jid); } else { woempa(IO_LEVEL, "no hardCoded suid found for %k\n",clazz); *suid = Wonka_suid(env, NULL, Class); } } { //setup writeReplace jmethodID jmid = (*env)->GetMethodID(env, Class, "writeReplace", "()Ljava/lang/Object;"); if(jmid != NULL) { jobject method; enterUnsafeRegion(thread); method = allocInstance(thread, clazzMethod); enterSafeRegion(thread); if(method){ setWotsitField(method, F_Method_wotsit, jmid); setReferenceField(newOSC, method, F_ObjectStreamClass_writeReplace); setBooleanField(method, F_AccessibleObject_accessible, WONKA_TRUE); } else { return NULL; } } else { (*env)->ExceptionClear(env); } } //this allows us to check if the object is an array !!! if(clazz->dims){ flags |= 0x01000000; //make sure this is the same value as java.io.ObjectStreamClass IS_ARRAY } setIntegerField(newOSC, F_ObjectStreamClass_flags, flags); setReferenceField(newOSC, Class, F_ObjectStreamClass_clazz); } return newOSC; } void ObjectStreamClass_verifyInput(JNIEnv *env, w_instance thisOSC) { w_instance Class = getReferenceField(thisOSC, F_ObjectStreamClass_clazz); w_thread thread = JNIEnv2w_thread(env); w_int flags = getIntegerField(thisOSC, F_ObjectStreamClass_flags); w_clazz clazz; if (mustBeInitialized(clazzField) == CLASS_LOADING_FAILED || mustBeInitialized(clazzMethod) == CLASS_LOADING_FAILED ) { return; } if(Class == NULL){ throwException(thread, clazzClassNotFoundException, NULL); return; } clazz = Class2clazz(Class); //check if this class is serializable woempa(IO_LEVEL, "Class %k is serializable ? %d\n",clazz,isAssignmentCompatible(clazz, clazzSerializable)); if(!isAssignmentCompatible(clazz, clazzSerializable)){ //this is allowed to happen if it is the clazzDescripter of when a non serializable class gets serialized w_long* suid = (w_long*)wordFieldPointer(thisOSC, F_ObjectStreamClass_suid); if(*suid != 0x0 || flags != 0){ flags |= (0x00800000 | 0x00400000); //make sure this is the same value as java.io.ObjectStreamClass IS_BAD and IS_NOT_SER woempa(IO_LEVEL, "Class %k is not serializable\n",clazz); throwException(thread, clazzInvalidClassException, "Class %k is not serializable",clazz); } return; } else{ woempa(IO_LEVEL, "Class %k is serializable\n",clazz); } //check serialVersionUID ... { w_long* suid = (w_long*)wordFieldPointer(thisOSC, F_ObjectStreamClass_suid); w_field flds = clazz->own_fields; w_word stop = clazz->numStaticFields; w_long realsuid; w_string name = cstring2String("serialVersionUID", 16); w_word i; w_field jid = NULL; if (!name) { wabort(ABORT_WONKA, "Unable to create name\n"); } for(i = 0 ; i < stop ; i++){ w_field f = flds+i; if(f->name == name){ if(f->value_clazz == clazz_long || isSet(f->flags, ACC_PRIVATE | ACC_FINAL | ACC_STATIC)){ jid = f; } break; } } deregisterString(name); if(jid != NULL){ woempa(IO_LEVEL, "hardCoded suid found for %k\n",clazz); realsuid =(*env)->GetStaticLongField(env, Class, jid); } else { realsuid = Wonka_suid(env, NULL, Class); woempa(IO_LEVEL, "no hardCoded suid found for %k calculated %lld\n",clazz,realsuid); } if(realsuid != *suid){ flags |= (0x00800000 | 0x00200000); //make sure this is the same value as java.io.ObjectStreamClass IS_BAD and WRONG_SUID woempa(IO_LEVEL, "local Class %k has different SUID %lld (%llx) than SUID on stream %lld (%llx)\n",clazz, realsuid, realsuid, *suid, *suid); throwException(thread, clazzInvalidClassException, "local Class %k has different SUID %lld (0x%llx) then SUID on stream %lld(0x%llx) ", clazz, realsuid, realsuid, *suid, *suid); return; } else { woempa(IO_LEVEL, "local Class %k has same SUID %llx then SUID on stream %llx\n",clazz, realsuid, *suid); } } { //setup readResolve jmethodID jmid = (*env)->GetMethodID(env, Class, "readResolve", "()Ljava/lang/Object;"); if(jmid != NULL) { jobject method; enterUnsafeRegion(thread); method = allocInstance(thread, clazzMethod); enterSafeRegion(thread); if(method){ setWotsitField(method, F_Method_wotsit, jmid); setReferenceField(thisOSC, method, F_ObjectStreamClass_readResolve); setBooleanField(method, F_AccessibleObject_accessible, WONKA_TRUE); } else { return; } } else { (*env)->ExceptionClear(env); } } { //setup readObject jmethodID jmid = (*env)->GetMethodID(env, Class, "readObject", "(Ljava/io/ObjectInputStream;)V"); if(jmid != NULL){ if(jmid->spec.declaring_clazz == clazz) { w_instance Method; enterUnsafeRegion(thread); Method = allocInstance(thread, clazzMethod); enterSafeRegion(thread); if(Method){ w_method method = (w_method) jmid; w_int acc_flags = method->flags & 0x0000ffff; if(acc_flags & ACC_PRIVATE){ setReferenceField(thisOSC, Method, F_ObjectStreamClass_readObject); setWotsitField(Method, F_Method_wotsit, jmid); setBooleanField(Method, F_AccessibleObject_accessible, WONKA_TRUE); } } else { return; } } } else { (*env)->ExceptionClear(env); } } { //walk through the ObjectStreamFields and create the Fields where needed ... w_instance OsFields = getReferenceField(thisOSC, F_ObjectStreamClass_osFields); w_word numFields = clazz->numFields; w_field flds = clazz->own_fields; w_word start = clazz->numStaticFields; w_instance * osFields; w_int i; w_int length; if(OsFields == NULL){ return; } osFields = instance2Array_instance(OsFields); length = instance2Array_length(OsFields); for(i = 0 ; i < length ; i++){ w_instance OsField = osFields[i]; w_instance Name; w_string name; w_instance Type; w_string type; w_word j; if(!OsField){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d] is NULL\n",i); return; } Name = getReferenceField(OsField, F_ObjectStreamField_name); if(!Name){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d].name is NULL\n",i); return; } name = String2string(Name); Type = getReferenceField(OsField, F_ObjectStreamField_typeString); if(!Type){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d].type is NULL\n",i); return; } type = String2string(Type); for(j = start ; j < numFields ; j++){ w_field osfield = flds+j; if(osfield->name == name && osfield->value_clazz->dotified == type){ w_instance newField; enterUnsafeRegion(thread); newField = allocInstance(thread, clazzField); enterSafeRegion(thread); if(newField){ setWotsitField(newField, F_Field_wotsit, osfield); setBooleanField(newField, F_AccessibleObject_accessible, WONKA_TRUE); setReferenceField(OsField, newField, F_ObjectStreamField_field); break; } else { return; } } } } } //TODO: what about serialPersitantFields ??? --> we use the fields found on the stream ! } w_instance ObjectStreamClass_createFields(JNIEnv *env, w_instance thisOSC) { w_thread thread = JNIEnv2w_thread(env); w_instance Class = getReferenceField(thisOSC, F_ObjectStreamClass_clazz); w_instance OSFIELDS = NULL; w_clazz clazz; threadMustBeSafe(thread); if (mustBeInitialized(clazzField) == CLASS_LOADING_FAILED || mustBeInitialized(clazzObjectStreamField) == CLASS_LOADING_FAILED ) { return NULL; } if(Class == NULL){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException Class is NULL\n"); return NULL; } clazz = Class2clazz(Class); if(isAssignmentCompatible(clazz, clazzSerializable)){ jfieldID jid = (*env)->GetStaticFieldID(env, Class, "serialPersistentFields", "[Ljava/io/ObjectStreamField;"); if(jid != NULL){ w_instance Field; enterUnsafeRegion(thread); Field = allocInstance(thread, clazzField); enterSafeRegion(thread); if(Field){ w_field field = (w_field)jid; setWotsitField(Field, F_Field_wotsit, field); if(isSet(field->flags, ACC_FINAL | ACC_PRIVATE )){ w_instance OsFields = (*env)->GetStaticObjectField(env, Class, jid); if(OsFields && (OsFields = cloneArray(thread,OsFields))){ w_int i = 0; w_int length = instance2Array_length(OsFields); w_instance * osFields = instance2Array_instance(OsFields); w_word numFields = clazz->numFields; w_field flds = clazz->own_fields; w_word start = clazz->numStaticFields; for( ; i < length ; i++){ w_instance OsField = osFields[i]; w_instance Name; w_string name; w_instance Type; w_clazz type; w_word j; if(!OsField){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d] is NULL\n",i); return NULL; } Name = getReferenceField(OsField, F_ObjectStreamField_name); if(!Name){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d].name is NULL\n",i); return NULL; } name = String2string(Name); Type = getReferenceField(OsField, F_ObjectStreamField_type); if(!Type){ throwNullPointerException(thread); woempa(IO_LEVEL, "Throwing NullPointerException ObjectStreamField[%d].type is NULL\n",i); return NULL; } type = Class2clazz(Type); for(j = start ; j < numFields ; j++){ w_field osfield = flds+j; if(osfield->name == name && osfield->value_clazz == type){ w_instance newField; enterUnsafeRegion(thread); newField = allocInstance(thread, clazzField); enterSafeRegion(thread); if(newField){ setWotsitField(newField, F_Field_wotsit, osfield); setBooleanField(newField, F_AccessibleObject_accessible, WONKA_TRUE); setReferenceField(OsField, newField, F_ObjectStreamField_field); break; } else { return NULL; } } } /** if we don't find the w_field we don't create a Field object ** it's up to the ObjectOutputStream to complain about it !!! */ } } return OsFields; } woempa(9, "found static field serialPersistentFields in %k, but it was not private and final\n",clazz); } else { woempa(IO_LEVEL, "returning Null: failed to create Field\n"); return NULL; } } else { w_int numField = clazz->numFields; w_field flds = clazz->own_fields; w_int i = clazz->numStaticFields; w_int count=0; w_field* prf; (*env)->ExceptionClear(env); prf = allocMem((numField - i) * sizeof(w_field)); if(prf == NULL){ woempa(IO_LEVEL, "returning Null: allocMem failed.\n"); return NULL; } for( ; i < numField ; i++){ if(isNotSet(flds[i].flags, ACC_TRANSIENT | ACC_STATIC)){ prf[count++] = flds+i; } } woempa(IO_LEVEL, "found %d fields to be serialized in %k\n",count,clazz); if(count){ w_clazz array_osfclazz = getNextDimension(clazzObjectStreamField, NULL); w_clazz array_fclazz = getNextDimension(clazzField, NULL); if(array_fclazz && array_osfclazz && mustBeInitialized(array_fclazz) != CLASS_LOADING_FAILED && mustBeInitialized(array_osfclazz) != CLASS_LOADING_FAILED) { enterUnsafeRegion(thread); OSFIELDS = allocArrayInstance_1d(thread, array_osfclazz, count); enterSafeRegion(thread); if(OSFIELDS){ for(i = 0 ; i < count ; i++){ w_instance OSField; w_instance newField; w_field field = prf[i]; w_instance String; w_instance FldClass; enterUnsafeRegion(thread); OSField = allocInstance(thread, clazzObjectStreamField); newField = allocInstance(thread, clazzField); enterSafeRegion(thread); String = getStringInstance(field->name); if (!OSField || !newField || !String) { woempa(9, "Unable to allocate OSField and newField\n"); return NULL; } if(mustBeLoaded(&field->value_clazz) == CLASS_LOADING_FAILED){ break; } FldClass = clazz2Class(field->value_clazz); woempa(IO_LEVEL, "field %i in %k: %w %k \n",i,clazz,field->name,field->value_clazz); if(!OSField && newField){ break; } setWotsitField(newField, F_Field_wotsit, field); setBooleanField(newField, F_AccessibleObject_accessible, WONKA_TRUE); ObjectStreamField_create(env, OSField, String, FldClass); setArrayReferenceField(OSFIELDS, OSField, (w_int) i); setReferenceField(OSField, newField, F_ObjectStreamField_field); } } } } releaseMem(prf); } } return OSFIELDS; }
32.414876
164
0.599867
[ "object" ]
19dd74dbcaa6fa9d3d1929dd307bce7173644595
1,183
h
C
include/openIMUdata.h
akira215/OpenIMUdriver
1d67b53c0c2870c7e9fff24247e82821aaff05f1
[ "MIT" ]
null
null
null
include/openIMUdata.h
akira215/OpenIMUdriver
1d67b53c0c2870c7e9fff24247e82821aaff05f1
[ "MIT" ]
null
null
null
include/openIMUdata.h
akira215/OpenIMUdriver
1d67b53c0c2870c7e9fff24247e82821aaff05f1
[ "MIT" ]
null
null
null
#pragma once #include "openIMUdataTypes.h" #include <map> #include <string> #include <vector> #define CONFIG_FILE "../openimu.json" //TODO move that ! #define USER_MESSAGES "userMessages" #define OUTPUT_PACKETS "outputPackets" //typedef std::variant<uint8_t, uint16_t, uint32_t, uint64_t, float, double, // int8_t, int16_t, int32_t, int64_t, std::string> dataVariant; class OpenIMUdata { public : /* inline constexpr static std::string _types[] = { "uchar", "uint16", "uint32", "uint64", "float", "double", "char","int16","int32","int64", "string" }; */ OpenIMUdata(); ~OpenIMUdata(); void newData(std::string& data); void setPacketType(std::string& packetType); void error(const std::string& msg); private : void clearData(); std::vector<IMUData*> _data_vector; // each data pointer is stored twice std::map<std::string, IMUData*> _data_map; // key :name of data / value uint32_t timeITOW; //msec double time; // s float roll; // rad float pitch; // rad float xRate; // rad/s float yRate; // rad/s float zRate; // rad/s float xAccel; // m/s/s float yAccel; // m/s/s float zAccel; // m/s/s uint8_t opMode; uint8_t linAccSw; uint8_t turnSw; };
24.142857
100
0.685545
[ "vector" ]
19ea61449842850585bc80fcb7c8fc4ff60ee7cf
864
h
C
applications/ParticlesEditor/include/Render/FluidModificatorObserver.h
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
applications/ParticlesEditor/include/Render/FluidModificatorObserver.h
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
applications/ParticlesEditor/include/Render/FluidModificatorObserver.h
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
#pragma once #include <mtt/editorLib/Render/HullDrawableNode.h> #include <mtt/editorLib/Render/Object3DRenderObserver.h> #include <mtt/editorLib/Render/IconDrawableNode.h> class FluidModificator; class FluidModificatorObserver : public mtt::Object3DRenderObserver { Q_OBJECT public: FluidModificatorObserver( FluidModificator& object, const QString &iconFilename, mtt::CommonEditData& commonData); FluidModificatorObserver(const FluidModificatorObserver&) = delete; FluidModificatorObserver& operator = ( const FluidModificatorObserver&) = delete; virtual ~FluidModificatorObserver() noexcept = default; private: void _updateHull() noexcept; private: FluidModificator& _object; mtt::IconDrawableNode _iconNode; mtt::HullDrawableNode _hullNode; };
29.793103
80
0.719907
[ "render", "object" ]
19f29a5f42788c20e35051b6ce194d44feec4cb1
12,170
h
C
cpp/duck/optional.h
lereldarion/duck
dc419c0ec496c1d7e809b6f1b473e03a709c75bd
[ "MIT" ]
null
null
null
cpp/duck/optional.h
lereldarion/duck
dc419c0ec496c1d7e809b6f1b473e03a709c75bd
[ "MIT" ]
null
null
null
cpp/duck/optional.h
lereldarion/duck
dc419c0ec496c1d7e809b6f1b473e03a709c75bd
[ "MIT" ]
null
null
null
#pragma once // In place optional type // STATUS: mature #include <cassert> #include <duck/type_traits.h> #include <utility> namespace duck { // Type tag and global value for "No value" struct NullOpt { constexpr NullOpt () = default; }; constexpr NullOpt nullopt{}; template <typename T> class Optional { /* Optional<T> is similar to the c++17 std::optional<T>. * It conditionally stores in place a T value. * * It behaves like a pointer to data, also for constness: * A const Optional cannot change its state ; however the stored value is mutable. * An Optional<const T> can change its state but not the stored value after creation. * * Moves are considered to change state, so move overloads require a non const && *this. * A moved-from Optional still contains a value (which is moved-from). * * Types that do not support copy/move assignments use destruction+copy/move construction instead. * Non copyable and non movable object should only use emplace(). */ static_assert (!std::is_reference<T>::value, "base Optional<T> does not support references"); public: using value_type = T; // Constructors constexpr Optional () : has_value_ (false) {} constexpr Optional (NullOpt) noexcept : Optional () {} Optional (const Optional & other) : Optional () { if (other) create (*other); } Optional (Optional && other) noexcept : Optional () { if (other) create (*std::move (other)); } Optional (const T & t) : Optional () { create (t); } Optional (T && t) : Optional () { create (std::move (t)); } template <typename... Args> Optional (in_place_t, Args &&... args) : Optional () { create (std::forward<Args> (args)...); } template <typename U, typename... Args> Optional (in_place_t, std::initializer_list<U> ilist, Args &&... args) : Optional () { create (ilist, std::forward<Args> (args)...); } ~Optional () { reset (); } // Assignment Optional & operator= (NullOpt) noexcept { reset (); return *this; } Optional & operator= (const Optional & other) { if (has_value () && other) replace_value_with (*other); else if (!has_value () && other) create (*other); else if (has_value () && !other) destroy (); return *this; } Optional & operator= (Optional && other) noexcept { if (has_value () && other) replace_value_with (std::move (*other)); else if (!has_value () && other) create (std::move (*other)); else if (has_value () && !other) destroy (); return *this; } Optional & operator= (const T & t) { if (has_value ()) replace_value_with (t); else create (t); return *this; } Optional & operator= (T && t) noexcept { if (has_value ()) replace_value_with (std::move (t)); else create (std::move (t)); return *this; } // Status constexpr bool has_value () const noexcept { return has_value_; } constexpr explicit operator bool () const noexcept { return has_value (); } // Unchecked access T & value () const & noexcept { assert (has_value ()); return *value_ptr (); } T && value () && noexcept { assert (has_value ()); return std::move (*value_ptr ()); } T * operator-> () const noexcept { return value_ptr (); } T & operator* () const & noexcept { return value (); } T && operator* () && noexcept { return std::move (*this).value (); } // Modifiers void reset () noexcept { if (has_value ()) destroy (); } template <typename... Args> T & emplace (Args &&... args) { reset (); create (std::forward<Args> (args)...); return value (); } template <typename U, typename... Args> T & emplace (std::initializer_list<U> ilist, Args &&... args) { reset (); create (ilist, std::forward<Args> (args)...); return value (); } void swap (Optional & other) noexcept { using std::swap; if (has_value () && other) { swap (value (), other.value ()); } else if (!has_value () && other) { create (std::move (*other)); other.destroy (); } else if (has_value () && !other) { other.create (std::move (value ())); destroy (); } } // Access with default template <typename U> constexpr T value_or (U && default_value) const & { return has_value () ? value () : static_cast<T> (std::forward<U> (default_value)); } template <typename U> T value_or (U && default_value) && { return has_value () ? std::move (*this).value () : static_cast<T> (std::forward<U> (default_value)); } // Access with generated default template <typename Callable> T value_or_generate (Callable && callable) const & { return has_value () ? value () : std::forward<Callable> (callable) (); } template <typename Callable> T value_or_generate (Callable && callable) && { return has_value () ? std::move (*this).value () : std::forward<Callable> (callable) (); } // Map : Optional<T> -> Optional<U> with f : T -> U template <typename Callable, typename ReturnType = invoke_result_t<Callable, const T &>> Optional<ReturnType> map (Callable && callable) const & { if (has_value ()) return std::forward<Callable> (callable) (value ()); else return {}; } template <typename Callable, typename ReturnType = invoke_result_t<Callable, T &&>> Optional<ReturnType> map (Callable && callable) && { if (has_value ()) return std::forward<Callable> (callable) (std::move (*this).value ()); else return {}; } // Filter : Optional<T> -> Optional<T>, propagate value if p(value), or return NullOpt template <typename Predicate> Optional filter (Predicate && predicate) const & { if (has_value () && std::forward<Predicate> (predicate) (value ())) return *this; else return {}; } template <typename Predicate> Optional filter (Predicate && predicate) && { if (has_value () && std::forward<Predicate> (predicate) (value ())) return std::move (*this); else return {}; } // Cast : Optional<T> -> Optional<U>. TODO improve useability template <typename U> Optional<U> cast () const & { if (has_value ()) return static_cast<U> (value ()); else return {}; } template <typename U> Optional<U> cast () && { if (has_value ()) return static_cast<U> (std::move (*this).value ()); else return {}; } private: template <typename... Args> void create (Args &&... args) { assert (!has_value_); new (&storage_) T (std::forward<Args> (args)...); has_value_ = true; } void destroy () noexcept { assert (has_value_); value_ptr ()->~T (); has_value_ = false; } // Implement replace using assignment operators if possible, or destroy+constructor template <typename U> void replace_value_with (U && u) { replace_value_with_helper (std::forward<U> (u), std::is_assignable<T, U>{}); } template <typename U> void replace_value_with_helper (U && u, std::true_type) { value () = std::forward<U> (u); } template <typename U> void replace_value_with_helper (U && u, std::false_type) { destroy (); create (std::forward<U> (u)); } // Storage is "mutable" to support muting the object if the optional is const T * value_ptr () const noexcept { return reinterpret_cast<T *> (&storage_); } mutable aligned_storage_t<sizeof (T), alignof (T)> storage_; bool has_value_; }; template <typename T> class Optional<T &> { /* Specialisation for references. * This specialisation has the same semantics as a pointer. * * Copy and moves just copy the pointer/reference. * Access returns the reference itself, so operator-> will modify the referenced object. * The reference can be modified by assignment and the same modifiers as the main class. * All modifiers bind to both T & and T * for convenience. */ public: using value_type = T &; // Constructors constexpr Optional () = default; constexpr Optional (NullOpt) noexcept : Optional () {} constexpr Optional (const Optional &) = default; constexpr Optional (Optional &&) = default; constexpr Optional (std::nullptr_t) noexcept : Optional () {} constexpr Optional (T * t) noexcept : pointer_ (t) {} constexpr Optional (T & t) noexcept : Optional (&t) {} ~Optional () = default; // Assignment Optional & operator= (NullOpt) noexcept { reset (); return *this; } Optional & operator= (const Optional &) = default; Optional & operator= (Optional &&) = default; Optional & operator= (std::nullptr_t) noexcept { pointer_ = nullptr; return *this; } Optional & operator= (T * t) { pointer_ = t; return *this; } Optional & operator= (T & t) { return *this = &t; } // Status constexpr bool has_value () const noexcept { return pointer_ != nullptr; } constexpr explicit operator bool () const noexcept { return has_value (); } // Unchecked access T & value () const noexcept { assert (has_value ()); return *pointer_; } T * operator-> () const noexcept { return pointer_; } T & operator* () const noexcept { return value (); } // Modifiers void reset () noexcept { pointer_ = nullptr; } void emplace (T * t) noexcept { pointer_ = t; } void emplace (T & t) noexcept { emplace (&t); } void swap (Optional & other) noexcept { using std::swap; swap (pointer_, other.pointer_); } // Access with default constexpr T & value_or (T & default_ref) const { return has_value () ? value () : default_ref; } // Access with generated default template <typename Callable> constexpr T & value_or_generate (Callable && callable) const { return has_value () ? value () : std::forward<Callable> (callable) (); } // Map : Optional<T &> -> Optional<U> with f : T & -> U template <typename Callable, typename ReturnType = invoke_result_t<Callable, T &>> Optional<ReturnType> map (Callable && callable) const { if (has_value ()) return std::forward<Callable> (callable) (value ()); else return {}; } // Filter : Optional<T &> -> Optional<T &>, propagate ref if p(ref), or return NullOpt template <typename Predicate> Optional filter (Predicate && predicate) const { if (has_value () && std::forward<Predicate> (predicate) (value ())) return *this; else return {}; } // Cast : Optional<T &> -> Optional<U> template <typename U> Optional<U> cast () const { if (has_value ()) return static_cast<U> (value ()); else return {}; } private: T * pointer_{nullptr}; }; /* a | b -> returns a if a, or b. * Both a and b are evaluated (no operator|| lazy semantics). * If both a and b are the same kind of reference (lvalue/rvalue), just return the reference. * If reference kind differs, an intermediate Optional<T> is built from the right refs. */ template <typename T> const Optional<T> & operator| (const Optional<T> & a, const Optional<T> & b) noexcept { return a ? a : b; } template <typename T> Optional<T> && operator| (Optional<T> && a, Optional<T> && b) noexcept { return a ? std::move (a) : std::move (b); } template <typename T> Optional<T> operator| (const Optional<T> & a, Optional<T> && b) { return a ? a : std::move (b); } template <typename T> Optional<T> operator| (Optional<T> && a, const Optional<T> & b) { return a ? std::move (a) : b; } // Overloads ending with plain object ("true" optional) template <typename T> T operator| (const Optional<T> & a, const T & b) { return a.value_or (b); } template <typename T> T operator| (Optional<T> && a, const T & b) { return std::move (a).value_or (b); } template <typename T> T operator| (const Optional<T> & a, T && b) { return a.value_or (std::move (b)); } template <typename T> T operator| (Optional<T> && a, T && b) { return std::move (a).value_or (std::move (b)); } /* Call find(key) on an associative container, return the result as an optional. * Intended to avoid comparing the iterator with end(). */ template <typename Container, typename Key> Optional<typename Container::mapped_type &> optional_find (Container & container, const Key & key) { auto it = container.find (key); if (it != container.end ()) return it->second; else return {}; } template <typename Container, typename Key> Optional<const typename Container::mapped_type &> optional_find (const Container & container, const Key & key) { auto it = container.find (key); if (it != container.end ()) return it->second; else return {}; } } // namespace duck
31.61039
100
0.650781
[ "object" ]
19f2dbe493441ff4f625ec387bbecf85499cf416
442
h
C
VGP334/19_HelloFABRIK/GameState.h
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
VGP334/19_HelloFABRIK/GameState.h
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
VGP334/19_HelloFABRIK/GameState.h
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
#pragma once #include <JimmyGodEngine/Inc/JimmyGodEngine.h> class GameState : public JimmyGod::AppState { public: void Initialize() override; void Terminate() override; void Update(float deltaTime) override; void Render() override; void DebugUI() override; private: JimmyGod::Math::Vector3 mTarget; std::vector<JimmyGod::Math::Vector3> mPoints; JimmyGod::Graphics::Camera mCamera; float mTime = 0.0f; };
19.217391
47
0.708145
[ "render", "vector" ]
c204ad0d4808b3f9803339632db9894dc0f064f8
2,672
h
C
Example/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h
shsteven/YapDatabaseObject-CloudKit
ceea3d47880f23aa6182752040a311e7795e9a58
[ "MIT" ]
2
2015-12-03T04:21:03.000Z
2017-05-12T21:59:14.000Z
Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h
douli9862/hls-ios-Example
bc5dbb4a909a79c23a4a7450c738671e358cbf7e
[ "Apache-2.0" ]
null
null
null
Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h
douli9862/hls-ios-Example
bc5dbb4a909a79c23a4a7450c738671e358cbf7e
[ "Apache-2.0" ]
null
null
null
#import <Foundation/Foundation.h> /** * A YapDatabaseQuery is used to pass SQL style queries into various extension classes. * The query that you pass represents everything after the SELECT clause of a query. * * For example: * query = [YapDatabaseQuery queryWithFormat:@"WHERE department = ? AND salary >= ?", deptStr, @(minSalary)]; * [secondaryIndex enumerateKeysAndObjectsMatchingQuery:query * usingBlock:^(NSString *collection, NSString *key, id object, BOOL *stop){ * ... * }]; * * Methods that take YapDatabaseQuery parameters will automatically prefix your query string with * the proper 'SELECT' clause. So it may get expanded to something like this: * * @"SELECT rowid FROM 'database' WHERE department = ? AND salary >= ?" * * YapDatabaseQuery supports the following types as query parameters: * - NSNumber * - NSDate (automatically converted to double via timeIntervalSinceReferenceDate) * - NSString * - NSArray (of any regular type above) * * Example 2: * * NSArray *departments = [self engineeringDepartments]; * query = [YapDatabaseQuery queryWithFormat:@"WHERE title = ? AND department IN (?)", @"manager", departments]; **/ @interface YapDatabaseQuery : NSObject /** * A YapDatabaseQuery is everything after the SELECT clause of a query. * Thus they generally start with "WHERE ...". * * Please note that you can ONLY pass objects as parameters. * Primitive types such as int, float, double, etc are NOT supported. * You MUST wrap these using NSNumber. **/ + (instancetype)queryWithFormat:(NSString *)format, ...; /** * Alternative initializer if you have a prepared va_list. * * Swift note: * You may prefer to use 'queryWithString:(NSString *)queryString parameters:(NSArray *)queryParameters' instead. * * Alternatively, define the following somewhere in your Swift code: * * extension YapDatabaseQuery { * class func queryWithFormat(format: String, _ arguments: CVarArgType...) -> YapDatabaseQuery? { * return withVaList(arguments, { YapDatabaseQuery(format: format, arguments: $0) }) * } * } **/ + (instancetype)queryWithFormat:(NSString *)format arguments:(va_list)arguments; /** * Alternative initializer - generally preferred for Swift code. **/ + (instancetype)queryWithString:(NSString *)queryString parameters:(NSArray *)queryParameters; /** * Shorthand for a query with no 'WHERE' clause. * Equivalent to [YapDatabaseQuery queryWithFormat:@""]. **/ + (instancetype)queryMatchingAll; @property (nonatomic, strong, readonly) NSString *queryString; @property (nonatomic, strong, readonly) NSArray *queryParameters; @end
36.108108
118
0.715195
[ "object" ]
c2056f4b0e8709394c2a01a66396a6ae5803d4d4
28,357
h
C
3rdparty/lbfgs/ap.h
topiolli/into
f0a47736f5c93dd32e89e7aad34152ae1afc5583
[ "BSD-3-Clause" ]
14
2015-01-19T22:14:18.000Z
2020-04-13T23:27:20.000Z
3rdparty/lbfgs/ap.h
topiolli/into
f0a47736f5c93dd32e89e7aad34152ae1afc5583
[ "BSD-3-Clause" ]
null
null
null
3rdparty/lbfgs/ap.h
topiolli/into
f0a47736f5c93dd32e89e7aad34152ae1afc5583
[ "BSD-3-Clause" ]
14
2015-01-16T05:43:15.000Z
2019-01-29T07:57:11.000Z
/******************************************************************** AP library. See www.alglib.net or alglib.sources.ru for details. ********************************************************************/ #ifndef AP_H #define AP_H #include <stdlib.h> #include <math.h> /******************************************************************** Checking of the array boundaries mode. ********************************************************************/ //#define NO_AP_ASSERT #define AP_ASSERT #ifndef AP_ASSERT #define NO_AP_ASSERT #endif #ifdef NO_AP_ASSERT #ifdef AP_ASSERT #undef NO_AP_ASSERT #endif #endif /******************************************************************** This symbol is used for debugging. Do not define it and do not remove comments. ********************************************************************/ //#define UNSAFE_MEM_COPY /******************************************************************** Namespace of a standard library AlgoPascal. ********************************************************************/ namespace ap { /******************************************************************** Exception class. ********************************************************************/ class ap_error { public: static void make_assertion(bool bClause) { if(!bClause) throw ap_error(); }; private: }; /******************************************************************** Class defining a complex number with double precision. ********************************************************************/ class complex; class complex { public: complex():x(0.0),y(0.0){}; complex(const double &_x):x(_x),y(0.0){}; complex(const double &_x, const double &_y):x(_x),y(_y){}; complex(const complex &z):x(z.x),y(z.y){}; complex& operator= (const double& v){ x = v; y = 0.0; return *this; }; complex& operator+=(const double& v){ x += v; return *this; }; complex& operator-=(const double& v){ x -= v; return *this; }; complex& operator*=(const double& v){ x *= v; y *= v; return *this; }; complex& operator/=(const double& v){ x /= v; y /= v; return *this; }; complex& operator= (const complex& z){ x = z.x; y = z.y; return *this; }; complex& operator+=(const complex& z){ x += z.x; y += z.y; return *this; }; complex& operator-=(const complex& z){ x -= z.x; y -= z.y; return *this; }; complex& operator*=(const complex& z){ double t = x*z.x-y*z.y; y = x*z.y+y*z.x; x = t; return *this; }; complex& operator/=(const complex& z) { ap::complex result; double e; double f; if( fabs(z.y)<fabs(z.x) ) { e = z.y/z.x; f = z.x+z.y*e; result.x = (z.x+z.y*e)/f; result.y = (z.y-z.x*e)/f; } else { e = z.x/z.y; f = z.y+z.x*e; result.x = (z.y+z.x*e)/f; result.y = (-z.x+z.y*e)/f; } *this = result; return *this; }; double x, y; }; complex operator/(const complex& lhs, const complex& rhs); bool operator==(const complex& lhs, const complex& rhs); bool operator!=(const complex& lhs, const complex& rhs); complex operator+(const complex& lhs); complex operator-(const complex& lhs); complex operator+(const complex& lhs, const complex& rhs); complex operator+(const complex& lhs, const double& rhs); complex operator+(const double& lhs, const complex& rhs); complex operator-(const complex& lhs, const complex& rhs); complex operator-(const complex& lhs, const double& rhs); complex operator-(const double& lhs, const complex& rhs); complex operator*(const complex& lhs, const complex& rhs); complex operator*(const complex& lhs, const double& rhs); complex operator*(const double& lhs, const complex& rhs); complex operator/(const complex& lhs, const complex& rhs); complex operator/(const double& lhs, const complex& rhs); complex operator/(const complex& lhs, const double& rhs); double abscomplex(const complex &z); complex conj(const complex &z); complex csqr(const complex &z); /******************************************************************** Template defining vector in memory. It is used by the basic subroutines of linear algebra. Vector consists of Length elements of type T, starting from an element, which Data is pointed to. Interval between adjacent elements equals the value of Step. The class provides an access for reading only. ********************************************************************/ template<class T> class const_raw_vector { public: const_raw_vector(const T *Data, int Length, int Step): pData(const_cast<T*>(Data)),iLength(Length),iStep(Step){}; const T* GetData() const { return pData; }; int GetLength() const { return iLength; }; int GetStep() const { return iStep; }; protected: T *pData; int iLength, iStep; }; /******************************************************************** Template defining vector in memory, derived from const_raw_vector. It is used by the basic subroutines of linear algebra. Vector consists of Length elements of type T, starting from an element, which Data is pointed to. Interval between adjacent elements equals the value of Step. The class provides an access both for reading and writing. ********************************************************************/ template<class T> class raw_vector : public const_raw_vector<T> { public: raw_vector(T *Data, int Length, int Step):const_raw_vector<T>(Data, Length, Step){}; T* GetData() { return const_raw_vector<T>::pData; }; }; /******************************************************************** Scalar product ********************************************************************/ template<class T> T vdotproduct(const_raw_vector<T> v1, const_raw_vector<T> v2) { ap_error::make_assertion(v1.GetLength()==v2.GetLength()); if( v1.GetStep()==1 && v2.GetStep()==1 ) { // // fast // T r = 0; const T *p1 = v1.GetData(); const T *p2 = v2.GetData(); int imax = v1.GetLength()/4; int i; for(i=imax; i!=0; i--) { r += (*p1)*(*p2) + p1[1]*p2[1] + p1[2]*p2[2] + p1[3]*p2[3]; p1+=4; p2+=4; } for(i=0; i<v1.GetLength()%4; i++) r += (*(p1++))*(*(p2++)); return r; } else { // // general // int offset11 = v1.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = v2.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T r = 0; const T *p1 = v1.GetData(); const T *p2 = v2.GetData(); int imax = v1.GetLength()/4; int i; for(i=0; i<imax; i++) { r += (*p1)*(*p2) + p1[offset11]*p2[offset21] + p1[offset12]*p2[offset22] + p1[offset13]*p2[offset23]; p1+=offset14; p2+=offset24; } for(i=0; i<v1.GetLength()%4; i++) { r += (*p1)*(*p2); p1+=offset11; p2+=offset21; } return r; } } /******************************************************************** Copy one vector into another ********************************************************************/ template<class T> void vmove(raw_vector<T> vdst, const_raw_vector<T> vsrc) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/2; int i; for(i=imax; i!=0; i--) { *p1 = *p2; p1[1] = p2[1]; p1 += 2; p2 += 2; } if(vdst.GetLength()%2 != 0) *p1 = *p2; return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 = *p2; p1[offset11] = p2[offset21]; p1[offset12] = p2[offset22]; p1[offset13] = p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 = *p2; p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Copy one vector multiplied by -1 into another. ********************************************************************/ template<class T> void vmoveneg(raw_vector<T> vdst, const_raw_vector<T> vsrc) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/2; int i; for(i=0; i<imax; i++) { *p1 = -*p2; p1[1] = -p2[1]; p1 += 2; p2 += 2; } if(vdst.GetLength()%2 != 0) *p1 = -*p2; return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 = -*p2; p1[offset11] = -p2[offset21]; p1[offset12] = -p2[offset22]; p1[offset13] = -p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 = -*p2; p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Copy one vector multiplied by a number into another vector. ********************************************************************/ template<class T, class T2> void vmove(raw_vector<T> vdst, const_raw_vector<T> vsrc, T2 alpha) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 = alpha*(*p2); p1[1] = alpha*p2[1]; p1[2] = alpha*p2[2]; p1[3] = alpha*p2[3]; p1 += 4; p2 += 4; } for(i=0; i<vdst.GetLength()%4; i++) *(p1++) = alpha*(*(p2++)); return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 = alpha*(*p2); p1[offset11] = alpha*p2[offset21]; p1[offset12] = alpha*p2[offset22]; p1[offset13] = alpha*p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 = alpha*(*p2); p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Vector addition ********************************************************************/ template<class T> void vadd(raw_vector<T> vdst, const_raw_vector<T> vsrc) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 += *p2; p1[1] += p2[1]; p1[2] += p2[2]; p1[3] += p2[3]; p1 += 4; p2 += 4; } for(i=0; i<vdst.GetLength()%4; i++) *(p1++) += *(p2++); return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 += *p2; p1[offset11] += p2[offset21]; p1[offset12] += p2[offset22]; p1[offset13] += p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 += *p2; p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Add one vector multiplied by a number to another vector. ********************************************************************/ template<class T, class T2> void vadd(raw_vector<T> vdst, const_raw_vector<T> vsrc, T2 alpha) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 += alpha*(*p2); p1[1] += alpha*p2[1]; p1[2] += alpha*p2[2]; p1[3] += alpha*p2[3]; p1 += 4; p2 += 4; } for(i=0; i<vdst.GetLength()%4; i++) *(p1++) += alpha*(*(p2++)); return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 += alpha*(*p2); p1[offset11] += alpha*p2[offset21]; p1[offset12] += alpha*p2[offset22]; p1[offset13] += alpha*p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 += alpha*(*p2); p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Vector subtraction ********************************************************************/ template<class T> void vsub(raw_vector<T> vdst, const_raw_vector<T> vsrc) { ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 -= *p2; p1[1] -= p2[1]; p1[2] -= p2[2]; p1[3] -= p2[3]; p1 += 4; p2 += 4; } for(i=0; i<vdst.GetLength()%4; i++) *(p1++) -= *(p2++); return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; T *p1 = vdst.GetData(); const T *p2 = vsrc.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 -= *p2; p1[offset11] -= p2[offset21]; p1[offset12] -= p2[offset22]; p1[offset13] -= p2[offset23]; p1 += offset14; p2 += offset24; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 -= *p2; p1 += vdst.GetStep(); p2 += vsrc.GetStep(); } return; } } /******************************************************************** Subtract one vector multiplied by a number from another vector. ********************************************************************/ template<class T, class T2> void vsub(raw_vector<T> vdst, const_raw_vector<T> vsrc, T2 alpha) { vadd(vdst, vsrc, -alpha); } /******************************************************************** In-place vector multiplication ********************************************************************/ template<class T, class T2> void vmul(raw_vector<T> vdst, T2 alpha) { if( vdst.GetStep()==1 ) { // // fast // T *p1 = vdst.GetData(); int imax = vdst.GetLength()/4; int i; for(i=imax; i!=0; i--) { *p1 *= alpha; p1[1] *= alpha; p1[2] *= alpha; p1[3] *= alpha; p1 += 4; } for(i=0; i<vdst.GetLength()%4; i++) *(p1++) *= alpha; return; } else { // // general // int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; T *p1 = vdst.GetData(); int imax = vdst.GetLength()/4; int i; for(i=0; i<imax; i++) { *p1 *= alpha; p1[offset11] *= alpha; p1[offset12] *= alpha; p1[offset13] *= alpha; p1 += offset14; } for(i=0; i<vdst.GetLength()%4; i++) { *p1 *= alpha; p1 += vdst.GetStep(); } return; } } /******************************************************************** Template of a dynamical one-dimensional array ********************************************************************/ template<class T> class template_1d_array { public: template_1d_array() { m_Vec=0; m_iVecSize = 0; }; ~template_1d_array() { if(m_Vec) delete[] m_Vec; }; template_1d_array(const template_1d_array &rhs) { m_iVecSize = rhs.m_iVecSize; m_iLow = rhs.m_iLow; m_iHigh = rhs.m_iHigh; if(rhs.m_Vec) { m_Vec = new T[m_iVecSize]; #ifndef UNSAFE_MEM_COPY for(int i=0; i<m_iVecSize; i++) m_Vec[i] = rhs.m_Vec[i]; #else memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T)); #endif } else m_Vec=0; }; const template_1d_array& operator=(const template_1d_array &rhs) { if( this==&rhs ) return *this; m_iLow = rhs.m_iLow; m_iHigh = rhs.m_iHigh; m_iVecSize = rhs.m_iVecSize; if(m_Vec) delete[] m_Vec; if(rhs.m_Vec) { m_Vec = new T[m_iVecSize]; #ifndef UNSAFE_MEM_COPY for(int i=0; i<m_iVecSize; i++) m_Vec[i] = rhs.m_Vec[i]; #else memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T)); #endif } else m_Vec=0; return *this; }; const T& operator()(int i) const { #ifndef NO_AP_ASSERT ap_error::make_assertion(i>=m_iLow && i<=m_iHigh); #endif return m_Vec[ i-m_iLow ]; }; T& operator()(int i) { #ifndef NO_AP_ASSERT ap_error::make_assertion(i>=m_iLow && i<=m_iHigh); #endif return m_Vec[ i-m_iLow ]; }; void setbounds( int iLow, int iHigh ) { if(m_Vec) delete[] m_Vec; m_iLow = iLow; m_iHigh = iHigh; m_iVecSize = iHigh-iLow+1; m_Vec = new T[m_iVecSize]; }; void setcontent( int iLow, int iHigh, const T *pContent ) { setbounds(iLow, iHigh); for(int i=iLow; i<=iHigh; i++) (*this)(i) = pContent[i-iLow]; }; T* getcontent() { return m_Vec; }; const T* getcontent() const { return m_Vec; }; int getlowbound(int iBoundNum = 0) const { return m_iLow; }; int gethighbound(int iBoundNum = 0) const { return m_iHigh; }; int getvecsize() const { return m_iVecSize; }; raw_vector<T> getvector(int iStart, int iEnd) { if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) ) return raw_vector<T>(0, 0, 1); else return raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1); }; const_raw_vector<T> getvector(int iStart, int iEnd) const { if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) ) return const_raw_vector<T>(0, 0, 1); else return const_raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1); }; private: bool wrongIdx(int i) const { return i<m_iLow || i>m_iHigh; }; T *m_Vec; long m_iVecSize; long m_iLow, m_iHigh; }; /******************************************************************** Template of a dynamical two-dimensional array ********************************************************************/ template<class T> class template_2d_array { public: template_2d_array() { m_Vec=0; m_iVecSize=0; }; ~template_2d_array() { if(m_Vec) delete[] m_Vec; }; template_2d_array(const template_2d_array &rhs) { m_iVecSize = rhs.m_iVecSize; m_iLow1 = rhs.m_iLow1; m_iLow2 = rhs.m_iLow2; m_iHigh1 = rhs.m_iHigh1; m_iHigh2 = rhs.m_iHigh2; m_iConstOffset = rhs.m_iConstOffset; m_iLinearMember = rhs.m_iLinearMember; if(rhs.m_Vec) { m_Vec = new T[m_iVecSize]; #ifndef UNSAFE_MEM_COPY for(int i=0; i<m_iVecSize; i++) m_Vec[i] = rhs.m_Vec[i]; #else memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T)); #endif } else m_Vec=0; }; const template_2d_array& operator=(const template_2d_array &rhs) { if( this==&rhs ) return *this; m_iLow1 = rhs.m_iLow1; m_iLow2 = rhs.m_iLow2; m_iHigh1 = rhs.m_iHigh1; m_iHigh2 = rhs.m_iHigh2; m_iConstOffset = rhs.m_iConstOffset; m_iLinearMember = rhs.m_iLinearMember; m_iVecSize = rhs.m_iVecSize; if(m_Vec) delete[] m_Vec; if(rhs.m_Vec) { m_Vec = new T[m_iVecSize]; #ifndef UNSAFE_MEM_COPY for(int i=0; i<m_iVecSize; i++) m_Vec[i] = rhs.m_Vec[i]; #else memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T)); #endif } else m_Vec=0; return *this; }; const T& operator()(int i1, int i2) const { #ifndef NO_AP_ASSERT ap_error::make_assertion(i1>=m_iLow1 && i1<=m_iHigh1); ap_error::make_assertion(i2>=m_iLow2 && i2<=m_iHigh2); #endif return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember]; }; T& operator()(int i1, int i2) { #ifndef NO_AP_ASSERT ap_error::make_assertion(i1>=m_iLow1 && i1<=m_iHigh1); ap_error::make_assertion(i2>=m_iLow2 && i2<=m_iHigh2); #endif return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember]; }; void setbounds( int iLow1, int iHigh1, int iLow2, int iHigh2 ) { if(m_Vec) delete[] m_Vec; m_iVecSize = (iHigh1-iLow1+1)*(iHigh2-iLow2+1); m_Vec = new T[m_iVecSize]; m_iLow1 = iLow1; m_iHigh1 = iHigh1; m_iLow2 = iLow2; m_iHigh2 = iHigh2; m_iConstOffset = -m_iLow2-m_iLow1*(m_iHigh2-m_iLow2+1); m_iLinearMember = (m_iHigh2-m_iLow2+1); }; void setcontent( int iLow1, int iHigh1, int iLow2, int iHigh2, const T *pContent ) { setbounds(iLow1, iHigh1, iLow2, iHigh2); for(int i=0; i<m_iVecSize; i++) m_Vec[i]=pContent[i]; }; T* getcontent() { return m_Vec; }; const T* getcontent() const { return m_Vec; }; int getlowbound(int iBoundNum) const { return iBoundNum==1 ? m_iLow1 : m_iLow2; }; int gethighbound(int iBoundNum) const { return iBoundNum==1 ? m_iHigh1 : m_iHigh2; }; raw_vector<T> getcolumn(int iColumn, int iRowStart, int iRowEnd) { if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) ) return raw_vector<T>(0, 0, 1); else return raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember); }; raw_vector<T> getrow(int iRow, int iColumnStart, int iColumnEnd) { if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd)) return raw_vector<T>(0, 0, 1); else return raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1); }; const_raw_vector<T> getcolumn(int iColumn, int iRowStart, int iRowEnd) const { if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) ) return const_raw_vector<T>(0, 0, 1); else return const_raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember); }; const_raw_vector<T> getrow(int iRow, int iColumnStart, int iColumnEnd) const { if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd)) return const_raw_vector<T>(0, 0, 1); else return const_raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1); }; private: bool wrongRow(int i) const { return i<m_iLow1 || i>m_iHigh1; }; bool wrongColumn(int j) const { return j<m_iLow2 || j>m_iHigh2; }; T *m_Vec; long m_iVecSize; long m_iLow1, m_iLow2, m_iHigh1, m_iHigh2; long m_iConstOffset, m_iLinearMember; }; typedef template_1d_array<int> integer_1d_array; typedef template_1d_array<double> real_1d_array; typedef template_1d_array<complex> complex_1d_array; typedef template_1d_array<bool> boolean_1d_array; typedef template_2d_array<int> integer_2d_array; typedef template_2d_array<double> real_2d_array; typedef template_2d_array<complex> complex_2d_array; typedef template_2d_array<bool> boolean_2d_array; /******************************************************************** Constants and functions introduced for compatibility with AlgoPascal ********************************************************************/ extern const double machineepsilon; extern const double maxrealnumber; extern const double minrealnumber; int sign(double x); double randomreal(); int randominteger(int maxv); int round(double x); int trunc(double x); int ifloor(double x); int iceil(double x); double pi(); double sqr(double x); int maxint(int m1, int m2); int minint(int m1, int m2); double maxreal(double m1, double m2); double minreal(double m1, double m2); };//namespace ap #endif
27.99309
113
0.478012
[ "vector" ]
c2068fd00ec6dfee5360c0d7d11fd6a203b9b0dd
1,153
h
C
DataStructures/GTFS/Entities/Stop.h
kit-algo/ULTRA-Transfer-Time
49b6ed196daf64269f1521052d9dced0447521e2
[ "MIT" ]
null
null
null
DataStructures/GTFS/Entities/Stop.h
kit-algo/ULTRA-Transfer-Time
49b6ed196daf64269f1521052d9dced0447521e2
[ "MIT" ]
null
null
null
DataStructures/GTFS/Entities/Stop.h
kit-algo/ULTRA-Transfer-Time
49b6ed196daf64269f1521052d9dced0447521e2
[ "MIT" ]
null
null
null
#pragma once #include <iostream> #include <vector> #include <string> #include "../../Geometry/Point.h" #include "../../../Helpers/IO/Serialization.h" namespace GTFS { class Stop { public: Stop(const std::string& stopId = "", const std::string& name = "", const Geometry::Point& coordinates = Geometry::Point()) : stopId(stopId), name(name), coordinates(coordinates) { } Stop(IO::Deserialization& deserialize) { this->deserialize(deserialize); } inline bool validate() noexcept { if (name.empty()) name = "NOT_NAMED"; return !stopId.empty(); } friend std::ostream& operator<<(std::ostream& out, const Stop& s) { return out << "Stop{" << s.stopId << ", " << s.name << ", " << s.coordinates << "}"; } inline void serialize(IO::Serialization& serialize) const noexcept { serialize(stopId, name, coordinates); } inline void deserialize(IO::Deserialization& deserialize) noexcept { deserialize(stopId, name, coordinates); } public: std::string stopId{""}; std::string name{""}; Geometry::Point coordinates{}; }; }
23.530612
128
0.605377
[ "geometry", "vector" ]
c20de76e6473b1a1f2841b446ca87d10953fafb6
1,933
h
C
BibleStudyGui/UIStarredVersesWidget.h
joshpeterson/BibleStudy
178239d3ee51cd8e341f807618dacc24a1b1b4be
[ "BSL-1.0" ]
1
2019-06-10T02:48:49.000Z
2019-06-10T02:48:49.000Z
BibleStudyGui/UIStarredVersesWidget.h
joshpeterson/BibleStudy
178239d3ee51cd8e341f807618dacc24a1b1b4be
[ "BSL-1.0" ]
null
null
null
BibleStudyGui/UIStarredVersesWidget.h
joshpeterson/BibleStudy
178239d3ee51cd8e341f807618dacc24a1b1b4be
[ "BSL-1.0" ]
null
null
null
#ifndef __UI_STARRED_VERSES_WIDGET_H #define __UI_STARRED_VERSES_WIDGET_H #include <QWidget> #include <QAbstractItemModel> #include <boost/shared_ptr.hpp> class QListView; namespace BibleDatabase { class VerseDisplay; } namespace BibleStudyGui { class StarredVersesModel; //! This class is an implementation of a view from the Qt Model/View framework for a list view which represents the verses the user has starred. class UIStarredVersesWidget : public QWidget { Q_OBJECT public: //! Create a new instance of the UIStarredVersesWidget class. UIStarredVersesWidget(boost::shared_ptr<StarredVersesModel> starred_verses_model, QWidget* parent = 0); //! Listen to and process key presses. void keyPressEvent(QKeyEvent* key_event); public slots: //! Add a verse to the collection of starred verses. void add_starred_verse(boost::shared_ptr<BibleDatabase::VerseDisplay> verse); //! Remove a verse from the collection of starred verses. void remove_starred_verse(boost::shared_ptr<BibleDatabase::VerseDisplay> verse); //! Get the verse at the given index and emit the verse_display_changed signal for that verse. void display_verse_text(const QModelIndex& index); //! Copies the selected verses in the starred verses to the clipboard. void copy_selected_verses(); //! Select all starred verses. void select_all_verses(); //! Build and display context menu when the user right clicks on the search results. void display_starred_verses_context_menu(const QPoint& position); signals: //! Signal other widgets that a new verse should be displayed. void verse_display_changed(boost::shared_ptr<BibleDatabase::VerseDisplay> verse); private: QListView* m_starred_verses_view; boost::shared_ptr<StarredVersesModel> m_starred_verses_model; }; } #endif // __UI_STARRED_VERSES_WIDGET_H
30.68254
145
0.744956
[ "model" ]
c20f3e70fbc9a82f6e4272b38adbbac9553b6b1a
14,439
h
C
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskToyModel.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
114
2017-03-03T09:12:23.000Z
2022-03-03T20:29:42.000Z
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskToyModel.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
19,637
2017-01-16T12:34:41.000Z
2022-03-31T22:02:40.000Z
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskToyModel.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
1,021
2016-07-14T22:41:16.000Z
2022-03-31T05:15:51.000Z
#ifndef ALIANALYSISTASKTOYMODEL_CXX #define ALIANALYSISTASKTOYMODEL_CXX // Analysis task for a simple toy model, currently used for the // balance function // Authors: Panos Christakoglou@nikhef.nl class TList; class TH1F; class TH2F; class TH3F; class TF1; class TLorentzVector; class AliBalancePsi; class AliEventPoolManager; class AliAnalysisTaskToyModel : public TObject { public: AliAnalysisTaskToyModel(); virtual ~AliAnalysisTaskToyModel(); virtual void Init(); virtual void CreateOutputObjects(); virtual void Run(Int_t nEvents); virtual void FinishOutput(); void SetDebugFlag() {fUseDebug = kTRUE;} void SetAnalysisObject(AliBalancePsi *const analysis) { fBalance = analysis; } void SetShufflingObject(AliBalancePsi *const analysisShuffled) { fRunShuffling = kTRUE; fShuffledBalance = analysisShuffled; } void SetMixingObject(AliBalancePsi *const analysisMixed) { fRunMixing = kTRUE; fMixedBalance = analysisMixed; } //============Toy model: List of setters============// void SetTotalMultiplicity(Double_t mean, Double_t sigma) { fTotalMultiplicityMean = mean; fTotalMultiplicitySigma = sigma;} void SetNetCharge(Double_t mean, Double_t sigma) { fNetChargeMean = mean; fNetChargeSigma = sigma;} //Acceptance void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax, Double_t etamin, Double_t etamax){ fPtMin = ptmin; fPtMax = ptmax; fEtaMin = etamin; fEtaMax = etamax; } // Additional options (for integral studies) void SetSigmaGaussEta(Double_t sigmaGaussEta){ fSigmaGaussEta = sigmaGaussEta; } void SetConstantEta(Double_t constantEta){ fConstantEta = constantEta; } void SetFixPt(Double_t fixPt){ fFixPt = fixPt; } void SetFixedPositiveRatio(Bool_t fixedPositiveRatio=kTRUE){ fFixedPositiveRatio = fixedPositiveRatio; } //Acceptance filter void SetAcceptanceParameterization(TF1 *parameterization) { fUseAcceptanceParameterization = kTRUE; fAcceptanceParameterization = parameterization;} //Acceptance - simulate detector effects/inefficiencies void SimulateDetectorEffects() {fSimulateDetectorEffects = kTRUE;} void SetNumberOfInefficientSectorsInPhi(Int_t numberOfInefficientSectors) { fNumberOfInefficientSectors = numberOfInefficientSectors; fInefficiencyFactorInPhi = 0.5;} void SetInefficiencyFactor(Double_t gInefficiencyFactorInPhi) { fInefficiencyFactorInPhi = gInefficiencyFactorInPhi;} void SetNumberOfDeadSectorsInPhi(Int_t numberOfDeadSectors) { fNumberOfDeadSectors = numberOfDeadSectors;} void EnableEfficiencyDropNearEtaEdges() { fEfficiencyDropNearEtaEdges = kTRUE;} void SimulateDetectorEffectsCorrection(TString filename, Int_t nCentralityBins, Double_t *centralityArrayForCorrections); //All charges void SetSpectraTemperatureForAllCharges(Double_t temperature) { fUseAllCharges = kTRUE; fTemperatureAllCharges = temperature;} void SetDirectedFlowForAllCharges(Double_t v1) { fUseAllCharges = kTRUE; fDirectedFlowAllCharges = v1;} void SetEllipticFlowForAllCharges(Double_t v2) { fUseAllCharges = kTRUE; fEllipticFlowAllCharges = v2;} void SetTriangularFlowForAllCharges(Double_t v3) { fUseAllCharges = kTRUE; fTriangularFlowAllCharges = v3;} void SetQuandrangularFlowForAllCharges(Double_t v4) { fUseAllCharges = kTRUE; fQuandrangularFlowAllCharges = v4;} void SetPentangularFlowForAllCharges(Double_t v5) { fUseAllCharges = kTRUE; fPentangularFlowAllCharges = v5;} //Pions void SetPionPercentage(Double_t percentage) { fPionPercentage = percentage;} void SetSpectraTemperatureForPions(Double_t temperature) { fTemperaturePions = temperature;} void SetDirectedFlowForPions(Double_t v1) { fDirectedFlowPions = v1;} void SetEllipticFlowForPions(Double_t v2) { fEllipticFlowPions = v2;} void SetTriangularFlowForPions(Double_t v3) { fTriangularFlowPions = v3;} void SetQuandrangularFlowForPions(Double_t v4) { fQuandrangularFlowPions = v4;} void SetPentangularFlowForPions(Double_t v5) { fPentangularFlowPions = v5;} //Kaons void SetKaonPercentage(Double_t percentage) { fKaonPercentage = percentage;} void SetSpectraTemperatureForKaons(Double_t temperature) { fTemperatureKaons = temperature;} void SetDirectedFlowForKaons(Double_t v1) { fDirectedFlowKaons = v1;} void SetEllipticFlowForKaons(Double_t v2) { fEllipticFlowKaons = v2;} void SetTriangularFlowForKaons(Double_t v3) { fTriangularFlowKaons = v3;} void SetQuandrangularFlowForKaons(Double_t v4) { fQuandrangularFlowKaons = v4;} void SetPentangularFlowForKaons(Double_t v5) { fPentangularFlowKaons = v5;} //Protons void SetProtonPercentage(Double_t percentage) { fProtonPercentage = percentage;} void SetSpectraTemperatureForProtons(Double_t temperature) { fTemperatureProtons = temperature;} void SetDirectedFlowForProtons(Double_t v1) { fDirectedFlowProtons = v1;} void SetEllipticFlowForProtons(Double_t v2) { fEllipticFlowProtons = v2;} void SetTriangularFlowForProtons(Double_t v3) { fTriangularFlowProtons = v3;} void SetQuandrangularFlowForProtons(Double_t v4) { fQuandrangularFlowProtons = v4;} void SetPentangularFlowForProtons(Double_t v5) { fPentangularFlowProtons = v5;} // particle selection: -1 no selection, 0 pions, 1 kaons, 2 protons void SelectParticleSpecies(Int_t iParticle){ fSelectParticle = iParticle; } //Dynamical correlations void SetCorrelationPercentage(Double_t percentage) { fUseDynamicalCorrelations = kTRUE; fDynamicalCorrelationsPercentage = percentage; } void SetCorrelationDeltaEta(Double_t deltaEta) { fUseDynamicalCorrelations = kTRUE; fDynamicalCorrelationsDeltaEta = deltaEta; } void SetCorrelationDeltaPhi(Double_t deltaPhi) { fUseDynamicalCorrelations = kTRUE; fDynamicalCorrelationsDeltaPhi = deltaPhi; } //Rapidity shift void SetRapidityShift() { fUseRapidityShift = kTRUE; } //Use rapidity instead of eta in correlation functions void SetUseRapidity() { fUseRapidity = kTRUE; } //Jet-like structures void SetUseJets() {fUseJets = kTRUE;} // Local charge conservation (LCC) void SetUseLCC() {fUseLCC = kTRUE;}//default values for sigma (pt=0.1,eta=0.5,phi=0.5) void SetUseLCC(Double_t sigmaPt, Double_t sigmaEta, Double_t sigmaPhi) { fUseLCC = kTRUE; fSigmaPt = sigmaPt; fSigmaEta = sigmaEta; fSigmaPhi = sigmaPhi; } //============Toy model: List of setters============// private: void SetupEfficiencyMatrix();//setup the efficiency matrix Double_t GetTrackbyTrackCorrectionMatrix(Double_t vEta, Double_t vPhi, Double_t vPt, Short_t vCharge, Double_t gCentrality);//efficiency factor for the track Bool_t fUseDebug; //Debug flag AliBalancePsi *fBalance; //BF object Bool_t fRunShuffling;//run shuffling or not AliBalancePsi *fShuffledBalance; //BF object (shuffled) Bool_t fRunMixing;//run mixing or not AliBalancePsi *fMixedBalance; //BF object (mixed) AliEventPoolManager* fPoolMgr; //! event pool manager TList *fList; //fList object TList *fListBF; //fList object TList *fListBFS; //fList object (shuffling) TList *fListBFM; //fList object (mixing) TH1F *fHistEventStats; //event stats TH1F *fHistNumberOfAcceptedParticles; //number of accepted particles TH1F *fHistReactionPlane; //reaction plane angle TH1F *fHistEtaTotal; //pseudo-rapidity (full phase space) TH1F *fHistEta; //pseudo-rapidity (acceptance) TH2F *fHistEtaPhiPos; //eta-phi pos TH2F *fHistEtaPhiNeg; //eta-phi neg TH1F *fHistRapidity; //rapidity (acceptance) TH1F *fHistRapidityPions; //rapidity (acceptance) TH1F *fHistRapidityKaons; //rapidity (acceptance) TH1F *fHistRapidityProtons; //rapidity (acceptance) TH1F *fHistPhi; //phi (acceptance) TH1F *fHistPhiPions; //phi (acceptance) TH1F *fHistPhiKaons; //phi (acceptance) TH1F *fHistPhiProtons; //phi (acceptance) TH1F *fHistPt; //pt (acceptance) TH1F *fHistPtPions; //pt (acceptance) TH1F *fHistPtKaons; //pt (acceptance) TH1F *fHistPtProtons; //pt (acceptance) //Toy model input Double_t fTotalMultiplicityMean; //mean for the total multiplicity Double_t fTotalMultiplicitySigma; //sigma for the total multiplicity Double_t fNetChargeMean; //mean for the net charge Double_t fNetChargeSigma; //sigma for the net charge Double_t fPtMin; //pt min for acceptance Double_t fPtMax; //pt max for acceptance Double_t fEtaMin; //eta min for acceptance Double_t fEtaMax; //eta max for acceptance Double_t fSigmaGaussEta; //sigma for the Gaussian distribution of randomly produced particles (default = 4.0) Double_t fConstantEta; //eta value for a constant distribution of particles, if -1. then Gauss is used (default = -1) Double_t fFixPt; //fixed pT for unidentified particles (default = -1., i.e. randomly produced pT from fPtSpectraAllCharges) Bool_t fFixedPositiveRatio; //fix ratio of produced positive to negative particles (dafult = kFALSE, i.e. randomly produced ratio) //Acceptance parameterization Bool_t fUseAcceptanceParameterization; //flag acceptance parameterization TF1 *fAcceptanceParameterization; //acceptance parameterization //Simulate detector effects Bool_t fSimulateDetectorEffects;//simulate detector effects in pT Int_t fNumberOfInefficientSectors;//inefficient secotrs in phi Double_t fInefficiencyFactorInPhi;//efficiency factor < 1 Int_t fNumberOfDeadSectors;//number of dead sectors Bool_t fEfficiencyDropNearEtaEdges;//efficiency drop in eta edges TH3F *fEfficiencyMatrix; //efficiency matrix in eta-pt-phi Bool_t fSimulateDetectorEffectsCorrection;//simulate detector effects as used for correction of data TH3F *fHistCorrectionPlus[101]; //correction matrix Plus TH3F *fHistCorrectionMinus[101]; //correction matrix minus Double_t fCentralityArrayForCorrections[101];//centrality array for correction Int_t fCentralityArrayBinsForCorrections;//number of centralitry bins Double_t fPtMinForCorrections;//only used for AODs Double_t fPtMaxForCorrections;//only used for AODs Double_t fPtBinForCorrections; //=================================correction Double_t fEtaMinForCorrections;//only used for AODs Double_t fEtaMaxForCorrections;//only used for AODs Double_t fEtaBinForCorrections; //=================================correction Double_t fPhiMinForCorrections;//only used for AODs Double_t fPhiMaxForCorrections;//only used for AODs Double_t fPhiBinForCorrections; //=================================correction //Kinematics Bool_t fUseAllCharges; //use all charges Int_t fSelectParticle; //select particle species (no selection -1 [default], pions 0, kaons 1, protons 2) Double_t fParticleMass; //particle mass TF1 *fPtSpectraAllCharges; //spectra for all charges Double_t fTemperatureAllCharges; //temperature for pt spectra Double_t fReactionPlane; //reaction plane angle TF1 *fAzimuthalAngleAllCharges; //azimuthal angle Double_t fDirectedFlowAllCharges; //directed flow value Double_t fEllipticFlowAllCharges; //elliptic flow value Double_t fTriangularFlowAllCharges; //triangular flow value Double_t fQuandrangularFlowAllCharges; //quadrangular flow value Double_t fPentangularFlowAllCharges; //pentangular flow value Double_t fPionPercentage; //percentage of pions Double_t fPionMass; //pion mass TF1 *fPtSpectraPions; //spectra for pions Double_t fTemperaturePions; //temperature for pt spectra TF1 *fAzimuthalAnglePions; //azimuthal angle for pions Double_t fDirectedFlowPions; //directed flow value Double_t fEllipticFlowPions; //elliptic flow value Double_t fTriangularFlowPions; //triangular flow value Double_t fQuandrangularFlowPions; //quadrangular flow value Double_t fPentangularFlowPions; //pentangular flow value Double_t fKaonPercentage; //percentage of kaons Double_t fKaonMass; //kaon mass TF1 *fPtSpectraKaons; //spectra for kaons Double_t fTemperatureKaons; //temperature for pt spectra TF1 *fAzimuthalAngleKaons; //azimuthal angle for kaons Double_t fDirectedFlowKaons; //directed flow value Double_t fEllipticFlowKaons; //elliptic flow value Double_t fTriangularFlowKaons; //triangular flow value Double_t fQuandrangularFlowKaons; //quadrangular flow value Double_t fPentangularFlowKaons; //pentangular flow value Double_t fProtonPercentage; //percentage of protons Double_t fProtonMass; //proton mass TF1 *fPtSpectraProtons; //spectra for protons Double_t fTemperatureProtons; //temperature for pt spectra TF1 *fAzimuthalAngleProtons; //azimuthal angle for protons Double_t fDirectedFlowProtons; //directed flow value Double_t fEllipticFlowProtons; //elliptic flow value Double_t fTriangularFlowProtons; //triangular flow value Double_t fQuandrangularFlowProtons; //quadrangular flow value Double_t fPentangularFlowProtons; //pentangular flow value Bool_t fUseDynamicalCorrelations; //Usage of dynamical correlations Double_t fDynamicalCorrelationsPercentage; //Percentage of correlations Double_t fDynamicalCorrelationsDeltaEta; //Gaussian Width in Eta for correlations Double_t fDynamicalCorrelationsDeltaPhi; //Gaussian Width in Eta correlations Bool_t fUseRapidityShift; //Usage of rapidity shift Double_t fRapidityShift;//shift in rapidity (only applicable if fUseAllCharges==kFALSE) Bool_t fUseRapidity; //Usage of rapidity instead of eta in correlation functions TLorentzVector *vTmp;// temporary vector for calculating shifted observables TLorentzVector *vShift;// rapidity shift TLorentzVector *vBeam_p;// proton beam TLorentzVector *vBeam_Pb;// Pb beam Bool_t fUseJets;//Usage of jet-like structures TF1 *fPtAssoc;//pt of associated Bool_t fUseLCC;//Usage of Local Charge Conservation Double_t fSigmaPt;//sigma for LCC spread in pT Double_t fSigmaEta;//sigma for LCC spread in Eta Double_t fSigmaPhi;//sigma for LCC spread in Phi AliAnalysisTaskToyModel(const AliAnalysisTaskToyModel&); // not implemented AliAnalysisTaskToyModel& operator=(const AliAnalysisTaskToyModel&); // not implemented ClassDef(AliAnalysisTaskToyModel, 1); // example of analysis }; #endif
39.88674
132
0.761064
[ "object", "vector", "model" ]
c21534c05a83411266f88fb073fdae5a60be7422
5,585
c
C
src/bin/e_uuid_store.c
tizenorg/platform.upstream.enlightenment
b875f6029a55f52f9b9460aaca58cc1e4912f15f
[ "BSD-2-Clause" ]
null
null
null
src/bin/e_uuid_store.c
tizenorg/platform.upstream.enlightenment
b875f6029a55f52f9b9460aaca58cc1e4912f15f
[ "BSD-2-Clause" ]
null
null
null
src/bin/e_uuid_store.c
tizenorg/platform.upstream.enlightenment
b875f6029a55f52f9b9460aaca58cc1e4912f15f
[ "BSD-2-Clause" ]
null
null
null
/* vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 */ /* 1. Create mmaped memory blob, name the memory object * 2. Fill in table and keep it up-to-date * 3. (optional) Write the whole blob into a file on disk for later use) */ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> #include <Eina.h> #include <e.h> /* Use anonymous mapping if we don't want a persistent file on the disk */ #define OBJECT_NAME "/e_uuid_store" #define TABLE_SIZE 10*eina_cpu_page_size() struct uuid_store *store; void e_uuid_dump(void) { struct uuid_table *table; int i; char uuid_string[37]; if (store == NULL) return; table = store->table; if (table == NULL) return; INF("Dump UUID table:"); for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++) { if (uuid_is_null(table->entries[i].uuid)) continue; uuid_unparse(table->entries[i].uuid, uuid_string); INF("UUID %s, x=%i, y=%i, width=%i, heigth=%i", uuid_string, table->entries[i].x, table->entries[i].y, table->entries[i].width, table->entries[i].heigth); } } /** * Initialize the UUID store * * @returns 1 if init was successful, 0 on failure */ EINTERN int e_uuid_store_init(void) { /* FIXME think about refcounting here */ eina_init(); store = calloc(1, sizeof(struct uuid_store)); if (store == NULL) return 0; /* Try to open existing SHM object */ store->shmfd = shm_open(OBJECT_NAME, O_RDWR, S_IRWXU | S_IRWXG); if (store->shmfd < 0 && errno == ENOENT) { INF("shm_open failed to open an existing file %s", OBJECT_NAME); if (!e_uuid_store_reload()) return 0; } else if (store->shmfd < 0) { INF("shm_open failed"); return 0; } /* Adjust in memory blob to our given table size */ /* FIXME: How can we make sure we have the right size for our given table? */ if (ftruncate(store->shmfd, TABLE_SIZE) < 0) { ERR("ftruncate failed: %s", strerror(errno)); return 0; } store->table = (struct uuid_table *)mmap(NULL, TABLE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, store->shmfd, 0); if (store->table == NULL) { ERR("mmap failed"); return 0; } INF("mmaped blob with size %i created", TABLE_SIZE); if (store->table->version) INF("UUID table with version %i", store->table->version); else store->table->version = 1; INF("UUID table with %i entries", store->table->entry_count); return 1; } EINTERN int e_uuid_store_shutdown(void) { /* Cleanup for shutdown */ if (shm_unlink(OBJECT_NAME) != 0) { ERR("shm_unlink failed"); return 0; } close(store->shmfd); free(store); eina_shutdown(); return 1; } Eina_Bool e_uuid_store_reload(void) { /* After crash reload the table with its POSIX object name from memory */ store->shmfd = shm_open(OBJECT_NAME, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG); if (store->shmfd < 0) { INF("shm_open failed"); return EINA_FALSE; } return EINA_TRUE; } Eina_Bool e_uuid_store_entry_del(uuid_t uuid) { struct uuid_table *table; int i; char uuid_string[37]; if (store == NULL) return EINA_FALSE; table = store->table; if (table == NULL) return EINA_FALSE; /* Search through uuid list and delete if found */ for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++) { if (!uuid_compare(table->entries[i].uuid, uuid)) { uuid_clear(table->entries[i].uuid); table->entries[i].x = 0; table->entries[i].x = 0; table->entries[i].width = 0; table->entries[i].heigth = 0; table->entry_count--; uuid_unparse(uuid, uuid_string); DBG("Removed entry with UUID %s", uuid_string); return EINA_TRUE; } } uuid_unparse(uuid, uuid_string); DBG("NOT removed entry with UUID %s. Entry not found.", uuid_string); return EINA_FALSE; } /* FIXME: Think about having _add and _update functions instead only update */ Eina_Bool e_uuid_store_entry_update(uuid_t uuid, E_Client *ec) { struct uuid_table *table; int i, index = -1; char uuid_string[37]; if (store == NULL) return EINA_FALSE; table = store->table; if (table == NULL) return EINA_FALSE; /* Search through uuid list if it already exist if yes update */ for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++) { if (!uuid_compare(table->entries[i].uuid, uuid)) { table->entries[i].x = ec->x; table->entries[i].y = ec->y; table->entries[i].width = ec->client.w; table->entries[i].heigth = ec->client.h; uuid_unparse(uuid, uuid_string); DBG("Updated entry with UUID %s", uuid_string); return EINA_TRUE; } } /* Find first empty entry */ for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++) { if (uuid_is_null(table->entries[i].uuid)) index = i; } if (index == -1) { ERR("UUID table full"); return EINA_FALSE; } /* We do not have this UUID in the table yet. Create it */ table->entries[index].x = ec->x; table->entries[index].y = ec->y; table->entries[index].width = ec->client.w; table->entries[index].heigth = ec->client.h; uuid_copy(table->entries[index].uuid, uuid); table->entry_count++; uuid_unparse(table->entries[index].uuid, uuid_string); DBG("Created entry with UUID %s", uuid_string); return EINA_TRUE; }
25.737327
115
0.60573
[ "object" ]
c229ba621a6586246cc99cb62c9ea406b26e6b50
11,960
c
C
picoquictest/transport_param_test.c
frochet/pquic
68284d680ab69fb06fc3750f78ea4816fee712fb
[ "MIT" ]
98
2019-06-27T11:54:39.000Z
2022-03-19T07:40:24.000Z
picoquictest/transport_param_test.c
frochet/pquic
68284d680ab69fb06fc3750f78ea4816fee712fb
[ "MIT" ]
31
2019-08-29T07:41:25.000Z
2022-01-04T17:11:39.000Z
picoquictest/transport_param_test.c
frochet/pquic
68284d680ab69fb06fc3750f78ea4816fee712fb
[ "MIT" ]
21
2019-08-05T08:40:49.000Z
2022-03-28T03:48:01.000Z
/* * Author: Christian Huitema * Copyright (c) 2017, Private Octopus, Inc. * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * 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 Private Octopus, Inc. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "../picoquic/picoquic_internal.h" #include "../picoquic/util.h" #include "picoquictest_internal.h" #include <stdlib.h> #include <string.h> #include "../picoquic/memory.h" /* Start with a series of test vectors to test that * encoding and decoding are OK. * Then, add fuzz testing. */ #define TRANSPORT_CID_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },0 } #define TRANSPORT_PREFERRED_ADDRESS_NULL \ { {0, 0, 0, 0}, 0, \ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, \ TRANSPORT_CID_NULL, \ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }} static picoquic_tp_t transport_param_test1 = { TRANSPORT_CID_NULL, 30000, 1480, 0x400000, 0x200000, 0x200000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test2 = { TRANSPORT_CID_NULL, 30000, 1480, 0x400000, 0x200000, 0x200000, 0x100000, 10000, 10000, 1, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test3 = { TRANSPORT_CID_NULL, 30000, 0, 0x400000, 0x200000, 0x200000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test4 = { TRANSPORT_CID_NULL, 30000, 1480, 0x400000, 0x200000, 0x200000, 0x100000, 10000, 10000, 3, 25, 1, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test5 = { TRANSPORT_CID_NULL, 30000, 1480, 0x400000, 0x100000, 0x200000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test6 = { TRANSPORT_CID_NULL, 30000, 1480, 0x400000, 0x200000, 0x100000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test7 = { TRANSPORT_CID_NULL, 30000, 1480, 0x100000, 0x200000, 0x200000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static picoquic_tp_t transport_param_test8 = { TRANSPORT_CID_NULL, 1000, 1480, 0x100000, 0x200000, 0x200000, 0x100000, 10000, 10000, 3, 25, 0, TRANSPORT_PREFERRED_ADDRESS_NULL, 2, NULL, NULL }; static uint8_t transport_param_reset_secret[PICOQUIC_RESET_SECRET_SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; /* * Before testing the transport parameters, test the encoding of stream_id */ int stream_id_to_rank_test() { int ret = 0; uint16_t test_rank[5] = { 0, 1, 2, 13833, 65535 }; for (int stream_type = 0; stream_type < 4; stream_type += 2) { for (int extension_mode = 0; extension_mode < 2; extension_mode ++) { for (int rank_id = 0; rank_id < 5; rank_id++) { uint32_t stream_id = picoquic_decode_transport_param_stream_id(test_rank[rank_id], extension_mode, stream_type); uint16_t decoded_rank = picoquic_prepare_transport_param_stream_id(stream_id, extension_mode, stream_type); uint32_t decoded_stream_id = picoquic_decode_transport_param_stream_id(decoded_rank, extension_mode, stream_type); if (decoded_rank != test_rank[rank_id] || decoded_stream_id != stream_id) { ret = -1; DBG_PRINTF("Extension mode %d, stream type %d, rank %d -> stream %d -> rank %d\n", extension_mode, stream_type, test_rank[rank_id], stream_id, decoded_rank, decoded_stream_id); } } } } return ret; } static int transport_param_compare(picoquic_tp_t* param, picoquic_tp_t* ref) { int ret = 0; if (param->initial_max_stream_data_bidi_local != ref->initial_max_stream_data_bidi_local) { ret = -1; } else if (param->initial_max_stream_data_bidi_remote != ref->initial_max_stream_data_bidi_remote) { ret = -1; } else if (param->initial_max_stream_data_uni != ref->initial_max_stream_data_uni) { ret = -1; } else if (param->initial_max_data != ref->initial_max_data) { ret = -1; } else if (param->initial_max_streams_bidi != ref->initial_max_streams_bidi) { ret = -1; } else if (param->initial_max_streams_uni != ref->initial_max_streams_uni) { ret = -1; } else if (param->max_idle_timeout != ref->max_idle_timeout) { ret = -1; } else if (memcmp(&param->preferred_address, &ref->preferred_address, sizeof(picoquic_tp_preferred_address_t)) != 0) { ret = -1; } return ret; } int transport_param_one_test(int mode, uint32_t version, uint32_t proposed_version, picoquic_tp_t* param) { int ret = 0; picoquic_quic_t quic_ctx; picoquic_cnx_t test_cnx; uint8_t buffer[256]; size_t encoded, decoded; memset(&quic_ctx, 0, sizeof(quic_ctx)); memset(&test_cnx, 0, sizeof(picoquic_cnx_t)); test_cnx.quic = &quic_ctx; struct sockaddr_in addr; picoquic_create_path(&test_cnx, 0, (struct sockaddr *) &addr); /* initialize the connection object to the test parameters */ memcpy(&test_cnx.local_parameters, param, sizeof(picoquic_tp_t)); // test_cnx.version = version; test_cnx.version_index = picoquic_get_version_index(version); test_cnx.proposed_version = proposed_version; memcpy(test_cnx.path[0]->reset_secret, transport_param_reset_secret, PICOQUIC_RESET_SECRET_SIZE); register_protocol_operations(&test_cnx); ret = picoquic_prepare_transport_extensions(&test_cnx, mode, buffer, sizeof(buffer), &encoded); if (ret == 0) { ret = picoquic_receive_transport_extensions(&test_cnx, mode, buffer, encoded, &decoded); if (ret == 0 && transport_param_compare(&test_cnx.remote_parameters, param) != 0) { ret = -1; } } return ret; } int transport_param_test() { int ret = 0; uint32_t version_default = PICOQUIC_INTEROP_VERSION; if (ret == 0) { ret = transport_param_one_test(0, version_default, version_default, &transport_param_test1); } if (ret == 0) { ret = transport_param_one_test(0, version_default, 0x0A1A0A1A, &transport_param_test2); } if (ret == 0) { ret = transport_param_one_test(0, version_default, 0x0A1A0A1A, &transport_param_test3); } if (ret == 0) { ret = transport_param_one_test(1, version_default, version_default, &transport_param_test4); } if (ret == 0) { ret = transport_param_one_test(1, version_default, 0x0A1A0A1A, &transport_param_test5); } if (ret == 0) { ret = transport_param_one_test(0, version_default, 0x0A1A0A1A, &transport_param_test6); } if (ret == 0) { ret = transport_param_one_test(0, version_default, 0xBABABABA, &transport_param_test7); } if (ret == 0) { ret = transport_param_one_test(0, version_default, 0x0A1A0A1A, &transport_param_test8); } return ret; } /* * Verify that we can properly log all the transport parameters. */ static char const* log_tp_test_file = "log_tp_test.txt"; static char const* log_tp_fuzz_file = "log_tp_fuzz_test.txt"; #ifdef _WINDOWS #ifndef _WINDOWS64 static char const* log_tp_test_ref = "..\\picoquictest\\log_tp_test_ref.txt"; #else static char const* log_tp_test_ref = "..\\..\\picoquictest\\log_tp_test_ref.txt"; #endif #else static char const* log_tp_test_ref = "picoquictest/log_tp_test_ref.txt"; #endif void picoquic_log_transport_extension_content(FILE* F, int log_cnxid, uint64_t cnx_id_64, uint8_t * bytes, size_t bytes_max, int client_mode, uint32_t initial_version, uint32_t final_version); typedef struct st_transport_param_stream_id_test_t { int extension_mode; int stream_id_type; int rank; int stream_id; } transport_param_stream_id_test_t; transport_param_stream_id_test_t const transport_param_stream_id_test_table[] = { { 0, PICOQUIC_STREAM_ID_BIDIR, 0, 0xFFFFFFFF }, { 1, PICOQUIC_STREAM_ID_BIDIR, 0, 0xFFFFFFFF }, { 0, PICOQUIC_STREAM_ID_UNIDIR, 0, 0xFFFFFFFF }, { 1, PICOQUIC_STREAM_ID_UNIDIR, 0, 0xFFFFFFFF }, { 0, PICOQUIC_STREAM_ID_BIDIR, 1, PICOQUIC_STREAM_ID_SERVER_INITIATED_BIDIR }, { 1, PICOQUIC_STREAM_ID_BIDIR, 1, PICOQUIC_STREAM_ID_CLIENT_INITIATED_BIDIR }, { 0, PICOQUIC_STREAM_ID_UNIDIR, 1, PICOQUIC_STREAM_ID_SERVER_INITIATED_UNIDIR }, { 1, PICOQUIC_STREAM_ID_UNIDIR, 1, PICOQUIC_STREAM_ID_CLIENT_INITIATED_UNIDIR }, { 0, PICOQUIC_STREAM_ID_BIDIR, 65535, PICOQUIC_STREAM_ID_SERVER_MAX_INITIAL_BIDIR }, { 1, PICOQUIC_STREAM_ID_BIDIR, 65535, PICOQUIC_STREAM_ID_CLIENT_MAX_INITIAL_BIDIR }, { 0, PICOQUIC_STREAM_ID_UNIDIR, 65535, PICOQUIC_STREAM_ID_SERVER_MAX_INITIAL_UNIDIR }, { 1, PICOQUIC_STREAM_ID_UNIDIR, 65535, PICOQUIC_STREAM_ID_CLIENT_MAX_INITIAL_UNIDIR }, { 0, PICOQUIC_STREAM_ID_BIDIR, 5, 17}, { 1, PICOQUIC_STREAM_ID_BIDIR, 6, 20 } }; static size_t const nb_transport_param_stream_id_test_table = sizeof(transport_param_stream_id_test_table) / sizeof(transport_param_stream_id_test_t); uint32_t picoquic_transport_param_to_stream_id(uint16_t rank, int client_mode, int stream_type); uint16_t picoquic_prepare_transport_param_stream_id(uint32_t stream_id, int extension_mode, int stream_type); int transport_param_stream_id_test() { int ret = 0; /* Decoding test */ for (size_t i = 0; i < nb_transport_param_stream_id_test_table; i++) { uint16_t rank = picoquic_prepare_transport_param_stream_id( transport_param_stream_id_test_table[i].stream_id, transport_param_stream_id_test_table[i].extension_mode, transport_param_stream_id_test_table[i].stream_id_type); if (rank != transport_param_stream_id_test_table[i].rank) { DBG_PRINTF("TP Stream prepare ID [%d] fails. Stream= 0x%x, expected rank 0x%x, got 0x%x\n", i, transport_param_stream_id_test_table[i].stream_id, transport_param_stream_id_test_table[i].rank, rank); ret = -1; } } /* Encoding test */ for (size_t i = 0; i < nb_transport_param_stream_id_test_table; i++) { uint32_t stream_id = picoquic_transport_param_to_stream_id( transport_param_stream_id_test_table[i].rank, transport_param_stream_id_test_table[i].extension_mode, transport_param_stream_id_test_table[i].stream_id_type); if (stream_id != transport_param_stream_id_test_table[i].stream_id) { DBG_PRINTF("TP Stream decode ID [%d] fails. Rank= 0x%x, expected stream 0x%x, got 0x%x\n", i, transport_param_stream_id_test_table[i].rank, transport_param_stream_id_test_table[i].stream_id, stream_id); ret = -1; } } return ret; }
38.831169
148
0.699749
[ "object" ]
eddead2ab46e2de1a4b24dc15b6b2005650ae0eb
104,235
h
C
schemas/cpp/openconfig/openconfig_ap_manager/openconfig_ap_manager.pb.h
seilis/serialization-perf
447cab4bfee66c8a86062b1b6169bddf81036a79
[ "Apache-2.0" ]
null
null
null
schemas/cpp/openconfig/openconfig_ap_manager/openconfig_ap_manager.pb.h
seilis/serialization-perf
447cab4bfee66c8a86062b1b6169bddf81036a79
[ "Apache-2.0" ]
2
2018-05-10T22:57:40.000Z
2018-05-16T10:14:23.000Z
schemas/cpp/openconfig/openconfig_ap_manager/openconfig_ap_manager.pb.h
seilis/serialization-perf
447cab4bfee66c8a86062b1b6169bddf81036a79
[ "Apache-2.0" ]
1
2018-05-09T03:03:01.000Z
2018-05-09T03:03:01.000Z
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: openconfig/openconfig_ap_manager/openconfig_ap_manager.proto #ifndef PROTOBUF_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto__INCLUDED #define PROTOBUF_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto__INCLUDED #include <string> #include <google/protobuf/stubs/common.h> #if GOOGLE_PROTOBUF_VERSION < 3005000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/metadata.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> // IWYU pragma: export #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/generated_enum_reflection.h> #include <google/protobuf/unknown_field_set.h> #include "github.com/openconfig/ygot/proto/ywrapper/ywrapper.pb.h" #include "github.com/openconfig/ygot/proto/yext/yext.pb.h" #include "openconfig/enums/enums.pb.h" // @@protoc_insertion_point(includes) namespace protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto { // Internal implementation detail -- do not use these members. struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; static const ::google::protobuf::internal::ParseTable schema[9]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; static const ::google::protobuf::uint32 offsets[]; }; void AddDescriptors(); void InitDefaultsJoinedAps_JoinedAp_StateImpl(); void InitDefaultsJoinedAps_JoinedAp_State(); void InitDefaultsJoinedAps_JoinedApImpl(); void InitDefaultsJoinedAps_JoinedAp(); void InitDefaultsJoinedAps_JoinedApKeyImpl(); void InitDefaultsJoinedAps_JoinedApKey(); void InitDefaultsJoinedApsImpl(); void InitDefaultsJoinedAps(); void InitDefaultsProvisionAps_ProvisionAp_ConfigImpl(); void InitDefaultsProvisionAps_ProvisionAp_Config(); void InitDefaultsProvisionAps_ProvisionAp_StateImpl(); void InitDefaultsProvisionAps_ProvisionAp_State(); void InitDefaultsProvisionAps_ProvisionApImpl(); void InitDefaultsProvisionAps_ProvisionAp(); void InitDefaultsProvisionAps_ProvisionApKeyImpl(); void InitDefaultsProvisionAps_ProvisionApKey(); void InitDefaultsProvisionApsImpl(); void InitDefaultsProvisionAps(); inline void InitDefaults() { InitDefaultsJoinedAps_JoinedAp_State(); InitDefaultsJoinedAps_JoinedAp(); InitDefaultsJoinedAps_JoinedApKey(); InitDefaultsJoinedAps(); InitDefaultsProvisionAps_ProvisionAp_Config(); InitDefaultsProvisionAps_ProvisionAp_State(); InitDefaultsProvisionAps_ProvisionAp(); InitDefaultsProvisionAps_ProvisionApKey(); InitDefaultsProvisionAps(); } } // namespace protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto namespace openconfig { namespace openconfig_ap_manager { class JoinedAps; class JoinedApsDefaultTypeInternal; extern JoinedApsDefaultTypeInternal _JoinedAps_default_instance_; class JoinedAps_JoinedAp; class JoinedAps_JoinedApDefaultTypeInternal; extern JoinedAps_JoinedApDefaultTypeInternal _JoinedAps_JoinedAp_default_instance_; class JoinedAps_JoinedApKey; class JoinedAps_JoinedApKeyDefaultTypeInternal; extern JoinedAps_JoinedApKeyDefaultTypeInternal _JoinedAps_JoinedApKey_default_instance_; class JoinedAps_JoinedAp_State; class JoinedAps_JoinedAp_StateDefaultTypeInternal; extern JoinedAps_JoinedAp_StateDefaultTypeInternal _JoinedAps_JoinedAp_State_default_instance_; class ProvisionAps; class ProvisionApsDefaultTypeInternal; extern ProvisionApsDefaultTypeInternal _ProvisionAps_default_instance_; class ProvisionAps_ProvisionAp; class ProvisionAps_ProvisionApDefaultTypeInternal; extern ProvisionAps_ProvisionApDefaultTypeInternal _ProvisionAps_ProvisionAp_default_instance_; class ProvisionAps_ProvisionApKey; class ProvisionAps_ProvisionApKeyDefaultTypeInternal; extern ProvisionAps_ProvisionApKeyDefaultTypeInternal _ProvisionAps_ProvisionApKey_default_instance_; class ProvisionAps_ProvisionAp_Config; class ProvisionAps_ProvisionAp_ConfigDefaultTypeInternal; extern ProvisionAps_ProvisionAp_ConfigDefaultTypeInternal _ProvisionAps_ProvisionAp_Config_default_instance_; class ProvisionAps_ProvisionAp_State; class ProvisionAps_ProvisionAp_StateDefaultTypeInternal; extern ProvisionAps_ProvisionAp_StateDefaultTypeInternal _ProvisionAps_ProvisionAp_State_default_instance_; } // namespace openconfig_ap_manager } // namespace openconfig namespace openconfig { namespace openconfig_ap_manager { enum JoinedAps_JoinedAp_State_PowerSource { JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_UNSET = 0, JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_AT = 1, JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_AF = 2, JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_PLUG = 3, JoinedAps_JoinedAp_State_PowerSource_JoinedAps_JoinedAp_State_PowerSource_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, JoinedAps_JoinedAp_State_PowerSource_JoinedAps_JoinedAp_State_PowerSource_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max }; bool JoinedAps_JoinedAp_State_PowerSource_IsValid(int value); const JoinedAps_JoinedAp_State_PowerSource JoinedAps_JoinedAp_State_PowerSource_PowerSource_MIN = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_UNSET; const JoinedAps_JoinedAp_State_PowerSource JoinedAps_JoinedAp_State_PowerSource_PowerSource_MAX = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_PLUG; const int JoinedAps_JoinedAp_State_PowerSource_PowerSource_ARRAYSIZE = JoinedAps_JoinedAp_State_PowerSource_PowerSource_MAX + 1; const ::google::protobuf::EnumDescriptor* JoinedAps_JoinedAp_State_PowerSource_descriptor(); inline const ::std::string& JoinedAps_JoinedAp_State_PowerSource_Name(JoinedAps_JoinedAp_State_PowerSource value) { return ::google::protobuf::internal::NameOfEnum( JoinedAps_JoinedAp_State_PowerSource_descriptor(), value); } inline bool JoinedAps_JoinedAp_State_PowerSource_Parse( const ::std::string& name, JoinedAps_JoinedAp_State_PowerSource* value) { return ::google::protobuf::internal::ParseNamedEnum<JoinedAps_JoinedAp_State_PowerSource>( JoinedAps_JoinedAp_State_PowerSource_descriptor(), name, value); } // =================================================================== class JoinedAps_JoinedAp_State : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State) */ { public: JoinedAps_JoinedAp_State(); virtual ~JoinedAps_JoinedAp_State(); JoinedAps_JoinedAp_State(const JoinedAps_JoinedAp_State& from); inline JoinedAps_JoinedAp_State& operator=(const JoinedAps_JoinedAp_State& from) { CopyFrom(from); return *this; } #if LANG_CXX11 JoinedAps_JoinedAp_State(JoinedAps_JoinedAp_State&& from) noexcept : JoinedAps_JoinedAp_State() { *this = ::std::move(from); } inline JoinedAps_JoinedAp_State& operator=(JoinedAps_JoinedAp_State&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const JoinedAps_JoinedAp_State& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const JoinedAps_JoinedAp_State* internal_default_instance() { return reinterpret_cast<const JoinedAps_JoinedAp_State*>( &_JoinedAps_JoinedAp_State_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0; void Swap(JoinedAps_JoinedAp_State* other); friend void swap(JoinedAps_JoinedAp_State& a, JoinedAps_JoinedAp_State& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline JoinedAps_JoinedAp_State* New() const PROTOBUF_FINAL { return New(NULL); } JoinedAps_JoinedAp_State* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const JoinedAps_JoinedAp_State& from); void MergeFrom(const JoinedAps_JoinedAp_State& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(JoinedAps_JoinedAp_State* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- typedef JoinedAps_JoinedAp_State_PowerSource PowerSource; static const PowerSource POWERSOURCE_UNSET = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_UNSET; static const PowerSource POWERSOURCE_AT = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_AT; static const PowerSource POWERSOURCE_AF = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_AF; static const PowerSource POWERSOURCE_PLUG = JoinedAps_JoinedAp_State_PowerSource_POWERSOURCE_PLUG; static inline bool PowerSource_IsValid(int value) { return JoinedAps_JoinedAp_State_PowerSource_IsValid(value); } static const PowerSource PowerSource_MIN = JoinedAps_JoinedAp_State_PowerSource_PowerSource_MIN; static const PowerSource PowerSource_MAX = JoinedAps_JoinedAp_State_PowerSource_PowerSource_MAX; static const int PowerSource_ARRAYSIZE = JoinedAps_JoinedAp_State_PowerSource_PowerSource_ARRAYSIZE; static inline const ::google::protobuf::EnumDescriptor* PowerSource_descriptor() { return JoinedAps_JoinedAp_State_PowerSource_descriptor(); } static inline const ::std::string& PowerSource_Name(PowerSource value) { return JoinedAps_JoinedAp_State_PowerSource_Name(value); } static inline bool PowerSource_Parse(const ::std::string& name, PowerSource* value) { return JoinedAps_JoinedAp_State_PowerSource_Parse(name, value); } // accessors ------------------------------------------------------- // .ywrapper.UintValue uptime = 38916154 [(.yext.schemapath) = "/joined-aps/joined-ap/state/uptime"]; bool has_uptime() const; void clear_uptime(); static const int kUptimeFieldNumber = 38916154; const ::ywrapper::UintValue& uptime() const; ::ywrapper::UintValue* release_uptime(); ::ywrapper::UintValue* mutable_uptime(); void set_allocated_uptime(::ywrapper::UintValue* uptime); // .ywrapper.StringValue mac = 123107383 [(.yext.schemapath) = "/joined-aps/joined-ap/state/mac"]; bool has_mac() const; void clear_mac(); static const int kMacFieldNumber = 123107383; const ::ywrapper::StringValue& mac() const; ::ywrapper::StringValue* release_mac(); ::ywrapper::StringValue* mutable_mac(); void set_allocated_mac(::ywrapper::StringValue* mac); // .ywrapper.StringValue hostname = 179090877 [(.yext.schemapath) = "/joined-aps/joined-ap/state/hostname"]; bool has_hostname() const; void clear_hostname(); static const int kHostnameFieldNumber = 179090877; const ::ywrapper::StringValue& hostname() const; ::ywrapper::StringValue* release_hostname(); ::ywrapper::StringValue* mutable_hostname(); void set_allocated_hostname(::ywrapper::StringValue* hostname); // .ywrapper.StringValue model = 290964229 [(.yext.schemapath) = "/joined-aps/joined-ap/state/model"]; bool has_model() const; void clear_model(); static const int kModelFieldNumber = 290964229; const ::ywrapper::StringValue& model() const; ::ywrapper::StringValue* release_model(); ::ywrapper::StringValue* mutable_model(); void set_allocated_model(::ywrapper::StringValue* model); // .ywrapper.BoolValue enabled = 359246197 [(.yext.schemapath) = "/joined-aps/joined-ap/state/enabled"]; bool has_enabled() const; void clear_enabled(); static const int kEnabledFieldNumber = 359246197; const ::ywrapper::BoolValue& enabled() const; ::ywrapper::BoolValue* release_enabled(); ::ywrapper::BoolValue* mutable_enabled(); void set_allocated_enabled(::ywrapper::BoolValue* enabled); // .ywrapper.StringValue serial = 454568434 [(.yext.schemapath) = "/joined-aps/joined-ap/state/serial"]; bool has_serial() const; void clear_serial(); static const int kSerialFieldNumber = 454568434; const ::ywrapper::StringValue& serial() const; ::ywrapper::StringValue* release_serial(); ::ywrapper::StringValue* mutable_serial(); void set_allocated_serial(::ywrapper::StringValue* serial); // .ywrapper.StringValue ipv4 = 472039243 [(.yext.schemapath) = "/joined-aps/joined-ap/state/ipv4"]; bool has_ipv4() const; void clear_ipv4(); static const int kIpv4FieldNumber = 472039243; const ::ywrapper::StringValue& ipv4() const; ::ywrapper::StringValue* release_ipv4(); ::ywrapper::StringValue* mutable_ipv4(); void set_allocated_ipv4(::ywrapper::StringValue* ipv4); // .ywrapper.StringValue ipv6 = 472039241 [(.yext.schemapath) = "/joined-aps/joined-ap/state/ipv6"]; bool has_ipv6() const; void clear_ipv6(); static const int kIpv6FieldNumber = 472039241; const ::ywrapper::StringValue& ipv6() const; ::ywrapper::StringValue* release_ipv6(); ::ywrapper::StringValue* mutable_ipv6(); void set_allocated_ipv6(::ywrapper::StringValue* ipv6); // .openconfig.enums.OpenconfigWifiTypesAPSTATE opstate = 107965202 [(.yext.schemapath) = "/joined-aps/joined-ap/state/opstate"]; void clear_opstate(); static const int kOpstateFieldNumber = 107965202; ::openconfig::enums::OpenconfigWifiTypesAPSTATE opstate() const; void set_opstate(::openconfig::enums::OpenconfigWifiTypesAPSTATE value); // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.PowerSource power_source = 439858589 [(.yext.schemapath) = "/joined-aps/joined-ap/state/power-source"]; void clear_power_source(); static const int kPowerSourceFieldNumber = 439858589; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource power_source() const; void set_power_source(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource value); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::ywrapper::UintValue* uptime_; ::ywrapper::StringValue* mac_; ::ywrapper::StringValue* hostname_; ::ywrapper::StringValue* model_; ::ywrapper::BoolValue* enabled_; ::ywrapper::StringValue* serial_; ::ywrapper::StringValue* ipv4_; ::ywrapper::StringValue* ipv6_; int opstate_; int power_source_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsJoinedAps_JoinedAp_StateImpl(); }; // ------------------------------------------------------------------- class JoinedAps_JoinedAp : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp) */ { public: JoinedAps_JoinedAp(); virtual ~JoinedAps_JoinedAp(); JoinedAps_JoinedAp(const JoinedAps_JoinedAp& from); inline JoinedAps_JoinedAp& operator=(const JoinedAps_JoinedAp& from) { CopyFrom(from); return *this; } #if LANG_CXX11 JoinedAps_JoinedAp(JoinedAps_JoinedAp&& from) noexcept : JoinedAps_JoinedAp() { *this = ::std::move(from); } inline JoinedAps_JoinedAp& operator=(JoinedAps_JoinedAp&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const JoinedAps_JoinedAp& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const JoinedAps_JoinedAp* internal_default_instance() { return reinterpret_cast<const JoinedAps_JoinedAp*>( &_JoinedAps_JoinedAp_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 1; void Swap(JoinedAps_JoinedAp* other); friend void swap(JoinedAps_JoinedAp& a, JoinedAps_JoinedAp& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline JoinedAps_JoinedAp* New() const PROTOBUF_FINAL { return New(NULL); } JoinedAps_JoinedAp* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const JoinedAps_JoinedAp& from); void MergeFrom(const JoinedAps_JoinedAp& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(JoinedAps_JoinedAp* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- typedef JoinedAps_JoinedAp_State State; // accessors ------------------------------------------------------- // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State state = 345610787 [(.yext.schemapath) = "/joined-aps/joined-ap/state"]; bool has_state() const; void clear_state(); static const int kStateFieldNumber = 345610787; const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State& state() const; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* release_state(); ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* mutable_state(); void set_allocated_state(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* state); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* state_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsJoinedAps_JoinedApImpl(); }; // ------------------------------------------------------------------- class JoinedAps_JoinedApKey : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey) */ { public: JoinedAps_JoinedApKey(); virtual ~JoinedAps_JoinedApKey(); JoinedAps_JoinedApKey(const JoinedAps_JoinedApKey& from); inline JoinedAps_JoinedApKey& operator=(const JoinedAps_JoinedApKey& from) { CopyFrom(from); return *this; } #if LANG_CXX11 JoinedAps_JoinedApKey(JoinedAps_JoinedApKey&& from) noexcept : JoinedAps_JoinedApKey() { *this = ::std::move(from); } inline JoinedAps_JoinedApKey& operator=(JoinedAps_JoinedApKey&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const JoinedAps_JoinedApKey& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const JoinedAps_JoinedApKey* internal_default_instance() { return reinterpret_cast<const JoinedAps_JoinedApKey*>( &_JoinedAps_JoinedApKey_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 2; void Swap(JoinedAps_JoinedApKey* other); friend void swap(JoinedAps_JoinedApKey& a, JoinedAps_JoinedApKey& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline JoinedAps_JoinedApKey* New() const PROTOBUF_FINAL { return New(NULL); } JoinedAps_JoinedApKey* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const JoinedAps_JoinedApKey& from); void MergeFrom(const JoinedAps_JoinedApKey& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(JoinedAps_JoinedApKey* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // string hostname = 1 [(.yext.schemapath) = "/joined-aps/joined-ap/hostname"]; void clear_hostname(); static const int kHostnameFieldNumber = 1; const ::std::string& hostname() const; void set_hostname(const ::std::string& value); #if LANG_CXX11 void set_hostname(::std::string&& value); #endif void set_hostname(const char* value); void set_hostname(const char* value, size_t size); ::std::string* mutable_hostname(); ::std::string* release_hostname(); void set_allocated_hostname(::std::string* hostname); // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp joined_ap = 2; bool has_joined_ap() const; void clear_joined_ap(); static const int kJoinedApFieldNumber = 2; const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp& joined_ap() const; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* release_joined_ap(); ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* mutable_joined_ap(); void set_allocated_joined_ap(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* joined_ap); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr hostname_; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* joined_ap_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsJoinedAps_JoinedApKeyImpl(); }; // ------------------------------------------------------------------- class JoinedAps : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.JoinedAps) */ { public: JoinedAps(); virtual ~JoinedAps(); JoinedAps(const JoinedAps& from); inline JoinedAps& operator=(const JoinedAps& from) { CopyFrom(from); return *this; } #if LANG_CXX11 JoinedAps(JoinedAps&& from) noexcept : JoinedAps() { *this = ::std::move(from); } inline JoinedAps& operator=(JoinedAps&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const JoinedAps& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const JoinedAps* internal_default_instance() { return reinterpret_cast<const JoinedAps*>( &_JoinedAps_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 3; void Swap(JoinedAps* other); friend void swap(JoinedAps& a, JoinedAps& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline JoinedAps* New() const PROTOBUF_FINAL { return New(NULL); } JoinedAps* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const JoinedAps& from); void MergeFrom(const JoinedAps& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(JoinedAps* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- typedef JoinedAps_JoinedAp JoinedAp; typedef JoinedAps_JoinedApKey JoinedApKey; // accessors ------------------------------------------------------- // repeated .openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey joined_ap = 215441873 [(.yext.schemapath) = "/joined-aps/joined-ap"]; int joined_ap_size() const; void clear_joined_ap(); static const int kJoinedApFieldNumber = 215441873; const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey& joined_ap(int index) const; ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey* mutable_joined_ap(int index); ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey* add_joined_ap(); ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey >* mutable_joined_ap(); const ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey >& joined_ap() const; // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.JoinedAps) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey > joined_ap_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsJoinedApsImpl(); }; // ------------------------------------------------------------------- class ProvisionAps_ProvisionAp_Config : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config) */ { public: ProvisionAps_ProvisionAp_Config(); virtual ~ProvisionAps_ProvisionAp_Config(); ProvisionAps_ProvisionAp_Config(const ProvisionAps_ProvisionAp_Config& from); inline ProvisionAps_ProvisionAp_Config& operator=(const ProvisionAps_ProvisionAp_Config& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProvisionAps_ProvisionAp_Config(ProvisionAps_ProvisionAp_Config&& from) noexcept : ProvisionAps_ProvisionAp_Config() { *this = ::std::move(from); } inline ProvisionAps_ProvisionAp_Config& operator=(ProvisionAps_ProvisionAp_Config&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const ProvisionAps_ProvisionAp_Config& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProvisionAps_ProvisionAp_Config* internal_default_instance() { return reinterpret_cast<const ProvisionAps_ProvisionAp_Config*>( &_ProvisionAps_ProvisionAp_Config_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 4; void Swap(ProvisionAps_ProvisionAp_Config* other); friend void swap(ProvisionAps_ProvisionAp_Config& a, ProvisionAps_ProvisionAp_Config& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProvisionAps_ProvisionAp_Config* New() const PROTOBUF_FINAL { return New(NULL); } ProvisionAps_ProvisionAp_Config* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const ProvisionAps_ProvisionAp_Config& from); void MergeFrom(const ProvisionAps_ProvisionAp_Config& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ProvisionAps_ProvisionAp_Config* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // .ywrapper.StringValue hostname = 170733812 [(.yext.schemapath) = "/provision-aps/provision-ap/config/hostname"]; bool has_hostname() const; void clear_hostname(); static const int kHostnameFieldNumber = 170733812; const ::ywrapper::StringValue& hostname() const; ::ywrapper::StringValue* release_hostname(); ::ywrapper::StringValue* mutable_hostname(); void set_allocated_hostname(::ywrapper::StringValue* hostname); // .ywrapper.StringValue mac = 194092264 [(.yext.schemapath) = "/provision-aps/provision-ap/config/mac"]; bool has_mac() const; void clear_mac(); static const int kMacFieldNumber = 194092264; const ::ywrapper::StringValue& mac() const; ::ywrapper::StringValue* release_mac(); ::ywrapper::StringValue* mutable_mac(); void set_allocated_mac(::ywrapper::StringValue* mac); // .ywrapper.StringValue country_code = 206658667 [(.yext.schemapath) = "/provision-aps/provision-ap/config/country-code"]; bool has_country_code() const; void clear_country_code(); static const int kCountryCodeFieldNumber = 206658667; const ::ywrapper::StringValue& country_code() const; ::ywrapper::StringValue* release_country_code(); ::ywrapper::StringValue* mutable_country_code(); void set_allocated_country_code(::ywrapper::StringValue* country_code); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::ywrapper::StringValue* hostname_; ::ywrapper::StringValue* mac_; ::ywrapper::StringValue* country_code_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsProvisionAps_ProvisionAp_ConfigImpl(); }; // ------------------------------------------------------------------- class ProvisionAps_ProvisionAp_State : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State) */ { public: ProvisionAps_ProvisionAp_State(); virtual ~ProvisionAps_ProvisionAp_State(); ProvisionAps_ProvisionAp_State(const ProvisionAps_ProvisionAp_State& from); inline ProvisionAps_ProvisionAp_State& operator=(const ProvisionAps_ProvisionAp_State& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProvisionAps_ProvisionAp_State(ProvisionAps_ProvisionAp_State&& from) noexcept : ProvisionAps_ProvisionAp_State() { *this = ::std::move(from); } inline ProvisionAps_ProvisionAp_State& operator=(ProvisionAps_ProvisionAp_State&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const ProvisionAps_ProvisionAp_State& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProvisionAps_ProvisionAp_State* internal_default_instance() { return reinterpret_cast<const ProvisionAps_ProvisionAp_State*>( &_ProvisionAps_ProvisionAp_State_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 5; void Swap(ProvisionAps_ProvisionAp_State* other); friend void swap(ProvisionAps_ProvisionAp_State& a, ProvisionAps_ProvisionAp_State& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProvisionAps_ProvisionAp_State* New() const PROTOBUF_FINAL { return New(NULL); } ProvisionAps_ProvisionAp_State* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const ProvisionAps_ProvisionAp_State& from); void MergeFrom(const ProvisionAps_ProvisionAp_State& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ProvisionAps_ProvisionAp_State* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // .ywrapper.StringValue hostname = 271064359 [(.yext.schemapath) = "/provision-aps/provision-ap/state/hostname"]; bool has_hostname() const; void clear_hostname(); static const int kHostnameFieldNumber = 271064359; const ::ywrapper::StringValue& hostname() const; ::ywrapper::StringValue* release_hostname(); ::ywrapper::StringValue* mutable_hostname(); void set_allocated_hostname(::ywrapper::StringValue* hostname); // .ywrapper.StringValue country_code = 408053928 [(.yext.schemapath) = "/provision-aps/provision-ap/state/country-code"]; bool has_country_code() const; void clear_country_code(); static const int kCountryCodeFieldNumber = 408053928; const ::ywrapper::StringValue& country_code() const; ::ywrapper::StringValue* release_country_code(); ::ywrapper::StringValue* mutable_country_code(); void set_allocated_country_code(::ywrapper::StringValue* country_code); // .ywrapper.StringValue mac = 419942637 [(.yext.schemapath) = "/provision-aps/provision-ap/state/mac"]; bool has_mac() const; void clear_mac(); static const int kMacFieldNumber = 419942637; const ::ywrapper::StringValue& mac() const; ::ywrapper::StringValue* release_mac(); ::ywrapper::StringValue* mutable_mac(); void set_allocated_mac(::ywrapper::StringValue* mac); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::ywrapper::StringValue* hostname_; ::ywrapper::StringValue* country_code_; ::ywrapper::StringValue* mac_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsProvisionAps_ProvisionAp_StateImpl(); }; // ------------------------------------------------------------------- class ProvisionAps_ProvisionAp : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp) */ { public: ProvisionAps_ProvisionAp(); virtual ~ProvisionAps_ProvisionAp(); ProvisionAps_ProvisionAp(const ProvisionAps_ProvisionAp& from); inline ProvisionAps_ProvisionAp& operator=(const ProvisionAps_ProvisionAp& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProvisionAps_ProvisionAp(ProvisionAps_ProvisionAp&& from) noexcept : ProvisionAps_ProvisionAp() { *this = ::std::move(from); } inline ProvisionAps_ProvisionAp& operator=(ProvisionAps_ProvisionAp&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const ProvisionAps_ProvisionAp& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProvisionAps_ProvisionAp* internal_default_instance() { return reinterpret_cast<const ProvisionAps_ProvisionAp*>( &_ProvisionAps_ProvisionAp_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 6; void Swap(ProvisionAps_ProvisionAp* other); friend void swap(ProvisionAps_ProvisionAp& a, ProvisionAps_ProvisionAp& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProvisionAps_ProvisionAp* New() const PROTOBUF_FINAL { return New(NULL); } ProvisionAps_ProvisionAp* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const ProvisionAps_ProvisionAp& from); void MergeFrom(const ProvisionAps_ProvisionAp& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ProvisionAps_ProvisionAp* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- typedef ProvisionAps_ProvisionAp_Config Config; typedef ProvisionAps_ProvisionAp_State State; // accessors ------------------------------------------------------- // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config config = 215617448 [(.yext.schemapath) = "/provision-aps/provision-ap/config"]; bool has_config() const; void clear_config(); static const int kConfigFieldNumber = 215617448; const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config& config() const; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* release_config(); ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* mutable_config(); void set_allocated_config(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* config); // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State state = 335992769 [(.yext.schemapath) = "/provision-aps/provision-ap/state"]; bool has_state() const; void clear_state(); static const int kStateFieldNumber = 335992769; const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State& state() const; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* release_state(); ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* mutable_state(); void set_allocated_state(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* state); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* config_; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* state_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsProvisionAps_ProvisionApImpl(); }; // ------------------------------------------------------------------- class ProvisionAps_ProvisionApKey : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey) */ { public: ProvisionAps_ProvisionApKey(); virtual ~ProvisionAps_ProvisionApKey(); ProvisionAps_ProvisionApKey(const ProvisionAps_ProvisionApKey& from); inline ProvisionAps_ProvisionApKey& operator=(const ProvisionAps_ProvisionApKey& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProvisionAps_ProvisionApKey(ProvisionAps_ProvisionApKey&& from) noexcept : ProvisionAps_ProvisionApKey() { *this = ::std::move(from); } inline ProvisionAps_ProvisionApKey& operator=(ProvisionAps_ProvisionApKey&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const ProvisionAps_ProvisionApKey& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProvisionAps_ProvisionApKey* internal_default_instance() { return reinterpret_cast<const ProvisionAps_ProvisionApKey*>( &_ProvisionAps_ProvisionApKey_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 7; void Swap(ProvisionAps_ProvisionApKey* other); friend void swap(ProvisionAps_ProvisionApKey& a, ProvisionAps_ProvisionApKey& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProvisionAps_ProvisionApKey* New() const PROTOBUF_FINAL { return New(NULL); } ProvisionAps_ProvisionApKey* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const ProvisionAps_ProvisionApKey& from); void MergeFrom(const ProvisionAps_ProvisionApKey& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ProvisionAps_ProvisionApKey* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // string mac = 1 [(.yext.schemapath) = "/provision-aps/provision-ap/mac"]; void clear_mac(); static const int kMacFieldNumber = 1; const ::std::string& mac() const; void set_mac(const ::std::string& value); #if LANG_CXX11 void set_mac(::std::string&& value); #endif void set_mac(const char* value); void set_mac(const char* value, size_t size); ::std::string* mutable_mac(); ::std::string* release_mac(); void set_allocated_mac(::std::string* mac); // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp provision_ap = 2; bool has_provision_ap() const; void clear_provision_ap(); static const int kProvisionApFieldNumber = 2; const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp& provision_ap() const; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* release_provision_ap(); ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* mutable_provision_ap(); void set_allocated_provision_ap(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* provision_ap); // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr mac_; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* provision_ap_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsProvisionAps_ProvisionApKeyImpl(); }; // ------------------------------------------------------------------- class ProvisionAps : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:openconfig.openconfig_ap_manager.ProvisionAps) */ { public: ProvisionAps(); virtual ~ProvisionAps(); ProvisionAps(const ProvisionAps& from); inline ProvisionAps& operator=(const ProvisionAps& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProvisionAps(ProvisionAps&& from) noexcept : ProvisionAps() { *this = ::std::move(from); } inline ProvisionAps& operator=(ProvisionAps&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const ProvisionAps& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProvisionAps* internal_default_instance() { return reinterpret_cast<const ProvisionAps*>( &_ProvisionAps_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 8; void Swap(ProvisionAps* other); friend void swap(ProvisionAps& a, ProvisionAps& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProvisionAps* New() const PROTOBUF_FINAL { return New(NULL); } ProvisionAps* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const ProvisionAps& from); void MergeFrom(const ProvisionAps& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ProvisionAps* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- typedef ProvisionAps_ProvisionAp ProvisionAp; typedef ProvisionAps_ProvisionApKey ProvisionApKey; // accessors ------------------------------------------------------- // repeated .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey provision_ap = 172245559 [(.yext.schemapath) = "/provision-aps/provision-ap"]; int provision_ap_size() const; void clear_provision_ap(); static const int kProvisionApFieldNumber = 172245559; const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey& provision_ap(int index) const; ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey* mutable_provision_ap(int index); ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey* add_provision_ap(); ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey >* mutable_provision_ap(); const ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey >& provision_ap() const; // @@protoc_insertion_point(class_scope:openconfig.openconfig_ap_manager.ProvisionAps) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey > provision_ap_; mutable int _cached_size_; friend struct ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::TableStruct; friend void ::protobuf_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto::InitDefaultsProvisionApsImpl(); }; // =================================================================== // =================================================================== #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ // JoinedAps_JoinedAp_State // .ywrapper.BoolValue enabled = 359246197 [(.yext.schemapath) = "/joined-aps/joined-ap/state/enabled"]; inline bool JoinedAps_JoinedAp_State::has_enabled() const { return this != internal_default_instance() && enabled_ != NULL; } inline const ::ywrapper::BoolValue& JoinedAps_JoinedAp_State::enabled() const { const ::ywrapper::BoolValue* p = enabled_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.enabled) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::BoolValue*>( &::ywrapper::_BoolValue_default_instance_); } inline ::ywrapper::BoolValue* JoinedAps_JoinedAp_State::release_enabled() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.enabled) ::ywrapper::BoolValue* temp = enabled_; enabled_ = NULL; return temp; } inline ::ywrapper::BoolValue* JoinedAps_JoinedAp_State::mutable_enabled() { if (enabled_ == NULL) { enabled_ = new ::ywrapper::BoolValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.enabled) return enabled_; } inline void JoinedAps_JoinedAp_State::set_allocated_enabled(::ywrapper::BoolValue* enabled) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(enabled_); } if (enabled) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { enabled = ::google::protobuf::internal::GetOwnedMessage( message_arena, enabled, submessage_arena); } } else { } enabled_ = enabled; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.enabled) } // .ywrapper.StringValue hostname = 179090877 [(.yext.schemapath) = "/joined-aps/joined-ap/state/hostname"]; inline bool JoinedAps_JoinedAp_State::has_hostname() const { return this != internal_default_instance() && hostname_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::hostname() const { const ::ywrapper::StringValue* p = hostname_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.hostname) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_hostname() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.hostname) ::ywrapper::StringValue* temp = hostname_; hostname_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_hostname() { if (hostname_ == NULL) { hostname_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.hostname) return hostname_; } inline void JoinedAps_JoinedAp_State::set_allocated_hostname(::ywrapper::StringValue* hostname) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(hostname_); } if (hostname) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { hostname = ::google::protobuf::internal::GetOwnedMessage( message_arena, hostname, submessage_arena); } } else { } hostname_ = hostname; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.hostname) } // .ywrapper.StringValue ipv4 = 472039243 [(.yext.schemapath) = "/joined-aps/joined-ap/state/ipv4"]; inline bool JoinedAps_JoinedAp_State::has_ipv4() const { return this != internal_default_instance() && ipv4_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::ipv4() const { const ::ywrapper::StringValue* p = ipv4_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv4) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_ipv4() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv4) ::ywrapper::StringValue* temp = ipv4_; ipv4_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_ipv4() { if (ipv4_ == NULL) { ipv4_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv4) return ipv4_; } inline void JoinedAps_JoinedAp_State::set_allocated_ipv4(::ywrapper::StringValue* ipv4) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(ipv4_); } if (ipv4) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { ipv4 = ::google::protobuf::internal::GetOwnedMessage( message_arena, ipv4, submessage_arena); } } else { } ipv4_ = ipv4; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv4) } // .ywrapper.StringValue ipv6 = 472039241 [(.yext.schemapath) = "/joined-aps/joined-ap/state/ipv6"]; inline bool JoinedAps_JoinedAp_State::has_ipv6() const { return this != internal_default_instance() && ipv6_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::ipv6() const { const ::ywrapper::StringValue* p = ipv6_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv6) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_ipv6() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv6) ::ywrapper::StringValue* temp = ipv6_; ipv6_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_ipv6() { if (ipv6_ == NULL) { ipv6_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv6) return ipv6_; } inline void JoinedAps_JoinedAp_State::set_allocated_ipv6(::ywrapper::StringValue* ipv6) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(ipv6_); } if (ipv6) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { ipv6 = ::google::protobuf::internal::GetOwnedMessage( message_arena, ipv6, submessage_arena); } } else { } ipv6_ = ipv6; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.ipv6) } // .ywrapper.StringValue mac = 123107383 [(.yext.schemapath) = "/joined-aps/joined-ap/state/mac"]; inline bool JoinedAps_JoinedAp_State::has_mac() const { return this != internal_default_instance() && mac_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::mac() const { const ::ywrapper::StringValue* p = mac_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.mac) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_mac() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.mac) ::ywrapper::StringValue* temp = mac_; mac_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_mac() { if (mac_ == NULL) { mac_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.mac) return mac_; } inline void JoinedAps_JoinedAp_State::set_allocated_mac(::ywrapper::StringValue* mac) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(mac_); } if (mac) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { mac = ::google::protobuf::internal::GetOwnedMessage( message_arena, mac, submessage_arena); } } else { } mac_ = mac; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.mac) } // .ywrapper.StringValue model = 290964229 [(.yext.schemapath) = "/joined-aps/joined-ap/state/model"]; inline bool JoinedAps_JoinedAp_State::has_model() const { return this != internal_default_instance() && model_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::model() const { const ::ywrapper::StringValue* p = model_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.model) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_model() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.model) ::ywrapper::StringValue* temp = model_; model_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_model() { if (model_ == NULL) { model_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.model) return model_; } inline void JoinedAps_JoinedAp_State::set_allocated_model(::ywrapper::StringValue* model) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(model_); } if (model) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { model = ::google::protobuf::internal::GetOwnedMessage( message_arena, model, submessage_arena); } } else { } model_ = model; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.model) } // .openconfig.enums.OpenconfigWifiTypesAPSTATE opstate = 107965202 [(.yext.schemapath) = "/joined-aps/joined-ap/state/opstate"]; inline void JoinedAps_JoinedAp_State::clear_opstate() { opstate_ = 0; } inline ::openconfig::enums::OpenconfigWifiTypesAPSTATE JoinedAps_JoinedAp_State::opstate() const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.opstate) return static_cast< ::openconfig::enums::OpenconfigWifiTypesAPSTATE >(opstate_); } inline void JoinedAps_JoinedAp_State::set_opstate(::openconfig::enums::OpenconfigWifiTypesAPSTATE value) { opstate_ = value; // @@protoc_insertion_point(field_set:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.opstate) } // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.PowerSource power_source = 439858589 [(.yext.schemapath) = "/joined-aps/joined-ap/state/power-source"]; inline void JoinedAps_JoinedAp_State::clear_power_source() { power_source_ = 0; } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource JoinedAps_JoinedAp_State::power_source() const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.power_source) return static_cast< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource >(power_source_); } inline void JoinedAps_JoinedAp_State::set_power_source(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource value) { power_source_ = value; // @@protoc_insertion_point(field_set:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.power_source) } // .ywrapper.StringValue serial = 454568434 [(.yext.schemapath) = "/joined-aps/joined-ap/state/serial"]; inline bool JoinedAps_JoinedAp_State::has_serial() const { return this != internal_default_instance() && serial_ != NULL; } inline const ::ywrapper::StringValue& JoinedAps_JoinedAp_State::serial() const { const ::ywrapper::StringValue* p = serial_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.serial) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::release_serial() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.serial) ::ywrapper::StringValue* temp = serial_; serial_ = NULL; return temp; } inline ::ywrapper::StringValue* JoinedAps_JoinedAp_State::mutable_serial() { if (serial_ == NULL) { serial_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.serial) return serial_; } inline void JoinedAps_JoinedAp_State::set_allocated_serial(::ywrapper::StringValue* serial) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(serial_); } if (serial) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { serial = ::google::protobuf::internal::GetOwnedMessage( message_arena, serial, submessage_arena); } } else { } serial_ = serial; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.serial) } // .ywrapper.UintValue uptime = 38916154 [(.yext.schemapath) = "/joined-aps/joined-ap/state/uptime"]; inline bool JoinedAps_JoinedAp_State::has_uptime() const { return this != internal_default_instance() && uptime_ != NULL; } inline const ::ywrapper::UintValue& JoinedAps_JoinedAp_State::uptime() const { const ::ywrapper::UintValue* p = uptime_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.uptime) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::UintValue*>( &::ywrapper::_UintValue_default_instance_); } inline ::ywrapper::UintValue* JoinedAps_JoinedAp_State::release_uptime() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.uptime) ::ywrapper::UintValue* temp = uptime_; uptime_ = NULL; return temp; } inline ::ywrapper::UintValue* JoinedAps_JoinedAp_State::mutable_uptime() { if (uptime_ == NULL) { uptime_ = new ::ywrapper::UintValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.uptime) return uptime_; } inline void JoinedAps_JoinedAp_State::set_allocated_uptime(::ywrapper::UintValue* uptime) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(uptime_); } if (uptime) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { uptime = ::google::protobuf::internal::GetOwnedMessage( message_arena, uptime, submessage_arena); } } else { } uptime_ = uptime; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State.uptime) } // ------------------------------------------------------------------- // JoinedAps_JoinedAp // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.State state = 345610787 [(.yext.schemapath) = "/joined-aps/joined-ap/state"]; inline bool JoinedAps_JoinedAp::has_state() const { return this != internal_default_instance() && state_ != NULL; } inline void JoinedAps_JoinedAp::clear_state() { if (GetArenaNoVirtual() == NULL && state_ != NULL) { delete state_; } state_ = NULL; } inline const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State& JoinedAps_JoinedAp::state() const { const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* p = state_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.state) return p != NULL ? *p : *reinterpret_cast<const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State*>( &::openconfig::openconfig_ap_manager::_JoinedAps_JoinedAp_State_default_instance_); } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* JoinedAps_JoinedAp::release_state() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.state) ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* temp = state_; state_ = NULL; return temp; } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* JoinedAps_JoinedAp::mutable_state() { if (state_ == NULL) { state_ = new ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.state) return state_; } inline void JoinedAps_JoinedAp::set_allocated_state(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State* state) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete state_; } if (state) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { state = ::google::protobuf::internal::GetOwnedMessage( message_arena, state, submessage_arena); } } else { } state_ = state; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedAp.state) } // ------------------------------------------------------------------- // JoinedAps_JoinedApKey // string hostname = 1 [(.yext.schemapath) = "/joined-aps/joined-ap/hostname"]; inline void JoinedAps_JoinedApKey::clear_hostname() { hostname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& JoinedAps_JoinedApKey::hostname() const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) return hostname_.GetNoArena(); } inline void JoinedAps_JoinedApKey::set_hostname(const ::std::string& value) { hostname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) } #if LANG_CXX11 inline void JoinedAps_JoinedApKey::set_hostname(::std::string&& value) { hostname_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) } #endif inline void JoinedAps_JoinedApKey::set_hostname(const char* value) { GOOGLE_DCHECK(value != NULL); hostname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) } inline void JoinedAps_JoinedApKey::set_hostname(const char* value, size_t size) { hostname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) } inline ::std::string* JoinedAps_JoinedApKey::mutable_hostname() { // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) return hostname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* JoinedAps_JoinedApKey::release_hostname() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) return hostname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void JoinedAps_JoinedApKey::set_allocated_hostname(::std::string* hostname) { if (hostname != NULL) { } else { } hostname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), hostname); // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.hostname) } // .openconfig.openconfig_ap_manager.JoinedAps.JoinedAp joined_ap = 2; inline bool JoinedAps_JoinedApKey::has_joined_ap() const { return this != internal_default_instance() && joined_ap_ != NULL; } inline void JoinedAps_JoinedApKey::clear_joined_ap() { if (GetArenaNoVirtual() == NULL && joined_ap_ != NULL) { delete joined_ap_; } joined_ap_ = NULL; } inline const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp& JoinedAps_JoinedApKey::joined_ap() const { const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* p = joined_ap_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.joined_ap) return p != NULL ? *p : *reinterpret_cast<const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp*>( &::openconfig::openconfig_ap_manager::_JoinedAps_JoinedAp_default_instance_); } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* JoinedAps_JoinedApKey::release_joined_ap() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.joined_ap) ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* temp = joined_ap_; joined_ap_ = NULL; return temp; } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* JoinedAps_JoinedApKey::mutable_joined_ap() { if (joined_ap_ == NULL) { joined_ap_ = new ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.joined_ap) return joined_ap_; } inline void JoinedAps_JoinedApKey::set_allocated_joined_ap(::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp* joined_ap) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete joined_ap_; } if (joined_ap) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { joined_ap = ::google::protobuf::internal::GetOwnedMessage( message_arena, joined_ap, submessage_arena); } } else { } joined_ap_ = joined_ap; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey.joined_ap) } // ------------------------------------------------------------------- // JoinedAps // repeated .openconfig.openconfig_ap_manager.JoinedAps.JoinedApKey joined_ap = 215441873 [(.yext.schemapath) = "/joined-aps/joined-ap"]; inline int JoinedAps::joined_ap_size() const { return joined_ap_.size(); } inline void JoinedAps::clear_joined_ap() { joined_ap_.Clear(); } inline const ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey& JoinedAps::joined_ap(int index) const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.JoinedAps.joined_ap) return joined_ap_.Get(index); } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey* JoinedAps::mutable_joined_ap(int index) { // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.JoinedAps.joined_ap) return joined_ap_.Mutable(index); } inline ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey* JoinedAps::add_joined_ap() { // @@protoc_insertion_point(field_add:openconfig.openconfig_ap_manager.JoinedAps.joined_ap) return joined_ap_.Add(); } inline ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey >* JoinedAps::mutable_joined_ap() { // @@protoc_insertion_point(field_mutable_list:openconfig.openconfig_ap_manager.JoinedAps.joined_ap) return &joined_ap_; } inline const ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedApKey >& JoinedAps::joined_ap() const { // @@protoc_insertion_point(field_list:openconfig.openconfig_ap_manager.JoinedAps.joined_ap) return joined_ap_; } // ------------------------------------------------------------------- // ProvisionAps_ProvisionAp_Config // .ywrapper.StringValue country_code = 206658667 [(.yext.schemapath) = "/provision-aps/provision-ap/config/country-code"]; inline bool ProvisionAps_ProvisionAp_Config::has_country_code() const { return this != internal_default_instance() && country_code_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_Config::country_code() const { const ::ywrapper::StringValue* p = country_code_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.country_code) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::release_country_code() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.country_code) ::ywrapper::StringValue* temp = country_code_; country_code_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::mutable_country_code() { if (country_code_ == NULL) { country_code_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.country_code) return country_code_; } inline void ProvisionAps_ProvisionAp_Config::set_allocated_country_code(::ywrapper::StringValue* country_code) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(country_code_); } if (country_code) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { country_code = ::google::protobuf::internal::GetOwnedMessage( message_arena, country_code, submessage_arena); } } else { } country_code_ = country_code; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.country_code) } // .ywrapper.StringValue hostname = 170733812 [(.yext.schemapath) = "/provision-aps/provision-ap/config/hostname"]; inline bool ProvisionAps_ProvisionAp_Config::has_hostname() const { return this != internal_default_instance() && hostname_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_Config::hostname() const { const ::ywrapper::StringValue* p = hostname_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.hostname) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::release_hostname() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.hostname) ::ywrapper::StringValue* temp = hostname_; hostname_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::mutable_hostname() { if (hostname_ == NULL) { hostname_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.hostname) return hostname_; } inline void ProvisionAps_ProvisionAp_Config::set_allocated_hostname(::ywrapper::StringValue* hostname) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(hostname_); } if (hostname) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { hostname = ::google::protobuf::internal::GetOwnedMessage( message_arena, hostname, submessage_arena); } } else { } hostname_ = hostname; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.hostname) } // .ywrapper.StringValue mac = 194092264 [(.yext.schemapath) = "/provision-aps/provision-ap/config/mac"]; inline bool ProvisionAps_ProvisionAp_Config::has_mac() const { return this != internal_default_instance() && mac_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_Config::mac() const { const ::ywrapper::StringValue* p = mac_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.mac) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::release_mac() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.mac) ::ywrapper::StringValue* temp = mac_; mac_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_Config::mutable_mac() { if (mac_ == NULL) { mac_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.mac) return mac_; } inline void ProvisionAps_ProvisionAp_Config::set_allocated_mac(::ywrapper::StringValue* mac) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(mac_); } if (mac) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { mac = ::google::protobuf::internal::GetOwnedMessage( message_arena, mac, submessage_arena); } } else { } mac_ = mac; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config.mac) } // ------------------------------------------------------------------- // ProvisionAps_ProvisionAp_State // .ywrapper.StringValue country_code = 408053928 [(.yext.schemapath) = "/provision-aps/provision-ap/state/country-code"]; inline bool ProvisionAps_ProvisionAp_State::has_country_code() const { return this != internal_default_instance() && country_code_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_State::country_code() const { const ::ywrapper::StringValue* p = country_code_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.country_code) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::release_country_code() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.country_code) ::ywrapper::StringValue* temp = country_code_; country_code_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::mutable_country_code() { if (country_code_ == NULL) { country_code_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.country_code) return country_code_; } inline void ProvisionAps_ProvisionAp_State::set_allocated_country_code(::ywrapper::StringValue* country_code) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(country_code_); } if (country_code) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { country_code = ::google::protobuf::internal::GetOwnedMessage( message_arena, country_code, submessage_arena); } } else { } country_code_ = country_code; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.country_code) } // .ywrapper.StringValue hostname = 271064359 [(.yext.schemapath) = "/provision-aps/provision-ap/state/hostname"]; inline bool ProvisionAps_ProvisionAp_State::has_hostname() const { return this != internal_default_instance() && hostname_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_State::hostname() const { const ::ywrapper::StringValue* p = hostname_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.hostname) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::release_hostname() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.hostname) ::ywrapper::StringValue* temp = hostname_; hostname_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::mutable_hostname() { if (hostname_ == NULL) { hostname_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.hostname) return hostname_; } inline void ProvisionAps_ProvisionAp_State::set_allocated_hostname(::ywrapper::StringValue* hostname) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(hostname_); } if (hostname) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { hostname = ::google::protobuf::internal::GetOwnedMessage( message_arena, hostname, submessage_arena); } } else { } hostname_ = hostname; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.hostname) } // .ywrapper.StringValue mac = 419942637 [(.yext.schemapath) = "/provision-aps/provision-ap/state/mac"]; inline bool ProvisionAps_ProvisionAp_State::has_mac() const { return this != internal_default_instance() && mac_ != NULL; } inline const ::ywrapper::StringValue& ProvisionAps_ProvisionAp_State::mac() const { const ::ywrapper::StringValue* p = mac_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.mac) return p != NULL ? *p : *reinterpret_cast<const ::ywrapper::StringValue*>( &::ywrapper::_StringValue_default_instance_); } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::release_mac() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.mac) ::ywrapper::StringValue* temp = mac_; mac_ = NULL; return temp; } inline ::ywrapper::StringValue* ProvisionAps_ProvisionAp_State::mutable_mac() { if (mac_ == NULL) { mac_ = new ::ywrapper::StringValue; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.mac) return mac_; } inline void ProvisionAps_ProvisionAp_State::set_allocated_mac(::ywrapper::StringValue* mac) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(mac_); } if (mac) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { mac = ::google::protobuf::internal::GetOwnedMessage( message_arena, mac, submessage_arena); } } else { } mac_ = mac; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State.mac) } // ------------------------------------------------------------------- // ProvisionAps_ProvisionAp // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.Config config = 215617448 [(.yext.schemapath) = "/provision-aps/provision-ap/config"]; inline bool ProvisionAps_ProvisionAp::has_config() const { return this != internal_default_instance() && config_ != NULL; } inline void ProvisionAps_ProvisionAp::clear_config() { if (GetArenaNoVirtual() == NULL && config_ != NULL) { delete config_; } config_ = NULL; } inline const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config& ProvisionAps_ProvisionAp::config() const { const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* p = config_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.config) return p != NULL ? *p : *reinterpret_cast<const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config*>( &::openconfig::openconfig_ap_manager::_ProvisionAps_ProvisionAp_Config_default_instance_); } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* ProvisionAps_ProvisionAp::release_config() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.config) ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* temp = config_; config_ = NULL; return temp; } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* ProvisionAps_ProvisionAp::mutable_config() { if (config_ == NULL) { config_ = new ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.config) return config_; } inline void ProvisionAps_ProvisionAp::set_allocated_config(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_Config* config) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete config_; } if (config) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { config = ::google::protobuf::internal::GetOwnedMessage( message_arena, config, submessage_arena); } } else { } config_ = config; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.config) } // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.State state = 335992769 [(.yext.schemapath) = "/provision-aps/provision-ap/state"]; inline bool ProvisionAps_ProvisionAp::has_state() const { return this != internal_default_instance() && state_ != NULL; } inline void ProvisionAps_ProvisionAp::clear_state() { if (GetArenaNoVirtual() == NULL && state_ != NULL) { delete state_; } state_ = NULL; } inline const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State& ProvisionAps_ProvisionAp::state() const { const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* p = state_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.state) return p != NULL ? *p : *reinterpret_cast<const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State*>( &::openconfig::openconfig_ap_manager::_ProvisionAps_ProvisionAp_State_default_instance_); } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* ProvisionAps_ProvisionAp::release_state() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.state) ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* temp = state_; state_ = NULL; return temp; } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* ProvisionAps_ProvisionAp::mutable_state() { if (state_ == NULL) { state_ = new ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.state) return state_; } inline void ProvisionAps_ProvisionAp::set_allocated_state(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp_State* state) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete state_; } if (state) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { state = ::google::protobuf::internal::GetOwnedMessage( message_arena, state, submessage_arena); } } else { } state_ = state; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp.state) } // ------------------------------------------------------------------- // ProvisionAps_ProvisionApKey // string mac = 1 [(.yext.schemapath) = "/provision-aps/provision-ap/mac"]; inline void ProvisionAps_ProvisionApKey::clear_mac() { mac_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& ProvisionAps_ProvisionApKey::mac() const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) return mac_.GetNoArena(); } inline void ProvisionAps_ProvisionApKey::set_mac(const ::std::string& value) { mac_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) } #if LANG_CXX11 inline void ProvisionAps_ProvisionApKey::set_mac(::std::string&& value) { mac_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) } #endif inline void ProvisionAps_ProvisionApKey::set_mac(const char* value) { GOOGLE_DCHECK(value != NULL); mac_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) } inline void ProvisionAps_ProvisionApKey::set_mac(const char* value, size_t size) { mac_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) } inline ::std::string* ProvisionAps_ProvisionApKey::mutable_mac() { // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) return mac_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ProvisionAps_ProvisionApKey::release_mac() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) return mac_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ProvisionAps_ProvisionApKey::set_allocated_mac(::std::string* mac) { if (mac != NULL) { } else { } mac_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), mac); // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.mac) } // .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionAp provision_ap = 2; inline bool ProvisionAps_ProvisionApKey::has_provision_ap() const { return this != internal_default_instance() && provision_ap_ != NULL; } inline void ProvisionAps_ProvisionApKey::clear_provision_ap() { if (GetArenaNoVirtual() == NULL && provision_ap_ != NULL) { delete provision_ap_; } provision_ap_ = NULL; } inline const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp& ProvisionAps_ProvisionApKey::provision_ap() const { const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* p = provision_ap_; // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.provision_ap) return p != NULL ? *p : *reinterpret_cast<const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp*>( &::openconfig::openconfig_ap_manager::_ProvisionAps_ProvisionAp_default_instance_); } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* ProvisionAps_ProvisionApKey::release_provision_ap() { // @@protoc_insertion_point(field_release:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.provision_ap) ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* temp = provision_ap_; provision_ap_ = NULL; return temp; } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* ProvisionAps_ProvisionApKey::mutable_provision_ap() { if (provision_ap_ == NULL) { provision_ap_ = new ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp; } // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.provision_ap) return provision_ap_; } inline void ProvisionAps_ProvisionApKey::set_allocated_provision_ap(::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionAp* provision_ap) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete provision_ap_; } if (provision_ap) { ::google::protobuf::Arena* submessage_arena = NULL; if (message_arena != submessage_arena) { provision_ap = ::google::protobuf::internal::GetOwnedMessage( message_arena, provision_ap, submessage_arena); } } else { } provision_ap_ = provision_ap; // @@protoc_insertion_point(field_set_allocated:openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey.provision_ap) } // ------------------------------------------------------------------- // ProvisionAps // repeated .openconfig.openconfig_ap_manager.ProvisionAps.ProvisionApKey provision_ap = 172245559 [(.yext.schemapath) = "/provision-aps/provision-ap"]; inline int ProvisionAps::provision_ap_size() const { return provision_ap_.size(); } inline void ProvisionAps::clear_provision_ap() { provision_ap_.Clear(); } inline const ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey& ProvisionAps::provision_ap(int index) const { // @@protoc_insertion_point(field_get:openconfig.openconfig_ap_manager.ProvisionAps.provision_ap) return provision_ap_.Get(index); } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey* ProvisionAps::mutable_provision_ap(int index) { // @@protoc_insertion_point(field_mutable:openconfig.openconfig_ap_manager.ProvisionAps.provision_ap) return provision_ap_.Mutable(index); } inline ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey* ProvisionAps::add_provision_ap() { // @@protoc_insertion_point(field_add:openconfig.openconfig_ap_manager.ProvisionAps.provision_ap) return provision_ap_.Add(); } inline ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey >* ProvisionAps::mutable_provision_ap() { // @@protoc_insertion_point(field_mutable_list:openconfig.openconfig_ap_manager.ProvisionAps.provision_ap) return &provision_ap_; } inline const ::google::protobuf::RepeatedPtrField< ::openconfig::openconfig_ap_manager::ProvisionAps_ProvisionApKey >& ProvisionAps::provision_ap() const { // @@protoc_insertion_point(field_list:openconfig.openconfig_ap_manager.ProvisionAps.provision_ap) return provision_ap_; } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) } // namespace openconfig_ap_manager } // namespace openconfig namespace google { namespace protobuf { template <> struct is_proto_enum< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource> : ::google::protobuf::internal::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource>() { return ::openconfig::openconfig_ap_manager::JoinedAps_JoinedAp_State_PowerSource_descriptor(); } } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_openconfig_2fopenconfig_5fap_5fmanager_2fopenconfig_5fap_5fmanager_2eproto__INCLUDED
43.28696
190
0.748338
[ "model" ]
edf1666a1b49ef116adfe0b4f45cfa374ff2c2b4
14,121
c
C
src/module/math/light_matrix.c
shaopengyuan/FMT-Firmware
bbdb3649ec4c1cad3d4a7fc3866091f99807fcfc
[ "Apache-2.0" ]
72
2021-09-13T20:29:29.000Z
2022-03-30T01:42:09.000Z
src/module/math/light_matrix.c
shaopengyuan/FMT-Firmware
bbdb3649ec4c1cad3d4a7fc3866091f99807fcfc
[ "Apache-2.0" ]
4
2021-11-06T14:39:26.000Z
2022-01-06T11:50:04.000Z
src/module/math/light_matrix.c
shaopengyuan/FMT-Firmware
bbdb3649ec4c1cad3d4a7fc3866091f99807fcfc
[ "Apache-2.0" ]
32
2021-09-18T14:41:37.000Z
2022-03-31T06:36:06.000Z
/****************************************************************************** * Copyright 2020 The Firmament 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. *****************************************************************************/ #include <firmament.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include "module/math/light_matrix.h" #define MAT_LEGAL_CHECKING #define min(a, b) ((a) > (b) ? (b) : (a)) //#define equal(a, b) ((a-b)<1e-7 && (a-b)>-(1e-7)) #define equal(a, b) (((a) - (b)) < (1e-15) && ((a) - (b)) > -(1e-15)) /************************************************************************/ /* Private Function */ /************************************************************************/ static void swap(int* a, int* b) { int m; m = *a; *a = *b; *b = m; } static void perm(int list[], int k, int m, int* p, Mat* mat, MAT_TYPE* det) { int i; if (k > m) { MAT_TYPE res = mat->element[0][list[0]]; for (i = 1; i < mat->row; i++) { res *= mat->element[i][list[i]]; } if (*p % 2) { //odd is negative *det -= res; } else { //even is positive *det += res; } } else { // if the element is 0, we don't need to calculate the value for this permutation // if(!equal(mat->element[k][list[k]], 0.0f)) // perm(list, k + 1, m, p, mat, det); perm(list, k + 1, m, p, mat, det); for (i = k + 1; i <= m; i++) { // if(equal(mat->element[k][list[i]], 0.0f)) // continue; swap(&list[k], &list[i]); *p += 1; perm(list, k + 1, m, p, mat, det); swap(&list[k], &list[i]); *p -= 1; } } } /************************************************************************/ /* Public Function */ /************************************************************************/ Mat* MatCreate(Mat* mat, int row, int col) { int i; mat->element = (MAT_TYPE**)MAT_MALLOC(row * sizeof(MAT_TYPE*)); mat->buffer = (MAT_TYPE*)MAT_MALLOC(row * col * sizeof(MAT_TYPE)); if (mat->element == NULL || mat->buffer == NULL) { MatDelete(mat); return NULL; } for (i = 0; i < row; i++) { mat->element[i] = &mat->buffer[i * col]; } mat->row = row; mat->col = col; return mat; } void MatDelete(Mat* mat) { MAT_FREE(mat->element); MAT_FREE(mat->buffer); } Mat* MatSetVal(Mat* mat, MAT_TYPE* val) { int row, col; for (row = 0; row < mat->row; row++) { for (col = 0; col < mat->col; col++) { mat->element[row][col] = val[col + row * mat->col]; } } return mat; } void MatDump(const Mat* mat) { int row, col; #ifdef MAT_LEGAL_CHECKING if (mat == NULL) { return; } #endif MAT_PRINTF("Mat %dx%d:\n", mat->row, mat->col); for (row = 0; row < mat->row; row++) { for (col = 0; col < mat->col; col++) { MAT_PRINTF("%.4f\t", mat->element[row][col]); } MAT_PRINTF("\n"); } } Mat* MatZeros(Mat* mat) { int row, col; for (row = 0; row < mat->row; row++) { for (col = 0; col < mat->col; col++) { mat->element[row][col] = 0.0f; } } return mat; } Mat* MatEye(Mat* mat) { int i; MatZeros(mat); for (i = 0; i < min(mat->row, mat->col); i++) { mat->element[i][i] = 1.0f; } return mat; } /* dst = src1 + src2 */ Mat* MatAdd(Mat* src1, Mat* src2, Mat* dst) { int row, col; #ifdef MAT_LEGAL_CHECKING if (!(src1->row == src2->row && src2->row == dst->row && src1->col == src2->col && src2->col == dst->col)) { MAT_PRINTF("err check, unmatch matrix for MatAdd\n"); MatDump(src1); MatDump(src2); MatDump(dst); return NULL; } #endif for (row = 0; row < src1->row; row++) { for (col = 0; col < src1->col; col++) { dst->element[row][col] = src1->element[row][col] + src2->element[row][col]; } } return dst; } /* dst = src1 - src2 */ Mat* MatSub(Mat* src1, Mat* src2, Mat* dst) { int row, col; #ifdef MAT_LEGAL_CHECKING if (!(src1->row == src2->row && src2->row == dst->row && src1->col == src2->col && src2->col == dst->col)) { MAT_PRINTF("err check, unmatch matrix for MatSub\n"); MatDump(src1); MatDump(src2); MatDump(dst); return NULL; } #endif for (row = 0; row < src1->row; row++) { for (col = 0; col < src1->col; col++) { dst->element[row][col] = src1->element[row][col] - src2->element[row][col]; } } return dst; } /* dst = src1 * src2 */ Mat* MatMul(Mat* src1, Mat* src2, Mat* dst) { int row, col; int i; MAT_TYPE temp; #ifdef MAT_LEGAL_CHECKING if (src1->col != src2->row || src1->row != dst->row || src2->col != dst->col) { MAT_PRINTF("err check, unmatch matrix for MatMul\n"); MatDump(src1); MatDump(src2); MatDump(dst); return NULL; } #endif for (row = 0; row < dst->row; row++) { for (col = 0; col < dst->col; col++) { temp = 0.0f; for (i = 0; i < src1->col; i++) { temp += src1->element[row][i] * src2->element[i][col]; } dst->element[row][col] = temp; } } return dst; } /* dst = src' */ Mat* MatTrans(Mat* src, Mat* dst) { int row, col; #ifdef MAT_LEGAL_CHECKING if (src->row != dst->col || src->col != dst->row) { MAT_PRINTF("err check, unmatch matrix for MatTranspose\n"); MatDump(src); MatDump(dst); return NULL; } #endif for (row = 0; row < dst->row; row++) { for (col = 0; col < dst->col; col++) { dst->element[row][col] = src->element[col][row]; } } return dst; } // return det(mat) MAT_TYPE MatDet(Mat* mat) { MAT_TYPE det = 0.0f; int plarity = 0; int* list; int i; #ifdef MAT_LEGAL_CHECKING if (mat->row != mat->col) { MAT_PRINTF("err check, not a square matrix for MatDetermine\n"); MatDump(mat); return 0.0f; } #endif list = (int*)MAT_MALLOC(sizeof(int) * mat->col); if (list == NULL) { MAT_PRINTF("malloc list fail\n"); return 0.0f; } for (i = 0; i < mat->col; i++) list[i] = i; perm(list, 0, mat->row - 1, &plarity, mat, &det); MAT_FREE(list); return det; } // dst = adj(src) Mat* MatAdj(Mat* src, Mat* dst) { Mat smat; int row, col; int i, j, r, c; MAT_TYPE det; #ifdef MAT_LEGAL_CHECKING if (src->row != src->col || src->row != dst->row || src->col != dst->col) { MAT_PRINTF("err check, not a square matrix for MatAdj\n"); MatDump(src); MatDump(dst); return NULL; } #endif MatCreate(&smat, src->row - 1, src->col - 1); for (row = 0; row < src->row; row++) { for (col = 0; col < src->col; col++) { r = 0; for (i = 0; i < src->row; i++) { if (i == row) continue; c = 0; for (j = 0; j < src->col; j++) { if (j == col) continue; smat.element[r][c] = src->element[i][j]; c++; } r++; } det = MatDet(&smat); if ((row + col) % 2) det = -det; dst->element[col][row] = det; } } MatDelete(&smat); return dst; } // dst = src^(-1) Mat* MatInv(Mat* src, Mat* dst) { Mat adj_mat; MAT_TYPE det; int row, col; #ifdef MAT_LEGAL_CHECKING if (src->row != src->col || src->row != dst->row || src->col != dst->col) { MAT_PRINTF("err check, not a square matrix for MatInv\n"); MatDump(src); MatDump(dst); return NULL; } #endif //MAT_PRINTF("create\n"); MatCreate(&adj_mat, src->row, src->col); //MAT_PRINTF("create finish\n"); MatAdj(src, &adj_mat); //MAT_PRINTF("adj\n"); det = MatDet(src); //MAT_PRINTF("inv det:%f\n", det); if (equal(det, 0.0f)) { MAT_PRINTF("err, determinate is 0 for MatInv\n"); return NULL; } for (row = 0; row < src->row; row++) { for (col = 0; col < src->col; col++) dst->element[row][col] = adj_mat.element[row][col] / det; } MatDelete(&adj_mat); return dst; } void MatCopy(Mat* src, Mat* dst) { int row, col; #ifdef MAT_LEGAL_CHECKING if (src->row != dst->row || src->col != dst->col) { MAT_PRINTF("err check, unmathed matrix for MatCopy\n"); MatDump(src); MatDump(dst); return; } #endif for (row = 0; row < src->row; row++) { for (col = 0; col < src->col; col++) dst->element[row][col] = src->element[row][col]; } } // Calculate eigen value and eigen vector of mat // eps: accurancy // njt: maximal iteration count void MatEig(Mat* mat, MAT_TYPE* eig_val, Mat* eig_vec, MAT_TYPE eps, int njt) { int i, j; int nDim = mat->row; #ifdef MAT_LEGAL_CHECKING if (mat->row != mat->col) { MAT_PRINTF("err check, not a squre matrix for MatEig\n"); MatDump(mat); return; } #endif Mat temp_mat; MatCreate(&temp_mat, mat->row, mat->col); MatCopy(mat, &temp_mat); for (i = 0; i < nDim; i++) { eig_vec->element[i][i] = 1.0f; for (int j = 0; j < nDim; j++) { if (i != j) eig_vec->element[i][j] = 0.0f; } } int nCount = 0; //iteration count while (1) { //find maxial element in non-diagram of mat MAT_TYPE dbMax = temp_mat.element[0][1]; int nRow = 0; int nCol = 1; for (i = 0; i < nDim; i++) { //row for (j = 0; j < nDim; j++) { //col MAT_TYPE d = fabs(temp_mat.element[i][j]); if ((i != j) && (d > dbMax)) { dbMax = d; nRow = i; nCol = j; } } } if (dbMax < eps) { break; } if (nCount > njt) { MAT_PRINTF("reach max njt\n"); break; } nCount++; MAT_TYPE dbApp = temp_mat.element[nRow][nRow]; MAT_TYPE dbApq = temp_mat.element[nRow][nCol]; MAT_TYPE dbAqq = temp_mat.element[nCol][nCol]; // calculate rotation angle MAT_TYPE dbAngle = 0.5 * atan2(-2 * dbApq, dbAqq - dbApp); MAT_TYPE dbSinTheta = sin(dbAngle); MAT_TYPE dbCosTheta = cos(dbAngle); MAT_TYPE dbSin2Theta = sin(2 * dbAngle); MAT_TYPE dbCos2Theta = cos(2 * dbAngle); temp_mat.element[nRow][nRow] = dbApp * dbCosTheta * dbCosTheta + dbAqq * dbSinTheta * dbSinTheta + 2 * dbApq * dbCosTheta * dbSinTheta; temp_mat.element[nCol][nCol] = dbApp * dbSinTheta * dbSinTheta + dbAqq * dbCosTheta * dbCosTheta - 2 * dbApq * dbCosTheta * dbSinTheta; temp_mat.element[nRow][nCol] = 0.5 * (dbAqq - dbApp) * dbSin2Theta + dbApq * dbCos2Theta; temp_mat.element[nCol][nRow] = temp_mat.element[nRow][nCol]; for (i = 0; i < nDim; i++) { if ((i != nCol) && (i != nRow)) { dbMax = temp_mat.element[i][nRow]; temp_mat.element[i][nRow] = temp_mat.element[i][nCol] * dbSinTheta + dbMax * dbCosTheta; temp_mat.element[i][nCol] = temp_mat.element[i][nCol] * dbCosTheta - dbMax * dbSinTheta; } } for (j = 0; j < nDim; j++) { if ((j != nCol) && (j != nRow)) { dbMax = temp_mat.element[nRow][j]; temp_mat.element[nRow][j] = temp_mat.element[nCol][j] * dbSinTheta + dbMax * dbCosTheta; temp_mat.element[nCol][j] = temp_mat.element[nCol][j] * dbCosTheta - dbMax * dbSinTheta; } } // calculate eigen vector for (i = 0; i < nDim; i++) { dbMax = eig_vec->element[i][nRow]; eig_vec->element[i][nRow] = eig_vec->element[i][nCol] * dbSinTheta + dbMax * dbCosTheta; eig_vec->element[i][nCol] = eig_vec->element[i][nCol] * dbCosTheta - dbMax * dbSinTheta; } } // calculate eigen value for (i = 0; i < nDim; i++) { eig_val[i] = temp_mat.element[i][i]; } // set sign for (i = 0; i < nDim; i++) { MAT_TYPE dSumVec = 0; for (j = 0; j < nDim; j++) dSumVec += eig_vec->element[j][i]; if (dSumVec < 0) { for (j = 0; j < nDim; j++) eig_vec->element[j][i] *= -1; } } MatDelete(&temp_mat); } MAT_TYPE MatNorm(Mat* mat) { MAT_TYPE max_eig_val = 0.0f; #ifdef MAT_LEGAL_CHECKING if (mat->row != mat->col) { MAT_PRINTF("err check, not a squre matrix for MatEig\n"); MatDump(mat); return 0; } #endif MAT_TYPE* eig_val = (MAT_TYPE*)MAT_MALLOC(mat->row * sizeof(MAT_TYPE)); Mat eig_vec; MatCreate(&eig_vec, mat->row, mat->col); MatEig(mat, eig_val, &eig_vec, 1e-6, 100); for (int i = 0; i < mat->row; i++) { if (eig_val[i] > max_eig_val) max_eig_val = eig_val[i]; } MAT_FREE(eig_val); MatDelete(&eig_vec); return max_eig_val; }
24.09727
143
0.483323
[ "vector" ]
edf849515110619c4a4a6b48e7d180be4a47b8ec
3,543
c
C
nitan/kungfu/skill/yunlong-zhua/ningxue.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
1
2019-03-27T07:25:16.000Z
2019-03-27T07:25:16.000Z
nitan/kungfu/skill/yunlong-zhua/ningxue.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
nitan/kungfu/skill/yunlong-zhua/ningxue.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
// ningxue.c 凝血神爪 // Last Modified by sir on 5/5/2001 #include <ansi.h> inherit F_SSERVER; #define PNAME "凝血神爪" int perform(object me, object target) { string msg; int damage,skill; object weapon; string limb; mapping limbs; int flag; string fskill,sskill,bskill,pfname,pskill; sskill = explode(__FILE__,"/")[<2]; pfname = explode(__FILE__,"/")[<1][0..<3]; if (userp(me) && !wizardp(me) && !query("perform/"+pfname, me) && !query("can_perform/"+sskill+"/"+pfname, me) && !query_temp("murong/xingyi", me) ) return notify_fail("你所使用的外功中沒有這種功能。\n"); if( !objectp(target) ) {flag =1;target = offensive_target(me);} if( !target || !target->is_character() || target == me || !me->is_fighting(target) || !living(target) || query_temp("noliving", target) ) return notify_fail(PNAME"只能對戰鬥中的對手使用。\n"); if( objectp(weapon=query_temp("weapon", me)) ) return notify_fail("你必須空手運功。\n"); if((int)me->query_str() < 30) return notify_fail("你膂力不夠,不能使用凝血神爪!\n"); fskill = "yunlong-shengong"; bskill = "claw"; fskill = me->query_skill_mapped("force"); if( query_temp("murong/xingyi", me) ) { sskill = "douzhuan-xingyi"; fskill = "shenyuan-gong"; bskill = "parry"; } if( (int)me->query_skill(fskill, 1) < 120 ) return notify_fail("你的"+to_chinese(fskill)+"修為不夠,目前還不能使用"+PNAME+"。\n"); if( (int)me->query_skill(sskill, 1) < 150 ) return notify_fail("你的"+to_chinese(sskill)+"修為不夠,目前還不能使用"+PNAME+"。\n"); if( query("neili", me)<800 ) return notify_fail("你內力現在不夠,不能使用凝血神爪!\n"); if( target->is_busy() ) return notify_fail(target->name()+"目前正自顧不暇,放膽攻擊吧!\n"); msg = HIR "$N使出雲龍爪絕技「凝血神爪」,真氣灌注雙爪抓向$n。\n"NOR; if( random(query("combat_exp", me))>query("combat_exp", target)/4 ) { if( arrayp(limbs=query("limbs", target)) ) limb = limbs[random(sizeof(limbs))]; else limb = "要害"; msg+=HIR "$n連忙騰挪躲閃,然而“撲哧”一聲,$N" HIR "五指正抓在$n" HIR "的" + limb + ",只聽得$n" HIR "一聲慘叫,鮮血橫飛。\n" NOR; skill = me->query_skill(bskill, 1) * 2; damage = skill + (int)me->query_skill("force", 1)/2; addn("neili", -300, me); me->start_busy(2); target->start_busy(random(3)); target->receive_damage("qi", damage,me); target->receive_wound("qi", damage/4,me); target->receive_damage("jing", damage*7/10,me); target->receive_wound("jing", damage/3,me); addn("neili", -600, target); } else { msg += HIG "可是$p看破了$P的企圖,騰身避開,並沒有中招。\n" NOR; me->start_busy(4); addn("neili", -100, me); } message_combatd(msg, me, target); return 1; } string name() {return replace_string(replace_string(PNAME,"「",""),"」","");} int help(object me) { write(WHT"\n"+to_chinese(explode(__FILE__,"/")[<2])+"之"+name()+WHT":"NOR"\n"); write(@HELP 使用功效: 傷敵氣血和精氣 出手要求: 雲龍神功120級 雲龍爪150級 後天膂力30 內力800 HELP ); return 1; }
31.918919
87
0.500988
[ "object" ]
61017c38c1e270a81571fda81577c5bb60acc08a
2,259
h
C
src/Learning/StochasticGradientDescent.h
andreas-hjortgaard/master_thesis
bb03ca9fc030c5142a7dde2ec80a85abc06e2cfb
[ "MIT" ]
null
null
null
src/Learning/StochasticGradientDescent.h
andreas-hjortgaard/master_thesis
bb03ca9fc030c5142a7dde2ec80a85abc06e2cfb
[ "MIT" ]
null
null
null
src/Learning/StochasticGradientDescent.h
andreas-hjortgaard/master_thesis
bb03ca9fc030c5142a7dde2ec80a85abc06e2cfb
[ "MIT" ]
1
2018-10-20T00:43:36.000Z
2018-10-20T00:43:36.000Z
/* Conditional Random Fields for Object Localization * Master thesis source code * * Authors: * Andreas Christian Eilschou (jwb226@alumni.ku.dk) * Andreas Hjortgaard Danielsen (gxn961@alumni.ku.dk) * * Department of Computer Science * University of Copenhagen * Denmark * * Date: 27-08-2012 */ #ifndef _STOCHASTIC_GRADIENT_DESCENT_H_ #define _STOCHASTIC_GRADIENT_DESCENT_H_ #include "GradientDescent.h" #include "ObjectiveFunctions/StochasticGradient.h" // implementation of stochastic gradient descent // inspired by Leon Bottou's crfsgd // http://leon.bottou.org/projects/sgd class StochasticGradientDescent : public GradientDescent { protected: StochasticGradient *gradient; // parameters for learning rate // eta(t) = 1/(alpha*(t+t0)) decreasing eta // eta(t) = 1/(alpha*t0) constant eta bool constLearningRate; double alpha; double t0; // maximum number of epochs int maxEpochs; // current epoch and iteration int epoch; int t; // path for temporary weights std::string tempWeightsPath; // try given learning rate on sample subset // for use in initializeLearningRate double tryEta(Weights &w, double eta, SearchIx &sample, bool normalized); // print progress void progress(Weights &w, Weights &wAvg, int epoch, int t, double eta, bool lastEpoch) ; public: // constructors StochasticGradientDescent(ObjectiveFunction *obj, StochasticGradient *grad); StochasticGradientDescent(ObjectiveFunction *obj, StochasticGradient *grad, double alpha_, double t0_, bool constLearningRate = false); // getters and setters for learning rate parameters double getAlpha(); void setAlpha(double alpha_); double getT0(); void setT0(double t0_); void setMaxEpochs(int maxEpochs_); // path for storing temporary weights between iterations void setTempWeightsPath(std::string path); // use training data (or a subset) to initialize t0 and alpha void initializeLearningRate(Weights &w, double initialEta, int sampleSize, bool normalized); // training procedure virtual Weights learnWeights(const Weights &w); }; #endif // _STOCHASTIC_GRADIENT_DESCENT_H_
27.54878
139
0.712262
[ "object" ]
61086ee41f89e5661669d4c0311c49815a6e3b44
3,028
h
C
src/ext/glbinding/include/glbinding/Meta.h
carl-221b/gen_planete
89cf1096363c8f1e1ee0de3221e3cd5057862391
[ "MIT" ]
null
null
null
src/ext/glbinding/include/glbinding/Meta.h
carl-221b/gen_planete
89cf1096363c8f1e1ee0de3221e3cd5057862391
[ "MIT" ]
null
null
null
src/ext/glbinding/include/glbinding/Meta.h
carl-221b/gen_planete
89cf1096363c8f1e1ee0de3221e3cd5057862391
[ "MIT" ]
null
null
null
#pragma once #include <glbinding/glbinding_api.h> #include <string> #include <utility> #include <vector> #include <set> #include <cstdint> #include <glbinding/gl/types.h> namespace glbinding { class Version; class GLBINDING_API Meta { public: Meta() = delete; static bool extensive(); static int glRevision(); static gl::GLbitfield getBitfield(const std::string & glbitfield); static std::vector<gl::GLbitfield> bitfields(); static const std::string & getString(gl::GLenum glenum); static gl::GLenum getEnum(const std::string & glenum); static std::vector<gl::GLenum> enums(); static const std::string & getString(gl::GLboolean glboolean); static gl::GLboolean getBoolean(const std::string & glboolean); static const std::string & getString(gl::GLextension glextension); static gl::GLextension getExtension(const std::string & glextension); static std::set<gl::GLextension> extensions(); static const std::set<std::string> & getRequiredFunctions(gl::GLextension glextension); static const std::set<gl::GLextension> & getExtensionsRequiring(const std::string & glfunction); static const Version & getRequiringVersion(gl::GLextension glextension); static const std::set<Version> & versions(); static const std::string & getString(gl::AttribMask glbitfield); static const std::string & getString(gl::ClearBufferMask glbitfield); static const std::string & getString(gl::ClientAttribMask glbitfield); static const std::string & getString(gl::ContextFlagMask glbitfield); static const std::string & getString(gl::ContextProfileMask glbitfield); static const std::string & getString(gl::FfdMaskSGIX glbitfield); static const std::string & getString(gl::FragmentShaderColorModMaskATI glbitfield); static const std::string & getString(gl::FragmentShaderDestMaskATI glbitfield); static const std::string & getString(gl::FragmentShaderDestModMaskATI glbitfield); static const std::string & getString(gl::MapBufferUsageMask glbitfield); static const std::string & getString(gl::MemoryBarrierMask glbitfield); static const std::string & getString(gl::PathRenderingMaskNV glbitfield); static const std::string & getString(gl::PerformanceQueryCapsMaskINTEL glbitfield); static const std::string & getString(gl::SyncObjectMask glbitfield); static const std::string & getString(gl::TextureStorageMaskAMD glbitfield); static const std::string & getString(gl::UseProgramStageMask glbitfield); static const std::string & getString(gl::VertexHintsMaskPGI glbitfield); static const std::string & getString(gl::UnusedMask glbitfield); static const std::string & getString(gl::BufferAccessMask glbitfield); static const std::string & getString(gl::BufferStorageMask glbitfield); static const std::string & getString(gl::PathFontStyle glbitfield); private: static size_t alphabeticalGroupIndex(const std::string & identifier, std::uint8_t prefixLength); }; } // namespace gl
38.820513
100
0.744386
[ "vector" ]
6113931233831b26453829c15002df486bed28b3
2,898
h
C
PrototypeEngine/src/core/PrototypeTextureBuffer.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
2
2021-08-19T17:15:49.000Z
2021-12-28T22:48:47.000Z
PrototypeEngine/src/core/PrototypeTextureBuffer.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
null
null
null
PrototypeEngine/src/core/PrototypeTextureBuffer.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
null
null
null
/// Copyright 2021 Omar Sherif Fathy /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. #pragma once #include "../../include/PrototypeEngine/PrototypeEngineApi.h" #include <memory> #include <optional> #include <string> #include <vector> #include <nlohmann/json.hpp> struct PrototypeTextureBuffer; typedef void(PROTOTYPE_DYNAMIC_FN_CALL* onTextureBufferReloadFn)(PrototypeTextureBuffer* textureBuffer); typedef void(PROTOTYPE_DYNAMIC_FN_CALL* onTextureBufferGpuUploadFn)(PrototypeTextureBuffer* textureBuffer); struct PrototypeTextureBufferSource { PrototypeTextureBufferSource(std::string fullpath, std::vector<unsigned char> data, i32 width, i32 height, i32 components, time_t timestamp) : fullpath(fullpath) , data(data) , width(width) , height(height) , components(components) , timestamp(timestamp) {} std::string fullpath; std::vector<unsigned char> data; i32 width; i32 height; i32 components; time_t timestamp; }; struct PrototypeTextureBuffer { PrototypeTextureBuffer(const std::string name); ~PrototypeTextureBuffer(); const u32& id() const; const std::string& name() const; const PrototypeTextureBufferSource& source() const; const bool& needsUpload() const; void setSource(std::shared_ptr<PrototypeTextureBufferSource> source); void stageChange(); void commitChange(); void unsetData(); static void to_json(nlohmann::json& j, const PrototypeTextureBuffer& textureBuffer); static void from_json(const nlohmann::json& j); void* userData; private: const u32 _id; const std::string _name; bool _needsUpload; mutable std::shared_ptr<PrototypeTextureBufferSource> _source; };
36.225
108
0.567633
[ "vector" ]
612a262f1231273a3dd65fb0fa843e0dfc906dfe
1,110
h
C
Algorithms/scale/Scale.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
Algorithms/scale/Scale.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
Algorithms/scale/Scale.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
#ifndef SIDECAR_ALGORITHMS_SCALE_H // -*- C++ -*- #define SIDECAR_ALGORITHMS_SCALE_H #include "Algorithms/Algorithm.h" #include "Messages/Video.h" #include "Parameter/Parameter.h" namespace SideCar { namespace Algorithms { class Scale : public Algorithm { public: using DatumType = Messages::Video::DatumType; /** Constructor. \param controller object that controls us \param log device used for log messages */ Scale(Controller& controller, Logger::Log& log); /** Implementation of the Algorithm::startup interface. Register runtime parameters with the controller. \return true if successful, false otherwise */ bool startup(); void setScale(double value) { scale_->setValue(value); } private: /** Process next PRI message. \param msg message to process \return true if successful, false otherwise */ bool process(const Messages::Video::Ref& msg); Parameter::BoolValue::Ref enabled_; Parameter::DoubleValue::Ref scale_; }; } // end namespace Algorithms } // end namespace SideCar /** \file */ #endif
21.764706
108
0.686486
[ "object" ]
612b8e279c511aedb19ebe114648748610702f62
4,002
c
C
src/thirdparty/libzdb/src/util/Vector.c
nneesshh/pb-entity-db
efb3ca2c5f1f509ae12a3181545d77daf6de1d0b
[ "MIT" ]
2
2018-08-08T02:10:12.000Z
2019-05-04T04:51:12.000Z
src/thirdparty/libzdb/src/util/Vector.c
nneesshh/pb-entity-db
efb3ca2c5f1f509ae12a3181545d77daf6de1d0b
[ "MIT" ]
null
null
null
src/thirdparty/libzdb/src/util/Vector.c
nneesshh/pb-entity-db
efb3ca2c5f1f509ae12a3181545d77daf6de1d0b
[ "MIT" ]
null
null
null
/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. * * 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/>. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include <stdio.h> #include "Vector.h" /** * Implementation of the Vector interface. * * @file */ /* ----------------------------------------------------------- Definitions */ #define T Vector_T struct T { int length; int capacity; void **array; uint32_t timestamp; }; /* ------------------------------------------------------- Private methods */ static inline void _ensureCapacity(T V) { if (V->length >= V->capacity) { V->capacity = 2 * V->length; RESIZE(V->array, V->capacity * sizeof (void *)); } } /* ----------------------------------------------------- Protected methods */ #ifdef PACKAGE_PROTECTED #pragma GCC visibility push(hidden) #endif T Vector_new(int hint) { T V; Assertion_assert(hint >= 0); NEW(V); if (hint == 0) hint = 16; V->capacity = hint; V->array = CALLOC(V->capacity, sizeof (void *)); return V; } void Vector_free(T *V) { Assertion_assert(V && *V); FREE((*V)->array); FREE(*V); } void Vector_insert(T V, int i, void *e) { Assertion_assert(V); Assertion_assert(i >= 0 && i <= V->length); V->timestamp++; _ensureCapacity(V); for (int j = V->length++; j > i; j--) V->array[j] = V->array[j-1]; V->array[i] = e; } void *Vector_set(T V, int i, void *e) { Assertion_assert(V); Assertion_assert(i >= 0 && i < V->length); V->timestamp++; void *prev = V->array[i]; V->array[i] = e; return prev; } void *Vector_get(T V, int i) { Assertion_assert(V); Assertion_assert(i >= 0 && i < V->length); return V->array[i]; } void *Vector_remove(T V, int i) { Assertion_assert(V); Assertion_assert(i >= 0 && i < V->length); V->timestamp++; void *x = V->array[i]; V->length--; for (int j = i; j < V->length; j++) V->array[j] = V->array[j+1]; return x; } void Vector_push(T V, void *e) { Assertion_assert(V); V->timestamp++; _ensureCapacity(V); V->array[V->length++] = e; } void *Vector_pop(T V) { Assertion_assert(V); Assertion_assert(V->length>0); V->timestamp++; return V->array[--V->length]; } int Vector_isEmpty(T V) { Assertion_assert(V); return (V->length == 0); } int Vector_size(T V) { Assertion_assert(V); return V->length; } void Vector_map(T V, void apply(const void *element, void *ap), void *ap) { Assertion_assert(V); Assertion_assert(apply); uint32_t stamp = V->timestamp; for (int i = 0; i < V->length; i++) { apply(V->array[i], ap); Assertion_assert(V->timestamp == stamp); } } void **Vector_toArray(T V) { int i; Assertion_assert(V); void **array = ALLOC((V->length + 1) * sizeof (*array)); for (i = 0; i < V->length; i++) array[i] = V->array[i]; array[i] = NULL; return array; } #ifdef PACKAGE_PROTECTED #pragma GCC visibility pop #endif
22.110497
77
0.57921
[ "vector" ]
613474db1f42d8616e7f3a647612eb18593fc28f
2,583
h
C
aws-cpp-sdk-kafka/include/aws/kafka/model/ProvisionedThroughput.h
truthiswill/aws-sdk-cpp
6e854b6a8bc7945f150c3a11551196bda341962a
[ "Apache-2.0" ]
1
2022-02-10T08:06:54.000Z
2022-02-10T08:06:54.000Z
aws-cpp-sdk-kafka/include/aws/kafka/model/ProvisionedThroughput.h
truthiswill/aws-sdk-cpp
6e854b6a8bc7945f150c3a11551196bda341962a
[ "Apache-2.0" ]
1
2021-10-14T16:57:00.000Z
2021-10-18T10:47:24.000Z
aws-cpp-sdk-kafka/include/aws/kafka/model/ProvisionedThroughput.h
truthiswill/aws-sdk-cpp
6e854b6a8bc7945f150c3a11551196bda341962a
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/kafka/Kafka_EXPORTS.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Kafka { namespace Model { /** * Contains information about provisioned throughput for EBS storage volumes * attached to kafka broker nodes.<p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ProvisionedThroughput">AWS * API Reference</a></p> */ class AWS_KAFKA_API ProvisionedThroughput { public: ProvisionedThroughput(); ProvisionedThroughput(Aws::Utils::Json::JsonView jsonValue); ProvisionedThroughput& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * Provisioned throughput is enabled or not. */ inline bool GetEnabled() const{ return m_enabled; } /** * Provisioned throughput is enabled or not. */ inline bool EnabledHasBeenSet() const { return m_enabledHasBeenSet; } /** * Provisioned throughput is enabled or not. */ inline void SetEnabled(bool value) { m_enabledHasBeenSet = true; m_enabled = value; } /** * Provisioned throughput is enabled or not. */ inline ProvisionedThroughput& WithEnabled(bool value) { SetEnabled(value); return *this;} /** * Throughput value of the EBS volumes for the data drive on each kafka broker node * in MiB per second. */ inline int GetVolumeThroughput() const{ return m_volumeThroughput; } /** * Throughput value of the EBS volumes for the data drive on each kafka broker node * in MiB per second. */ inline bool VolumeThroughputHasBeenSet() const { return m_volumeThroughputHasBeenSet; } /** * Throughput value of the EBS volumes for the data drive on each kafka broker node * in MiB per second. */ inline void SetVolumeThroughput(int value) { m_volumeThroughputHasBeenSet = true; m_volumeThroughput = value; } /** * Throughput value of the EBS volumes for the data drive on each kafka broker node * in MiB per second. */ inline ProvisionedThroughput& WithVolumeThroughput(int value) { SetVolumeThroughput(value); return *this;} private: bool m_enabled; bool m_enabledHasBeenSet; int m_volumeThroughput; bool m_volumeThroughputHasBeenSet; }; } // namespace Model } // namespace Kafka } // namespace Aws
26.90625
115
0.689895
[ "model" ]
6145822aace3ffac7b10b546ec11f39c6c0fc0d8
384
h
C
libraries/mmlibc/include/mmbits/struct_typed_mem_info.h
betopp/pathetix
a18a1211f6f3ca3c9ebd0e3de6784ae0591d1265
[ "MIT" ]
null
null
null
libraries/mmlibc/include/mmbits/struct_typed_mem_info.h
betopp/pathetix
a18a1211f6f3ca3c9ebd0e3de6784ae0591d1265
[ "MIT" ]
null
null
null
libraries/mmlibc/include/mmbits/struct_typed_mem_info.h
betopp/pathetix
a18a1211f6f3ca3c9ebd0e3de6784ae0591d1265
[ "MIT" ]
null
null
null
//mmlibc/include/mmbits/struct_typed_mem_info.h //Fragment for building C standard headers. //Bryan E. Topp <betopp@betopp.com> 2020 #ifndef _STRUCT_TYPED_MEM_INFO_H #define _STRUCT_TYPED_MEM_INFO_H #include <mmbits/typedef_size.h> struct posix_typed_mem_info { size_t posix_tmi_length; //Maximum length allocatable from a typed memory object }; #endif //_STRUCT_TYPED_MEM_INFO_H
25.6
81
0.817708
[ "object" ]
614649565c5b397c3ba40e446050819c7537f735
14,678
h
C
Sources/Elastos/Frameworks/Droid/Base/Packages/SystemUI/inc/elastos/droid/systemui/recents/views/TaskView.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
7
2017-07-13T10:34:54.000Z
2021-04-16T05:40:35.000Z
Sources/Elastos/Frameworks/Droid/Base/Packages/SystemUI/inc/elastos/droid/systemui/recents/views/TaskView.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
null
null
null
Sources/Elastos/Frameworks/Droid/Base/Packages/SystemUI/inc/elastos/droid/systemui/recents/views/TaskView.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
9
2017-07-13T12:33:20.000Z
2021-06-19T02:46:48.000Z
//========================================================================= // Copyright (C) 2012 The Elastos 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. //========================================================================= #ifndef __ELASTOS_DROID_SYSTEMUI_RECENTS_VIEWS_TASKVIEW_H__ #define __ELASTOS_DROID_SYSTEMUI_RECENTS_VIEWS_TASKVIEW_H__ #include "elastos/droid/systemui/recents/views/AnimateableViewBounds.h" #include "elastos/droid/systemui/recents/views/TaskViewFooter.h" #include "elastos/droid/systemui/recents/views/TaskViewHeader.h" #include "elastos/droid/systemui/recents/views/TaskViewThumbnail.h" #include "elastos/droid/systemui/recents/views/ViewAnimation.h" #include "elastos/droid/systemui/recents/model/Task.h" using Elastos::Droid::Animation::IAnimatorListener; using Elastos::Droid::View::IViewOnClickListener; using Elastos::Droid::View::IViewOnLongClickListener; using Elastos::Droid::View::Animation::IAccelerateInterpolator; using Elastos::Droid::SystemUI::Recents::Model::Task; using Elastos::Droid::SystemUI::Recents::Model::ITaskCallbacks; namespace Elastos { namespace Droid { namespace SystemUI { namespace Recents { namespace Views { /* A task view */ class TaskView : public FrameLayout , public ITaskView { private: class Wrapper : public Object , public ITaskCallbacks , public ITaskFooterViewCallbacks , public IViewOnClickListener , public IViewOnLongClickListener { public: Wrapper( /* [in] */ TaskView* host); CAR_INTERFACE_DECL() CARAPI OnTaskDataLoaded(); CARAPI OnTaskDataUnloaded(); /**** TaskViewFooter.TaskFooterViewCallbacks ****/ CARAPI OnTaskFooterHeightChanged( /* [in] */ Int32 height, /* [in] */ Int32 maxHeight); /**** View.OnClickListener Implementation ****/ CARAPI OnClick( /* [in] */ IView* v); /**** View.OnLongClickListener Implementation ****/ // @Override CARAPI OnLongClick( /* [in] */ IView* v, /* [out] */ Boolean* result); private: TaskView* mHost; }; class TaskProgressAnimatorUpdateListener : public Object , public IAnimatorUpdateListener { public: TO_STRING_IMPL("TaskView::TaskProgressAnimatorUpdateListener") CAR_INTERFACE_DECL() TaskProgressAnimatorUpdateListener( /* [in] */ TaskView* host); // @Override CARAPI OnAnimationUpdate( /* [in] */ IValueAnimator* animation); private: TaskView* mHost; }; class ClipTopAnimatorUpdateListener : public Object , public IAnimatorUpdateListener { public: TO_STRING_IMPL("TaskView::ClipTopAnimatorUpdateListener") CAR_INTERFACE_DECL() ClipTopAnimatorUpdateListener( /* [in] */ TaskView* host); // @Override CARAPI OnAnimationUpdate( /* [in] */ IValueAnimator* animation); private: TaskView* mHost; }; class MyViewOutlineProvider : public ViewOutlineProvider { public: TO_STRING_IMPL("TaskView::MyViewOutlineProvider") MyViewOutlineProvider( /* [in] */ TaskView* host); // @Override CARAPI GetOutline( /* [in] */ IView* view, /* [in] */ IOutline* outline); private: TaskView* mHost; }; class EndLaunchedFromAppWithScreenshotRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::EndLaunchedFromAppWithScreenshotRunnable") EndLaunchedFromAppWithScreenshotRunnable( /* [in] */ TaskView* host, /* [in] */ ViewAnimation::TaskViewEnterContext* ctx); // @Override CARAPI Run(); private: TaskView* mHost; AutoPtr<ViewAnimation::TaskViewEnterContext> mCtx; }; class AnimateDimRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::AnimateDimRunnable") AnimateDimRunnable( /* [in] */ TaskView* host, /* [in] */ ViewAnimation::TaskViewEnterContext* ctx); // @Override CARAPI Run(); private: TaskView* mHost; AutoPtr<ViewAnimation::TaskViewEnterContext> mCtx; }; class EndLaunchedFromAppWithThumbnailRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::EndLaunchedFromAppWithThumbnailRunnable") EndLaunchedFromAppWithThumbnailRunnable( /* [in] */ ViewAnimation::TaskViewEnterContext* ctx); // @Override CARAPI Run(); private: AutoPtr<ViewAnimation::TaskViewEnterContext> mCtx; }; class EnableFocusAnimationsDimRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::EnableFocusAnimationsDimRunnable") EnableFocusAnimationsDimRunnable( /* [in] */ TaskView* host); // @Override CARAPI Run(); private: TaskView* mHost; }; class EndDeleteTaskAnimationRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::EndDeleteTaskAnimationRunnable") EndDeleteTaskAnimationRunnable( /* [in] */ TaskView* host, /* [in] */ IRunnable* r); // @Override CARAPI Run(); private: TaskView* mHost; AutoPtr<IRunnable> mR; }; class DismissTaskRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::DismissTaskRunnable") DismissTaskRunnable( /* [in] */ TaskView* host); // @Override CARAPI Run(); private: TaskView* mHost; }; class OnClickRunnable : public Runnable { public: TO_STRING_IMPL("TaskView::OnClickRunnable") OnClickRunnable( /* [in] */ TaskView* host, /* [in] */ IView* v); // @Override CARAPI Run(); private: TaskView* mHost; AutoPtr<IView> mV; }; public: TaskView(); CAR_INTERFACE_DECL() CARAPI constructor( /* [in] */ IContext* context); CARAPI constructor( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs); CARAPI constructor( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs, /* [in] */ Int32 defStyleAttr); CARAPI constructor( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs, /* [in] */ Int32 defStyleAttr, /* [in] */ Int32 defStyleRes); /** Set callback */ CARAPI_(void) SetCallbacks( /* [in] */ ITaskViewCallbacks* cb); /** Gets the task */ CARAPI_(AutoPtr<Task>) GetTask(); /** Returns the view bounds. */ CARAPI_(AutoPtr<AnimateableViewBounds>) GetViewBounds(); /** Synchronizes this view's properties with the task's transform */ CARAPI_(void) UpdateViewPropertiesToTaskTransform( /* [in] */ TaskViewTransform* toTransform, /* [in] */ Int32 duration); CARAPI_(void) UpdateViewPropertiesToTaskTransform( /* [in] */ TaskViewTransform* toTransform, /* [in] */ Int32 duratio, /* [in] */ IAnimatorUpdateListener* updateCallback); /** Resets this view's properties */ CARAPI_(void) ResetViewProperties(); /** * When we are un/filtering, this method will set up the transform that we are animating to, * in order to hide the task. */ CARAPI_(void) PrepareTaskTransformForFilterTaskHidden( /* [in] */ TaskViewTransform* toTransform); /** * When we are un/filtering, this method will setup the transform that we are animating from, * in order to show the task. */ CARAPI_(void) PrepareTaskTransformForFilterTaskVisible( /* [in] */ TaskViewTransform* fromTransform); /** Prepares this task view for the enter-recents animations. This is called earlier in the * first layout because the actual animation into recents may take a long time. */ CARAPI_(void) PrepareEnterRecentsAnimation( /* [in] */ Boolean isTaskViewLaunchTargetTask, /* [in] */ Boolean occludesLaunchTarget, /* [in] */ Int32 offscreenY); /** Animates this task view as it enters recents */ CARAPI_(void) StartEnterRecentsAnimation( /* [in] */ ViewAnimation::TaskViewEnterContext* ctx); /** Animates this task view as it leaves recents by pressing home. */ CARAPI_(void) StartExitToHomeAnimation( /* [in] */ ViewAnimation::TaskViewExitContext* ctx); /** Animates this task view as it exits recents */ CARAPI_(void) StartLaunchTaskAnimation( /* [in] */ IRunnable* postAnimRunnable, /* [in] */ Boolean isLaunchingTas, /* [in] */ Boolean occludesLaunchTarget, /* [in] */ Boolean lockToTask); /** Animates the deletion of this task view */ CARAPI_(void) StartDeleteTaskAnimation( /* [in] */ IRunnable* r); /** Animates this task view if the user does not interact with the stack after a certain time. */ CARAPI_(void) StartNoUserInteractionAnimation(); /** Mark this task view that the user does has not interacted with the stack after a certain time. */ CARAPI_(void) SetNoUserInteractionState(); /** Dismisses this task. */ CARAPI_(void) DismissTask(); /** Sets whether this task view is full screen or not. */ CARAPI_(void) SetIsFullScreen( /* [in] */ Boolean isFullscreen); /** Returns whether this task view should currently be drawn as a full screen view. */ CARAPI_(Boolean) IsFullScreenView(); /** * Returns whether this view should be clipped, or any views below should clip against this * view. */ CARAPI_(Boolean) ShouldClipViewInStack(); /** Sets whether this view should be clipped, or clipped against. */ CARAPI_(void) SetClipViewInStack( /* [in] */ Boolean clip); /** Gets the max footer height. */ CARAPI_(Int32) GetMaxFooterHeight(); /** Animates the footer into and out of view. */ CARAPI_(void) AnimateFooterVisibility( /* [in] */ Boolean visible, /* [in] */ Int32 duration); /** Sets the current task progress. */ CARAPI SetTaskProgress( /* [in] */ Float p); CARAPI GetTaskProgress( /* [out] */ Float* p); /** Returns the current task progress. */ CARAPI_(Float) GetTaskProgress(); /** Returns the current dim. */ CARAPI SetDim( /* [in] */ Int32 dim); CARAPI GetDim( /* [out] */ Int32* dim); /** Returns the current dim. */ CARAPI_(Int32) GetDim(); /** Animates the dim to the task progress. */ CARAPI_(void) AnimateDimToProgress( /* [in] */ Int32 delay, /* [in] */ Int32 duration, /* [in] */ IAnimatorListener* postAnimRunnable); /** Compute the dim as a function of the scale of this view. */ CARAPI_(Int32) GetDimFromTaskProgress(); /** Update the dim as a function of the scale of this view. */ CARAPI_(void) UpdateDimFromTaskProgress(); /**** View focus state ****/ /** * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen * if the view is not currently visible, or we are in touch state (where we still want to keep * track of focus). */ CARAPI_(void) SetFocusedTask(); /** * Unsets the focused task explicitly. */ CARAPI_(void) UnsetFocusedTask(); /** * Returns whether we have explicitly been focused. */ CARAPI_(Boolean) IsFocusedTask(); /** Enables all focus animations. */ CARAPI_(void) EnableFocusAnimations(); /**** TaskCallbacks Implementation ****/ /** Binds this task view to the task */ CARAPI_(void) OnTaskBound( /* [in] */ ITask* t); CARAPI OnTaskDataLoaded(); CARAPI OnTaskDataUnloaded(); /** Enables/disables handling touch on this task view. */ CARAPI_(void) SetTouchEnabled( /* [in] */ Boolean enabled); /**** TaskViewFooter.TaskFooterViewCallbacks ****/ CARAPI OnTaskFooterHeightChanged( /* [in] */ Int32 height, /* [in] */ Int32 maxHeight); /**** View.OnClickListener Implementation ****/ CARAPI OnClick( /* [in] */ IView* v); /**** View.OnLongClickListener Implementation ****/ // @Override CARAPI OnLongClick( /* [in] */ IView* v, /* [out] */ Boolean* result); protected: // @Override CARAPI OnFinishInflate(); // @Override CARAPI OnMeasure( /* [in] */ Int32 widthMeasureSpec, /* [in] */ Int32 heightMeasureSpec); /** * Updates the explicitly focused state when the view focus changes. */ // @Override CARAPI_(void) OnFocusChanged( /* [in] */ Boolean gainFocus, /* [in] */ Int32 direction, /* [in] */ IRect* previouslyFocusedRect); public: AutoPtr<RecentsConfiguration> mConfig; Float mTaskProgress; AutoPtr<IAnimator> mTaskProgressAnimator; //IObjectAnimator AutoPtr<IAnimator> mDimAnimator; //IObjectAnimator Float mMaxDimScale; Int32 mDim; AutoPtr<IAccelerateInterpolator> mDimInterpolator; AutoPtr<IPorterDuffColorFilter> mDimColorFilter; AutoPtr<Task> mTask; Boolean mTaskDataLoaded; Boolean mIsFocused; Boolean mFocusAnimationsEnabled; Boolean mIsFullScreenView; Boolean mClipViewInStack; AutoPtr<AnimateableViewBounds> mViewBounds; AutoPtr<IPaint> mLayerPaint; AutoPtr<IView> mContent; AutoPtr<TaskViewThumbnail> mThumbnailView; AutoPtr<TaskViewHeader> mHeaderView; AutoPtr<TaskViewFooter> mFooterView; AutoPtr<IView> mActionButtonView; AutoPtr<ITaskViewCallbacks> mCb; // Optimizations AutoPtr<IAnimatorUpdateListener> mUpdateDimListener; private: AutoPtr<Wrapper> mWrapper; }; } // namespace Views } // namespace Recents } // namespace SystemUI } // namespace Droid } // namespace Elastos #endif // __ELASTOS_DROID_SYSTEMUI_RECENTS_VIEWS_TASKVIEW_H__
28.172745
105
0.628015
[ "object", "model", "transform" ]
614d68bd110952d523ee8e46177bc97f0aa6cb39
6,545
h
C
kernel/mach/mach_types.h
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
27
2015-03-06T06:47:58.000Z
2021-11-06T02:01:26.000Z
kernel/mach/mach_types.h
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
null
null
null
kernel/mach/mach_types.h
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
11
2015-08-16T02:07:39.000Z
2020-06-02T17:42:14.000Z
/* * Mach Operating System * Copyright (c) 1992,1991,1990,1989,1988 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, 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. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * HISTORY * $Log: mach_types.h,v $ * Revision 2.11 93/01/24 13:20:48 danner * Include the pc_sample.h definition for everyone. The * sample_control structure is included in task.h and thread.h. * [93/01/12 rvb] * * Revision 2.10 93/01/14 17:44:36 danner * Moved definition of vm_address_t to std_types.h. * [92/12/14 pds] * Cleanup. * [92/06/10 pds] * * Revision 2.9 92/03/10 16:27:03 jsb * NORMA_VM: define mach_xmm_obj_t and xmm_kobj_lookup(). * [92/02/10 08:47:29 jsb] * * Revision 2.8 91/06/25 10:30:20 rpd * Added KERNEL-compilation includes for *_array_t types. * [91/05/23 rpd] * * Revision 2.7 91/06/06 17:08:07 jsb * Added emulation_vector_t for new get/set emulation vector calls. * [91/05/24 17:46:31 jsb] * * Revision 2.6 91/05/14 16:55:17 mrt * Correcting copyright * * Revision 2.5 91/02/05 17:33:43 mrt * Changed to new Mach copyright * [91/02/01 17:18:38 mrt] * * Revision 2.4 90/08/07 18:00:30 rpd * Added processor_set_name_array_t. * Removed vm_region_t, vm_region_array_t. * [90/08/07 rpd] * * Revision 2.3 90/06/02 14:58:42 rpd * Converted to new IPC. * [90/03/26 22:33:59 rpd] * * Revision 2.2 90/01/22 23:05:48 af * Added inclusion of vm_attributes. * [89/12/09 af] * * Moved KERNEL type definitions into kern/mach_types_kernel.h, so * that changing them will not affect user programs. * [89/04/06 dbg] * * Removed io_buf_t, io_buf_ptr_t in favor of device interface. * Removed include of ipc_netport.h. Removed vm_page_data_t * (obsolete). * [89/01/14 dbg] * * Revision 2.1 89/08/03 16:02:27 rwd * Created. * * Revision 2.3 89/02/25 18:38:04 gm0w * Changes for cleanup. * * Revision 2.2 89/01/15 16:30:50 rpd * Moved from kern/ to mach/. * [89/01/15 14:35:53 rpd] * * Revision 2.10 89/01/12 11:15:18 rpd * Removed pointer_t declaration; it belongs in std_types.h. * * Revision 2.9 89/01/12 07:57:53 rpd * Moved basic stuff to std_types.h. Removed debugging definitions. * Moved io_buf definitions to device_types.h. * [89/01/12 04:51:54 rpd] * * Revision 2.8 89/01/04 13:37:34 rpd * Include <kern/fpa_counters.h>, for fpa_counters_t. * [89/01/01 15:03:52 rpd] * * Revision 2.7 88/09/25 22:15:28 rpd * Changed sys/callout.h to kern/callout_statistics.h. * [88/09/09 14:00:19 rpd] * * Changed includes to the new style. * Added include of sys/callout.h. * [88/09/09 04:47:42 rpd] * * Revision 2.6 88/08/06 18:22:34 rpd * Changed sys/mach_ipc_netport.h to kern/ipc_netport.h. * * Revision 2.5 88/07/21 00:36:06 rpd * Added include of ipc_statistics.h. * * Revision 2.4 88/07/17 19:33:20 mwyoung * *** empty log message *** * * 29-Jun-88 Michael Young (mwyoung) at Carnegie-Mellon University * Use new <mach/memory_object.h>. * * 9-Apr-88 Daniel Julin (dpj) at Carnegie-Mellon University * Changed mach_ipc_vmtp.h to mach_ipc_netport.h. * * 1-Mar-88 Mary Thompson (mrt) at Carnegie Mellon * Added a conditional on _MACH_INIT_ before the include * of mach_init.h so that the kernel make of mach_user_internal * would not include mach_init.h * * 18-Jan-88 David Golub (dbg) at Carnegie-Mellon University * Added includes of task_info, thread_info, task_special_ports, * thread_special_ports for new interfaces. * * 12-Dec-87 Michael Young (mwyoung) at Carnegie-Mellon University * Reduced old history. */ /* * File: mach/mach_types.h * Author: Avadis Tevanian, Jr., Michael Wayne Young * Date: 1986 * * Mach external interface definitions. * */ #ifndef _MACH_MACH_TYPES_H_ #define _MACH_MACH_TYPES_H_ #include <mach/host_info.h> #include <mach/machine.h> #include <mach/machine/vm_types.h> #include <mach/memory_object.h> #include <mach/pc_sample.h> #include <mach/port.h> #include <mach/processor_info.h> #include <mach/task_info.h> #include <mach/task_special_ports.h> #include <mach/thread_info.h> #include <mach/thread_special_ports.h> #include <mach/thread_status.h> #include <mach/time_value.h> #include <mach/vm_attributes.h> #include <mach/vm_inherit.h> #include <mach/vm_prot.h> #include <mach/vm_statistics.h> #ifdef KERNEL #include <kern/task.h> /* for task_array_t */ #include <kern/thread.h> /* for thread_array_t */ #include <kern/processor.h> /* for processor_array_t, processor_set_array_t, processor_set_name_array_t */ #include <kern/syscall_emulation.h> /* for emulation_vector_t */ #include <norma_vm.h> #if NORMA_VM typedef struct xmm_obj *mach_xmm_obj_t; extern mach_xmm_obj_t xmm_kobj_lookup(); #endif /* NORMA_VM */ #else /* KERNEL */ typedef mach_port_t task_t; typedef task_t *task_array_t; typedef task_t vm_task_t; typedef task_t ipc_space_t; typedef mach_port_t thread_t; typedef thread_t *thread_array_t; typedef mach_port_t host_t; typedef mach_port_t host_priv_t; typedef mach_port_t processor_t; typedef mach_port_t *processor_array_t; typedef mach_port_t processor_set_t; typedef mach_port_t processor_set_name_t; typedef mach_port_t *processor_set_array_t; typedef mach_port_t *processor_set_name_array_t; typedef vm_offset_t *emulation_vector_t; #endif /* KERNEL */ /* * Backwards compatibility, for those programs written * before mach/{std,mach}_types.{defs,h} were set up. */ #include <mach/std_types.h> #endif /* _MACH_MACH_TYPES_H_ */
31.771845
75
0.702215
[ "vector" ]
6150b14e16c28a453d12020eac512b5be3a64680
637
h
C
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/WXOpenBusinessViewReq.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
30
2020-03-22T12:30:21.000Z
2022-02-09T08:49:13.000Z
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/WXOpenBusinessViewReq.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
null
null
null
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/WXOpenBusinessViewReq.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
8
2020-03-22T12:30:23.000Z
2020-09-22T04:01:47.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import "BaseReq.h" @class NSString; @interface WXOpenBusinessViewReq : BaseReq { NSString *_businessType; NSString *_query; NSString *_extInfo; } + (id)object; @property(copy, nonatomic) NSString *extInfo; // @synthesize extInfo=_extInfo; @property(copy, nonatomic) NSString *query; // @synthesize query=_query; @property(copy, nonatomic) NSString *businessType; // @synthesize businessType=_businessType; - (void).cxx_destruct; @end
24.5
93
0.712716
[ "object" ]
6157fe1dcaa25323df82e92c9b7d8702d414f9bd
5,119
h
C
poincare/include/poincare/layout.h
VersiraSec/epsilon-cfw
d12b44c6c6668ecc14b60d8dd098ba5c230b1291
[ "FSFAP" ]
1,442
2017-08-28T19:39:45.000Z
2022-03-30T00:56:14.000Z
poincare/include/poincare/layout.h
VersiraSec/epsilon-cfw
d12b44c6c6668ecc14b60d8dd098ba5c230b1291
[ "FSFAP" ]
1,321
2017-08-28T23:03:10.000Z
2022-03-31T19:32:17.000Z
poincare/include/poincare/layout.h
VersiraSec/epsilon-cfw
d12b44c6c6668ecc14b60d8dd098ba5c230b1291
[ "FSFAP" ]
421
2017-08-28T22:02:39.000Z
2022-03-28T20:52:21.000Z
#ifndef POINCARE_LAYOUT_REFERENCE_H #define POINCARE_LAYOUT_REFERENCE_H #include <poincare/context.h> #include <poincare/layout_node.h> #include <poincare/tree_handle.h> #include <escher/palette.h> namespace Poincare { class LayoutCursor; class Expression; class Layout : public TreeHandle { friend class GridLayoutNode; friend class HorizontalLayoutNode; friend class LayoutNode; friend class LayoutCursor; friend class VerticalOffsetLayoutNode; public: Layout() : TreeHandle() {} Layout(const LayoutNode * node) : TreeHandle(node) {} Layout clone() const; LayoutNode * node() const { assert(isUninitialized() || !TreeHandle::node()->isGhost()); return static_cast<LayoutNode *>(TreeHandle::node()); } static Layout LayoutFromAddress(const void * address, size_t size); // Properties LayoutNode::Type type() const { return node()->type(); } bool isIdenticalTo(Layout l) { return isUninitialized() ? l.isUninitialized() : node()->isIdenticalTo(l); } // Rendering void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = Escher::Palette::Select) { return node()->draw(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor); } void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) { return node()->render(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor); } KDSize layoutSize() const { return node()->layoutSize(); } KDPoint absoluteOrigin() const { return node()->absoluteOrigin(); } KDCoordinate baseline() { return node()->baseline(); } void invalidAllSizesPositionsAndBaselines() { return node()->invalidAllSizesPositionsAndBaselines(); } // Serialization int serializeForParsing(char * buffer, int bufferSize) const { return node()->serialize(buffer, bufferSize); } int serializeParsedExpression(char * buffer, int bufferSize, Context * context) const; // Layout properties typedef bool (*LayoutTest)(const Layout l); Layout recursivelyMatches(LayoutTest test) const; bool mustHaveLeftSibling() const { return const_cast<Layout *>(this)->node()->mustHaveLeftSibling(); } bool isEmpty() const { return const_cast<Layout *>(this)->node()->isEmpty(); } bool isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) const { return const_cast<Layout *>(this)->node()->isCollapsable(numberOfOpenParenthesis, goingLeft); } int leftCollapsingAbsorbingChildIndex() const { return const_cast<Layout *>(this)->node()->leftCollapsingAbsorbingChildIndex(); } int rightCollapsingAbsorbingChildIndex() const { return const_cast<Layout *>(this)->node()->rightCollapsingAbsorbingChildIndex(); } bool hasText() { return node()->hasText(); } Layout XNTLayout() const; // Layout modification void deleteBeforeCursor(LayoutCursor * cursor) { return node()->deleteBeforeCursor(cursor); } bool removeGraySquaresFromAllMatrixAncestors() { return node()->removeGraySquaresFromAllMatrixAncestors(); } bool removeGraySquaresFromAllMatrixChildren() { return node()->removeGraySquaresFromAllMatrixChildren(); } bool addGraySquaresToAllMatrixAncestors() { return node()->addGraySquaresToAllMatrixAncestors(); } Layout layoutToPointWhenInserting(Expression * correspondingExpression) { // Pointer to correspondingExpr because expression.h includes layout.h assert(correspondingExpression != nullptr); return Layout(node()->layoutToPointWhenInserting(correspondingExpression)); } // Cursor LayoutCursor cursor() const; LayoutCursor equivalentCursor(LayoutCursor * cursor); // Tree Layout childAtIndex(int i) const; Layout root() const { assert(!isUninitialized()); return Layout(node()->root()); } Layout parent() const { assert(!isUninitialized()); return Layout(node()->parent()); } // Tree modification // Add void addSibling(LayoutCursor * cursor, Layout sibling, bool moveCursor); // Replace void replaceChild(Layout oldChild, Layout newChild, LayoutCursor * cursor = nullptr, bool force = false); void replaceChildWithEmpty(Layout oldChild, LayoutCursor * cursor = nullptr); void replaceWith(Layout newChild, LayoutCursor * cursor); void replaceWithJuxtapositionOf(Layout leftChild, Layout rightChild, LayoutCursor * cursor, bool putCursorInTheMiddle = false); // Collapse void collapseSiblings(LayoutCursor * cursor); protected: // Add void addChildAtIndex(Layout l, int index, int currentNumberOfChildren, LayoutCursor * cursor); // Remove void removeChild(Layout l, LayoutCursor * cursor, bool force = false); void removeChildAtIndex(int index, LayoutCursor * cursor, bool force = false); private: // Tree modification enum class HorizontalDirection { Left, Right }; void collapseOnDirection(HorizontalDirection direction, int absorbingChildIndex); }; } #endif
44.513043
239
0.752491
[ "render" ]
61593ebb282d41d1835c04ff7bb1519bfa5b9a1c
626
h
C
src/mp.h
schardong/mpalg
d4366ee4312b38fbe15f49061b034327a880aade
[ "MIT" ]
1
2016-11-09T13:03:37.000Z
2016-11-09T13:03:37.000Z
src/mp.h
schardong/mpalg
d4366ee4312b38fbe15f49061b034327a880aade
[ "MIT" ]
null
null
null
src/mp.h
schardong/mpalg
d4366ee4312b38fbe15f49061b034327a880aade
[ "MIT" ]
null
null
null
/** * @file mp.h * @author Guilherme G. Schardong [gschardong@inf.puc-rio.br] * @date 26/06/2016 * @brief Defitions of the Multidimensional Projection algorithms implemented in * this library. */ #ifndef MULTIDIMENSIONAL_PROJECTIONS_H #define MULTIDIMENSIONAL_PROJECTIONS_H #include <opencv2/core/core.hpp> #include <vector> cv::Mat cmdscale(const cv::Mat& dist, const int k, const cv::Mat* eigenvals = NULL, const cv::Mat* eigenvecs = NULL); cv::Mat lamp(const cv::Mat& X, const std::vector<int> cp_index, const cv::Mat& Ys); #endif // MULTIDIMENSIONAL_PROJECTIONS_H
27.217391
80
0.683706
[ "vector" ]
615cae4f81906dcbfcb25e90836249d574ed5356
7,360
h
C
dlls/bot.h
avwuff/Half-Life-TFC-AVC-Mod
3b6a32b615e42cd541f078065458d47c3d4688ba
[ "MIT" ]
5
2019-05-08T19:25:02.000Z
2021-09-12T00:26:20.000Z
dlls/bot.h
avwuff/Half-Life-TFC-AVC-Mod
3b6a32b615e42cd541f078065458d47c3d4688ba
[ "MIT" ]
1
2018-08-28T13:46:12.000Z
2018-08-28T13:48:40.000Z
dlls/bot.h
avwuff/Half-Life-TFC-AVC-Mod
3b6a32b615e42cd541f078065458d47c3d4688ba
[ "MIT" ]
1
2021-03-08T15:39:39.000Z
2021-03-08T15:39:39.000Z
// // HPB_bot - botman's High Ping Bastard bot // // (http://planethalflife.com/botman/) // // bot.h // #ifndef BOT_H #define BOT_H // stuff for Win32 vs. Linux builds #ifndef __linux__ typedef int (FAR *GETENTITYAPI)(DLL_FUNCTIONS *, int); typedef int (FAR *GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *); typedef void (DLLEXPORT *GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *); typedef int (*SERVER_GETBLENDINGINTERFACE) (int, struct sv_blending_interface_s **, struct engine_studio_api_s *, float (*)[3][4], float (*)[MAXSTUDIOBONES][3][4]); typedef void (FAR *LINK_ENTITY_FUNC)(entvars_t *); #else #include <dlfcn.h> #define GetProcAddress dlsym typedef int BOOL; typedef int (*GETENTITYAPI)(DLL_FUNCTIONS *, int); typedef int (*GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *); typedef void (*GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *); typedef int (*SERVER_GETBLENDINGINTERFACE) (int, struct sv_blending_interface_s **, struct engine_studio_api_s *, float (*)[3][4], float (*)[MAXSTUDIOBONES][3][4]); typedef void (*LINK_ENTITY_FUNC)(entvars_t *); #endif // define constants used to identify the MOD we are playing... #define VALVE_DLL 1 #define TFC_DLL 2 #define CSTRIKE_DLL 3 #define GEARBOX_DLL 4 #define FRONTLINE_DLL 5 // define some function prototypes... BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ); void ClientPutInServer( edict_t *pEntity ); void ClientCommand( edict_t *pEntity ); void FakeClientCommand(edict_t *pBot, char *arg1, char *arg2, char *arg3); const char *Cmd_Args( void ); const char *Cmd_Argv( int argc ); int Cmd_Argc( void ); #define LADDER_UNKNOWN 0 #define LADDER_UP 1 #define LADDER_DOWN 2 #define WANDER_LEFT 1 #define WANDER_RIGHT 2 #define BOT_PITCH_SPEED 20 #define BOT_YAW_SPEED 20 #define RESPAWN_IDLE 1 #define RESPAWN_NEED_TO_RESPAWN 2 #define RESPAWN_IS_RESPAWNING 3 // game start messages for TFC... #define MSG_TFC_IDLE 1 #define MSG_TFC_TEAM_SELECT 2 #define MSG_TFC_CLASS_SELECT 3 // game start messages for CS... #define MSG_CS_IDLE 1 #define MSG_CS_TEAM_SELECT 2 #define MSG_CS_CT_SELECT 3 #define MSG_CS_T_SELECT 4 // game start messages for OpFor... #define MSG_OPFOR_IDLE 1 #define MSG_OPFOR_TEAM_SELECT 2 #define MSG_OPFOR_CLASS_SELECT 3 // game start messages for FrontLineForce... #define MSG_FLF_IDLE 1 #define MSG_FLF_TEAM_SELECT 2 #define MSG_FLF_CLASS_SELECT 3 #define MSG_FLF_PISTOL_SELECT 4 #define MSG_FLF_WEAPON_SELECT 5 #define MSG_FLF_RIFLE_SELECT 6 #define MSG_FLF_SHOTGUN_SELECT 7 #define MSG_FLF_SUBMACHINE_SELECT 8 #define MSG_FLF_HEAVYWEAPONS_SELECT 9 #define TFC_CLASS_CIVILIAN 0 #define TFC_CLASS_SCOUT 1 #define TFC_CLASS_SNIPER 2 #define TFC_CLASS_SOLDIER 3 #define TFC_CLASS_DEMOMAN 4 #define TFC_CLASS_MEDIC 5 #define TFC_CLASS_HWGUY 6 #define TFC_CLASS_PYRO 7 #define TFC_CLASS_SPY 8 #define TFC_CLASS_ENGINEER 9 #define BOT_SKIN_LEN 32 #define BOT_NAME_LEN 32 #define MAX_BOT_WHINE 100 typedef struct { int iId; // weapon ID int iClip; // amount of ammo in the clip int iAmmo1; // amount of ammo in primary reserve int iAmmo2; // amount of ammo in secondary reserve } bot_current_weapon_t; typedef struct { bool is_used; int respawn_state; edict_t *pEdict; bool need_to_initialize; char name[BOT_NAME_LEN+1]; char skin[BOT_SKIN_LEN+1]; int bot_skill; int not_started; int start_action; float kick_time; float create_time; // things from pev in CBasePlayer... int bot_team; int bot_class; int bot_money; // for Counter-Strike int primary_weapon; // for Front Line Force int secondary_weapon; // for Front Line Force int defender; // for Front Line Force int warmup; // for Front Line Force float idle_angle; float idle_angle_time; // for Front Line Force int round_end; // round has ended (in round based games) float blinded_time; float f_max_speed; float prev_speed; float prev_time; Vector v_prev_origin; float f_find_item; edict_t *pBotPickupItem; int ladder_dir; float f_start_use_ladder_time; float f_end_use_ladder_time; bool waypoint_top_of_ladder; float f_wall_check_time; float f_wall_on_right; float f_wall_on_left; float f_dont_avoid_wall_time; float f_look_for_waypoint_time; float f_jump_time; float f_dont_check_stuck; int wander_dir; float f_exit_water_time; Vector waypoint_origin; float f_waypoint_time; int curr_waypoint_index; int prev_waypoint_index[5]; float f_random_waypoint_time; int waypoint_goal; float f_waypoint_goal_time; bool waypoint_near_flag; Vector waypoint_flag_origin; float prev_waypoint_distance; edict_t *pBotEnemy; float f_bot_see_enemy_time; float f_bot_find_enemy_time; edict_t *pBotUser; float f_bot_use_time; float f_bot_spawn_time; edict_t *killer_edict; bool b_bot_say_killed; float f_bot_say_killed; float f_sniper_aim_time; float f_shoot_time; float f_primary_charging; float f_secondary_charging; int charging_weapon_id; float f_move_speed; float f_pause_time; float f_sound_update_time; bool bot_has_flag; bool b_see_tripmine; bool b_shoot_tripmine; Vector v_tripmine; bool b_use_health_station; float f_use_health_time; bool b_use_HEV_station; float f_use_HEV_time; bool b_use_button; float f_use_button_time; bool b_lift_moving; bool b_use_capture; float f_use_capture_time; edict_t *pCaptureEdict; bot_current_weapon_t current_weapon; // one current weapon for each bot int m_rgAmmo[MAX_AMMO_SLOTS]; // total ammo amounts (1 array for each bot) } bot_t; #define MAX_TEAMS 32 #define MAX_TEAMNAME_LENGTH 16 #define MAX_FLAGS 5 typedef struct { bool mdl_match; int team_no; edict_t *edict; } FLAG_S; // new UTIL.CPP functions... edict_t *UTIL_FindEntityInSphere( edict_t *pentStart, const Vector &vecCenter, float flRadius ); edict_t *UTIL_FindEntityByString( edict_t *pentStart, const char *szKeyword, const char *szValue ); edict_t *UTIL_FindEntityByClassname( edict_t *pentStart, const char *szName ); edict_t *UTIL_FindEntityByTargetname( edict_t *pentStart, const char *szName ); void ClientPrint( edict_t *pEdict, int msg_dest, const char *msg_name); void UTIL_SayText( const char *pText, edict_t *pEdict ); void UTIL_HostSay( edict_t *pEntity, int teamonly, char *message ); int UTIL_GetTeam(edict_t *pEntity); int UTIL_GetClass(edict_t *pEntity); int UTIL_GetBotIndex(edict_t *pEdict); bot_t *UTIL_GetBotPointer(edict_t *pEdict); bool IsAlive(edict_t *pEdict); bool FInViewCone(Vector *pOrigin, edict_t *pEdict); bool FVisible( const Vector &vecOrigin, edict_t *pEdict ); Vector Center(edict_t *pEdict); Vector GetGunPosition(edict_t *pEdict); void UTIL_SelectItem(edict_t *pEdict, char *item_name); Vector VecBModelOrigin(edict_t *pEdict); bool UpdateSounds(edict_t *pEdict, edict_t *pPlayer); void UTIL_ShowMenu( edict_t *pEdict, int slots, int displaytime, bool needmore, char *pText ); void UTIL_BuildFileName(char *filename, char *arg1, char *arg2); #endif // BOT_H
26.47482
164
0.740353
[ "vector" ]
615ce7e27ffcd06db1a975dd4e312acd449b6a03
792
h
C
Triangle.h
jasperdewinther/advanced_graphics
49225b4b82f6cd4c2ccab20b72c8661170d57684
[ "CC0-1.0" ]
null
null
null
Triangle.h
jasperdewinther/advanced_graphics
49225b4b82f6cd4c2ccab20b72c8661170d57684
[ "CC0-1.0" ]
null
null
null
Triangle.h
jasperdewinther/advanced_graphics
49225b4b82f6cd4c2ccab20b72c8661170d57684
[ "CC0-1.0" ]
null
null
null
#pragma once #include <vector> #include <fstream> #include "Materials.h" #include "Utils.h" class Triangle { public: float3 p0; float3 p1; float3 p2; float3 normal; Material m; Triangle(float3 p0, float3 p1, float3 p2, float3 normal, Material material); float3 get_normal() const; float3 get_center() const; }; std::vector<Triangle> get_mesh_from_file(const std::string& filename, float scalefactor, Material material); Triangle parse_triangle(const std::string& s, const std::vector<float3>& vertices, const std::vector<float3>& normals, const float& scalefactor, const Material& material); std::pair<Triangle, Triangle> parse_quad(const std::string& s, const std::vector<float3>& vertices, const std::vector<float3>& normals, const float& scalefactor, const Material& material);
33
188
0.758838
[ "vector" ]
61641e4390da0dbb9b78bead7f9b3013eb583be7
701
h
C
Example/FFPopup_Example/Classes/Controllers/FFSelectionViewController.h
BinBear/FFPopup
44c5205f0ccc5d7aabae538298fcaed09ad2d488
[ "MIT" ]
null
null
null
Example/FFPopup_Example/Classes/Controllers/FFSelectionViewController.h
BinBear/FFPopup
44c5205f0ccc5d7aabae538298fcaed09ad2d488
[ "MIT" ]
null
null
null
Example/FFPopup_Example/Classes/Controllers/FFSelectionViewController.h
BinBear/FFPopup
44c5205f0ccc5d7aabae538298fcaed09ad2d488
[ "MIT" ]
null
null
null
// // FFSelectionViewController.h // FFPopup_Example // // Created by JonyFang on 2018/11/29. // Copyright © 2018年 JonyFang. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSUInteger, FFSelectionType) { FFSelectionType_None, FFSelectionType_HorizontalLayout, FFSelectionType_VerticalLayout, FFSelectionType_ShowAnimation, FFSelectionType_DismissAnimation, FFSelectionType_Mask }; @class FFPopupModel; @interface FFSelectionViewController : UIViewController @property (nonatomic, copy, nullable) void(^selectedBlock)(void); - (void)configureWithType:(FFSelectionType)type model:(FFPopupModel *)model; @end NS_ASSUME_NONNULL_END
24.172414
76
0.787447
[ "model" ]
6164ed32a2328e3d024646f76cc4921482569b30
9,847
h
C
source/neurog.h
Meta-chan/NeuroG
accee94a1aa81ec4e761cf7dc327c3488fdb1bac
[ "MIT" ]
null
null
null
source/neurog.h
Meta-chan/NeuroG
accee94a1aa81ec4e761cf7dc327c3488fdb1bac
[ "MIT" ]
null
null
null
source/neurog.h
Meta-chan/NeuroG
accee94a1aa81ec4e761cf7dc327c3488fdb1bac
[ "MIT" ]
null
null
null
/* Part of the NeuroG Project. Distributed under MIT License, which means: - Do whatever you want - Keep this notice and include the license file to your project - I provide no warranty To get help with installation, visit README Created by Kyrylo Sovailo, github.com/Meta-chan, k.sovailo@gmail.com Reinventing bicycles since 2020 */ #include <assert.h> #include <math.h> size_t neurog::Neuro::_last_backward_quadratic_count = 0; mathg::Function neurog::Neuro::_last_backward_quadratic; size_t neurog::Neuro::_last_backward_cross_entrophy_count = 0; mathg::Function neurog::Neuro::_last_backward_cross_entrophy; bool neurog::Neuro::_static_init(Cost cost) noexcept { char error[128]; if (cost == Cost::quadratic) { if (++_last_backward_quadratic_count > 1) return _last_backward_quadratic.ok(); _last_backward_quadratic.init(R"( matrix float goal; matrix float last; out float gradient; void main() { gradient = (1.0 - last[row][column]) * last[row][column] * (goal[row][column] - last[row][column]); } )", error, 128); return _last_backward_quadratic.ok(); } else { if (++_last_backward_cross_entrophy_count > 1) return _last_backward_cross_entrophy.ok(); _last_backward_cross_entrophy.init(R"( matrix float goal; matrix float last; out float gradient; void main() { gradient = goal[row][column] - last[row][column]; } )", error, 128); return _last_backward_cross_entrophy.ok(); } } void neurog::Neuro::_static_finalize(Cost cost) noexcept { if (cost == Cost::quadratic) { if (--_last_backward_quadratic_count == 0) _last_backward_quadratic.finalize(); } else { if (--_last_backward_cross_entrophy_count == 0) _last_backward_cross_entrophy.finalize(); } } neurog::Neuro::Neuro() noexcept { } neurog::Neuro::Neuro(size_t nlayers, Layer::Info * const * const layers, Cost cost, GLsizei batch_size, bool train) noexcept { init(nlayers, layers, cost, batch_size, train); } neurog::Neuro::Neuro(const char *filename, Cost cost, GLsizei batch_size, bool train) noexcept { init(filename, cost, batch_size, train); } bool neurog::Neuro::init(size_t nlayers, Layer::Info * const * const layers, Cost cost, GLsizei batch_size, bool train) noexcept { //Compiling functions if (_inited) _static_finalize(_cost); if (!_static_init(cost)) return false; _inited = true; _cost = cost; //Checking input assert(nlayers >= 1); assert(batch_size > 0); for (size_t i = 0; i < nlayers; i++) { assert(layers[i]->previous > 0); assert(layers[i]->next > 0); if (i != 0 && i != nlayers - 1) assert(layers[i]->next == layers[i + 1]->previous); assert(layers[i]->typ == Layer::Type::full); } try { //Initializing layers _train = train; _max_batch_size = batch_size; _batch_size = batch_size; _layers.resize(nlayers, nullptr); for (size_t i = 0; i < nlayers; i++) { if (layers[i]->typ == Layer::Type::full) { _layers[i] = new FullLayer(*((FullLayer::Info*)layers[i]), train); if (!_layers[i]->ok()) return false; } } //Initializing vectors _vectors = std::vector<mathg::Matrix>(nlayers + 1); if (!_vectors[0].init(batch_size, layers[0]->previous, mathg::Type::float_)) return false; for (size_t i = 1; i < _vectors.size(); i++) { if (!_vectors[i].init(batch_size, layers[i - 1]->next, mathg::Type::float_)) return false; } if (train) { //Initializing errors _errors = std::vector<mathg::Matrix>(nlayers); for (size_t i = 0; i < _errors.size(); i++) { if (!_errors[i].init(batch_size, layers[i]->next, mathg::Type::float_)) return false; } //Intializing goal if (!_goal.init(batch_size, layers[nlayers - 1]->next, mathg::Type::float_)) return false; } } catch (...) { return false; } _ok = true; return true; } bool neurog::Neuro::init(const char *filename, Cost cost, GLsizei batch_size, bool train) noexcept { //Compiling functions if (_inited) _static_finalize(_cost); if (!_static_init(cost)) return false; _inited = true; _cost = cost; //Checking input assert(batch_size > 0); try { //Opening file std::ifstream file(filename, std::ios::binary); FileHeader header, sample; if (!file.read((char*)&header, sizeof(FileHeader))) return false; if (memcmp(header.signature, sample.signature, 3) != 0 || header.version != sample.version) return false; //Initializing layers and reading infos _train = train; _max_batch_size = batch_size; _batch_size = batch_size; std::vector<GLint> vector_sizes; while (true) { Layer::Info basic_info; if (!file.read((char*)&basic_info, sizeof(Layer::Type))) break; if (basic_info.next <= 0 || basic_info.previous <= 0) break; if (vector_sizes.size() == 0) vector_sizes.push_back(basic_info.previous); vector_sizes.push_back(basic_info.next); file.seekg(0-sizeof(Layer::Info), std::ios::cur); if (basic_info.typ == Layer::Type::full) { FullLayer::Info info; if (!file.read((char*)&info, sizeof(FullLayer::Info))) break; _layers.push_back(new FullLayer(info, &file, train)); } if (!_layers.back()->ok()) return false; } if (vector_sizes.empty()) return false; //Initializing vectors _vectors = std::vector<mathg::Matrix>(vector_sizes.size()); for (size_t i = 0; i < _vectors.size(); i++) { if (!_vectors[i].init(batch_size, vector_sizes[i], mathg::Type::float_)) return false; } if (train) { //Initializing errors _errors = std::vector<mathg::Matrix>(vector_sizes.size() - 1); for (size_t i = 0; i < _errors.size(); i++) { if (!_errors[i].init(batch_size, vector_sizes[i + 1], mathg::Type::float_)) return false; } //Intializing goal if (!_goal.init(batch_size, vector_sizes.back(), mathg::Type::float_)) return false; } } catch (...) { return false; } _ok = true; return true; } bool neurog::Neuro::ok() const noexcept { return _ok; } bool neurog::Neuro::save(const char *filename) noexcept { assert(ok()); try { std::ofstream file(filename, std::ios::binary); FileHeader header; if (!file.write((char*)&header, sizeof(FileHeader))) return false; for (size_t i = 0; i < _layers.size(); i++) { if (!_layers[i]->save(&file)) return false; } } catch (...) { return false; } return true; } void neurog::Neuro::finalize() noexcept { if (_inited) _static_finalize(_cost); for (size_t i = 0; i > _layers.size(); i++) { if (_layers[i] != nullptr) delete _layers[i]; } _layers.clear(); _vectors.clear(); _errors.clear(); _goal.finalize(); _ok = false; _inited = false; _train = false; _max_batch_size = 0; _batch_size = 0; _accumulator_count = 0; } neurog::Neuro::~Neuro() noexcept { finalize(); } GLint &neurog::Neuro::batch_size() noexcept { assert(ok()); return _batch_size; } const GLint &neurog::Neuro::batch_size() const noexcept { assert(ok()); return _batch_size; } neurog::Cost &neurog::Neuro::cost() noexcept { assert(ok()); return _cost; } const neurog::Cost &neurog::Neuro::cost() const noexcept { assert(ok()); return _cost; } neurog::Layer *neurog::Neuro::layers(size_t i) noexcept { assert(ok()); assert(i < _layers.size()); return _layers[i]; } const neurog::Layer *neurog::Neuro::layers(size_t i) const noexcept { assert(ok()); assert(i < _layers.size()); return _layers[i]; } mathg::Matrix *neurog::Neuro::input() noexcept { assert(ok()); return &_vectors.front(); } mathg::Matrix *neurog::Neuro::output() noexcept { assert(ok()); return &_vectors.back(); } mathg::Matrix *neurog::Neuro::goal() noexcept { assert(ok()); assert(_train); return &_goal; } bool neurog::Neuro::forward() noexcept { assert(ok()); assert(_batch_size >= 0); assert(_batch_size <= _max_batch_size); if (_batch_size == 0) return true; for (size_t i = 0; i < _layers.size(); i++) { if (!_layers[i]->forward(_batch_size, &_vectors[i], &_vectors[i + 1])) return false; } return true; } bool neurog::Neuro::backward() noexcept { assert(ok()); assert(_train); assert(_batch_size >= 0); assert(_batch_size <= _max_batch_size); if (_batch_size == 0) return true; //Calculate error for last layer if (_cost == Cost::quadratic) { if (!_errors.back().assign(&_last_backward_quadratic, &_goal, &_vectors.back())) return false; } else { if (!_errors.back().assign(&_last_backward_cross_entrophy, &_goal, &_vectors.back())) return false; } //Backward error for (size_t i = _layers.size() - 1; i > 0; i--) { if (!_layers[i]->backward(_batch_size, &_vectors[i], &_vectors[i + 1], &_errors[i - 1], &_errors[i])) return false; } //Accumulate error for (size_t i = _layers.size() - 1; i != (size_t)-1; i--) { if (!_layers[i]->accumulate(_batch_size, &_vectors[i], &_errors[i])) return false; } _accumulator_count += _batch_size; return true; } bool neurog::Neuro::correct() noexcept { assert(ok()); assert(_train); if (_accumulator_count == 0) return true; for (size_t i = _layers.size() - 1; i != (size_t)-1; i--) { if (!_layers[i]->correct(_batch_size)) return false; } _accumulator_count = 0; return true; } float neurog::Neuro::cost(float output, float goal) const noexcept { assert(ok()); if (_cost == Cost::quadratic) { return (output - goal) * (output - goal); } else { float c = -goal * log(output) - (1.0f - goal) * log(1.0f - output); return c == c ? c : 0.0f; } } float neurog::Neuro::cost(const float *output, const float *goal) const noexcept { assert(ok()); if (_cost == Cost::quadratic) { float sum = 0.0f; for (size_t i = 0; i < _batch_size; i++) { sum += ((output[i] - goal[i]) * (output[i] - goal[i])); } return sum; } else { float sum = 0.0f; for (size_t i = 0; i < _batch_size; i++) { float c = - goal[i] * log(output[i]) - (1.0f - goal[i]) * log(1.0f - output[i]); if (c == c) sum += c; } return sum; } }
22.9
117
0.659287
[ "vector" ]
616e74a295b9ed29a370ea685330cf594e784e67
13,150
h
C
Networking/src/UtilsASIO.h
keithrausch/InterprocessMemPool
9610dbeb880b35457d5f7f050912502cde258abd
[ "MIT" ]
null
null
null
Networking/src/UtilsASIO.h
keithrausch/InterprocessMemPool
9610dbeb880b35457d5f7f050912502cde258abd
[ "MIT" ]
null
null
null
Networking/src/UtilsASIO.h
keithrausch/InterprocessMemPool
9610dbeb880b35457d5f7f050912502cde258abd
[ "MIT" ]
1
2021-08-31T00:06:22.000Z
2021-08-31T00:06:22.000Z
// Keith Rausch #ifndef UTILS_ASIO_H #define UTILS_ASIO_H #include <boost/enable_shared_from_this.hpp> #include <boost/beast.hpp> #include <boost/asio.hpp> #include <string> #include <boost/asio/steady_timer.hpp> #include <boost/beast/core/bind_handler.hpp> namespace utils_asio { using boost::asio::ip::address; using boost::asio::ip::tcp; using boost::asio::ip::udp; // // MUST USE THIS CLASS INSIDE A std::shared_ptr via std::make_shared // class UDPReceiver : public std::enable_shared_from_this<UDPReceiver> { udp::socket socket; udp::endpoint remoteEndpoint; std::vector<char> recvBuffer; boost::asio::steady_timer timeout; double timeout_period_seconds; // only has millisecond precision std::atomic<bool> timedout; public: struct Callbacks { typedef std::function<void(const udp::endpoint &, void *msgPtr, size_t msgSize)> CallbackReadT; typedef std::function<void(const udp::endpoint &, boost::system::error_code)> CallbackErrorT; typedef std::function<void()> CallbackTimeoutT; CallbackReadT callbackRead; CallbackErrorT callbackError; CallbackTimeoutT callbackTimeout; }; Callbacks callbacks; explicit UDPReceiver(boost::asio::io_context &io_context, unsigned short portNumber, size_t maxMessageLength, double timeout_period_seconds_in, const Callbacks &callbacks_in = Callbacks()) : socket(io_context, udp::endpoint(udp::v4(), portNumber)), recvBuffer(maxMessageLength), timeout(io_context), timeout_period_seconds(timeout_period_seconds_in), callbacks(callbacks_in) { socket.set_option(boost::asio::ip::udp::socket::reuse_address(true)); // DO NOT CALL start_recieve(); here. shared_from_this() needs a fully constructed // shared_ptr to work, and calling start_receive here enevitably calls shared_from_this() // before the constructor is finished // https://stackoverflow.com/questions/43261673/stdbad-weak-ptr-while-shared-from-this } // DO NOT CALL START IN CONSTRUCTOR. no shared pointer exits yet, enabled_shared_from_this will break // https://stackoverflow.com/questions/43261673/stdbad-weak-ptr-while-shared-from-this void run() { timedout = false; timeout.async_wait(boost::beast::bind_front_handler(&UDPReceiver::check_timeout, shared_from_this())); start_recieve(); } private: void on_error(boost::system::error_code ec) { if (callbacks.callbackError && !timedout) callbacks.callbackError(remoteEndpoint, ec); // if (callbacks.callbackClose) // callbacks.callbackClose(remoteEndpoint, ec); } void on_recieve(boost::system::error_code ec, std::size_t bytes_transferred) { if (ec) { on_error(ec); return; } if (callbacks.callbackRead) callbacks.callbackRead(remoteEndpoint, (void *)&*recvBuffer.begin(), bytes_transferred); start_recieve(); } void start_recieve() { // Set a deadline for the read operation. timedout = false; if (timeout_period_seconds <= 0) timeout.expires_at(boost::asio::steady_timer::time_point::max()); else { size_t timeout_period_ms = timeout_period_seconds * 1000 ; timeout.expires_after(std::chrono::milliseconds(timeout_period_ms)); // cancels the timer and resets it } socket.async_receive_from(boost::asio::buffer(recvBuffer), remoteEndpoint, boost::beast::bind_front_handler(&UDPReceiver::on_recieve, shared_from_this())); } // // This function is called when the timer expires, OR when it is reset/ cancelled (like with steady_timer::expires_after()) // // This handler calls itself. Every time the timer is reset, this handler will get called with an // error (but we dont care about the error). that means that whenever this function is called, a // timer either just expired, or was reset and needs to be used to time a new function. It doesnt // actually matter which scenario called this handler to fire, we just need to know how long to sleep // the timer for, and if the callbackTimeout() member should be called // void check_timeout(boost::system::error_code ec) { if (ec && ec != boost::asio::error::operation_aborted) on_error(ec); // Check whether the deadline has passed. We compare the deadline against // the current time since a new asynchronous operation may have moved the // deadline before this actor had a chance to run. if (timeout.expiry() <= boost::asio::steady_timer::clock_type::now()) { timedout = true; if (callbacks.callbackTimeout) callbacks.callbackTimeout(); // The deadline has passed. The socket is closed so that any outstanding // asynchronous operations are cancelled. socket.close(); // There is no longer an active deadline. The expiry is set to the // maximum time point so that the actor takes no action until a new // deadline is set. timeout.expires_at(boost::asio::steady_timer::time_point::max()); } // Put the actor back to sleep. timeout.async_wait(boost::beast::bind_front_handler(&UDPReceiver::check_timeout, shared_from_this())); } }; /* static void SendBroadcast(boost::asio::io_service &io_service, const std::string &msg, unsigned short portSender, const std::string &destination, unsigned short portReceiver) { namespace ba = boost::asio; namespace bs = boost::system; using ba::ip::udp; udp::socket sock(io_service, udp::endpoint(udp::v4(), portSender)); sock.set_option(ba::ip::udp::socket::reuse_address(true)); sock.set_option(ba::socket_base::broadcast(true)); udp::endpoint sender_endpoint(ba::ip::address_v4::from_string(destination), portReceiver); auto handler = [](const boost::system::error_code &, std::size_t) {}; sock.async_send_to(boost::asio::buffer(msg.c_str(), msg.length()), sender_endpoint, handler); } */ // // MUST USE THIS CLASS INSIDE A std::shared_ptr via std::make_shared // class Heartbeat : public std::enable_shared_from_this<Heartbeat> { // namespace ba = boost::asio; // namespace bs = boost::system; // using boost::asio::ip::udp; boost::asio::io_context &io_context; udp::socket socket; udp::endpoint receiver_endpoint; boost::asio::steady_timer timer; float period_seconds; typedef std::function<std::string(void)> MsgCreatorT; MsgCreatorT msgCreator; std::string msg; bool running; public: Heartbeat(boost::asio::io_context &io_context_in, const MsgCreatorT &msgCreator_in, unsigned short portSender, const std::string &destination, unsigned short portReceiver, float period_seconds_in) : io_context(io_context_in), socket(io_context, udp::endpoint(udp::v4(), portSender)), receiver_endpoint(boost::asio::ip::address_v4::from_string(destination), portReceiver), timer(io_context), period_seconds(period_seconds_in), msgCreator(msgCreator_in), msg(), running(false) { socket.set_option(udp::socket::reuse_address(true)); socket.set_option(boost::asio::socket_base::broadcast(true)); } void run() { // calling run multiple times could stomp on the message before its sent if (running) return; running = true; start_send(); } private: void on_wait(const boost::system::error_code &error) { if (error) return; start_send(); } void on_send(const boost::system::error_code &error, std::size_t) // secnd arg is number of bytes sent. { if (error) return; timer.expires_after(boost::asio::chrono::milliseconds((size_t)(period_seconds * 1000))); // cancels the timer and resets it timer.async_wait(boost::beast::bind_front_handler(&Heartbeat::on_wait, shared_from_this())); } void start_send() { if (msgCreator) msg = msgCreator(); socket.async_send_to(boost::asio::buffer(msg.c_str(), msg.length()), receiver_endpoint, boost::beast::bind_front_handler(&Heartbeat::on_send, shared_from_this())); // when the socket is destroped, all pending ops are cancelled, os msg cant go out of scope before its used } }; // // A utility class for getting an io_context and then protecting it with an executor_work_guard. // This is useful because calling io_context::run() without any pending handlers will shutdown the // executor inside io_context immediately. Furthermore, When the io_context runs out of handlers to // run, it will shut down the execuctor, and the calls to ::run() will stop blocking. This class keeps // that from happening (by using boost::asio::executor_work_guard) // // This class goes one step further and sets up handlers for SIGINT and SIGTERM and shutsdown the io_context // when they are received. This means that we can cntrl+c our program and it will shut down gracefully. sick. // class GuardedContext { boost::asio::io_context io_context; using work_guard_type = boost::asio::executor_work_guard<boost::asio::io_context::executor_type>; work_guard_type work_guard; // keeps io_context::run() from returning if all jobs are finished std::vector<std::thread> threads; // threads that call io_context::run() boost::asio::signal_set signals; std::mutex mutex; typedef std::function<void(const boost::system::error_code &, int)> SignalCallbackT; typedef std::function<void()> ShutdownCallbackT; SignalCallbackT signalCallback; ShutdownCallbackT shutdownCallback; void on_sigevent(const boost::system::error_code &error, int signal_number) { if (error) std::cout << "GuardedContext::on_sigevent() - CAUGHT SIGEVENT (" + std::to_string(signal_number) + "). BUT HAD ERROR: " << error << std::endl; if (error) return; std::cout << "GuardedContext::on_sigevent() - CAUGHT SIGEVENT (" + std::to_string(signal_number) + "). STOPPING IOCONTEXT.\n"; io_context.stop(); // do not call Shutdown() here. // that would mean that the thread handling this handler would be trying to join itself // and that would deadlock. // https://stackoverflow.com/questions/64039374/c-terminate-called-after-throwing-an-instance-of-stdsystem-error-what-r if (signalCallback) { signalCallback(error, signal_number); signalCallback = 0; // good practice, i think } } public: GuardedContext() : io_context(), work_guard(io_context.get_executor()), signals(io_context) { } GuardedContext(size_t nThreads) : io_context(), work_guard(io_context.get_executor()), signals(io_context) { Run(nThreads); } void SetSignalCallback(const SignalCallbackT & signalCallback_in) { signalCallback = signalCallback_in; } void SetShutdownCallback(const ShutdownCallbackT & shutdownCallback_in) { shutdownCallback = shutdownCallback_in; } ~GuardedContext() { Shutdown(); } boost::asio::io_context &GetIOContext() { return io_context; } void Run(size_t nThreads) { // Do not run if already called. // This is a design choice since caling Run() multiple times wouldnt truly hurt much. // This function could be so much more complicated. if (threads.size() > 0) { std::cout << "GuardedContext::Run() - YOU MAY NOT CALL RUN MULTIPLE TIMES\n"; return; } // Run the I/O service on the requested number of threads threads.reserve(nThreads); for (size_t i = 0; i < nThreads; ++i) threads.emplace_back([this] { io_context.run(); }); // set handlers for sigint, sigterm, etccc // Construct a signal set registered for process termination. // Start an asynchronous wait for one of the signals to occur. signals.add(SIGINT); signals.add(SIGTERM); signals.async_wait(boost::beast::bind_front_handler(&GuardedContext::on_sigevent, this)); } void Shutdown() { std::lock_guard<std::mutex> guard(mutex); if (shutdownCallback) { shutdownCallback(); shutdownCallback = 0; // prevent it from being called twice } signals.cancel(); // cancel the callbacks. this frees up the scope of the lambdas. do this before stopping the service if (!io_context.stopped()) io_context.stop(); // required because we have a executor_work_guard // Block until all the threads exit for (auto &thread : threads) { if (thread.joinable()) thread.join(); } } }; } // namespace utils_asio #endif
34.514436
200
0.663574
[ "vector" ]
e89853db96988f3ea9bf778758fa5a2759588ac1
26,497
c
C
libvips-8.11/libvips/conversion/tilecache.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
2
2020-11-19T04:09:33.000Z
2020-11-24T04:51:19.000Z
libvips-8.11/libvips/conversion/tilecache.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
null
null
null
libvips-8.11/libvips/conversion/tilecache.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
1
2021-01-16T10:36:37.000Z
2021-01-16T10:36:37.000Z
/* Simple tile or line cache. * * This isn't the same as the sinkscreen cache: we don't sub-divide, and we * single-thread our callee. * * 23/8/06 * - take ownership of reused tiles in case the cache is being shared * 13/2/07 * - release ownership after fillng with pixels in case we read across * threads * 4/2/10 * - gtkdoc * 12/12/10 * - use im_prepare_to() and avoid making a sequence for every cache tile * 5/12/11 * - rework as a class * 23/6/12 * - listen for "minimise" signal * 23/8/12 * - split to line and tile cache * - use a hash table instead of a list * 13/9/12 * - oops, linecache was oversized * 12/11/12 * - make linecache 50% larger to give some slop room * 8/10/12 * - make it optionally threaded * 21/2/13 * - could deadlock if downstream raised an error (thanks Todd) * 25/4/13 * - cache minimisation is optional, see "persistent" flag * 26/8/14 Lovell * - free the hash table in _dispose() * 11/7/16 * - terminate on tile calc error * 7/3/17 * - remove "access" on linecache, use the base class instead */ /* This file is part of VIPS. VIPS is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 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 Lesser General Public License for more details. You should have received a cache of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk */ /* #define VIPS_DEBUG_RED #define VIPS_DEBUG */ #ifdef HAVE_CONFIG_H #include <config.h> #endif /*HAVE_CONFIG_H*/ #include <vips/intl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vips/vips.h> #include <vips/internal.h> #include <vips/debug.h> #include "pconversion.h" /* A tile in cache can be in one of three states: * * DATA - the tile holds valid pixels * CALC - some thread somewhere is calculating it * PEND - some thread somewhere wants it */ typedef enum VipsTileState { VIPS_TILE_STATE_DATA, VIPS_TILE_STATE_CALC, VIPS_TILE_STATE_PEND } VipsTileState; /* A tile in our cache. */ typedef struct _VipsTile { struct _VipsBlockCache *cache; VipsTileState state; VipsRegion *region; /* Region with private mem for data */ /* We count how many threads are relying on this tile. This tile can't * be flushed if ref_count > 0. */ int ref_count; /* Tile position. Just use left/top to calculate a hash. This is the * key for the hash table. Don't use region->valid in case the region * pointer is NULL. */ VipsRect pos; } VipsTile; typedef struct _VipsBlockCache { VipsConversion parent_instance; VipsImage *in; int tile_width; int tile_height; int max_tiles; VipsAccess access; gboolean threaded; gboolean persistent; int ntiles; /* Current cache size */ GMutex *lock; /* Lock everything here */ GCond *new_tile; /* A new tile is ready */ GHashTable *tiles; /* Tiles, hashed by coordinates */ GQueue *recycle; /* Queue of unreffed tiles to reuse */ } VipsBlockCache; typedef VipsConversionClass VipsBlockCacheClass; G_DEFINE_ABSTRACT_TYPE( VipsBlockCache, vips_block_cache, VIPS_TYPE_CONVERSION ); #define VIPS_TYPE_BLOCK_CACHE (vips_block_cache_get_type()) static void vips_block_cache_drop_all( VipsBlockCache *cache ) { /* FIXME this is a disaster if active threads are working on tiles. We * should have something to block new requests, and only dispose once * all tiles are unreffed. */ g_hash_table_remove_all( cache->tiles ); } static void vips_block_cache_dispose( GObject *gobject ) { VipsBlockCache *cache = (VipsBlockCache *) gobject; vips_block_cache_drop_all( cache ); VIPS_FREEF( vips_g_mutex_free, cache->lock ); VIPS_FREEF( vips_g_cond_free, cache->new_tile ); if( cache->tiles ) g_assert( g_hash_table_size( cache->tiles ) == 0 ); VIPS_FREEF( g_hash_table_destroy, cache->tiles ); VIPS_FREEF( g_queue_free, cache->recycle ); G_OBJECT_CLASS( vips_block_cache_parent_class )->dispose( gobject ); } static int vips_tile_move( VipsTile *tile, int x, int y ) { /* We are changing x/y and therefore the hash value. We must unlink * from the old hash position and relink at the new place. */ g_hash_table_steal( tile->cache->tiles, &tile->pos ); tile->pos.left = x; tile->pos.top = y; tile->pos.width = tile->cache->tile_width; tile->pos.height = tile->cache->tile_height; g_hash_table_insert( tile->cache->tiles, &tile->pos, tile ); if( vips_region_buffer( tile->region, &tile->pos ) ) return( -1 ); /* No data yet, but someone must want it. */ tile->state = VIPS_TILE_STATE_PEND; return( 0 ); } static VipsTile * vips_tile_new( VipsBlockCache *cache, int x, int y ) { VipsTile *tile; if( !(tile = VIPS_NEW( NULL, VipsTile )) ) return( NULL ); tile->cache = cache; tile->state = VIPS_TILE_STATE_PEND; tile->ref_count = 0; tile->region = NULL; tile->pos.left = x; tile->pos.top = y; tile->pos.width = cache->tile_width; tile->pos.height = cache->tile_height; g_hash_table_insert( cache->tiles, &tile->pos, tile ); g_queue_push_tail( tile->cache->recycle, tile ); g_assert( cache->ntiles >= 0 ); cache->ntiles += 1; if( !(tile->region = vips_region_new( cache->in )) ) { g_hash_table_remove( cache->tiles, &tile->pos ); return( NULL ); } vips__region_no_ownership( tile->region ); if( vips_tile_move( tile, x, y ) ) { g_hash_table_remove( cache->tiles, &tile->pos ); return( NULL ); } return( tile ); } /* Do we have a tile in the cache? */ static VipsTile * vips_tile_search( VipsBlockCache *cache, int x, int y ) { VipsRect pos; VipsTile *tile; pos.left = x; pos.top = y; pos.width = cache->tile_width; pos.height = cache->tile_height; tile = (VipsTile *) g_hash_table_lookup( cache->tiles, &pos ); return( tile ); } static void vips_tile_find_is_topper( gpointer element, gpointer user_data ) { VipsTile *this = (VipsTile *) element; VipsTile **best = (VipsTile **) user_data; if( !*best || this->pos.top < (*best)->pos.top ) *best = this; } /* Search the recycle list for the topmost tile. */ static VipsTile * vips_tile_find_topmost( GQueue *recycle ) { VipsTile *tile; tile = NULL; g_queue_foreach( recycle, vips_tile_find_is_topper, &tile ); return( tile ); } /* Find existing tile, make a new tile, or if we have a full set of tiles, * reuse one. */ static VipsTile * vips_tile_find( VipsBlockCache *cache, int x, int y ) { VipsTile *tile; /* In cache already? */ if( (tile = vips_tile_search( cache, x, y )) ) { VIPS_DEBUG_MSG_RED( "vips_tile_find: " "tile %d x %d in cache\n", x, y ); return( tile ); } /* VipsBlockCache not full? */ if( cache->max_tiles == -1 || cache->ntiles < cache->max_tiles ) { VIPS_DEBUG_MSG_RED( "vips_tile_find: " "making new tile at %d x %d\n", x, y ); if( !(tile = vips_tile_new( cache, x, y )) ) return( NULL ); return( tile ); } /* Reuse an old one, if there are any. We just peek the tile pointer, * it is removed from the recycle list later on _ref. */ if( cache->recycle ) { if( cache->access == VIPS_ACCESS_RANDOM ) tile = g_queue_peek_head( cache->recycle ); else /* This is slower :( We have to search the recycle * queue. */ tile = vips_tile_find_topmost( cache->recycle ); } if( !tile ) { /* There are no tiles we can reuse -- we have to make another * for now. They will get culled down again next time around. */ if( !(tile = vips_tile_new( cache, x, y )) ) return( NULL ); return( tile ); } VIPS_DEBUG_MSG_RED( "vips_tile_find: reusing tile %d x %d\n", tile->pos.left, tile->pos.top ); if( vips_tile_move( tile, x, y ) ) return( NULL ); return( tile ); } static gboolean vips_tile_unlocked( gpointer key, gpointer value, gpointer user_data ) { VipsTile *tile = (VipsTile *) value; return( !tile->ref_count ); } static void vips_block_cache_minimise( VipsImage *image, VipsBlockCache *cache ) { VIPS_DEBUG_MSG( "vips_block_cache_minimise:\n" ); g_mutex_lock( cache->lock ); /* We can't drop tiles that are in use. */ g_hash_table_foreach_remove( cache->tiles, vips_tile_unlocked, NULL ); g_mutex_unlock( cache->lock ); } static int vips_block_cache_build( VipsObject *object ) { VipsConversion *conversion = VIPS_CONVERSION( object ); VipsBlockCache *cache = (VipsBlockCache *) object; VIPS_DEBUG_MSG( "vips_block_cache_build:\n" ); if( VIPS_OBJECT_CLASS( vips_block_cache_parent_class )-> build( object ) ) return( -1 ); VIPS_DEBUG_MSG( "vips_block_cache_build: max size = %g MB\n", (cache->max_tiles * cache->tile_width * cache->tile_height * VIPS_IMAGE_SIZEOF_PEL( cache->in )) / (1024 * 1024.0) ); if( !cache->persistent ) g_signal_connect( conversion->out, "minimise", G_CALLBACK( vips_block_cache_minimise ), cache ); return( 0 ); } static void vips_block_cache_class_init( VipsBlockCacheClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class ); VipsOperationClass *operation_class = VIPS_OPERATION_CLASS( class ); VIPS_DEBUG_MSG( "vips_block_cache_class_init\n" ); gobject_class->dispose = vips_block_cache_dispose; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; vobject_class->nickname = "blockcache"; vobject_class->description = _( "cache an image" ); vobject_class->build = vips_block_cache_build; operation_class->flags = VIPS_OPERATION_SEQUENTIAL; VIPS_ARG_IMAGE( class, "in", 1, _( "Input" ), _( "Input image" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsBlockCache, in ) ); VIPS_ARG_INT( class, "tile_height", 4, _( "Tile height" ), _( "Tile height in pixels" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, tile_height ), 1, 1000000, 128 ); VIPS_ARG_ENUM( class, "access", 6, _( "Access" ), _( "Expected access pattern" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, access ), VIPS_TYPE_ACCESS, VIPS_ACCESS_RANDOM ); VIPS_ARG_BOOL( class, "threaded", 7, _( "Threaded" ), _( "Allow threaded access" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, threaded ), FALSE ); VIPS_ARG_BOOL( class, "persistent", 8, _( "Persistent" ), _( "Keep cache between evaluations" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, persistent ), FALSE ); } static unsigned int vips_rect_hash( VipsRect *pos ) { guint hash; /* We could shift down by the tile size? * * X discrimination is more important than Y, since * most tiles will have a similar Y. */ hash = (guint) pos->left ^ ((guint) pos->top << 16); return( hash ); } static gboolean vips_rect_equal( VipsRect *a, VipsRect *b ) { return( a->left == b->left && a->top == b->top ); } static void vips_tile_destroy( VipsTile *tile ) { VipsBlockCache *cache = tile->cache; VIPS_DEBUG_MSG_RED( "vips_tile_destroy: tile %d, %d (%p)\n", tile->pos.left, tile->pos.top, tile ); /* 0 ref tiles should be on the recycle list. */ g_assert( tile->ref_count == 0 ); g_assert( g_queue_find( tile->cache->recycle, tile ) ); g_queue_remove( cache->recycle, tile ); cache->ntiles -= 1; g_assert( cache->ntiles >= 0 ); tile->cache = NULL; VIPS_UNREF( tile->region ); g_free( tile ); } static void vips_block_cache_init( VipsBlockCache *cache ) { cache->tile_width = 128; cache->tile_height = 128; cache->max_tiles = 1000; cache->access = VIPS_ACCESS_RANDOM; cache->threaded = FALSE; cache->persistent = FALSE; cache->ntiles = 0; cache->lock = vips_g_mutex_new(); cache->new_tile = vips_g_cond_new(); cache->tiles = g_hash_table_new_full( (GHashFunc) vips_rect_hash, (GEqualFunc) vips_rect_equal, NULL, (GDestroyNotify) vips_tile_destroy ); cache->recycle = g_queue_new(); } typedef struct _VipsTileCache { VipsBlockCache parent_instance; } VipsTileCache; typedef VipsBlockCacheClass VipsTileCacheClass; G_DEFINE_TYPE( VipsTileCache, vips_tile_cache, VIPS_TYPE_BLOCK_CACHE ); static void vips_tile_unref( VipsTile *tile ) { g_assert( tile->ref_count > 0 ); tile->ref_count -= 1; if( tile->ref_count == 0 ) { /* Place at the end of the recycle queue. We pop from the * front when selecting an unused tile for reuse. */ g_assert( !g_queue_find( tile->cache->recycle, tile ) ); g_queue_push_tail( tile->cache->recycle, tile ); } } static void vips_tile_ref( VipsTile *tile ) { tile->ref_count += 1; g_assert( tile->ref_count > 0 ); if( tile->ref_count == 1 ) { g_assert( g_queue_find( tile->cache->recycle, tile ) ); g_queue_remove( tile->cache->recycle, tile ); } } static void vips_tile_cache_unref( GSList *work ) { GSList *p; for( p = work; p; p = p->next ) vips_tile_unref( (VipsTile *) p->data ); g_slist_free( work ); } /* Make a set of work tiles. */ static GSList * vips_tile_cache_ref( VipsBlockCache *cache, VipsRect *r ) { const int tw = cache->tile_width; const int th = cache->tile_height; /* Find top left of tiles we need. */ const int xs = (r->left / tw) * tw; const int ys = (r->top / th) * th; GSList *work; VipsTile *tile; int x, y; /* Ref all the tiles we will need. */ work = NULL; for( y = ys; y < VIPS_RECT_BOTTOM( r ); y += th ) for( x = xs; x < VIPS_RECT_RIGHT( r ); x += tw ) { if( !(tile = vips_tile_find( cache, x, y )) ) { vips_tile_cache_unref( work ); return( NULL ); } vips_tile_ref( tile ); /* We must append, since we want to keep tile ordering * for sequential sources. */ work = g_slist_append( work, tile ); VIPS_DEBUG_MSG_RED( "vips_tile_cache_ref: " "tile %d, %d (%p)\n", x, y, tile ); } return( work ); } static void vips_tile_paste( VipsTile *tile, VipsRegion *or ) { VipsRect hit; /* The part of the tile that we need. */ vips_rect_intersectrect( &or->valid, &tile->pos, &hit ); if( !vips_rect_isempty( &hit ) ) vips_region_copy( tile->region, or, &hit, hit.left, hit.top ); } /* Also called from vips_line_cache_gen(), beware. */ static int vips_tile_cache_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsRegion *in = (VipsRegion *) seq; VipsBlockCache *cache = (VipsBlockCache *) b; VipsRect *r = &or->valid; VipsTile *tile; GSList *work; GSList *p; int result; result = 0; VIPS_GATE_START( "vips_tile_cache_gen: wait1" ); g_mutex_lock( cache->lock ); VIPS_GATE_STOP( "vips_tile_cache_gen: wait1" ); VIPS_DEBUG_MSG_RED( "vips_tile_cache_gen: " "left = %d, top = %d, width = %d, height = %d\n", r->left, r->top, r->width, r->height ); /* Ref all the tiles we will need. */ work = vips_tile_cache_ref( cache, r ); while( work ) { /* Search for data tiles: easy, we can just paste those in. */ for(;;) { for( p = work; p; p = p->next ) { tile = (VipsTile *) p->data; if( tile->state == VIPS_TILE_STATE_DATA ) break; } if( !p ) break; VIPS_DEBUG_MSG_RED( "vips_tile_cache_gen: " "pasting %p\n", tile ); vips_tile_paste( tile, or ); /* We're done with this tile. */ work = g_slist_remove( work, tile ); vips_tile_unref( tile ); } /* Calculate the first PEND tile we find on the work list. We * don't calculate all PEND tiles since after the first, more * DATA tiles might heve been made available by other threads * and we want to get them out of the way as soon as we can. */ for( p = work; p; p = p->next ) { tile = (VipsTile *) p->data; if( tile->state == VIPS_TILE_STATE_PEND ) { tile->state = VIPS_TILE_STATE_CALC; VIPS_DEBUG_MSG_RED( "vips_tile_cache_gen: " "calc of %p\n", tile ); /* In threaded mode, we let other threads run * while we calc this tile. In non-threaded * mode, we keep the lock and make 'em wait. */ if( cache->threaded ) g_mutex_unlock( cache->lock ); result = vips_region_prepare_to( in, tile->region, &tile->pos, tile->pos.left, tile->pos.top ); if( cache->threaded ) { VIPS_GATE_START( "vips_tile_cache_gen: " "wait2" ); g_mutex_lock( cache->lock ); VIPS_GATE_STOP( "vips_tile_cache_gen: " "wait2" ); } /* If there was an error calculating this * tile, black it out and terminate * calculation. We have to stop so we can * support things like --fail on jpegload. * * Don't return early, we'd deadlock. */ if( result ) { VIPS_DEBUG_MSG_RED( "vips_tile_cache_gen: " "error on tile %p\n", tile ); g_warning( _( "error in tile %d x %d" ), tile->pos.left, tile->pos.top ); vips_region_black( tile->region ); *stop = TRUE; } tile->state = VIPS_TILE_STATE_DATA; /* Let everyone know there's a new DATA tile. * They need to all check their work lists. */ g_cond_broadcast( cache->new_tile ); break; } } /* There are no PEND or DATA tiles, we must need a tile some * other thread is currently calculating. * * We must block until the CALC tiles we need are done. */ if( !p && work ) { for( p = work; p; p = p->next ) { tile = (VipsTile *) p->data; g_assert( tile->state == VIPS_TILE_STATE_CALC ); } VIPS_DEBUG_MSG_RED( "vips_tile_cache_gen: waiting\n" ); VIPS_GATE_START( "vips_tile_cache_gen: wait3" ); g_cond_wait( cache->new_tile, cache->lock ); VIPS_GATE_STOP( "vips_tile_cache_gen: wait3" ); VIPS_DEBUG_MSG( "vips_tile_cache_gen: awake!\n" ); } } g_mutex_unlock( cache->lock ); return( result ); } static int vips_tile_cache_build( VipsObject *object ) { VipsConversion *conversion = VIPS_CONVERSION( object ); VipsBlockCache *block_cache = (VipsBlockCache *) object; VipsTileCache *cache = (VipsTileCache *) object; VIPS_DEBUG_MSG( "vips_tile_cache_build\n" ); if( VIPS_OBJECT_CLASS( vips_tile_cache_parent_class )-> build( object ) ) return( -1 ); if( vips_image_pio_input( block_cache->in ) ) return( -1 ); if( vips_image_pipelinev( conversion->out, VIPS_DEMAND_STYLE_SMALLTILE, block_cache->in, NULL ) ) return( -1 ); if( vips_image_generate( conversion->out, vips_start_one, vips_tile_cache_gen, vips_stop_one, block_cache->in, cache ) ) return( -1 ); return( 0 ); } static void vips_tile_cache_class_init( VipsTileCacheClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class ); VIPS_DEBUG_MSG( "vips_tile_cache_class_init\n" ); gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; vobject_class->nickname = "tilecache"; vobject_class->description = _( "cache an image as a set of tiles" ); vobject_class->build = vips_tile_cache_build; VIPS_ARG_INT( class, "tile_width", 3, _( "Tile width" ), _( "Tile width in pixels" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, tile_width ), 1, 1000000, 128 ); VIPS_ARG_INT( class, "max_tiles", 5, _( "Max tiles" ), _( "Maximum number of tiles to cache" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsBlockCache, max_tiles ), -1, 1000000, 1000 ); } static void vips_tile_cache_init( VipsTileCache *cache ) { } /** * vips_tilecache: (method) * @in: input image * @out: (out): output image * @...: %NULL-terminated list of optional named arguments * * Optional arguments: * * * @tile_width: width of tiles in cache * * @tile_height: height of tiles in cache * * @max_tiles: maximum number of tiles to cache * * @access: hint expected access pattern #VipsAccess * * @threaded: allow many threads * * @persistent: don't drop cache at end of computation * * This operation behaves rather like vips_copy() between images * @in and @out, except that it keeps a cache of computed pixels. * This cache is made of up to @max_tiles tiles (a value of -1 * means any number of tiles), and each tile is of size @tile_width * by @tile_height pixels. * * Each cache tile is made with a single call to * vips_region_prepare(). * * When the cache fills, a tile is chosen for reuse. If @access is * #VIPS_ACCESS_RANDOM, then the least-recently-used tile is reused. If * @access is #VIPS_ACCESS_SEQUENTIAL * the top-most tile is reused. * * By default, @tile_width and @tile_height are 128 pixels, and the operation * will cache up to 1,000 tiles. @access defaults to #VIPS_ACCESS_RANDOM. * * Normally, only a single thread at once is allowed to calculate tiles. If * you set @threaded to %TRUE, vips_tilecache() will allow many threads to * calculate tiles at once, and share the cache between them. * * Normally the cache is dropped when computation finishes. Set @persistent to * %TRUE to keep the cache between computations. * * See also: vips_cache(), vips_linecache(). * * Returns: 0 on success, -1 on error. */ int vips_tilecache( VipsImage *in, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); result = vips_call_split( "tilecache", ap, in, out ); va_end( ap ); return( result ); } typedef struct _VipsLineCache { VipsBlockCache parent_instance; } VipsLineCache; typedef VipsBlockCacheClass VipsLineCacheClass; G_DEFINE_TYPE( VipsLineCache, vips_line_cache, VIPS_TYPE_BLOCK_CACHE ); static int vips_line_cache_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsBlockCache *block_cache = (VipsBlockCache *) b; VIPS_GATE_START( "vips_line_cache_gen: wait" ); g_mutex_lock( block_cache->lock ); VIPS_GATE_STOP( "vips_line_cache_gen: wait" ); /* We size up the cache to the largest request. */ if( or->valid.height > block_cache->max_tiles * block_cache->tile_height ) { block_cache->max_tiles = 1 + (or->valid.height / block_cache->tile_height); VIPS_DEBUG_MSG( "vips_line_cache_gen: bumped max_tiles to %d\n", block_cache->max_tiles ); } g_mutex_unlock( block_cache->lock ); return( vips_tile_cache_gen( or, seq, a, b, stop ) ); } static int vips_line_cache_build( VipsObject *object ) { VipsConversion *conversion = VIPS_CONVERSION( object ); VipsBlockCache *block_cache = (VipsBlockCache *) object; VipsLineCache *cache = (VipsLineCache *) object; int tile_width; int tile_height; int n_lines; VIPS_DEBUG_MSG( "vips_line_cache_build\n" ); if( !vips_object_argument_isset( object, "access" ) ) block_cache->access = VIPS_ACCESS_SEQUENTIAL; if( VIPS_OBJECT_CLASS( vips_line_cache_parent_class )-> build( object ) ) return( -1 ); /* This can go up with request size, see vips_line_cache_gen(). */ vips_get_tile_size( block_cache->in, &tile_width, &tile_height, &n_lines ); block_cache->tile_width = block_cache->in->Xsize; /* Output has two buffers n_lines height, so 2 * n_lines is the maximum * non-locality from threading. Double again for conv, rounding, etc. * * tile_height can be huge for things like tiff read, where we can * have a whole strip in a single tile ... we still need to have a * minimum of two strips, so we can handle requests that straddle a * tile boundary. */ block_cache->max_tiles = VIPS_MAX( 2, 4 * n_lines / block_cache->tile_height ); VIPS_DEBUG_MSG( "vips_line_cache_build: n_lines = %d\n", n_lines ); VIPS_DEBUG_MSG( "vips_line_cache_build: max_tiles = %d\n", block_cache->max_tiles ); VIPS_DEBUG_MSG( "vips_line_cache_build: tile_height = %d\n", block_cache->tile_height ); VIPS_DEBUG_MSG( "vips_line_cache_build: max size = %g MB\n", (block_cache->max_tiles * block_cache->tile_width * block_cache->tile_height * VIPS_IMAGE_SIZEOF_PEL( block_cache->in )) / (1024 * 1024.0) ); if( vips_image_pio_input( block_cache->in ) ) return( -1 ); if( vips_image_pipelinev( conversion->out, VIPS_DEMAND_STYLE_THINSTRIP, block_cache->in, NULL ) ) return( -1 ); if( vips_image_generate( conversion->out, vips_start_one, vips_line_cache_gen, vips_stop_one, block_cache->in, cache ) ) return( -1 ); return( 0 ); } static void vips_line_cache_class_init( VipsLineCacheClass *class ) { VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class ); VIPS_DEBUG_MSG( "vips_line_cache_class_init\n" ); vobject_class->nickname = "linecache"; vobject_class->description = _( "cache an image as a set of lines" ); vobject_class->build = vips_line_cache_build; } static void vips_line_cache_init( VipsLineCache *cache ) { } /** * vips_linecache: (method) * @in: input image * @out: (out): output image * @...: %NULL-terminated list of optional named arguments * * Optional arguments: * * * @access: hint expected access pattern #VipsAccess * * @tile_height: height of tiles in cache * * @threaded: allow many threads * * This operation behaves rather like vips_copy() between images * @in and @out, except that it keeps a cache of computed scanlines. * * The number of lines cached is enough for a small amount of non-local * access. * * Each cache tile is made with a single call to * vips_region_prepare(). * * When the cache fills, a tile is chosen for reuse. If @access is * #VIPS_ACCESS_RANDOM, then the least-recently-used tile is reused. If * @access is #VIPS_ACCESS_SEQUENTIAL, then * the top-most tile is reused. @access defaults to #VIPS_ACCESS_RANDOM. * * @tile_height can be used to set the size of the strips that * vips_linecache() uses. The default is 1 (a single scanline). * * Normally, only a single thread at once is allowed to calculate tiles. If * you set @threaded to %TRUE, vips_linecache() will allow many threads to * calculate tiles at once and share the cache between them. * * See also: vips_cache(), vips_tilecache(). * * Returns: 0 on success, -1 on error. */ int vips_linecache( VipsImage *in, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); result = vips_call_split( "linecache", ap, in, out ); va_end( ap ); return( result ); }
25.380268
79
0.689059
[ "object" ]
e8a4bd97173aab3b516514b1245834ca4d7dee2c
2,046
h
C
smtk/extension/qt/qtModelEntityItem.h
yumin/SMTK
d280f10c5b70953b2a0196f71832955c7fc75e7f
[ "BSD-3-Clause-Clear" ]
null
null
null
smtk/extension/qt/qtModelEntityItem.h
yumin/SMTK
d280f10c5b70953b2a0196f71832955c7fc75e7f
[ "BSD-3-Clause-Clear" ]
4
2016-11-10T15:49:51.000Z
2017-02-06T23:24:16.000Z
smtk/extension/qt/qtModelEntityItem.h
yumin/SMTK
d280f10c5b70953b2a0196f71832955c7fc75e7f
[ "BSD-3-Clause-Clear" ]
null
null
null
//========================================================================= // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //========================================================================= // .NAME qtModelEntityItem - UI components for attribute ModelEntityItem // .SECTION Description // .SECTION See Also // qtItem #ifndef __smtk_attribute_qtModelEntityItem_h #define __smtk_attribute_qtModelEntityItem_h #include "smtk/extension/qt/qtItem.h" #include "smtk/extension/qt/Exports.h" #include "smtk/model/EntityTypeBits.h" // for smtk::model::BitFlags class qtModelEntityItemInternals; class QBoxLayout; namespace smtk { namespace attribute { class SMTKQTEXT_EXPORT qtModelEntityItem : public qtItem { Q_OBJECT public: qtModelEntityItem(smtk::attribute::ItemPtr, QWidget* p, qtBaseView* bview, Qt::Orientation enumOrient = Qt::Horizontal); virtual ~qtModelEntityItem(); virtual void setLabelVisible(bool); virtual void associateEntities( const smtk::model::EntityRefs& selEntityRefs, bool resetExisting = true); public slots: void setOutputOptional(int); virtual void onRequestEntityAssociation(); signals: void requestEntityAssociation(); void entityListHighlighted( const smtk::common::UUIDs& uuids); protected slots: virtual void updateItemData(); virtual void popupViewItemSelected(); virtual void clearEntityAssociations(); protected: virtual void createWidget(); virtual void loadAssociatedEntities(); virtual void updateUI(); virtual void addEntityAssociationWidget(); private: qtModelEntityItemInternals *Internals; }; // class }; // namespace attribute }; // namespace smtk #endif
28.816901
75
0.663245
[ "model" ]
e8b0f52251a9274700e55ad9e2ed11ccd7389142
7,126
h
C
apps/uart_bootloader/test_app/firmware/src/config/sam_g55_xpro/device_vectors.h
Microchip-MPLAB-Harmony/bootloader_apps_uart
8faa0b6982ef6f3de916197a8a5aa771a6370c8b
[ "0BSD" ]
7
2020-09-14T04:42:31.000Z
2021-03-30T13:36:41.000Z
apps/msd_basic/firmware/src/config/sam_g55_xpro_freertos/device_vectors.h
Microchip-MPLAB-Harmony/usb_apps_host
d1f3db0bba39a13e779776721d156bc5bbd55da9
[ "BSD-Source-Code" ]
2
2020-08-19T19:17:36.000Z
2021-07-02T04:48:45.000Z
apps/msd_basic/firmware/src/config/sam_g55_xpro_freertos/device_vectors.h
Microchip-MPLAB-Harmony/usb_apps_host
d1f3db0bba39a13e779776721d156bc5bbd55da9
[ "BSD-Source-Code" ]
1
2020-11-27T05:41:21.000Z
2020-11-27T05:41:21.000Z
/******************************************************************************* Cortex-M device vectors file Company: Microchip Technology Inc. File Name: device_vectors.h Summary: Harmony3 device handler structure for cortex-M devices Description: This file contains Harmony3 device handler structure for cortex-M devices *******************************************************************************/ // DOM-IGNORE-BEGIN /******************************************************************************* * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to comply with third party license terms applicable to your * use of third party software (including open source software) that may * accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A * PARTICULAR PURPOSE. * * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. *******************************************************************************/ // DOM-IGNORE-END #ifndef DEVICE_VECTORS_H #define DEVICE_VECTORS_H // ***************************************************************************** // ***************************************************************************** // Section: Included Files // ***************************************************************************** // ***************************************************************************** #include <stdint.h> // ***************************************************************************** // ***************************************************************************** // Section: Data Types // ***************************************************************************** // ***************************************************************************** /* Function pointer type for vector handlers */ typedef void (*pfn_handler_t)(void); /* Structure defining device vector types */ typedef struct _H3DeviceVectors { /* Stack pointer */ uint32_t* pvStack; /* CORTEX-M4 handlers */ pfn_handler_t pfnReset_Handler; /* -15 Reset Vector, invoked on Power up and warm reset */ pfn_handler_t pfnNonMaskableInt_Handler; /* -14 Non maskable Interrupt, cannot be stopped or preempted */ pfn_handler_t pfnHardFault_Handler; /* -13 Hard Fault, all classes of Fault */ pfn_handler_t pfnMemoryManagement_Handler; /* -12 Memory Management, MPU mismatch, including Access Violation and No Match */ pfn_handler_t pfnBusFault_Handler; /* -11 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */ pfn_handler_t pfnUsageFault_Handler; /* -10 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ pfn_handler_t pfnReservedC9; pfn_handler_t pfnReservedC8; pfn_handler_t pfnReservedC7; pfn_handler_t pfnReservedC6; pfn_handler_t pfnSVCall_Handler; /* -5 System Service Call via SVC instruction */ pfn_handler_t pfnDebugMonitor_Handler; /* -4 Debug Monitor */ pfn_handler_t pfnReservedC3; pfn_handler_t pfnPendSV_Handler; /* -2 Pendable request for system service */ pfn_handler_t pfnSysTick_Handler; /* -1 System Tick Timer */ /* Peripheral handlers */ pfn_handler_t pfnSUPC_Handler; /* 0 Supply Controller */ pfn_handler_t pfnRSTC_Handler; /* 1 Reset Controller */ pfn_handler_t pfnRTC_Handler; /* 2 Real Time Clock */ pfn_handler_t pfnRTT_Handler; /* 3 Real Time Timer */ pfn_handler_t pfnWDT_Handler; /* 4 Watchdog Timer */ pfn_handler_t pfnPMC_Handler; /* 5 Power Management Controller */ pfn_handler_t pfnEFC_Handler; /* 6 Enhanced Flash Controller */ pfn_handler_t pfnFLEXCOM7_Handler; /* 7 FLEXCOM 7 */ pfn_handler_t pfnFLEXCOM0_Handler; /* 8 FLEXCOM 0 */ pfn_handler_t pfnFLEXCOM1_Handler; /* 9 FLEXCOM 1 */ pfn_handler_t pfnReserved10; pfn_handler_t pfnPIOA_Handler; /* 11 Parallel I/O Controller A */ pfn_handler_t pfnPIOB_Handler; /* 12 Parallel I/O Controller B */ pfn_handler_t pfnPDMIC0_Handler; /* 13 PDM 0 */ pfn_handler_t pfnFLEXCOM2_Handler; /* 14 FLEXCOM 2 */ pfn_handler_t pfnMEM2MEM_Handler; /* 15 MEM2MEM */ pfn_handler_t pfnI2SC0_Handler; /* 16 I2SC0 */ pfn_handler_t pfnI2SC1_Handler; /* 17 I2SC1 */ pfn_handler_t pfnPDMIC1_Handler; /* 18 PDM 1 */ pfn_handler_t pfnFLEXCOM3_Handler; /* 19 FLEXCOM 3 */ pfn_handler_t pfnFLEXCOM4_Handler; /* 20 FLEXCOM 4 */ pfn_handler_t pfnFLEXCOM5_Handler; /* 21 FLEXCOM 5 */ pfn_handler_t pfnFLEXCOM6_Handler; /* 22 FLEXCOM 6 */ pfn_handler_t pfnTC0_CH0_Handler; /* 23 Timer/Counter 0 Channel 0 */ pfn_handler_t pfnTC0_CH1_Handler; /* 24 Timer/Counter 0 Channel 1 */ pfn_handler_t pfnTC0_CH2_Handler; /* 25 Timer/Counter 0 Channel 2 */ pfn_handler_t pfnTC1_CH0_Handler; /* 26 Timer/Counter 1 Channel 0 */ pfn_handler_t pfnTC1_CH1_Handler; /* 27 Timer/Counter 1 Channel 1 */ pfn_handler_t pfnTC1_CH2_Handler; /* 28 Timer/Counter 1 Channel 2 */ pfn_handler_t pfnADC_Handler; /* 29 Analog To Digital Converter */ pfn_handler_t pfnReserved30; pfn_handler_t pfnReserved31; pfn_handler_t pfnReserved32; pfn_handler_t pfnReserved33; pfn_handler_t pfnReserved34; pfn_handler_t pfnReserved35; pfn_handler_t pfnReserved36; pfn_handler_t pfnReserved37; pfn_handler_t pfnReserved38; pfn_handler_t pfnReserved39; pfn_handler_t pfnReserved40; pfn_handler_t pfnReserved41; pfn_handler_t pfnReserved42; pfn_handler_t pfnReserved43; pfn_handler_t pfnReserved44; pfn_handler_t pfnReserved45; pfn_handler_t pfnReserved46; pfn_handler_t pfnUHP_Handler; /* 47 USB OHCI */ pfn_handler_t pfnUDP_Handler; /* 48 USB Device FS */ pfn_handler_t pfnCRCCU_Handler; /* 49 CRCCU */ }H3DeviceVectors; #endif //DEVICE_VECTORS_H
51.637681
140
0.591496
[ "vector" ]
e8c50ebed0a32defe47f8b24607685fc4805f835
1,919
h
C
src/srchilite/formatterfactory.h
lingnand/Helium
d1f8fab6eb5d60e35b3287f6ea35cd1fae71f816
[ "BSD-3-Clause" ]
8
2021-04-16T02:05:54.000Z
2022-03-16T13:56:23.000Z
src/srchilite/formatterfactory.h
lingnand/Helium
d1f8fab6eb5d60e35b3287f6ea35cd1fae71f816
[ "BSD-3-Clause" ]
null
null
null
src/srchilite/formatterfactory.h
lingnand/Helium
d1f8fab6eb5d60e35b3287f6ea35cd1fae71f816
[ "BSD-3-Clause" ]
2
2021-04-17T10:49:58.000Z
2021-07-21T20:39:52.000Z
// // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008 // // Copyright: See COPYING file that comes with this distribution // #ifndef FORMATTERFACTORY_H_ #define FORMATTERFACTORY_H_ #include <string> #include <list> #include <boost/shared_ptr.hpp> using std::string; namespace srchilite { /// constants indicating boldface, italics, etc. enum StyleConstant { ISBOLD = 1, ///< bold ISITALIC, ///< italics ISUNDERLINE, ///< underline ISFIXED, ///< fixed size ISNOTFIXED, ///< non fixed size ISNOREF ///< must not contain references }; /// collection of StyleConstant objects typedef std::list<StyleConstant> StyleConstants; /// shared pointer for StyleConstants typedef boost::shared_ptr<StyleConstants> StyleConstantsPtr; /// iterator for StyleConstants typedef StyleConstants::const_iterator StyleConstantsIterator; /** * The generic abstract factory to create Formatter objects, during the * parsing of style files. Note that creation methods do not return a specific * object, so that the implementation of where to store the Formatter objects * themselves is left completely to the programmer (and does not couple the factory * to a specific collection). */ class FormatterFactory { public: virtual ~FormatterFactory() { } /** * Creates a formatter for the specific language element (identified by * key) with the passed style parameters * * @param key the language element represented * @param color the color * @param bgcolor the background color * @param styleconstants additional formatting information (e.g., bold, italics, etc.) * @return false if a formatter for the specific key is already present */ virtual bool createFormatter(const string &key, const string &color, const string &bgcolor, StyleConstantsPtr styleconstants) = 0; }; } #endif /*FORMATTERFACTORY_H_*/
28.641791
90
0.723293
[ "object" ]
e8c7f65d0989742491c179b8809bdbf00b8ecf0e
1,071
h
C
src/UI/Button.h
Nickswoboda/Aegis
60e0e770892bdcb378686508ca455f6b5d522e33
[ "MIT" ]
null
null
null
src/UI/Button.h
Nickswoboda/Aegis
60e0e770892bdcb378686508ca455f6b5d522e33
[ "MIT" ]
null
null
null
src/UI/Button.h
Nickswoboda/Aegis
60e0e770892bdcb378686508ca455f6b5d522e33
[ "MIT" ]
null
null
null
#pragma once #include "Widget.h" #include "../Core/Event.h" #include "../Math/AABB.h" #include "../Math/Vec4.h" #include "../Renderer/Font.h" #include <array> #include <functional> namespace Aegis { class Button : public Widget { public: enum State { Normal, Pressed, Hovered, NumStates }; Button(const std::string& label = ""); bool IsPressed(int action); void OnEvent(Event& event) override; void Render() const override; void SetPos(Vec2 pos) override; const std::string& GetText() const; void SetText(const std::string& text); void SetFont(std::shared_ptr<Font> font) override; void SetStateTexture(State state, std::shared_ptr<Texture> texture); void SetStateBgColor(State state, const Vec4& color); int border_size_ = 0; Vec4 border_color_ = {0.0f, 0.0f, 0.0f, 1.0f}; State state_ = State::Normal; private: void UpdateTextRenderPos(); std::string text_; Vec2 text_pos_; bool hovered_ = false; std::array<Vec4, NumStates> bg_colors_; std::array<std::shared_ptr<Texture>, NumStates> textures_; }; }
21.857143
70
0.690009
[ "render" ]
e8d11126e08bb26a520bd73aa486f097f6a86a12
46,955
h
C
include/kos/heap.h
GrieferAtWork/KOS
5376a813854b35e3a3532a6e3b8dbb168478b40f
[ "Zlib" ]
2
2017-02-24T17:14:19.000Z
2017-10-12T19:26:13.000Z
include/kos/heap.h
GrieferAtWork/KOS
5376a813854b35e3a3532a6e3b8dbb168478b40f
[ "Zlib" ]
1
2019-11-02T10:21:11.000Z
2019-11-02T10:21:11.000Z
include/kos/heap.h
GabrielRavier/KOSmk3
5376a813854b35e3a3532a6e3b8dbb168478b40f
[ "Zlib" ]
1
2019-11-02T10:20:19.000Z
2019-11-02T10:20:19.000Z
/* Copyright (c) 2018 Griefer@Work * * * * This software is provided 'as-is', without any express or implied * * warranty. In no event will the authors be held liable for any damages * * arising from the use of this software. * * * * Permission is granted to anyone to use this software for any purpose, * * including commercial applications, and to alter it and redistribute it * * freely, subject to the following restrictions: * * * * 1. The origin of this software must not be misrepresented; you must not * * claim that you wrote the original software. If you use this software * * in a product, an acknowledgement in the product documentation would be * * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * */ #ifndef _KOS_HEAP_H #define _KOS_HEAP_H 1 #include <__stdinc.h> #ifdef __KERNEL__ #include <kernel/heap.h> #else /* __KERNEL__ */ #include <asm/types.h> #include <hybrid/align.h> #include <hybrid/list/list.h> #include <hybrid/list/atree.h> #include <hybrid/sync/atomic-rwlock.h> __SYSDECL_BEGIN /* User-space re-implementation of KOS's kernel-space heap objects. * The basic logic is the same, and heap validation makes use of a * hidden system call (not so hidden now that I mentioned it). * Anyways: `libc' exports all possible combinations of heap usage * functions, meaning that an application is able to * configure the desired behavior of heap functions itself. */ //#define CONFIG_NO_DEBUG_HEAP 1 //#define CONFIG_NO_HEAP_RANDOMIZE_OFFSETS 1 //#define CONFIG_NO_HEAP_TRACE_DANGLE 1 //#define CONFIG_HEAP_ALIGNMENT power-of-2 /* Enable heap memory pre-initialization, as well as special * data patterns for unallocated memory, in addition to the * ability of tracking use-after-free through `heap_validate()' * Note that `heap_validate()' attempts to optimize itself not * to check data blocks that haven't been modified since the * previous check, making use of `pagedir_haschanged()', should * the host support that function (`CONFIG_HAVE_PAGEDIR_CHANGED') */ #ifndef CONFIG_DEBUG_HEAP #if !defined(CONFIG_NO_DEBUG_HEAP) && !defined(NDEBUG) #define CONFIG_DEBUG_HEAP 1 #elif !defined(CONFIG_NO_DEBUG_HEAP) #define CONFIG_NO_DEBUG_HEAP 1 #endif #elif defined(CONFIG_NO_DEBUG_HEAP) #undef CONFIG_DEBUG_HEAP #endif /* Randomize in-heap allocation offsets (using `rand()') when * less memory than the best matching free slot contains is * allocated: * >> slot(48 bytes): FREEFREEFREEFREEFREEFREEFREEFREEFREEFREEFREEFREE * >> alloc(16 bytes): FREEFREEFREEFREE (Without `CONFIG_HEAP_RANDOMIZE_OFFSETS') * >> alloc(16 bytes): FREEFREEFREEFREE (With `CONFIG_HEAP_RANDOMIZE_OFFSETS') * >> alloc(16 bytes): FREEFREEFREEFREE (With `CONFIG_HEAP_RANDOMIZE_OFFSETS') * >> alloc(16 bytes): FREEFREEFREEFREE (With `CONFIG_HEAP_RANDOMIZE_OFFSETS') * This configuration option affects the results of `heap_alloc()' and `heap_align()' * Reasoning: * - Although even without this option, we are randomizing the kernel heap location * during early boot, once that's been established, no further randomization would * be done without this option enabled. * That could lead to bugs going undetected that depend on the relative offsets * between allocated data blocks, something that this option prevents by ensuring * that more randomization is added into the mix whenever memory is allocated. * - Without this option, only address bits above `PAGESIZE' would be randomized * for the kernel's default heaps, while bits between it and `HEAP_ALIGNMENT' * would be predictably consistent for consecutive allocations. * That might be another cause for buggy code that might accidentally rely on * those bits never changing. */ #ifndef CONFIG_HEAP_RANDOMIZE_OFFSETS #if !defined(CONFIG_NO_HEAP_RANDOMIZE_OFFSETS) && \ defined(CONFIG_DEBUG_HEAP) #define CONFIG_HEAP_RANDOMIZE_OFFSETS 1 #elif !defined(CONFIG_NO_HEAP_RANDOMIZE_OFFSETS) #define CONFIG_NO_HEAP_RANDOMIZE_OFFSETS 1 #endif #elif defined(CONFIG_NO_HEAP_RANDOMIZE_OFFSETS) #undef CONFIG_HEAP_RANDOMIZE_OFFSETS #endif #define HEAP_TYPE_FNORMAL 0x0000 /* No options enabled. */ #define HEAP_TYPE_FDEBUG 0x0001 /* CONFIG_DEBUG_HEAP */ #define HEAP_TYPE_FALIGN 0x0002 /* HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT */ /* Figure out the heap type selected by the current configuration. */ #ifdef CONFIG_DEBUG_HEAP #if HEAP_ALIGNMENT == __DEFAULT_HEAP_ALIGNMENT # define HEAP_TYPE_FCURRENT HEAP_TYPE_FDEBUG #else # define HEAP_TYPE_FCURRENT (HEAP_TYPE_FDEBUG|HEAP_TYPE_FALIGN) #endif #else /* CONFIG_DEBUG_HEAP */ #if HEAP_ALIGNMENT == __DEFAULT_HEAP_ALIGNMENT # define HEAP_TYPE_FCURRENT HEAP_TYPE_FNORMAL #else # define HEAP_TYPE_FCURRENT HEAP_TYPE_FALIGN #endif #endif /* !CONFIG_DEBUG_HEAP */ #if __SIZEOF_POINTER__ == 4 /* Using 16 allows a human to quickly notice heap pointers by realizing * that the last digit in a hexadecimal representation is ZERO(0). */ #define __HEAP_GET_DEFAULT_ALIGNMENT(heap_type) \ ((heap_type) & HEAP_TYPE_FDEBUG ? 16 : 8) #else #define __HEAP_GET_DEFAULT_ALIGNMENT(heap_type) 16 #endif #define __DEFAULT_HEAP_ALIGNMENT \ __HEAP_GET_DEFAULT_ALIGNMENT(HEAP_TYPE_FCURRENT) /* Minimum alignment of all heap pointers. */ #ifndef HEAP_ALIGNMENT #ifdef CONFIG_HEAP_ALIGNMENT # define HEAP_ALIGNMENT CONFIG_HEAP_ALIGNMENT #else # define HEAP_ALIGNMENT __DEFAULT_HEAP_ALIGNMENT #endif #endif #if (HEAP_ALIGNMENT & (HEAP_ALIGNMENT-1)) #error "Invalid `HEAP_ALIGNMENT' must be a power-of-2 number" #endif #ifdef CONFIG_DEBUG_HEAP #define DEBUGHEAP_NO_MANS_LAND 0xdeadbeef /* Debug initialization of unallocated memory. */ #define DEBUGHEAP_FRESH_MEMORY 0xaaaaaaaa /* Debug initialization of freshly allocated memory. */ #endif /* CONFIG_DEBUG_HEAP */ #ifdef __EXPOSE_HEAP_INTERNALS #define __HEAP_MEMBER(x) x #else #define __HEAP_MEMBER(x) __##x##__ #endif #ifdef __EXPOSE_HEAP_INTERNALS #define SIZEOF_MFREE offsetof(struct mfree,mf_data) #define HEAP_MINSIZE CEIL_ALIGN(SIZEOF_MFREE,HEAP_ALIGNMENT) #else #define HEAP_MINSIZE CEIL_ALIGN(offsetof(struct mfree,__mf_data__),HEAP_ALIGNMENT) #endif struct __ATTR_PACKED __HEAP_MEMBER(mfree) { LIST_NODE(struct __HEAP_MEMBER(mfree)) __HEAP_MEMBER(mf_lsize); /* [lock(:h_lock)][sort(ASCENDING(mf_size))] List of free entries ordered by size. */ ATREE_XNODE(struct __HEAP_MEMBER(mfree)) __HEAP_MEMBER(mf_laddr); /* [lock(:h_lock)][sort(ASCENDING(self))] List of free entries ordered by address. */ __size_t __HEAP_MEMBER(mf_size); /* Size of this block (in bytes; aligned by `HEAP_ALIGNMENT'; including this header) */ #ifdef __EXPOSE_HEAP_INTERNALS #define MFREE_FUNDEFINED 0x00 /* Memory initialization is undefined. * In debug mode, this means that memory is * initialized using `DEBUGHEAP_NO_MANS_LAND', * with portions that haven't been allocated yet * pending initialization for either `DEBUGHEAP_FRESH_MEMORY' * or ZERO(0), depending on how they were originally allocated. */ #define MFREE_FZERO GFP_CALLOC /* Memory is ZERO-initialized. */ #define MFREE_FMASK MFREE_FZERO /* Mask of known flags. */ #endif /* __EXPOSE_HEAP_INTERNALS */ __UINT8_TYPE__ __HEAP_MEMBER(mf_flags); /* Set of `MFREE_F*' */ #ifdef CONFIG_DEBUG_HEAP __UINT8_TYPE__ __HEAP_MEMBER(mf_szchk); /* Checksum for `mf_size' */ #endif __BYTE_TYPE__ __HEAP_MEMBER(mf_data)[1]; /* Block data. */ }; #ifdef __EXPOSE_HEAP_INTERNALS #define MFREE_MIN(self) ((__uintptr_t)(self)) #define MFREE_MAX(self) ((__uintptr_t)(self)+(self)->mf_size-1) #define MFREE_BEGIN(self) ((__uintptr_t)(self)) #define MFREE_END(self) ((__uintptr_t)(self)+(self)->mf_size) #define MFREE_SIZE(self) (self)->mf_size #endif /* Heap configuration: * Index offset for the first bucket that should be search for a given size. */ #if HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT #define __HEAP_BUCKET_OFFSET 1 #elif __DEFAULT_HEAP_ALIGNMENT == 4 #define __HEAP_BUCKET_OFFSET 3 /* FFS(__DEFAULT_HEAP_ALIGNMENT) */ #elif __DEFAULT_HEAP_ALIGNMENT == 8 #define __HEAP_BUCKET_OFFSET 4 /* FFS(__DEFAULT_HEAP_ALIGNMENT) */ #elif __DEFAULT_HEAP_ALIGNMENT == 16 #define __HEAP_BUCKET_OFFSET 5 /* FFS(__DEFAULT_HEAP_ALIGNMENT) */ #elif __DEFAULT_HEAP_ALIGNMENT == 32 #define __HEAP_BUCKET_OFFSET 6 /* FFS(__DEFAULT_HEAP_ALIGNMENT) */ #else #error "Invalid default alignment" #endif #ifdef __EXPOSE_HEAP_INTERNALS #include <hybrid/__bit.h> #define HEAP_BUCKET_OFFSET __HEAP_BUCKET_OFFSET #define HEAP_BUCKET_OF(size) (((__SIZEOF_SIZE_T__*8)-__hybrid_clz(size))-HEAP_BUCKET_OFFSET) #define HEAP_BUCKET_MINSIZE(i) (1 << ((i)+HEAP_BUCKET_OFFSET-1)) #endif /* __EXPOSE_HEAP_INTERNALS */ #define HEAP_BUCKET_COUNT ((__SIZEOF_SIZE_T__*8)-(__HEAP_BUCKET_OFFSET-1)) /* Figure out how to link against the selected heap type. */ #if HEAP_TYPE_FCURRENT == (HEAP_TYPE_FDEBUG|HEAP_TYPE_FALIGN) # define __HEAP_FUNCTION(x) x##_da #elif HEAP_TYPE_FCURRENT == HEAP_TYPE_FDEBUG # define __HEAP_FUNCTION(x) x##_d #elif HEAP_TYPE_FCURRENT == HEAP_TYPE_FALIGN # define __HEAP_FUNCTION(x) x##_a #elif HEAP_TYPE_FCURRENT == HEAP_TYPE_FNORMAL # define __HEAP_FUNCTION(x) x #else # error "Invalid current heap type" #endif /* Heap operation flags. */ #define HEAP_FNORMAL 0x0000 #define HEAP_FUSEHINTS 0x0001 /* Make use of address hints when allocating memory. */ #define HEAP_FDOWNHINT 0x0002 /* The heap grows downwards, rather than upwards. */ #define HEAP_FRANDOMIZE 0x0004 /* CONFIG_HEAP_RANDOMIZE_OFFSETS. */ #ifdef CONFIG_HEAP_RANDOMIZE_OFFSETS # define HEAP_FCURRENT HEAP_FRANDOMIZE #else /* CONFIG_HEAP_RANDOMIZE_OFFSETS */ # define HEAP_FCURRENT HEAP_FNORMAL #endif /* !CONFIG_HEAP_RANDOMIZE_OFFSETS */ struct __ATTR_PACKED __HEAP_MEMBER(heapstat) { WEAK __size_t __HEAP_MEMBER(hs_alloc); /* Total number of bytes currently allocated. */ WEAK __size_t __HEAP_MEMBER(hs_mmap); /* Total number of bytes currently mapped for the heap. */ WEAK __size_t __HEAP_MEMBER(hs_mmap_peak); /* The greatest number of bytes ever allocated from the system. */ }; struct __ATTR_PACKED heap { __UINTPTR_HALF_TYPE__ __HEAP_MEMBER(h_type); /* [== HEAP_TYPE_FCURRENT][const] The type of heap. */ __UINTPTR_HALF_TYPE__ __HEAP_MEMBER(h_flags); /* Heap flags (Set of `HEAP_F*'). */ atomic_rwlock_t __HEAP_MEMBER(h_lock); /* Lock for this heap. */ ATREE_HEAD(struct __HEAP_MEMBER(mfree)) __HEAP_MEMBER(h_addr); /* [lock(h_lock)][0..1] Heap sorted by address. */ LIST_HEAD(struct __HEAP_MEMBER(mfree)) /* [lock(h_lock)][0..1][*] Heap sorted by free range size. */ __HEAP_MEMBER(h_size)[HEAP_BUCKET_COUNT]; WEAK __size_t __HEAP_MEMBER(h_overalloc); /* Amount (in bytes) by which to over-allocate memory in heaps. * NOTE: Set to ZERO(0) to disable overallocation. */ WEAK __size_t __HEAP_MEMBER(h_freethresh); /* Threshold that must be reached before any continuous block of free * data is unmapped from the kernel VM. (Should always be `>= PAGESIZE') */ WEAK void *__HEAP_MEMBER(h_corehint); /* [valid_if(HEAP_FUSEHINTS)] Hint for where to allocate new memory. */ ATOMIC_DATA __size_t __HEAP_MEMBER(h_dangle); /* [lock(INCREMENT(h_lock),DECREMENT(atomic),READ(atomic))] * Amount of dangling bytes of memory (memory that was allocated, but may be * release again shortly) When new memory would have to be requested from the * core, this field is checked to see if it is likely that some large block * of memory will be released soon, preventing a race condition that would * unnecessarily allocate more memory when `heap_free()' is merging a data * block with another, larger data block, for which it must temporarily * allocate that larger data block. Another thread allocating memory at the * same time could otherwise decide that the cache has grown too small for * its allocation and unnecessarily request more memory from the core. */ struct __HEAP_MEMBER(heapstat) __HEAP_MEMBER(h_stat); /* [lock(h_lock)] Heap statistics. */ #ifdef CONFIG_DEBUG_HEAP LIST_NODE(struct heap) __HEAP_MEMBER(h_chain); /* [lock(INTERNAL(...))] Chain of all known debug heaps (for `heap_validate_all()') */ #endif /* CONFIG_DEBUG_HEAP */ #if HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT __size_t __HEAP_MEMBER(h_almask); /* [const] Heap alignment mask (== HEAP_ALIGNMENT-1) */ __size_t __HEAP_MEMBER(h_ialmask); /* [const] Inverse heap alignment mask (== ~(HEAP_ALIGNMENT-1)) */ __size_t __HEAP_MEMBER(h_minsize); /* [const] Heap min size (== (offsetof(struct mfree,mf_data) + HEAP_ALIGNMENT-1) & ~(HEAP_ALIGNMENT-1)) */ #endif }; #ifdef CONFIG_DEBUG_HEAP #define __HEAP_INIT_H_CHAIN , { NULL, NULL } #else /* CONFIG_DEBUG_HEAP */ #define __HEAP_INIT_H_CHAIN /* nothing */ #endif /* !CONFIG_DEBUG_HEAP */ #if HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT #define __HEAP_INIT_H_ALMASK \ , HEAP_ALIGNMENT-1, ~(HEAP_ALIGNMENT-1)\ , (__builtin_offsetof(struct __HEAP_MEMBER(mfree),mf_data) + HEAP_ALIGNMENT-1) & ~(HEAP_ALIGNMENT-1) #else #define __HEAP_INIT_H_ALMASK /* nothing */ #endif /* Static initializer for heaps: * >> struct heap my_heap = HEAP_INIT(PAGESIZE*2,PAGESIZE*16); */ #define HEAP_INIT(overalloc,free_threshold) \ { HEAP_TYPE_FCURRENT, HEAP_FCURRENT, ATOMIC_RWLOCK_INIT, \ NULL, { NULL, }, (overalloc), (free_threshold), NULL, 0, \ { 0, 0, 0 } __HEAP_INIT_H_CHAIN __HEAP_INIT_H_ALMASK } #ifndef __heapptr_defined #define __heapptr_defined 1 struct heapptr { void *hp_ptr; /* [1..hp_siz] Pointer base address. */ __size_t hp_siz; /* [!0] Size of the pointer. */ }; #endif /* !__heapptr_defined */ #ifndef __heapinfo_defined #define __heapinfo_defined 1 struct heapinfo { __size_t hi_trimable; /* Total amount of memory that could be heap_trim()-ed (in bytes). */ __size_t hi_free; /* Total size of currently free memory. */ __size_t hi_free_z; /* [<= hi_free] Amount of ZERO-initialized free memory. */ __size_t hi_free_min; /* [<= hi_free_max] Size of the smallest free heap node, or ZERO if there are none. */ __size_t hi_free_max; /* [>= hi_free_min] Size of the largest free heap node, or ZERO if there are none. */ __size_t hi_free_cnt; /* Amount of free heap nodes available for allocation. */ __size_t hi_alloc; /* Total number of bytes allocated using the heap. */ __size_t hi_mmap; /* Total number of bytes currently mapped for the heap. */ __size_t hi_mmap_peak; /* The greatest number of bytes ever allocated at the same time. */ }; #endif /* !__heapinfo_defined */ #define GFP_CALLOC 0x0010 /* Zero-initialize newly allocated memory. */ #define GFP_ATOMIC 0x0800 /* [== O_NONBLOCK] Do not block, but throw a resumable `E_WOULDBLOCK' error when a lock could not be acquired immediately. */ #define GFP_NOOVER 0x1000 /* Do not overallocate when mapping new memory. * Any (logical) call to `mmap()' and friends will * be limited to `CEIL_ALIGN(n_bytes,PAGESIZE)'. */ #define GFP_NOMAP 0x4000 /* Do not map new memory, but throw an `E_WOULDBLOCK' error when caches do not contain any memory. * Additionally, do not unmap system memory when this flag is set during a free-operation (including realloc when reducing a pointer size) */ #define GFP_NOTRIM 0x4000 /* Don't unmap memory once free blocks grow to sufficient lengths. */ #ifndef __gfp_t_defined #define __gfp_t_defined 1 typedef unsigned int gfp_t; /* Set of `GFP_*' */ #endif /* !__gfp_t_defined */ /* Link selected heap functions. */ #if HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT __REDIRECT_VOID(__LIBC,,__LIBCCALL,__os_heap_init,(struct heap *__restrict __self, __size_t __overalloc, __size_t __free_threshold, __UINT16_TYPE__ __flags, __size_t __heap_alignment),__HEAP_FUNCTION(heap_init),(__self,overalloc,free_threshold,__flags,__heap_alignment)) #else __REDIRECT_VOID(__LIBC,,__LIBCCALL,__os_heap_init,(struct heap *__restrict __self, __size_t __overalloc, __size_t __free_threshold, __UINT16_TYPE__ __flags),__HEAP_FUNCTION(heap_init),(__self,overalloc,free_threshold,__flags)) #endif __REDIRECT_VOID(__LIBC,,__LIBCCALL,__os_heap_fini,(struct heap *__restrict __self),__HEAP_FUNCTION(heap_fini),(__self)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_alloc,(struct heap *__restrict __self, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_alloc),(__self,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_align,(struct heap *__restrict __self, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_align),(__self,__min_alignment,__offset,__num_bytes,__flags)) __REDIRECT(__LIBC,,__size_t,__LIBCCALL,__os_heap_allat,(struct heap *__restrict __self, void *__restrict __ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_allat),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,void,__LIBCCALL,__os_heap_free,(struct heap *__restrict __self, void *__ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_free),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realloc,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realloc),(__self,__old_ptr,__old_bytes,__new_bytes,__alloc_flags,__free_flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realign,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realign),(__self,__old_ptr,__old_bytes,__min_alignment,__offset,__new_bytes,__alloc_flags,__free_flags)) __REDIRECT(__LIBC,,__size_t,__LIBCCALL,__os_heap_trim,(struct heap *__restrict __self, __size_t __threshold),__HEAP_FUNCTION(heap_trim),(__self,__threshold)) __REDIRECT(__LIBC,,struct heapinfo,__LIBCCALL,__os_heap_info,(struct heap *__restrict __self),__HEAP_FUNCTION(heap_info),(__self)) #if (HEAP_TYPE_FCURRENT & HEAP_TYPE_FDEBUG) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_alloc_untraced,(struct heap *__restrict __self, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_alloc_untraced),(__self,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_align_untraced,(struct heap *__restrict __self, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_align_untraced),(__self,__min_alignment,__offset,__num_bytes,__flags)) __REDIRECT(__LIBC,,__size_t,__LIBCCALL,__os_heap_allat_untraced,(struct heap *__restrict __self, void *__restrict __ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_allat_untraced),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,void,__LIBCCALL,__os_heap_free_untraced,(struct heap *__restrict __self, void *__ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_free_untraced),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realloc_untraced,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realloc_untraced),(__self,__old_ptr,__old_bytes,__new_bytes,__alloc_flags,__free_flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realign_untraced,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realign_untraced),(__self,__old_ptr,__old_bytes,__min_alignment,__offset,__new_bytes,__alloc_flags,__free_flags)) #else __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_alloc_untraced,(struct heap *__restrict __self, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_alloc),(__self,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_align_untraced,(struct heap *__restrict __self, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_align),(__self,__min_alignment,__offset,__num_bytes,__flags)) __REDIRECT(__LIBC,,__size_t,__LIBCCALL,__os_heap_allat_untraced,(struct heap *__restrict __self, void *__restrict __ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_allat),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,void,__LIBCCALL,__os_heap_free_untraced,(struct heap *__restrict __self, void *__ptr, __size_t __num_bytes, gfp_t __flags),__HEAP_FUNCTION(heap_free),(__self,__ptr,__num_bytes,__flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realloc_untraced,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realloc),(__self,__old_ptr,__old_bytes,__new_bytes,__alloc_flags,__free_flags)) __REDIRECT(__LIBC,,struct heapptr,__LIBCCALL,__os_heap_realign_untraced,(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags),__HEAP_FUNCTION(heap_realign),(__self,__old_ptr,__old_bytes,__min_alignment,__offset,__new_bytes,__alloc_flags,__free_flags)) #endif #ifndef __OMIT_HEAP_CONSTANT_P_WRAPPERS /* Initialize/finalize a dynamically allocated heap. */ __FORCELOCAL void (__LIBCCALL heap_init)(struct heap *__restrict __self, __size_t __overalloc, __size_t __free_threshold) { #if HEAP_ALIGNMENT != __DEFAULT_HEAP_ALIGNMENT __os_heap_init(__self,__overalloc,__free_threshold,HEAP_FCURRENT,HEAP_ALIGNMENT); #else __os_heap_init(__self,__overalloc,__free_threshold,HEAP_FCURRENT); #endif } __FORCELOCAL void (__LIBCCALL heap_fini)(struct heap *__restrict __self) { __os_heap_fini(__self); } /* Allocate at least `num_bytes' of dynamic memory, * aligned by at least `min_alignment' or `HEAP_ALIGNMENT'. * NOTES: * - Passing `0', or anything less than `HEAP_MINSIZE' * for `num_bytes' is the same as passing `HEAP_MINSIZE'. * - Passing anything less than `HEAP_ALIGNMENT' for `min_alignment' * is the same as passing `HEAP_ALIGNMENT' for `min_alignment' * - The `offset' parameter is a delta added to the returned pointer * where the given `min_alignment' applies: * >> assert(IS_ALIGNED((uintptr_t)return.hp_ptr + offset,min_alignment)); * However, it doesn't guaranty that memory at `(uintptr_t)return.hp_ptr + offset' * is actually part of the allocation. * HINT: `offset' is internally truncated by `min_alignment': * `offset = offset & (min_alignment-1)' * - These functions are written to be able to deal with _ANY_ `num_bytes' * value, including unaligned value, or absurdly large values that were * designed only to cause internal overflow errors. * The following flags affect behavior: * heap_alloc / heap_align: * - GFP_CALLOC -- Allocate ZERO-initialized memory (in `return.hp_ptr ...+= return.hp_siz') * - GFP_NOOVER -- Do not overallocate (by `self->h_overalloc') * - GFP_NOMAP -- Don't map new memory (throw `E_WOULDBLOCK' instead) * - GFP_ATOMIC -- Do not block when mapping new memory (throw `E_WOULDBLOCK' instead) * - GFP_NOFS|GFP_NOSWAP -- Behavioral modifiers for swapping memory * heap_free: * - GFP_CALLOC -- The given memory block is ZERO-initialized (allows for some internal optimizations) * - GFP_NOTRIM -- Do not `vm_unmap()' free memory blocks larger than * `h_freethresh', but keep them in cache instead. * NOTE: `heap_free()' always completes without blocking. * If `vm_unmap()' needs to be called, the free() operation * is either postponed until the next call to a heap function * that is allowed to block, or is simply kept in cache, as * though `GFP_NOMAP' has been passed. * NOTE: The `*_untraced' family of functions can be used to allocate memory * which itself is still tracked as a potential candidate for memory * leaks, however will not be used as a forwarding point for other * memory leaks. * HINT: Using heap functions, `malloc()' can be implemented as something as * simple as having a global heap and allocating the requested memory * size + HEAP_ALIGNMENT, then saving the allocated size just before * the user data area, which is then read from by free() and realloc(). * @param: flags: Set of `GFP_*' flags used for allocation. * @throw: E_BADALLOC: Failed to allocate memory. * @throw: E_WOULDBLOCK: `GFP_NOMAP' was specified and new memory would have had to be mapped. * @throw: E_WOULDBLOCK: `GFP_ATOMIC' was specified and a lock could not be acquired immediately. */ __FORCELOCAL struct heapptr (__LIBCCALL heap_alloc)(struct heap *__restrict __self, __size_t __num_bytes, gfp_t __flags) { if (__builtin_constant_p(__num_bytes)) return __os_heap_alloc(__self, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_alloc(__self,__num_bytes,__flags); } __FORCELOCAL struct heapptr (__LIBCCALL heap_align)(struct heap *__restrict __self, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __num_bytes, gfp_t __flags) { if ((__builtin_constant_p(__min_alignment) && __min_alignment <= HEAP_ALIGNMENT) && (__builtin_constant_p(__offset) && (__offset & (__min_alignment-1)) == 0)) return heap_alloc(__self,__num_bytes,__flags); if (__builtin_constant_p(__num_bytes)) return __os_heap_align(__self,__min_alignment,__offset, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_align(__self,__min_alignment,__offset,__num_bytes,__flags); } #ifndef __OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS __FORCELOCAL struct heapptr (__LIBCCALL heap_alloc_untraced)(struct heap *__restrict __self, __size_t __num_bytes, gfp_t __flags) { if (__builtin_constant_p(__num_bytes)) return __os_heap_alloc_untraced(__self, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_alloc_untraced(__self,__num_bytes,__flags); } __FORCELOCAL struct heapptr (__LIBCCALL heap_align_untraced)(struct heap *__restrict __self, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __num_bytes, gfp_t __flags) { if ((__builtin_constant_p(__min_alignment) && __min_alignment <= HEAP_ALIGNMENT) && (__builtin_constant_p(__offset) && (__offset & (__min_alignment-1)) == 0)) return heap_alloc_untraced(__self,__num_bytes,__flags); if (__builtin_constant_p(__num_bytes)) return __os_heap_align_untraced(__self,__min_alignment,__offset, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_align_untraced(__self,__min_alignment,__offset,__num_bytes,__flags); } #endif /* !__OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS */ /* Try to allocate memory at a given address, returning the actual * number of bytes that the function managed to allocate, ZERO(0) if * allocation is not possible due to an overlap, or throw an `E_BADALLOC' * if the additional `num_bytes' could not be allocated. * NOTE: When `num_bytes' is less than `HEAP_MINSIZE', this function * may actually return less than `HEAP_MINSIZE', too! * With that in mind, always make sure that you've either already * allocated neighboring data block, or that `num_bytes' is larger * than, or equal to `HEAP_MINSIZE'. * @return: * : The amount of continuous bytes allocated (`>= num_bytes'). * @return: 0 : Memory at the given address has already been allocated. * @assume(return == 0 || return >= num_bytes) * @param: flags: GFP flags used for allocation. * @throw: E_BADALLOC: Failed to allocate sufficient memory for the operation. * @throw: E_WOULDBLOCK: `GFP_NOMAP' was specified and new memory would have had to be mapped. * @throw: E_WOULDBLOCK: `GFP_ATOMIC' was specified and a lock could not be acquired immediately. */ __FORCELOCAL __size_t (__LIBCCALL heap_allat)(struct heap *__restrict __self, void *__restrict __ptr, __size_t __num_bytes, gfp_t __flags) { if (__builtin_constant_p(__num_bytes)) return __os_heap_allat(__self,__ptr, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_allat(__self,__ptr,__num_bytes,__flags); } #ifndef __OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS __FORCELOCAL __size_t (__LIBCCALL heap_allat_untraced)(struct heap *__restrict __self, void *__restrict __ptr, __size_t __num_bytes, gfp_t __flags) { if (__builtin_constant_p(__num_bytes)) return __os_heap_allat_untraced(__self,__ptr, (__num_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __flags); return __os_heap_allat_untraced(__self,__ptr,__num_bytes,__flags); } #endif /* !__OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS */ /* A convenience wrapper for `heap_alloc()', `heap_allat()' and * `heap_free()', implementing the following realloc()-style semantics: * - realloc(ptr,0) --> Realloc to minimal size * - realloc(ptr,malloc_usable_size(ptr)-x) --> Free unused memory at the end * - realloc(ptr,malloc_usable_size(ptr)+x) --> Try to `heap_allat()' at the old end, or move to new memory * - realloc(0,x) --> Same as `heap_alloc()' * NOTES: * - Nothing these functions do can't easily be * emulated using `heap_alloc()' and `heap_allat()' * In fact: these functions are simple wrappers for them. * - These functions always return a fully allocated heap data block. * - Alignment arguments passed to `heap_realign()' are ignored * unless the initial, or a new data block have to be allocated. * - Allocation and free flags have been split to allow the user * to request zero-initialized memory to be allocated for new * allocations, while simultaniously releasing unused memory * without indicating that it is zero-initialized. * - If realloc() needs to move the data block to a new location, * the old location is freed using `free_flags & ~GFP_CALLOC' * @assume(return.hp_siz >= new_bytes); * @param: old_ptr: [valid_if(old_bytes != 0)] Base address of the old data block. * @param: old_bytes: The old size of the data block (can be ZERO(0); must be aligned to `HEAP_ALIGNMENT' by the caller) * @param: alloc_flags: Set of `GFP_*' flags used for allocating data. * @param: free_flags: Set of `GFP_*' flags used for freeing data. * @param: new_bytes: The new size of the data block (will be aligned by `HEAP_ALIGNMENT'). * @throw: E_BADALLOC: Failed to allocate memory. * @throw: E_WOULDBLOCK: `GFP_NOMAP' was specified and new memory would have had to be mapped. * @throw: E_WOULDBLOCK: `GFP_ATOMIC' was specified and a lock could not be acquired immediately. */ __FORCELOCAL struct heapptr (__LIBCCALL heap_realloc)(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags) { if (__builtin_constant_p(__old_bytes)) { if (__old_bytes == 0) return heap_alloc(__self,__new_bytes,__alloc_flags); } if (__builtin_constant_p(__new_bytes)) return __os_heap_realloc(__self,__old_ptr,__old_bytes, (__new_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __alloc_flags,__free_flags); return __os_heap_realloc(__self,__old_ptr,__old_bytes,__new_bytes, __alloc_flags,__free_flags); } __FORCELOCAL struct heapptr (__LIBCCALL heap_realign)(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags) { if (__builtin_constant_p(__old_bytes)) { if (__old_bytes == 0) return heap_align(__self,__min_alignment,__offset,__new_bytes,__alloc_flags); } if ((__builtin_constant_p(__min_alignment) && __min_alignment <= HEAP_ALIGNMENT) && (__builtin_constant_p(__offset) && (__offset & (__min_alignment-1)) == 0)) return heap_realloc(__self,__old_ptr,__old_bytes,__new_bytes,__alloc_flags,__free_flags); if (__builtin_constant_p(__new_bytes)) return __os_heap_realign(__self,__old_ptr,__old_bytes,__min_alignment, __offset,(__new_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __alloc_flags,__free_flags); return __os_heap_realign(__self,__old_ptr,__old_bytes,__min_alignment, __offset,__new_bytes,__alloc_flags,__free_flags); } #ifndef __OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS __FORCELOCAL struct heapptr (__LIBCCALL heap_realloc_untraced)(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags) { if (__builtin_constant_p(__old_bytes)) { if (__old_bytes == 0) return heap_alloc_untraced(__self,__new_bytes,__alloc_flags); } if (__builtin_constant_p(__new_bytes)) return __os_heap_realloc_untraced(__self,__old_ptr,__old_bytes, (__new_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __alloc_flags,__free_flags); return __os_heap_realloc_untraced(__self,__old_ptr,__old_bytes,__new_bytes, __alloc_flags,__free_flags); } __FORCELOCAL struct heapptr (__LIBCCALL heap_realign_untraced)(struct heap *__restrict __self, void *__old_ptr, __size_t __old_bytes, __size_t __min_alignment, __ptrdiff_t __offset, __size_t __new_bytes, gfp_t __alloc_flags, gfp_t __free_flags) { if (__builtin_constant_p(__old_bytes)) { if (__old_bytes == 0) return heap_align_untraced(__self,__min_alignment,__offset,__new_bytes,__alloc_flags); } if ((__builtin_constant_p(__min_alignment) && __min_alignment <= HEAP_ALIGNMENT) && (__builtin_constant_p(__offset) && (__offset & (__min_alignment-1)) == 0)) return heap_realloc_untraced(__self,__old_ptr,__old_bytes,__new_bytes,__alloc_flags,__free_flags); if (__builtin_constant_p(__new_bytes)) return __os_heap_realign_untraced(__self,__old_ptr,__old_bytes,__min_alignment, __offset,(__new_bytes + (HEAP_ALIGNMENT-1)) & ~(HEAP_ALIGNMENT-1), __alloc_flags,__free_flags); return __os_heap_realign_untraced(__self,__old_ptr,__old_bytes,__min_alignment, __offset,__new_bytes,__alloc_flags,__free_flags); } #endif /* !__OMIT_HEAP_TRACED_CONSTANT_P_WRAPPERS */ #endif /* !__OMIT_HEAP_CONSTANT_P_WRAPPERS */ /* Free the given memory, returning it to the heap. * The caller must ensure that `ptr' and `num_bytes' are aligned by * `HEAP_ALIGNMENT', and that `num_bytes' be least `HEAP_MINSIZE' bytes large. * The following flags affect the behavior of this function: * - GFP_NOTRIM -- Do not release large blocks of free data back to the core. * - GFP_CALLOC -- The given data block is ZERO-initialized. * @param: flags: The flags that should be used when freeing data. (see above) * @param: ptr: The HEAP_ALIGNMENT-aligned base pointer of the block to-be freed. * @param: num_bytes: The amount of bytes that should be freed. * NOTE: This argument must be aligned by `HEAP_ALIGNMENT', * and must not be equal to ZERO(0). */ __FORCELOCAL __ATTR_NOTHROW void (__LIBCCALL heap_free)(struct heap *__restrict __self, void *__ptr, __size_t __num_bytes, gfp_t __flags) { __os_heap_free(__self,__ptr,__num_bytes,__flags); } __FORCELOCAL __ATTR_NOTHROW void (__LIBCCALL heap_free_untraced)(struct heap *__restrict __self, void *__ptr, __size_t __num_bytes, gfp_t __flags) { __os_heap_free_untraced(__self,__ptr,__num_bytes,__flags); } /* Truncate the given heap, releasing unmapping free memory chunks * that are greater than, or equal to `CEIL_ALIGN(threshold,PAGESIZE)' * @return: * : The total number of bytes released back to the core (a multiple of PAGESIZE) */ __FORCELOCAL __size_t (__LIBCCALL heap_trim)(struct heap *__restrict __self, __size_t __threshold) { return __os_heap_trim(__self,__threshold); } /* Collect various statistical information about * the given heap, packed together as a snapshot. */ __FORCELOCAL struct heapinfo (__LIBCCALL heap_info)(struct heap *__restrict __self) { return __os_heap_info(__self); } #ifndef __pfindleakscallback_defined #define __pfindleakscallback_defined 1 /* User-defined callback to-be invoked for detected memory leaks. * @param: BASE: The base address of the memory leak. * @param: NUM_BYTES: The number of consecutively leaked bytes. * @param: LEAKER_TID: The thread id (`gettid()') of the thread responsible for the allocation. * WARNING: That thread might not actually exist any more... * @param: FRAME_CNT: The number of valid instruction pointers found in `FRAME_IP' * @param: FRAME_IP: A vector enumerating the top-most `FRAME_CNT' instruction * pointers forming a traceback where the allocation was made. * HINT: You can easily convert these to file+line * using the `vinfo' printf extension: * >> printf("%[vinfo:%f(%l,%c) : %n : %p : Here\n]",IP); * @param: CLOSURE: The CLOSURE-argument passed to `heap_find_leaks()' * @return: * : Added to the sum of return values * eventually returned by `heap_find_leaks()'. * @return: < 0: Stop enumeration and have `heap_find_leaks()' re-return * the same negative return value, indicating an error. */ typedef __ssize_t (__LIBCCALL *pfindleakscallback)(void *__base, __size_t __num_bytes, __pid_t __leaker_tid, __size_t __frame_cnt, void *const __frame_ip[], void *__closure); #endif /* !__pfindleakscallback_defined */ #ifdef CONFIG_DEBUG_HEAP /* Validate the memory of the given heap for * consistency, checking for invalid use-after-free. */ __LIBC void (__LIBCCALL heap_validate)(struct heap *__restrict __self); __LIBC void (__LIBCCALL heap_validate_all)(void); /* Begin/end tracing heap memory blocks: * - Only memory that is traced can be walked when searching for memory leaks. * - Memory traced as `heap_trace_leakless()' will not show up as memory leaks. * - Memory traced as `heap_trace_root()' is used as a GC root location * when searching for memory leaks. * - Call `heap_untrace()' with any (non-inclusive) address * of a traced data block to untrace that memory block. * - The following memory locations are implicitly used as GC tracing points: * - .data * - .bss * - The active portion of the stack of any thread running in the current VM * - Additionally, any pointer contained in a general purpose register * of any of the previously mentioned threads also counts as reachable. * -> The idea if this memory leak detector is not to 100% be able to discover * _all_ memory leaks there are, but rather find allocated memory blocks * that are no longer reachable: * >> void foo() { * >> void *p = malloc(42); * >> heap_dump_leaks(); // Nothing * >> } * >> void bar() { * >> foo(); * >> heap_dump_leaks(); // Now it's a leak! (and will be dumped before this call returns) * >> } * An extremely similar mechanism is also used to detect memory leaks * in the kernel, but I find it works just as well in user-space. * HINT: As far as tracing leaks goes: When `CONFIG_DEBUG_HEAP' is * enabled, a traceback will be stored in a hidden data block * alongside every heap allocation, which is then used by * the kernel's `addr2line' interface to gain human-readable * source information. * @param: NUM_BYTES: The number of bytes to trace (no-op when ZERO(0)) * @param: NUM_SKIPFRAMES: The number of frames to skip in tracebacks. * Passing ZERO(0) will have the first traceback * entry refer to the location where this function * was called from. * WARNING: Traceback frames from FORCELOCAL/LOCAL * functions may be interpreted as a single * frame due to how FORCELOCAL operates. * If you wish to skip frames, don't include * inline function calls, maybe even make use * of the `ATTR_NOINLINE' function attribute. */ __LIBC void (__LIBCCALL heap_trace)(void *__base, __size_t __num_bytes, unsigned int __num_skipframes); __LIBC void (__LIBCCALL heap_trace_root)(void *__base, __size_t __num_bytes); __LIBC void (__LIBCCALL heap_trace_leakless)(void *__base, __size_t __num_bytes); __LIBC __ATTR_NOTHROW void (__LIBCCALL heap_untrace)(void *__ptr); /* Search for memory leaks and dump them to `stderr' in a human-readable format. * When searching for leaked data blocks, KOS will dereference * tracked heap-pointers that are referenced in some way by any * active component of the associated application's VM: * - Pointers found in general purpose registers of * any thread running within the current VM. * - Pointers found in the used part of the user-space * stack of any running thread * - Pointers found in writable global variables (.data & .bss) * - Pointers found in memory regions traced using `heap_trace_root()' * The definition of a pointer is as follows: * - Points into the user-space data segment * - Dereferencable (memory is mapped where it points to) * - Is aligned by at least `sizeof(void *)' * The definition of a heap-pointer is as follows: * - Points into any heap_trace()-ed data block * Reachable data blocks are then searched recursively and * every blocks that could be reached is marked specially. * Every block that couldn't be reached is then considered a leak. * With that in mind, this function may be called at any point * during the execution of an application, as it is not bound by * requiring the caller to perform a proper shutdown alongside * cleanup in order to prevent any allocated pointer from being * dumped. */ __LIBC __size_t (__LIBCCALL heap_dump_leaks)(void); /* High-level implementation for enumerating memory leaks: * Instead of dumping everything to `stderr', invoke `FUNC' for every leak detected. * @return: * : The sum of all calls to `FUNC', or the first negative value returned by it. */ __LIBC __ssize_t (__LIBCCALL heap_find_leaks)(pfindleakscallback __func, void *__closure); #else #define heap_validate(self) (void)0 #define heap_validate_all() (void)0 #define heap_trace(base,num_bytes) (void)0 #define heap_trace_root(base,num_bytes) (void)0 #define heap_trace_leakless(base,num_bytes) (void)0 #define heap_untrace(ptr) (void)0 #define heap_dump_leaks() 0 #endif #undef __HEAP_MEMBER __SYSDECL_END #endif /* !__KERNEL__ */ #endif /* !_KOS_HEAP_H */
58.040791
389
0.690917
[ "vector" ]
e8dc1f54d2d18b77d48bf937bbc3095a523ef491
414
h
C
Background.h
Risist/OpenGlArkanoid
c933aa1d059f900dac3f9d36f6c6cabbb4bcadbe
[ "MIT" ]
null
null
null
Background.h
Risist/OpenGlArkanoid
c933aa1d059f900dac3f9d36f6c6cabbb4bcadbe
[ "MIT" ]
null
null
null
Background.h
Risist/OpenGlArkanoid
c933aa1d059f900dac3f9d36f6c6cabbb4bcadbe
[ "MIT" ]
null
null
null
#pragma once #include "Game.h" #include "Rendering.h" class Background : public Game::GameObject { public: virtual void Init() override; virtual void FixedStep() override; virtual void OnPause() override; private: void InitModel(Rendering::Vertex* v, unsigned int nV); Math::Transform transform; Rendering::RenderObject< Rendering::EDrawMode::EStaticDraw, Rendering::EPrimitiveType::ELines> renderer; };
21.789474
105
0.76087
[ "transform" ]
e8deb9f0a1bf1b81dfc044709a4b61319fd50511
1,365
h
C
library/sort/problems/smallestBinaryArrayWithInversions.h
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
40
2017-11-26T05:29:18.000Z
2020-11-13T00:29:26.000Z
library/sort/problems/smallestBinaryArrayWithInversions.h
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
101
2019-02-09T06:06:09.000Z
2021-12-25T16:55:37.000Z
library/sort/problems/smallestBinaryArrayWithInversions.h
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
6
2017-01-03T14:17:58.000Z
2021-01-22T10:37:04.000Z
#pragma once // https://www.hackerearth.com/problem/algorithm/binary-inversions-cf645357/ // lexicographically smallest binary array such that the number of inversions in the array is equal to 'inversionCount' struct SmallestBinaryArrayWithInversions { // - zeroN = the number of 0 // - oneN = the number of 1 // - inversionCount = the number of inversions // O(N) static vector<int> solve(int zeroN, int oneN, long long inversionCount) { vector<int> res; if (1ll * zeroN * oneN < inversionCount) return res; // none res.reserve(zeroN + oneN); /* 00...0011...11011...1100...00 |<--->||<--->| |<--->||<--->| A B C D |A| = zeroN - (inversionCount / oneN) - 1 |B| = inversionCount % oneN |C| = oneN - (inversionCount % oneN) |D| = (inversionCount / oneN) */ int k = int(inversionCount / oneN); for (int i = 0; i < zeroN - k - 1; i++) res.push_back(0); for (int i = 0; i < inversionCount % oneN; i++) res.push_back(1); res.push_back(0); for (int i = 0; i < oneN - (inversionCount % oneN); i++) res.push_back(1); for (int i = 0; i < k; i++) res.push_back(0); return res; } };
32.5
119
0.514286
[ "vector" ]
e8e1f6e0e274358a9c7235387f7407d36bc3b2ff
15,567
h
C
src/lbm/constants.h
SFCMM/LBM
99bf39e177cb0af94d4073ee9f9aef2e52ba7851
[ "BSD-3-Clause" ]
null
null
null
src/lbm/constants.h
SFCMM/LBM
99bf39e177cb0af94d4073ee9f9aef2e52ba7851
[ "BSD-3-Clause" ]
null
null
null
src/lbm/constants.h
SFCMM/LBM
99bf39e177cb0af94d4073ee9f9aef2e52ba7851
[ "BSD-3-Clause" ]
null
null
null
#ifndef LBM_CONSTANTS_H #define LBM_CONSTANTS_H enum class LBMethodType; template <LBMethodType LBTYPE> class LBMethod; // default environment properties static constexpr GDouble defaultT20C = 293.15; static constexpr GDouble defaultMachNumber = 0.01; // default numerical properties static constexpr GDouble defaultRelaxT = 0.9; // default solver setting static constexpr GInt defaultInfoOutInterval = 10; static constexpr GInt defaultSolutionInterval = 100; static constexpr GInt maxNumberDistributions = 30; // default speed of sound static constexpr GDouble lbm_cs = 1.0 / gcem::sqrt(3.0); // assuming dx/dt = 1 static constexpr GDouble lbm_cssq = 1.0 / 3.0; // assuming dx/dt = 1 enum class LBEquation { Navier_Stokes, Poisson, Navier_Stokes_Poisson }; static constexpr std::array<std::string_view, 3> LBEquationName = {"Navier-Stokes", // Implementation based on "A novel lattice Boltzmann model for the // Poisson equation", 2008, Applied Mathematical Modeling, Chai and // Shi [CHAI08] "Poisson", "Navier-Stokes-Poisson"}; static constexpr auto getLBEquationType(const std::string_view equationName) -> LBEquation { if(equationName == "navierstokes") { return LBEquation::Navier_Stokes; } if(equationName == "poisson") { return LBEquation::Poisson; } if(equationName == "navierstokespoisson") { return LBEquation::Navier_Stokes_Poisson; } TERMM(-1, "Invalid equation configuration!"); } enum class LBInitialConditions { MEI06 // as per https://doi.org/10.1016/j.compfluid.2005.08.008 }; enum class LBSolverType { BGK, // classic Bhatnagar–Gross–Krook BGK_SMAGORINSKY, // classic Bhatnagar–Gross–Krook with Smagorinsky SGS model BGKC, // classic Bhatnagar–Gross–Krook-Cercignani (improved accuracy for heat conduction) BGKC_SMAGORINSKY, // classic Bhatnagar–Gross–Krook-Cercignani (improved accuracy for heat conduction) with Smagorinsky SGS model BGKI, // classic incompressible Bhatnagar–Gross–Krook BGKI_SMAGORINSKY, // classic incompressible Bhatnagar–Gross–Krook with Smagorinsky SGS model BGK_THERMAL, // thermal Bhatnagar–Gross–Krook BGK_MRT, // BGK with multiple relaxation times (improved stability) BGK_CDLB, // cascaded Digital BGK (viscosity is independent of MRT params) BGK_CLB, // cascaded BGK (viscosity is independent of MRT params) BGK_CUMULANT, // cumulant BGK BGK_KBC, // entropy modelled BGK (stable for High Reynolds number on underresolved grids, viscosity is independent of MRT params) EULER, PE }; template <GInt NDIM> inline auto inDirection(const std::array<GDouble, NDIM>& normal, const std::array<GDouble, NDIM>& direction) -> GBool { return inDirection(VectorD<NDIM>(normal.data()), direction); } template <GInt NDIM> inline auto inDirection(const VectorD<NDIM>& normal, const std::array<GDouble, NDIM>& direction) -> GBool { return static_cast<GBool>(normal.dot(VectorD<NDIM>(direction.data())) >= GDoubleEps); } enum class BndryType { Wall_BounceBack, // BounceBack Wall Boundary condition 1st order accurate Wall_BounceBack_TangentialVelocity, // BounceBack Boundary condition 1st order accurate with tangential velocity Inlet_BounceBack_ConstPressure, // BounceBack Boundary condition 1st order accurate with tangential velocity Outlet_BounceBack_ConstPressure, // BounceBack Boundary condition 1st order accurate with tangential velocity Periodic, // Periodic boundary condition handled through boundary class Dirichlet_NEEM // Dirichlet boundary condition using Non-equilibrium extrapolation method }; enum class LBMethodType { D1Q3, D2Q5, D2Q9, D3Q19, D3Q27, D4Q40, INVALID }; template <GInt NDIM, GInt NDIST> static constexpr auto getLBMethodType() -> LBMethodType { switch(NDIM) { case 1: return LBMethodType::D1Q3; case 2: switch(NDIST) { case 5: return LBMethodType::D2Q5; case 9: return LBMethodType::D2Q9; default: std::terminate(); } case 3: switch(NDIST) { case 19: return LBMethodType::D3Q19; case 27: return LBMethodType::D3Q27; default: std::terminate(); } case 4: return LBMethodType::D4Q40; default: std::terminate(); } } static constexpr auto getLBMethodType(const std::string_view modelName) -> LBMethodType { if(modelName == "D1Q3") { return LBMethodType::D1Q3; } if(modelName == "D2Q5") { return LBMethodType::D2Q5; } if(modelName == "D2Q9") { return LBMethodType::D2Q9; } if(modelName == "D3Q19") { return LBMethodType::D3Q19; } if(modelName == "D3Q27") { return LBMethodType::D3Q27; } TERMM(-1, "Invalid model configuration!"); } static constexpr auto getLBMethodType(const GInt noDims, const GInt noDistributions) -> LBMethodType { switch(noDims) { case 1: return getLBMethodType<1, 3>(); case 2: switch(noDistributions) { case 5: return getLBMethodType<2, 5>(); case 9: return getLBMethodType<2, 9>(); default: std::terminate(); } case 3: switch(noDistributions) { case 19: return getLBMethodType<3, 19>(); case 27: return getLBMethodType<3, 27>(); default: std::terminate(); } case 4: return getLBMethodType<4, 20>(); default: std::terminate(); } } static constexpr auto noDists(LBMethodType type) -> GInt { switch(type) { case LBMethodType::D1Q3: return 3; case LBMethodType::D2Q5: return 5; case LBMethodType::D2Q9: return 9; case LBMethodType::D3Q19: return 19; case LBMethodType::D3Q27: return 27; case LBMethodType::INVALID: default: return 0; } } static constexpr auto dim(LBMethodType type) -> GInt { switch(type) { case LBMethodType::D1Q3: return 1; case LBMethodType::D2Q5: case LBMethodType::D2Q9: return 2; case LBMethodType::D3Q19: case LBMethodType::D3Q27: return 3; case LBMethodType::INVALID: default: return 0; } } template <LBMethodType LBTYPE> class LBMethod { public: static constexpr std::array<std::array<GDouble, dim(LBTYPE)>, noDists(LBTYPE)> m_dirs{}; static constexpr auto oppositeDist(const GInt /*dist*/) -> GInt { TERMM(-1, "Invalid call"); return 0; } static constexpr GInt m_dim = 0; static constexpr GInt m_noDists = 0; static constexpr std::array<GDouble, 1> m_weights = {0}; static constexpr GDouble m_poissonAlpha = NAN; static constexpr std::array<GDouble, 1> m_poissonWeights = {0}; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = false; static constexpr std::string_view m_name = "INVALID"; }; template <> class LBMethod<LBMethodType::D1Q3> { public: static constexpr std::array<std::array<GDouble, 1>, 3> m_dirs = {{{{-1}}, {{1}}, {{0}}}}; static constexpr std::array<GInt, 3> m_oppositeDist = {1, 0, 2}; /// look-up table for opposite direction static constexpr auto oppositeDist(const GInt dist) -> GInt { return m_oppositeDist[dist]; } static constexpr std::array<GDouble, 3> m_weights = {1.0 / 6.0, 1.0 / 6.0, 2.0 / 3.0}; // see equation 2.3 in CHAI08 static constexpr GDouble m_poissonAlpha = 1.0 / 3.0; // see CHAI08 static constexpr std::array<GDouble, 3> m_poissonWeights = {0.5, 0.5, 0}; static constexpr GInt m_dim = 1; static constexpr GInt m_noDists = 3; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = true; static constexpr std::string_view m_name = "D1Q3"; }; template <> class LBMethod<LBMethodType::D2Q5> { public: static constexpr std::array<std::array<GDouble, 2>, 5> m_dirs = {{{{-1, 0}}, {{1, 0}}, {{0, -1}}, {{0, 1}}, {{0, 0}}}}; static constexpr std::array<GInt, 5> m_oppositeDist = {1, 0, 3, 2, 4}; /// look-up table for opposite direction static constexpr auto oppositeDist(const GInt dist) -> GInt { return m_oppositeDist[dist]; } static constexpr std::array<GDouble, 5> m_weights = {1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0, 1.0 / 3.0}; // see equation 2.3 in CHAI08 static constexpr GDouble m_poissonAlpha = 2.0 / 3.0; // test gave 1/3 // see CHAI08 static constexpr std::array<GDouble, 5> m_poissonWeights = {0.25, 0.25, 0.25, 0.25, 0.0}; static constexpr GInt m_dim = 2; static constexpr GInt m_noDists = 5; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = true; static constexpr std::string_view m_name = "D2Q5"; }; template <> class LBMethod<LBMethodType::D2Q9> { public: static constexpr std::array<std::array<GDouble, 2>, 9> m_dirs = { {{{-1, 0}}, {{1, 0}}, {{0, -1}}, {{0, 1}}, {{1, 1}}, {{1, -1}}, {{-1, -1}}, {{-1, 1}}, {{0, 0}}}}; static constexpr std::array<GInt, 9> m_oppositeDist = {1, 0, 3, 2, 6, 7, 4, 5, 8}; /// look-up table for opposite direction static constexpr auto oppositeDist(const GInt dist) -> GInt { return m_oppositeDist[dist]; } static constexpr std::array<GDouble, 9> m_weights = {1.0 / 9.0, 1.0 / 9.0, 1.0 / 9.0, 1.0 / 9.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 4.0 / 9.0}; static constexpr GDouble m_poissonAlpha = 1.0 / 3.0; static constexpr std::array<GDouble, 9> m_poissonWeights = {1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 0.0}; static constexpr GInt m_dim = 2; static constexpr GInt m_noDists = 9; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = false; static constexpr std::string_view m_name = "D2Q9"; }; template <> class LBMethod<LBMethodType::D3Q19> { public: static constexpr std::array<std::array<GDouble, 3>, 19> m_dirs = { {{{-1, 0, 0}}, {{1, 0, 0}}, // main dir x {{0, -1, 0}}, {{0, 1, 0}}, // main dir y {{0, 0, -1}}, {{0, 0, 1}}, // main dir z {{-1, -1, 0}}, {{-1, 1, 0}}, {{1, -1, 0}}, {{1, 1, 0}}, // diagonals in 2D plane (Note: order is different to 2DQ9) {{-1, 0, -1}}, {{-1, 0, 1}}, {{1, 0, -1}}, {{1, 0, 1}}, // diagonals in x dir {{0, -1, -1}}, {{0, -1, 1}}, {{0, 1, -1}}, {{0, 1, 1}}, // diagonals in y dir {{0, 0, 0}}}}; // center static constexpr std::array<GInt, 19> m_oppositeDist = {1, 0, 3, 2, 5, 4, 9, 8, 7, 6, 13, 12, 11, 10, 17, 16, 15, 14, 18}; /// look-up table for opposite direction static constexpr auto oppositeDist(const GInt dist) -> GInt { return m_oppositeDist[dist]; } static constexpr std::array<GDouble, 19> m_weights = {1.0 / 18.0, 1.0 / 18.0, 1.0 / 18.0, 1.0 / 18.0, 1.0 / 18.0, 1.0 / 18.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 36.0, 1.0 / 3.0}; static constexpr GDouble m_poissonAlpha = NAN; // static constexpr std::array<GDouble, 19> m_poissonWeights = {1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, // 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 0.0}; static constexpr GInt m_dim = 3; static constexpr GInt m_noDists = 19; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = false; static constexpr std::string_view m_name = "D3Q19"; }; template <> class LBMethod<LBMethodType::D3Q27> { public: static constexpr std::array<std::array<GDouble, 3>, 27> m_dirs = { {{{-1, 0, 0}}, {{1, 0, 0}}, // main dir x {{0, -1, 0}}, {{0, 1, 0}}, // main dir y {{0, 0, -1}}, {{0, 0, 1}}, // main dir z {{-1, -1, 0}}, {{-1, 1, 0}}, {{1, -1, 0}}, {{1, 1, 0}}, // diagonals in 2D plane (Note: order is different to // 2DQ9) {{-1, 0, -1}}, {{-1, 0, 1}}, {{1, 0, -1}}, {{1, 0, 1}}, // diagonals in x dir {{0, -1, -1}}, {{0, -1, 1}}, {{0, 1, -1}}, {{0, 1, 1}}, // diagonals in y dir {{-1.0, -1.0, -1.0}}, {{-1.0, -1.0, 1.0}}, {{-1.0, 1.0, -1.0}}, {{-1.0, 1.0, 1.0}}, {{1.0, -1.0, -1.0}}, {{1.0, -1.0, 1.0}}, {{1.0, 1.0, -1.0}}, {{1.0, 1.0, 1.0}}, // tridiagonal directions {{0, 0, 0}}}}; // center static constexpr std::array<GInt, 27> m_oppositeDist = {1, 0, 3, 2, 5, 4, 9, 8, 7, 6, 13, 12, 11, 10, 17, 16, 15, 14, 25, 24, 23, 22, 21, 20, 19, 18, 26}; /// look-up table for opposite direction static constexpr auto oppositeDist(const GInt dist) -> GInt { return m_oppositeDist[dist]; } static constexpr std::array<GDouble, 27> m_weights = { 2.0 / 27.0, 2.0 / 27.0, 2.0 / 27.0, 2.0 / 27.0, 2.0 / 27.0, 2.0 / 27.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 54.0, 1.0 / 216.0, 1.0 / 216.0, 1.0 / 216.0, 1.0 / 216.0, 1.0 / 216.0, 1.0 / 216.0, 8.0 / 27.0}; static constexpr GDouble m_poissonAlpha = NAN; // static constexpr std::array<GDouble, 19> m_poissonWeights = {1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, // 1.0 / 8.0, 1.0 / 8.0, 1.0 / 8.0, 0.0}; static constexpr GInt m_dim = 3; static constexpr GInt m_noDists = 27; static constexpr GBool m_isThermal = false; static constexpr GBool m_canPoisson = false; static constexpr std::string_view m_name = "D3Q27"; }; template <LBMethodType LBTYPE> static constexpr auto noVars(const LBEquation equation) -> GInt { switch(equation) { case LBEquation::Navier_Stokes: // Velocities + Density + Temperature return LBMethod<LBTYPE>::m_dim + 1 + static_cast<GInt>(LBMethod<LBTYPE>::m_isThermal); case LBEquation::Poisson: // Potential return 1; case LBEquation::Navier_Stokes_Poisson: // Velocities + Density + Temperature + Potential return LBMethod<LBTYPE>::m_dim + 1 + static_cast<GInt>(LBMethod<LBTYPE>::m_isThermal) + 1; default: TERMM(-1, "Invalid equation type!"); } } #endif // LBM_CONSTANTS_H
39.410127
140
0.566133
[ "model" ]
790d2567f6175d703f7d316ec5c2190c3088e943
1,702
h
C
twitter/include/Tweet.h
miglesias91/medios-digitales
3c237d939bb694502ce6d4f89a3fa44a66acd1ac
[ "MIT" ]
null
null
null
twitter/include/Tweet.h
miglesias91/medios-digitales
3c237d939bb694502ce6d4f89a3fa44a66acd1ac
[ "MIT" ]
null
null
null
twitter/include/Tweet.h
miglesias91/medios-digitales
3c237d939bb694502ce6d4f89a3fa44a66acd1ac
[ "MIT" ]
null
null
null
#pragma once // herramientas #include <utiles/include/Fecha.h> namespace medios { namespace twitter { class Tweet { public: Tweet(); Tweet(const uintmax_t id_tweet, const uintmax_t & id_usuario, const herramientas::utiles::Fecha & fecha_creacion, const std::string & texto_tweet); virtual ~Tweet(); // GETTERS uintmax_t getIdTweet(); herramientas::utiles::Fecha getFechaCreacion(); std::string getTextoTweet(); uintmax_t getIdUsuario(); std::vector<std::string> getHashtags(); Tweet * getTweetRetweeteado(); // SETTERS void setIdTweet(const uintmax_t & id); void setFechaCreacion(const herramientas::utiles::Fecha & fecha_creacion); void setTextoTweet(const std::string & texto_tweet); void setIdUsuario(const uintmax_t & id_usuario); void setHashtags(const std::vector<std::string> & hashtags); void setTweetRetweeteado(Tweet * tweet_retweeteado); // METODOS void agregarHashtags(const std::string & hashtag); // CONSULTAS bool contieneHashtag(const std::string & hashtag); bool esRetweet(); void esRetweet(bool es_retweet); // OPERADORES private: // METODOS PRIVADOS // ATRIBUTOS uintmax_t id_tweet, id_usuario; herramientas::utiles::Fecha fecha_creacion; // esta en formato UTF8 xq obtiene el valor del Json (rapidjson) que contiene. // (ir al test 'GettersYSettersCodificaciones' de 'herramientas_desarrollo' para ver como funciona. std::string texto_tweet; std::vector<std::string> hashtags; bool es_retweet; Tweet * tweet_retweeteado; }; }; };
21.544304
152
0.662162
[ "vector" ]
791523ad5af0d207aa2885772b5612b5586ac64f
1,142
h
C
KlurifaxRay/OpenKlurifax/Graphics/Vertex.h
exnotime/KlurifaxRay
1fd52ef9c7fdf067942df7559b93722632ea8ed2
[ "MIT" ]
null
null
null
KlurifaxRay/OpenKlurifax/Graphics/Vertex.h
exnotime/KlurifaxRay
1fd52ef9c7fdf067942df7559b93722632ea8ed2
[ "MIT" ]
null
null
null
KlurifaxRay/OpenKlurifax/Graphics/Vertex.h
exnotime/KlurifaxRay
1fd52ef9c7fdf067942df7559b93722632ea8ed2
[ "MIT" ]
null
null
null
#pragma once #include <glm\glm.hpp> using namespace glm; /*----------------------------------------- /This document provides a wide array of vertex types /If a new vertex type is added it must be added to the VertexBuffer class ------------------------------------------*/ //model with a single texture and lighting effects struct VertexPosNormalTex { VertexPosNormalTex(){ } VertexPosNormalTex(vec3 p, vec3 n, vec2 uv){ Position = p; Normal = n; TexCoord = uv; } vec3 Position; vec3 Normal; vec2 TexCoord; }; struct VertexPosNormalTexTangent { VertexPosNormalTexTangent(){ } VertexPosNormalTexTangent(vec3 p, vec3 n, vec2 uv,vec3 t){ Position = p; Normal = n; TexCoord = uv; Tangent = t; } vec3 Position; vec3 Normal; vec2 TexCoord; vec3 Tangent; }; //may be used for single color model or geometry shader based particle system struct VertexPos { vec3 Position; }; //may be used for screenaligned quad and geometry without advanced lighting model struct VertexPosTex { vec3 Position; vec2 TexCoord; }; //used for single colored models with lighting struct VertexPosNormal { vec3 Position; vec3 Normal; };
20.763636
81
0.685639
[ "geometry", "model" ]
792002397814f967e61420a59ca6671f503ea631
5,063
h
C
limbo/parsers/def/bison/DefDriver.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
74
2017-10-19T03:10:52.000Z
2022-03-28T17:51:54.000Z
limbo/parsers/def/bison/DefDriver.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
3
2017-12-06T01:49:21.000Z
2020-06-22T00:08:12.000Z
limbo/parsers/def/bison/DefDriver.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
26
2017-11-07T10:32:54.000Z
2021-10-02T02:22:37.000Z
/** * @file DefDriver.h * @brief Driver for Def parser * @author Yibo Lin * @date Oct 2014 */ #ifndef DEFPARSER_DRIVER_H #define DEFPARSER_DRIVER_H #include "DefDataBase.h" /** The example namespace is used to encapsulate the three parser classes * example::Parser, example::Scanner and example::Driver */ /** @brief namespace for DefParser */ namespace DefParser { using std::cout; using std::endl; using std::cerr; using std::string; using std::vector; using std::pair; using std::make_pair; using std::ostringstream; /** * @class DefParser::Driver * The Driver class brings together all components. It creates an instance of * the Parser and Scanner classes and connects them. Then the input stream is * fed into the scanner object and the parser gets it's token * sequence. Furthermore the driver object is available in the grammar rules as * a parameter. Therefore the driver class contains a reference to the * structure into which the parsed data is saved. */ class Driver { public: /// construct a new parser driver context /// @param db reference to database Driver(DefDataBase& db); /// enable debug output in the flex scanner bool trace_scanning; /// enable debug output in the bison parser bool trace_parsing; /// stream name (file or input stream) used for error messages. string streamname; /** Invoke the scanner and parser for a stream. * @param in input stream * @param sname stream name for error messages * @return true if successfully parsed */ bool parse_stream(std::istream& in, const string& sname = "stream input"); /** Invoke the scanner and parser on an input string. * @param input input string * @param sname stream name for error messages * @return true if successfully parsed */ bool parse_string(const string& input, const string& sname = "string stream"); /** Invoke the scanner and parser on a file. Use parse_stream with a * std::ifstream if detection of file reading errors is required. * @param filename input file name * @return true if successfully parsed */ bool parse_file(const string& filename); // To demonstrate pure handling of parse errors, instead of // simply dumping them on the standard error output, we will pass // them to the driver using the following two member functions. /** Error handling with associated line number. This can be modified to * output the error e.g. to a dialog box. */ void error(const class location& l, const string& m); /** General error handling. This can be modified to output the error * e.g. to a dialog box. */ void error(const string& m); /** Pointer to the current lexer instance, this is used to connect the * parser to the scanner. It is used in the yylex macro. */ class Scanner* lexer; /** Reference to the database filled during parsing of the * expressions. */ DefDataBase& m_db; /// @cond void dividerchar_cbk(string const&) ; void busbitchars_cbk(string const&) ; void version_cbk(double) ; void design_cbk(string const&) ; void unit_cbk(int) ; void diearea_cbk(int, int, int, int) ; void row_cbk(string&, string&, int, int, string&, int, int, int, int) ; void track_cbk(string const&, int, int, int, vector<string> const&) ; void gcellgrid_cbk(string const&, int, int, int) ; // component cbk void component_cbk_size(int) ; void component_cbk_position(string&, int, int, string&) ; void component_cbk_position(string&) ; void component_cbk_source(string const&) ; void component_cbk(string&, string&) ; // pin cbk // void pin_cbk(string const&, string const&, string const&, string const&, // int, int, string const&, string const&, int, int, int, int) ; void pin_cbk_size(int) ; void pin_cbk(string&); // remember to reset in this function void pin_cbk_net(string&); void pin_cbk_direction(string&); void pin_cbk_position(string&, int, int, string&); void pin_cbk_bbox(string&, int, int, int, int); void pin_cbk_use(string&); // net cbk void net_cbk_name(string&) ; void net_cbk_pin(string&, string&) ; void net_cbk_size(int) ; // blockage cbk void blockage_cbk_size(int); void blockage_cbk_placement(int, int, int, int); void blockage_cbk_routing(int, int, int, int); /// @endcond protected: /// @brief Use as a stack for node and pin pairs in a net, /// because net_cbk_pin will be called before net_cbk_name vector<pair<string, string> > m_vNetPin; /// @brief temporary row Row m_row; /// @brief temporary component Component m_comp; /// @brief temporary pin Pin m_pin; /// @brief temporary net Net m_net; }; /// @brief API for DefParser. /// Read DEF file and initialize database by calling user-defined callback functions. /// @param db database which is derived from @ref DefParser::DefDataBase /// @param defFile DEF file bool read(DefDataBase& db, const string& defFile); } // namespace example #endif // EXAMPLE_DRIVER_H
32.664516
86
0.69761
[ "object", "vector" ]
7930289222639977f0260bad1a470a4429e1e634
1,327
h
C
src/RisingNinja.h
egraether/bounce
06bceaacdc20ab7699fc6bb8d075757baddd0810
[ "MIT" ]
2
2017-09-01T09:13:00.000Z
2019-09-20T03:35:58.000Z
src/RisingNinja.h
egraether/bounce
06bceaacdc20ab7699fc6bb8d075757baddd0810
[ "MIT" ]
1
2021-04-10T10:17:24.000Z
2021-04-10T10:17:24.000Z
src/RisingNinja.h
egraether/bounce
06bceaacdc20ab7699fc6bb8d075757baddd0810
[ "MIT" ]
2
2021-02-25T16:52:52.000Z
2022-01-20T13:50:39.000Z
/* * MIT License * Copyright (c) 2010 Eberhard Gräther (http://egraether.multimediatechnology.at) * * Salzburg University of Applied Sciences */ // not finished, do not try to start #ifndef _RISING_NINJA_ #define _RISING_NINJA_ #include "Game.h" #include "Texture.h" #include "SpriteAnimation.h" #include "Infobox.h" #include "Vector.h" class RisingNinja : public Game { private: Vector ninjaHitPoint; Vector ninjaPosition, ninjaMotion; Vector hookPosition, hookMotion; bool hook; bool line; bool started; int width; int ninjaSize; int hookSize; float gravitationTime; struct Platform { int width; Vector position; Platform(int _width, int x, int y) : width(_width), position(x,y) {} bool draw() { ofSetColor(0xaaaaaa); ofRect(position.x - width / 2, position.y, width, 30); if (position.y > ofGetHeight()) return false; return true; } }; vector<Platform> platforms; int platformDistance; //bool checkOnPlatform(); public: RisingNinja(const char* titel, Infobox* infobox, const char* scoresFileName); virtual void reset(); virtual bool draw(bool hit, Vector &hitPoint); }; #endif
21.403226
82
0.614921
[ "vector" ]
7936ad030e69f81e5ec7532744b9d4a9c793eb76
3,086
h
C
SpineRuntimeEditorPlugin.h
2439905184/spine-runtime-for-godot
316057ddcb7989fab9dc35545a9646c0c0d8c5f3
[ "MIT" ]
74
2020-06-07T12:21:22.000Z
2022-03-22T16:46:16.000Z
SpineRuntimeEditorPlugin.h
2439905184/spine-runtime-for-godot
316057ddcb7989fab9dc35545a9646c0c0d8c5f3
[ "MIT" ]
41
2020-06-29T11:27:52.000Z
2022-03-14T23:48:19.000Z
SpineRuntimeEditorPlugin.h
2439905184/spine-runtime-for-godot
316057ddcb7989fab9dc35545a9646c0c0d8c5f3
[ "MIT" ]
23
2020-06-24T12:35:56.000Z
2022-03-23T02:15:51.000Z
// // Created by Raiix on 2021/7/13. // #ifndef GODOT_SPINERUNTIMEEDITORPLUGIN_H #define GODOT_SPINERUNTIMEEDITORPLUGIN_H #ifdef TOOLS_ENABLED #include "editor/editor_node.h" class SpineAtlasResourceImportPlugin : public EditorImportPlugin { GDCLASS(SpineAtlasResourceImportPlugin, EditorImportPlugin); public: String get_importer_name() const override {return "raiix.spine_runtime.atlas";} String get_visible_name() const override {return "Spine Runtime Atlas";} void get_recognized_extensions(List<String> *p_extensions) const override {p_extensions->push_back("atlas");} String get_preset_name(int p_idx) const override {if (p_idx == 0) return "Default"; else return "Unknown";} int get_preset_count() const override {return 1;} String get_save_extension() const override {return "spatlas";} String get_resource_type() const override {return "SpineAtlasResource";} void get_import_options(List<ImportOption> *r_options, int p_preset) const override; bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override {return true;} Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) override; }; class SpineJsonResourceImportPlugin : public EditorImportPlugin { GDCLASS(SpineJsonResourceImportPlugin, EditorImportPlugin); public: String get_importer_name() const override {return "raiix.spine_runtime.json";} String get_visible_name() const override {return "Spine Runtime Json";} void get_recognized_extensions(List<String> *p_extensions) const override {p_extensions->push_back("json");} String get_preset_name(int p_idx) const override {if (p_idx == 0) return "Default"; else return "Unknown";} int get_preset_count() const override {return 1;} String get_save_extension() const override {return "spjson";} String get_resource_type() const override {return "SpineSkeletonJsonDataResource";} void get_import_options(List<ImportOption> *r_options, int p_preset) const override {} bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override {return true;} Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) override; }; class SpineSpriteAnimateDialog; class SpineRuntimeEditorPlugin : public EditorPlugin { GDCLASS(SpineRuntimeEditorPlugin, EditorPlugin); protected: SpineSpriteAnimateDialog *animate_dialog; public: SpineRuntimeEditorPlugin(EditorNode *p_node); ~SpineRuntimeEditorPlugin(); String get_name() const override { return "SpineRuntimeEditorPlugin"; } bool has_main_screen() const { return false; } bool handles(Object *p_object) const override; void make_visible(bool p_visible) override; void _on_animate_button_pressed(); }; #endif #endif //GODOT_SPINERUNTIMEEDITORPLUGIN_H
47.476923
208
0.784835
[ "object" ]
7953ec106763b915cdcb33678ce979de21d9c265
10,643
c
C
code/elect_energy_avx512.c
acenet-arc/ACENET_Summer_School_OpenMP_ACC
5ac772d5eb8b68200735bb3de42c0709412cc347
[ "CC-BY-4.0" ]
1
2021-06-07T15:58:51.000Z
2021-06-07T15:58:51.000Z
code/elect_energy_avx512.c
acenet-arc/ACENET_Summer_School_OpenMP_ACC
5ac772d5eb8b68200735bb3de42c0709412cc347
[ "CC-BY-4.0" ]
null
null
null
code/elect_energy_avx512.c
acenet-arc/ACENET_Summer_School_OpenMP_ACC
5ac772d5eb8b68200735bb3de42c0709412cc347
[ "CC-BY-4.0" ]
null
null
null
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <immintrin.h> /* gcc -o evec1 elect_energy_vec_01.c -O4 -lm -fopenmp -march=native */ int main(int argc, char **argv) { struct timespec ts_start, ts_end; float time_total; int i, j, m, ix, iy, iz; int n = 60; /* number of atoms per side */ int n_charges = n * n * n; /* total number of charges */ float a = 0.5; /* Lattice constant */ long v_element_count = 0; long v_count = 0; float tmp_vec[4][16] __attribute__((aligned(64))); double Energy = 0.0; __m512 *X, *Y, *Z, *Q; __m512 tmpQ[16], tmpX[16], tmpY[16], tmpZ[16]; __m512 r_vec, result, vcps, diff[16], mask[16]; X = aligned_alloc(64, (n_charges) * sizeof(float)); Y = aligned_alloc(64, (n_charges) * sizeof(float)); Z = aligned_alloc(64, (n_charges) * sizeof(float)); Q = aligned_alloc(64, (n_charges) * sizeof(float)); srand(111); /* Seed random numbers generator */ /* Initialize X,Y,Z,Q and pack them in 512-bit long vectors */ for (ix = 0; ix < n; ix++) for (iy = 0; iy < n; iy++) for (iz = 0; iz < n; iz++) { tmp_vec[0][v_element_count] = ix * a; /* x coordinates */ tmp_vec[1][v_element_count] = iy * a; /* y coordinates */ tmp_vec[2][v_element_count] = iz * a; /* z coordinates */ tmp_vec[3][v_element_count] = 10*((double)random() / (double)RAND_MAX - 0.5); /* charges */ v_element_count++; /* when 16 elements are computed pack them into _m512 vectors */ if (v_element_count == 16) { X[v_count] = _mm512_set_ps( tmp_vec[0][15], tmp_vec[0][14], tmp_vec[0][13], tmp_vec[0][12], tmp_vec[0][11], tmp_vec[0][10], tmp_vec[0][9], tmp_vec[0][8], tmp_vec[0][7], tmp_vec[0][6], tmp_vec[0][5], tmp_vec[0][4], tmp_vec[0][3], tmp_vec[0][2], tmp_vec[0][1], tmp_vec[0][0]); Y[v_count] = _mm512_set_ps( tmp_vec[1][15], tmp_vec[1][14], tmp_vec[1][13], tmp_vec[1][12], tmp_vec[1][11], tmp_vec[1][10], tmp_vec[1][9], tmp_vec[1][8], tmp_vec[1][7], tmp_vec[1][6], tmp_vec[1][5], tmp_vec[1][4], tmp_vec[1][3], tmp_vec[1][2], tmp_vec[1][1], tmp_vec[1][0]); Z[v_count] = _mm512_set_ps( tmp_vec[2][15], tmp_vec[2][14], tmp_vec[2][13], tmp_vec[2][12], tmp_vec[2][11], tmp_vec[2][10], tmp_vec[2][9], tmp_vec[2][8], tmp_vec[2][7], tmp_vec[2][6], tmp_vec[2][5], tmp_vec[2][4], tmp_vec[2][3], tmp_vec[2][2], tmp_vec[2][1], tmp_vec[2][0]); Q[v_count] = _mm512_set_ps( tmp_vec[3][15], tmp_vec[3][14], tmp_vec[3][13], tmp_vec[3][12], tmp_vec[3][11], tmp_vec[3][10], tmp_vec[3][9], tmp_vec[3][8], tmp_vec[3][7], tmp_vec[3][6], tmp_vec[3][5], tmp_vec[3][4], tmp_vec[3][3], tmp_vec[3][2], tmp_vec[3][1], tmp_vec[3][0]); v_count++; v_element_count = 0; memset(tmp_vec, 0, 64 * sizeof(float)); } } /* Treat the remainder. The last vector is padded with zero charges and x coordinates outside of the range that are guaranteed not to result in any zero pairwise distances */ if (v_element_count != 0) { for (float v = n * a * 2; v_element_count < 16; v_element_count++, v += 1) { tmp_vec[0][v_element_count] = v; tmp_vec[1][v_element_count] = 0.0; tmp_vec[2][v_element_count] = 0.0; tmp_vec[3][v_element_count] = 0.0; } X[v_count] = _mm512_set_ps( tmp_vec[0][15], tmp_vec[0][14], tmp_vec[0][13], tmp_vec[0][12], tmp_vec[0][11], tmp_vec[0][10], tmp_vec[0][9], tmp_vec[0][8], tmp_vec[0][7], tmp_vec[0][6], tmp_vec[0][5], tmp_vec[0][4], tmp_vec[0][3], tmp_vec[0][2], tmp_vec[0][1], tmp_vec[0][0]); Y[v_count] = _mm512_set_ps( tmp_vec[1][15], tmp_vec[1][14], tmp_vec[1][13], tmp_vec[1][12], tmp_vec[1][11], tmp_vec[1][10], tmp_vec[1][9], tmp_vec[1][8], tmp_vec[1][7], tmp_vec[1][6], tmp_vec[1][5], tmp_vec[1][4], tmp_vec[1][3], tmp_vec[1][2], tmp_vec[1][1], tmp_vec[1][0]); Z[v_count] = _mm512_set_ps( tmp_vec[2][15], tmp_vec[2][14], tmp_vec[2][13], tmp_vec[2][12], tmp_vec[2][11], tmp_vec[2][10], tmp_vec[2][9], tmp_vec[2][8], tmp_vec[2][7], tmp_vec[2][6], tmp_vec[2][5], tmp_vec[2][4], tmp_vec[2][3], tmp_vec[2][2], tmp_vec[2][1], tmp_vec[2][0]); Q[v_count] = _mm512_set_ps( tmp_vec[3][15], tmp_vec[3][14], tmp_vec[3][13], tmp_vec[3][12], tmp_vec[3][11], tmp_vec[3][10], tmp_vec[3][9], tmp_vec[3][8], tmp_vec[3][7], tmp_vec[3][6], tmp_vec[3][5], tmp_vec[3][4], tmp_vec[3][3], tmp_vec[3][2], tmp_vec[3][1], tmp_vec[3][0]); v_count++; } /* mask upper triangular matrix elements */ mask[0] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0); mask[1] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0); mask[2] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0); mask[3] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0); mask[4] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0); mask[5] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0); mask[6] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0); mask[7] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0); mask[8] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[9] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[10] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[11] = (__m512)_mm512_set_epi32(-1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[12] = (__m512)_mm512_set_epi32(-1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[13] = (__m512)_mm512_set_epi32(-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[14] = (__m512)_mm512_set_epi32(-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); mask[15] = (__m512)_mm512_set_epi32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); clock_gettime(CLOCK_MONOTONIC, &ts_start); #pragma omp parallel for private(tmpQ, tmpX, tmpY, tmpZ, i, j, m, diff, r_vec, vcps, result) reduction(+:Energy) schedule(dynamic) for (i = 0; i < v_count; i++) { /* For each i prepare 16 - element X, Y, Z, and Q vectors */ tmpQ[0] = _mm512_set1_ps(Q[i][0]); tmpQ[1] = _mm512_set1_ps(Q[i][1]); tmpQ[2] = _mm512_set1_ps(Q[i][2]); tmpQ[3] = _mm512_set1_ps(Q[i][3]); tmpQ[4] = _mm512_set1_ps(Q[i][4]); tmpQ[5] = _mm512_set1_ps(Q[i][5]); tmpQ[6] = _mm512_set1_ps(Q[i][6]); tmpQ[7] = _mm512_set1_ps(Q[i][7]); tmpQ[8] = _mm512_set1_ps(Q[i][8]); tmpQ[9] = _mm512_set1_ps(Q[i][9]); tmpQ[10] = _mm512_set1_ps(Q[i][10]); tmpQ[11] = _mm512_set1_ps(Q[i][11]); tmpQ[12] = _mm512_set1_ps(Q[i][12]); tmpQ[13] = _mm512_set1_ps(Q[i][13]); tmpQ[14] = _mm512_set1_ps(Q[i][14]); tmpQ[15] = _mm512_set1_ps(Q[i][15]); tmpX[0] = _mm512_set1_ps(X[i][0]); tmpX[1] = _mm512_set1_ps(X[i][1]); tmpX[2] = _mm512_set1_ps(X[i][2]); tmpX[3] = _mm512_set1_ps(X[i][3]); tmpX[4] = _mm512_set1_ps(X[i][4]); tmpX[5] = _mm512_set1_ps(X[i][5]); tmpX[6] = _mm512_set1_ps(X[i][6]); tmpX[7] = _mm512_set1_ps(X[i][7]); tmpX[8] = _mm512_set1_ps(X[i][8]); tmpX[9] = _mm512_set1_ps(X[i][9]); tmpX[10] = _mm512_set1_ps(X[i][10]); tmpX[11] = _mm512_set1_ps(X[i][11]); tmpX[12] = _mm512_set1_ps(X[i][12]); tmpX[13] = _mm512_set1_ps(X[i][13]); tmpX[14] = _mm512_set1_ps(X[i][14]); tmpX[15] = _mm512_set1_ps(X[i][15]); tmpY[0] = _mm512_set1_ps(Y[i][0]); tmpY[1] = _mm512_set1_ps(Y[i][1]); tmpY[2] = _mm512_set1_ps(Y[i][2]); tmpY[3] = _mm512_set1_ps(Y[i][3]); tmpY[4] = _mm512_set1_ps(Y[i][4]); tmpY[5] = _mm512_set1_ps(Y[i][5]); tmpY[6] = _mm512_set1_ps(Y[i][6]); tmpY[7] = _mm512_set1_ps(Y[i][7]); tmpY[8] = _mm512_set1_ps(Y[i][8]); tmpY[9] = _mm512_set1_ps(Y[i][9]); tmpY[10] = _mm512_set1_ps(Y[i][10]); tmpY[11] = _mm512_set1_ps(Y[i][11]); tmpY[12] = _mm512_set1_ps(Y[i][12]); tmpY[13] = _mm512_set1_ps(Y[i][13]); tmpY[14] = _mm512_set1_ps(Y[i][14]); tmpY[15] = _mm512_set1_ps(Y[i][15]); tmpZ[0] = _mm512_set1_ps(Z[i][0]); tmpZ[1] = _mm512_set1_ps(Z[i][1]); tmpZ[2] = _mm512_set1_ps(Z[i][2]); tmpZ[3] = _mm512_set1_ps(Z[i][3]); tmpZ[4] = _mm512_set1_ps(Z[i][4]); tmpZ[5] = _mm512_set1_ps(Z[i][5]); tmpZ[6] = _mm512_set1_ps(Z[i][6]); tmpZ[7] = _mm512_set1_ps(Z[i][7]); tmpZ[8] = _mm512_set1_ps(Z[i][8]); tmpZ[9] = _mm512_set1_ps(Z[i][9]); tmpZ[10] = _mm512_set1_ps(Z[i][10]); tmpZ[11] = _mm512_set1_ps(Z[i][11]); tmpZ[12] = _mm512_set1_ps(Z[i][12]); tmpZ[13] = _mm512_set1_ps(Z[i][13]); tmpZ[14] = _mm512_set1_ps(Z[i][14]); tmpZ[15] = _mm512_set1_ps(Z[i][15]); /* Accumulate interactions within 16x16 blocks [i,i] in the vector 'vcps' */ vcps = _mm512_setzero_ps(); for (m = 0; m < 16; m++) { /* compute dx, dy, dz */ diff[0] = _mm512_sub_ps(tmpX[m], X[i]); diff[1] = _mm512_sub_ps(tmpY[m], Y[i]); diff[2] = _mm512_sub_ps(tmpZ[m], Z[i]); /* compute dx*dx + dy*dy + dz*dz */ r_vec = _mm512_fmadd_ps(diff[0], diff[0], _mm512_setzero_ps()); r_vec = _mm512_fmadd_ps(diff[1], diff[1], r_vec); r_vec = _mm512_fmadd_ps(diff[2], diff[2], r_vec); /* compute reciprocal distance [m][i]*/ r_vec = _mm512_rsqrt14_ps(r_vec); /* compute Q[m]*Q[i]/distance[m][i] */ result = _mm512_mul_ps(tmpQ[m], Q[i]); /* Q[m]*Q[i] */ result = _mm512_mul_ps(result, r_vec); result = _mm512_and_ps(mask[m], result); /* Apply mask */ vcps = _mm512_add_ps(vcps, result); } /* sum all elements of 'vcps' vector and transfer the result into double precision accumulator Energy */ Energy += _mm512_reduce_add_ps(vcps); /* Accumulate interactions between different 16x16 blocks [i,j] in the vector 'vcps' */ for (j = i + 1; j < v_count; j++) { vcps = _mm512_setzero_ps(); for (m = 0; m < 16; m++) { diff[0] = _mm512_sub_ps(tmpX[m], X[j]); diff[1] = _mm512_sub_ps(tmpY[m], Y[j]); diff[2] = _mm512_sub_ps(tmpZ[m], Z[j]); r_vec = _mm512_fmadd_ps(diff[0], diff[0], _mm512_setzero_ps()); r_vec = _mm512_fmadd_ps(diff[1], diff[1], r_vec); r_vec = _mm512_fmadd_ps(diff[2], diff[2], r_vec); r_vec = _mm512_rsqrt14_ps(r_vec); result = _mm512_mul_ps(tmpQ[m], Q[j]); vcps = _mm512_fmadd_ps(result, r_vec, vcps); } Energy += _mm512_reduce_add_ps(vcps); } } clock_gettime(CLOCK_MONOTONIC, &ts_end); time_total = (ts_end.tv_sec - ts_start.tv_sec) * 1e9 + (ts_end.tv_nsec - ts_start.tv_nsec); printf("\nTotal time is %f ms, Energy is %.3f\n", time_total / 1e6, Energy*1e-4); printf("%i\n", v_count); }
42.572
130
0.588932
[ "vector" ]
79619e7747d0fd1e5b01d686b55d7804b9585d29
4,216
h
C
sumo/src/activitygen/activities/AGActivity.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/activitygen/activities/AGActivity.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/activitygen/activities/AGActivity.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
2
2017-12-14T16:41:59.000Z
2020-10-16T17:51:27.000Z
/****************************************************************************/ /// @file AGActivity.h /// @author Piotr Woznica /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 /// @version $Id$ /// // Parent object for all activities. Derived classes generate trips for each // household. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ // Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ // // This file is part of SUMO. // SUMO 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. // /****************************************************************************/ #ifndef AGACTIVITY_H #define AGACTIVITY_H // =========================================================================== // included modules // =========================================================================== #ifdef _MSC_VER #include <windows_config.h> #else #include <config.h> #endif #include "AGTrip.h" #include "../city/AGHousehold.h" #include "../city/AGDataAndStatistics.h" // =========================================================================== // class definitions // =========================================================================== class AGActivity { public: AGActivity(AGHousehold* hh, AGDataAndStatistics* das, std::list<AGTrip>* prevTrips, int prio) : myHousehold(hh), myStatData(das), myPreviousTrips(prevTrips), activityPriority(prio), genDone(false), timePerKm(das->speedTimePerKm), carPreference(das->carPreference) {}; /** * returns whether the generation could have been well done */ bool isGenerated(); /** * main function called for trip generation * this function is overwritten in every child-class (every activity) */ virtual bool generateTrips() = 0; /** * determine the possible transportation means, what would be chosen: * 1 = foot * 2 = bus * 4 = car * any combination is possible by simply addition of these values * (ex. 7 means: 4+2+1 <=> foot, bus and car possible / 5 means: 4+1 <=> only foot and car are possible) */ int possibleTranspMean(AGPosition destination); /** * determine the possible means for a trip from one position to a destination. * whether CAR is necessary or not, BUS available or not... * 1 = by foot possible. * 2 = by bus possible. * 0 = by bus or foot NOT possible => only by car. * @NOTE: 4 is useless because it is always possible * @NOTE: 3 = 2 + 1 = means bus and foot possible. */ int availableTranspMeans(AGPosition from, AGPosition to); /** * evaluation of the needed time for going from one point to an other using the car */ int timeToDrive(AGPosition from, AGPosition to); /** * estimates the departure/arrival time given the departure location * the arrival location and the wished arrival/departure time */ int depHour(AGPosition from, AGPosition to, int arrival); int arrHour(AGPosition from, AGPosition to, int departure); /** * evaluates a random time between the given two time instants */ int randomTimeBetween(int begin, int end); std::list<AGTrip>& getPartialActivityTrips(); protected: AGHousehold* myHousehold; AGDataAndStatistics* myStatData; std::list<AGTrip>* myPreviousTrips; std::list<AGTrip> myPartialActivityTrips; int activityPriority; bool genDone; double timePerKm; /** * rate of taking the car instead of the bus because of personal preference */ double carPreference; }; #endif /****************************************************************************/
32.682171
108
0.558824
[ "object" ]
7968a1c7c6ae6685294877e6fa3374a216d5b346
532
h
C
oneEngine/oneGame/source/after/entities/menu/splash/CStudioSplash.h
jonting/1Engine
f22ba31f08fa96fe6405ebecec4f374138283803
[ "BSD-3-Clause" ]
8
2017-12-08T02:59:31.000Z
2022-02-02T04:30:03.000Z
oneEngine/oneGame/source/after/entities/menu/splash/CStudioSplash.h
jonting/1Engine
f22ba31f08fa96fe6405ebecec4f374138283803
[ "BSD-3-Clause" ]
2
2021-04-16T03:44:42.000Z
2021-08-30T06:48:44.000Z
oneEngine/oneGame/source/after/entities/menu/splash/CStudioSplash.h
jonting/1Engine
f22ba31f08fa96fe6405ebecec4f374138283803
[ "BSD-3-Clause" ]
1
2021-04-16T02:09:54.000Z
2021-04-16T02:09:54.000Z
#ifndef _C_STUDIO_SPLASH_H_ #define _C_STUDIO_SPLASH_H_ #include "engine/behavior/CGameBehavior.h" #include "renderer/object/CRenderableObject.h" class CTexture; class glMaterial; class CStudioSplash : public CGameBehavior, public CRenderableObject { public: CStudioSplash ( void ); ~CStudioSplash ( void ); void Update ( void ); bool Render ( const char pass ); bool Done ( void ); private: int fadeState; ftype fader; glMaterial* matBase; glMaterial* matPrim; CTexture* texBase; }; #endif//_C_STUDIO_SPLASH_H_
16.121212
68
0.757519
[ "render", "object" ]
797030c04515d4324d80bcad3aee08a4eff9c2b9
1,179
h
C
DFBaseDemocOC/DFBaseDemocOC/Classes/Share/DFShareUtils.h
dfanfan/DFBaseDemoOC
457b6672540b16b0445618a13080c26f48d2a3ad
[ "MIT" ]
null
null
null
DFBaseDemocOC/DFBaseDemocOC/Classes/Share/DFShareUtils.h
dfanfan/DFBaseDemoOC
457b6672540b16b0445618a13080c26f48d2a3ad
[ "MIT" ]
null
null
null
DFBaseDemocOC/DFBaseDemocOC/Classes/Share/DFShareUtils.h
dfanfan/DFBaseDemoOC
457b6672540b16b0445618a13080c26f48d2a3ad
[ "MIT" ]
null
null
null
// // DFShareUtils.h // DFBaseDemocOC // // Created by user on 24/7/19. // Copyright © 2019年 DF. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface DFThirdPlatforms : NSObject @property (nonatomic, copy) NSString *umAppkey; @property (nonatomic, copy) NSString *wechatAppkey; @property (nonatomic, copy) NSString *wechatAppSecret; @end @interface DFShareObject : NSObject @property (nonatomic, copy) NSString *webUrl; @property (nonatomic, copy) NSString *shareTitle; @property (nonatomic, copy) NSString *shareDesc; @property (nonatomic, copy) NSString *thumbUrl; @property (nonatomic, copy) NSString *thumbImageName; @end @interface DFShareUtils : NSObject + (void)confitSharePlatforms; + (BOOL)hasPlatforms; /// 返回app回调 + (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation; + (BOOL)openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options; /// 点击分享按钮调用 + (void)showSharePlatforms:(UIViewController *)vc object:(DFShareObject *)object complete:(void (^)(NSError *error))complete; @end NS_ASSUME_NONNULL_END
26.2
125
0.763359
[ "object" ]
b2abf305629701aba12ef488d3ab3b14b3d9caf1
2,993
h
C
wrappers/7.0.0/vtkAngularPeriodicFilterWrap.h
axkibe/node-vtk
900ad7b5500f672519da5aa24c99aa5a96466ef3
[ "BSD-3-Clause" ]
6
2016-02-03T12:48:36.000Z
2020-09-16T15:07:51.000Z
wrappers/7.0.0/vtkAngularPeriodicFilterWrap.h
axkibe/node-vtk
900ad7b5500f672519da5aa24c99aa5a96466ef3
[ "BSD-3-Clause" ]
4
2016-02-13T01:30:43.000Z
2020-03-30T16:59:32.000Z
wrappers/7.0.0/vtkAngularPeriodicFilterWrap.h
axkibe/node-vtk
900ad7b5500f672519da5aa24c99aa5a96466ef3
[ "BSD-3-Clause" ]
null
null
null
/* this file has been autogenerated by vtkNodeJsWrap */ /* editing this might proof futile */ #ifndef NATIVE_EXTENSION_VTK_VTKANGULARPERIODICFILTERWRAP_H #define NATIVE_EXTENSION_VTK_VTKANGULARPERIODICFILTERWRAP_H #include <nan.h> #include <vtkSmartPointer.h> #include <vtkAngularPeriodicFilter.h> #include "vtkPeriodicFilterWrap.h" #include "../../plus/plus.h" class VtkAngularPeriodicFilterWrap : public VtkPeriodicFilterWrap { public: using Nan::ObjectWrap::Wrap; static void Init(v8::Local<v8::Object> exports); static void InitPtpl(); static void ConstructorGetter( v8::Local<v8::String> property, const Nan::PropertyCallbackInfo<v8::Value>& info); VtkAngularPeriodicFilterWrap(vtkSmartPointer<vtkAngularPeriodicFilter>); VtkAngularPeriodicFilterWrap(); ~VtkAngularPeriodicFilterWrap( ); static Nan::Persistent<v8::FunctionTemplate> ptpl; private: static void New(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetCenter(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationAngle(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationArrayName(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationAxis(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationAxisMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationAxisMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationMode(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationModeMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetRotationModeMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void IsA(const Nan::FunctionCallbackInfo<v8::Value>& info); static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetCenter(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationAngle(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationArrayName(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationAxis(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationAxisToX(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationAxisToY(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationAxisToZ(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationMode(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationModeToArrayValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetRotationModeToDirectAngle(const Nan::FunctionCallbackInfo<v8::Value>& info); #ifdef VTK_NODE_PLUS_VTKANGULARPERIODICFILTERWRAP_CLASSDEF VTK_NODE_PLUS_VTKANGULARPERIODICFILTERWRAP_CLASSDEF #endif }; #endif
47.507937
93
0.795857
[ "object" ]
b2acbf511909b169830768a27090e226b878f86d
9,377
c
C
ccnxlibs/libccnx-portal/ccnx/api/ccnx_Portal/test/test_ccnx_PortalAnchor.c
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
10
2018-11-04T06:37:14.000Z
2022-02-18T00:26:34.000Z
ccnxlibs/libccnx-portal/ccnx/api/ccnx_Portal/test/test_ccnx_PortalAnchor.c
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
null
null
null
ccnxlibs/libccnx-portal/ccnx/api/ccnx_Portal/test/test_ccnx_PortalAnchor.c
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
3
2019-01-17T19:47:55.000Z
2022-02-18T00:28:18.000Z
/* * Copyright (c) 2017 Cisco and/or its affiliates. * 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 "../ccnx_PortalAnchor.c" #include <LongBow/testing.h> #include <LongBow/debugging.h> #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_SafeMemory.h> #include <parc/algol/parc_DisplayIndented.h> #include <parc/testing/parc_MemoryTesting.h> #include <parc/testing/parc_ObjectTesting.h> LONGBOW_TEST_RUNNER(ccnx_PortalAnchor) { // The following Test Fixtures will run their corresponding Test Cases. // Test Fixtures are run in the order specified, but all tests should be idempotent. // Never rely on the execution order of tests or share state between them. LONGBOW_RUN_TEST_FIXTURE(CreateAcquireRelease); LONGBOW_RUN_TEST_FIXTURE(Object); LONGBOW_RUN_TEST_FIXTURE(Specialization); } // The Test Runner calls this function once before any Test Fixtures are run. LONGBOW_TEST_RUNNER_SETUP(ccnx_PortalAnchor) { return LONGBOW_STATUS_SUCCEEDED; } // The Test Runner calls this function once after all the Test Fixtures are run. LONGBOW_TEST_RUNNER_TEARDOWN(ccnx_PortalAnchor) { return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_FIXTURE(CreateAcquireRelease) { LONGBOW_RUN_TEST_CASE(CreateAcquireRelease, CreateRelease); } LONGBOW_TEST_FIXTURE_SETUP(CreateAcquireRelease) { return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_FIXTURE_TEARDOWN(CreateAcquireRelease) { if (!parcMemoryTesting_ExpectedOutstanding(0, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) { return LONGBOW_STATUS_MEMORYLEAK; } return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_CASE(CreateAcquireRelease, CreateRelease) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); assertNotNull(instance, "Expected non-null result from ccnxPortalAnchor_Create();"); parcObjectTesting_AssertAcquireReleaseContract(ccnxPortalAnchor_Acquire, instance); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); assertNull(instance, "Expected null result from ccnxPortalAnchor_Release();"); } LONGBOW_TEST_FIXTURE(Object) { LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_Compare); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_Copy); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_Display); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_Equals); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_HashCode); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_IsValid); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_ToJSON); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_ToString); LONGBOW_RUN_TEST_CASE(Object, ccnxPortalAnchor_SerializeDeserialize); } LONGBOW_TEST_FIXTURE_SETUP(Object) { return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_FIXTURE_TEARDOWN(Object) { if (!parcMemoryTesting_ExpectedOutstanding(0, "%s mismanaged memory.", longBowTestCase_GetFullName(testCase))) { return LONGBOW_STATUS_MEMORYLEAK; } return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_Compare) { testUnimplemented(""); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_Copy) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); CCNxPortalAnchor *copy = ccnxPortalAnchor_Copy(instance); assertTrue(ccnxPortalAnchor_Equals(instance, copy), "Expected the copy to be equal to the original"); ccnxPortalAnchor_Release(&instance); ccnxPortalAnchor_Release(&copy); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_Display) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); ccnxPortalAnchor_Display(instance, 0); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_Equals) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *x = ccnxPortalAnchor_Create(name, expireTime); CCNxPortalAnchor *y = ccnxPortalAnchor_Create(name, expireTime); CCNxPortalAnchor *z = ccnxPortalAnchor_Create(name, expireTime); parcObjectTesting_AssertEquals(x, y, z, NULL); ccnxPortalAnchor_Release(&x); ccnxPortalAnchor_Release(&y); ccnxPortalAnchor_Release(&z); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_HashCode) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *x = ccnxPortalAnchor_Create(name, expireTime); CCNxPortalAnchor *y = ccnxPortalAnchor_Create(name, expireTime); parcObjectTesting_AssertHashCode(x, y); ccnxPortalAnchor_Release(&x); ccnxPortalAnchor_Release(&y); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_IsValid) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); assertTrue(ccnxPortalAnchor_IsValid(instance), "Expected ccnxPortalAnchor_Create to result in a valid instance."); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); assertFalse(ccnxPortalAnchor_IsValid(instance), "Expected ccnxPortalAnchor_Release to result in an invalid instance."); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_ToJSON) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); PARCJSON *json = ccnxPortalAnchor_ToJSON(instance); parcJSON_Release(&json); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_ToString) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); char *string = ccnxPortalAnchor_ToString(instance); assertNotNull(string, "Expected non-NULL result from ccnxPortalAnchor_ToString"); parcMemory_Deallocate((void **) &string); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Object, ccnxPortalAnchor_SerializeDeserialize) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *instance = ccnxPortalAnchor_Create(name, expireTime); PARCBufferComposer *composer = parcBufferComposer_Create(); ccnxPortalAnchor_Serialize(instance, composer); PARCBuffer *buffer = parcBufferComposer_ProduceBuffer(composer); CCNxPortalAnchor *copy = ccnxPortalAnchor_Deserialize(buffer); assertTrue(ccnxPortalAnchor_Equals(instance, copy), "Expected deserialized form to be equal to the original"); ccnxPortalAnchor_Release(&copy); parcBuffer_Release(&buffer); parcBufferComposer_Release(&composer); ccnxPortalAnchor_Release(&instance); ccnxName_Release(&name); } LONGBOW_TEST_FIXTURE(Specialization) { LONGBOW_RUN_TEST_CASE(Specialization, ccnxPortalAnchor_GetNamePrefix); LONGBOW_RUN_TEST_CASE(Specialization, ccnxPortalAnchor_GetExpireTime); } LONGBOW_TEST_FIXTURE_SETUP(Specialization) { return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_FIXTURE_TEARDOWN(Specialization) { if (!parcMemoryTesting_ExpectedOutstanding(0, "%s mismanaged memory.", longBowTestCase_GetFullName(testCase))) { return LONGBOW_STATUS_MEMORYLEAK; } return LONGBOW_STATUS_SUCCEEDED; } LONGBOW_TEST_CASE(Specialization, ccnxPortalAnchor_GetNamePrefix) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *anchor = ccnxPortalAnchor_Create(name, expireTime); CCNxName *actual = ccnxPortalAnchor_GetNamePrefix(anchor); assertTrue(ccnxName_Equals(name, actual), "Expected name to be equal."); ccnxPortalAnchor_Release(&anchor); ccnxName_Release(&name); } LONGBOW_TEST_CASE(Specialization, ccnxPortalAnchor_GetExpireTime) { CCNxName *name = ccnxName_CreateFromCString("lci:/name"); time_t expireTime = 123; CCNxPortalAnchor *anchor = ccnxPortalAnchor_Create(name, expireTime); time_t actual = ccnxPortalAnchor_GetExpireTime(anchor); assertTrue(expireTime == actual, "Expected expire-time to be equal."); ccnxPortalAnchor_Release(&anchor); ccnxName_Release(&name); } int main(int argc, char *argv[argc]) { LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(ccnx_PortalAnchor); int exitStatus = longBowMain(argc, argv, testRunner, NULL); longBowTestRunner_Destroy(&testRunner); exit(exitStatus); }
32.672474
123
0.774448
[ "object" ]
b2b28c674c33f857944fe0843ea4b1aa93c32fce
2,033
h
C
include/boxqp.h
nrkumar93/iLQR
6f19c005c335d9472a9b2dc4722960af50fef592
[ "MIT" ]
34
2018-02-26T17:56:13.000Z
2021-12-03T17:32:43.000Z
include/boxqp.h
nrkumar93/iLQR
6f19c005c335d9472a9b2dc4722960af50fef592
[ "MIT" ]
1
2018-12-20T02:35:48.000Z
2018-12-20T03:00:14.000Z
include/boxqp.h
nrkumar93/iLQR
6f19c005c335d9472a9b2dc4722960af50fef592
[ "MIT" ]
7
2017-12-15T12:23:34.000Z
2021-12-25T11:15:59.000Z
#ifndef _BOXQP_H_ #define _BOXQP_H_ #include "eigen_helpers.h" #include "eigen/Eigen/Core" #include "eigen/Eigen/Eigenvalues" #include <iostream> #include <vector> #include <cmath> #include <algorithm> // #define VERBOSE using Eigen::VectorXd; using Eigen::MatrixXd; using Eigen::VectorXi; // Optimization parameters static const int qp_maxIter = 100; // maximum number of iterations static const double minGrad = 1e-8; // minimum norm of non-fixed gradient static const double minRelImprove = 1e-8; // minimum relative improvement static const double stepDec = 0.6; // factor for decreasing stepsize static const double minStep = 1e-22; // minimal stepsize for linesearch static const double Armijo = 0.1; // Armijo parameter (fraction of linear improvement required in line search) struct lineSearchResult { lineSearchResult(int n_dims): x_opt(n_dims), v_opt(n_dims) {} bool failed = false; int n_steps = 0; VectorXd x_opt; double v_opt; }; struct boxQPResult { boxQPResult(int n_dims): x_opt(n_dims), v_free(n_dims), R_free(n_dims, n_dims) {} int result = 0; VectorXd x_opt; VectorXi v_free; MatrixXd R_free; // TODO replace this with Qfreeinv? since that's all we use this for }; boxQPResult boxQP(const MatrixXd &Q, const VectorXd &c, const VectorXd &x0, const VectorXd& lower, const VectorXd& upper); inline VectorXd clamp_to_limits(const VectorXd &x, const VectorXd& lower, const VectorXd& upper) { VectorXd x_clamped = upper.cwiseMin(x.cwiseMax(lower)); return x_clamped; } inline double quadCost(const MatrixXd& Q, const VectorXd& c, const VectorXd& x) { return 0.5*x.transpose()*Q*x + x.dot(c); } lineSearchResult quadclamp_line_search(const VectorXd& x0, const VectorXd& search_dir, const MatrixXd& Q, const VectorXd& c, const VectorXd& lower, const VectorXd& upper); inline bool approx_eq(double a, double b) { return (std::abs(a-b) < 1e-4); } #endif
30.343284
119
0.699459
[ "vector" ]
b2b8e201b551fe71823e73d43072612d1205f011
162,815
h
C
PrivateFrameworks/ProVideo.framework/PSMain.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
36
2016-04-20T04:19:04.000Z
2018-10-08T04:12:25.000Z
PrivateFrameworks/ProVideo.framework/PSMain.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
null
null
null
PrivateFrameworks/ProVideo.framework/PSMain.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
10
2016-06-16T02:40:44.000Z
2019-01-15T03:31:45.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/ProVideo.framework/ProVideo */ @interface PSMain : NSObject - (void)addEmitter:(id)arg1; - (void)addReplicator:(id)arg1; - (void)applicationDidFinishLaunching; - (bool)canAddEmitterToDoc:(struct OZDocument { int (**x1)(); int (**x2)(); struct PCSafeHandle {} *x3; struct OZScene {} *x4; struct PCString { struct __CFString {} *x_5_1_1; } x5; struct list<OZObjectSelections *, std::__1::allocator<OZObjectSelections *> > { struct __list_node_base<OZObjectSelections *, void *> { struct __list_node_base<OZObjectSelections *, void *> {} *x_1_2_1; struct __list_node_base<OZObjectSelections *, void *> {} *x_1_2_2; } x_6_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZObjectSelections *, void *> > > { unsigned long long x_2_2_1; } x_6_1_2; } x6; struct vector<OZChannelRef, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_7_1_1; struct OZChannelRef {} *x_7_1_2; struct __compressed_pair<OZChannelRef *, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_3_2_1; } x_7_1_3; } x7; struct PCString { struct __CFString {} *x_8_1_1; } x8; unsigned int x9; bool x10; bool x11; unsigned int x12; bool x13; int x14; struct PCString { struct __CFString {} *x_15_1_1; } x15; struct PCString { struct __CFString {} *x_16_1_1; } x16; unsigned int x17; unsigned long long x18; struct OZNotificationManager {} *x19; id x20; struct OZViewerState {} *x21[4]; struct OZCanvasState {} *x22; struct OZProjectPanelState {} *x23; struct OZTimelineState {} *x24; struct OZInspectorState {} *x25; bool x26; unsigned int x27; unsigned int x28; struct PCString { struct __CFString {} *x_29_1_1; } x29; bool x30; struct OZRigWidget {} *x31; struct vector<OZChannelRef, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_32_1_1; struct OZChannelRef {} *x_32_1_2; struct __compressed_pair<OZChannelRef *, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_3_2_1; } x_32_1_3; } x32; int x33; bool x34; }*)arg1; - (id)init; - (void)setupEmitter:(struct PSEmitter { int (**x1)(); struct PCRecursiveMutex { int (**x_2_1_1)(); struct _opaque_pthread_mutex_t { long long x_2_2_1; BOOL x_2_2_2[56]; } x_2_1_2; } x2; struct OZLockingGroupMutex { int (**x_3_1_1)(); struct _opaque_pthread_mutex_t { long long x_2_2_1; BOOL x_2_2_2[56]; } x_3_1_2; struct OZLocking {} *x_3_1_3; struct OZLockingGroup {} *x_3_1_4; bool x_3_1_5; } x3; int (**x4)(); struct OZFactory {} *x5; int (**x6)(); struct PCSafeHandle {} *x7; struct PCHash128 { unsigned int x_8_1_1[4]; } x8; int (**x9)(); struct OZChannelSceneNode { int (**x_10_1_1)(); struct OZFactory {} *x_10_1_2; int (**x_10_1_3)(); unsigned int x_10_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_10_1_5; struct PCString {} *x_10_1_6; struct OZChannelFolder {} *x_10_1_7; unsigned long long x_10_1_8; unsigned long long x_10_1_9; void *x_10_1_10; struct __CFString {} *x_10_1_11; struct __CFString {} *x_10_1_12; struct __CFString {} *x_10_1_13; struct OZChannelTimeConverter {} *x_10_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_10_1_15; unsigned int x_10_1_16; unsigned int x_10_1_17; struct FigTime { double x_18_2_1; } x_10_1_18; struct PCTimeRange { struct FigTime { double x_1_3_1; } x_19_2_1; struct FigTime { double x_2_3_1; } x_19_2_2; } x_10_1_19; bool x_10_1_20; bool x_10_1_21; struct OZObjectManipulator {} *x_10_1_22; struct OZTimeMarkerSet {} *x_10_1_23; struct list<OZSimulationBehavior *, std::__1::allocator<OZSimulationBehavior *> > { struct __list_node_base<OZSimulationBehavior *, void *> { struct __list_node_base<OZSimulationBehavior *, void *> {} *x_1_3_1; struct __list_node_base<OZSimulationBehavior *, void *> {} *x_1_3_2; } x_24_2_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZSimulationBehavior *, void *> > > { unsigned long long x_2_3_1; } x_24_2_2; } x_10_1_24; struct PCString { struct __CFString {} *x_25_2_1; } x_10_1_25; struct OZSceneNode {} *x_10_1_26; } x10; struct OZChannelFolder { int (**x_11_1_1)(); struct OZFactory {} *x_11_1_2; int (**x_11_1_3)(); unsigned int x_11_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_11_1_5; struct PCString {} *x_11_1_6; struct OZChannelFolder {} *x_11_1_7; unsigned long long x_11_1_8; unsigned long long x_11_1_9; void *x_11_1_10; struct __CFString {} *x_11_1_11; struct __CFString {} *x_11_1_12; struct __CFString {} *x_11_1_13; struct OZChannelTimeConverter {} *x_11_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_11_1_15; unsigned int x_11_1_16; unsigned int x_11_1_17; } x11; struct OZChannelFolder { int (**x_12_1_1)(); struct OZFactory {} *x_12_1_2; int (**x_12_1_3)(); unsigned int x_12_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_12_1_5; struct PCString {} *x_12_1_6; struct OZChannelFolder {} *x_12_1_7; unsigned long long x_12_1_8; unsigned long long x_12_1_9; void *x_12_1_10; struct __CFString {} *x_12_1_11; struct __CFString {} *x_12_1_12; struct __CFString {} *x_12_1_13; struct OZChannelTimeConverter {} *x_12_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_12_1_15; unsigned int x_12_1_16; unsigned int x_12_1_17; } x12; struct OZChannelFolder { int (**x_13_1_1)(); struct OZFactory {} *x_13_1_2; int (**x_13_1_3)(); unsigned int x_13_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_13_1_5; struct PCString {} *x_13_1_6; struct OZChannelFolder {} *x_13_1_7; unsigned long long x_13_1_8; unsigned long long x_13_1_9; void *x_13_1_10; struct __CFString {} *x_13_1_11; struct __CFString {} *x_13_1_12; struct __CFString {} *x_13_1_13; struct OZChannelTimeConverter {} *x_13_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_13_1_15; unsigned int x_13_1_16; unsigned int x_13_1_17; } x13; struct OZChannelFolder { int (**x_14_1_1)(); struct OZFactory {} *x_14_1_2; int (**x_14_1_3)(); unsigned int x_14_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_14_1_5; struct PCString {} *x_14_1_6; struct OZChannelFolder {} *x_14_1_7; unsigned long long x_14_1_8; unsigned long long x_14_1_9; void *x_14_1_10; struct __CFString {} *x_14_1_11; struct __CFString {} *x_14_1_12; struct __CFString {} *x_14_1_13; struct OZChannelTimeConverter {} *x_14_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_14_1_15; unsigned int x_14_1_16; unsigned int x_14_1_17; } x14; struct OZChannelFolder { int (**x_15_1_1)(); struct OZFactory {} *x_15_1_2; int (**x_15_1_3)(); unsigned int x_15_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_15_1_5; struct PCString {} *x_15_1_6; struct OZChannelFolder {} *x_15_1_7; unsigned long long x_15_1_8; unsigned long long x_15_1_9; void *x_15_1_10; struct __CFString {} *x_15_1_11; struct __CFString {} *x_15_1_12; struct __CFString {} *x_15_1_13; struct OZChannelTimeConverter {} *x_15_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_15_1_15; unsigned int x_15_1_16; unsigned int x_15_1_17; } x15; struct OZSceneNode {} *x16; struct OZScene {} *x17; struct list<OZEffect *, std::__1::allocator<OZEffect *> > { struct __list_node_base<OZEffect *, void *> { struct __list_node_base<OZEffect *, void *> {} *x_1_2_1; struct __list_node_base<OZEffect *, void *> {} *x_1_2_2; } x_18_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZEffect *, void *> > > { unsigned long long x_2_2_1; } x_18_1_2; } x18; struct list<OZBehavior *, std::__1::allocator<OZBehavior *> > { struct __list_node_base<OZBehavior *, void *> { struct __list_node_base<OZBehavior *, void *> {} *x_1_2_1; struct __list_node_base<OZBehavior *, void *> {} *x_1_2_2; } x_19_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZBehavior *, void *> > > { unsigned long long x_2_2_1; } x_19_1_2; } x19; unsigned int x20; double x21; struct PCHash128 { unsigned int x_22_1_1[4]; } x22; struct vector<unsigned int, std::__1::allocator<unsigned int> > { unsigned int *x_23_1_1; unsigned int *x_23_1_2; struct __compressed_pair<unsigned int *, std::__1::allocator<unsigned int> > { unsigned int *x_3_2_1; } x_23_1_3; } x23; struct __list_iterator<OZSceneNode *, void *> { struct __list_node_base<OZSceneNode *, void *> {} *x_24_1_1; } x24; unsigned int x25; struct OZChannelFolder { int (**x_26_1_1)(); struct OZFactory {} *x_26_1_2; int (**x_26_1_3)(); unsigned int x_26_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_26_1_5; struct PCString {} *x_26_1_6; struct OZChannelFolder {} *x_26_1_7; unsigned long long x_26_1_8; unsigned long long x_26_1_9; void *x_26_1_10; struct __CFString {} *x_26_1_11; struct __CFString {} *x_26_1_12; struct __CFString {} *x_26_1_13; struct OZChannelTimeConverter {} *x_26_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_26_1_15; unsigned int x_26_1_16; unsigned int x_26_1_17; } x26; struct OZChannelPosition3D { int (**x_27_1_1)(); struct OZFactory {} *x_27_1_2; int (**x_27_1_3)(); unsigned int x_27_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_27_1_5; struct PCString {} *x_27_1_6; struct OZChannelFolder {} *x_27_1_7; unsigned long long x_27_1_8; unsigned long long x_27_1_9; void *x_27_1_10; struct __CFString {} *x_27_1_11; struct __CFString {} *x_27_1_12; struct __CFString {} *x_27_1_13; struct OZChannelTimeConverter {} *x_27_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_27_1_15; unsigned int x_27_1_16; unsigned int x_27_1_17; bool x_27_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_27_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_27_1_20; bool x_27_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_27_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_27_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_27_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_27_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_27_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_27_1_27; unsigned int x_27_1_28; struct PCSpinLock { int x_29_2_1; } x_27_1_29; struct vector<double, std::__1::allocator<double> > { double *x_30_2_1; double *x_30_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_30_2_3; } x_27_1_30; bool x_27_1_31; bool x_27_1_32; struct OZChannelDouble { int (**x_33_2_1)(); struct OZFactory {} *x_33_2_2; int (**x_33_2_3)(); unsigned int x_33_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_33_2_5; struct PCString {} *x_33_2_6; struct OZChannelFolder {} *x_33_2_7; unsigned long long x_33_2_8; unsigned long long x_33_2_9; void *x_33_2_10; struct __CFString {} *x_33_2_11; struct __CFString {} *x_33_2_12; struct __CFString {} *x_33_2_13; struct OZChannelTimeConverter {} *x_33_2_14; struct OZChannelImpl {} *x_33_2_15; struct OZChannelImpl {} *x_33_2_16; struct OZChannelInfo {} *x_33_2_17; struct OZChannelInfo {} *x_33_2_18; struct OZCurve {} *x_33_2_19; } x_27_1_33; } x27; struct OZChannelRotation3D { int (**x_28_1_1)(); struct OZFactory {} *x_28_1_2; int (**x_28_1_3)(); unsigned int x_28_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_28_1_5; struct PCString {} *x_28_1_6; struct OZChannelFolder {} *x_28_1_7; unsigned long long x_28_1_8; unsigned long long x_28_1_9; void *x_28_1_10; struct __CFString {} *x_28_1_11; struct __CFString {} *x_28_1_12; struct __CFString {} *x_28_1_13; struct OZChannelTimeConverter {} *x_28_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_28_1_15; unsigned int x_28_1_16; unsigned int x_28_1_17; bool x_28_1_18; struct OZChannelAngle { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_28_1_19; struct OZChannelAngle { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_28_1_20; struct OZChannelAngle { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_28_1_21; struct OZChannelEnumInterpMode { int (**x_22_2_1)(); struct OZFactory {} *x_22_2_2; int (**x_22_2_3)(); unsigned int x_22_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_22_2_5; struct PCString {} *x_22_2_6; struct OZChannelFolder {} *x_22_2_7; unsigned long long x_22_2_8; unsigned long long x_22_2_9; void *x_22_2_10; struct __CFString {} *x_22_2_11; struct __CFString {} *x_22_2_12; struct __CFString {} *x_22_2_13; struct OZChannelTimeConverter {} *x_22_2_14; struct OZChannelImpl {} *x_22_2_15; struct OZChannelImpl {} *x_22_2_16; struct OZChannelInfo {} *x_22_2_17; struct OZChannelInfo {} *x_22_2_18; struct OZCurve {} *x_22_2_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_4_1; } x_20_3_1; } x_22_2_20; struct PCString { struct __CFString {} *x_21_3_1; } x_22_2_21; struct vector<int, std::__1::allocator<int> > { int *x_22_3_1; int *x_22_3_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_4_1; } x_22_3_3; } x_22_2_22; unsigned int x_22_2_23; struct PCString { struct __CFString {} *x_24_3_1; } x_22_2_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_3_1; struct PCString {} *x_25_3_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_4_1; } x_25_3_3; } x_22_2_25; } x_28_1_22; struct PCSpinLock { int x_23_2_1; } x_28_1_23; } x28; struct OZChannelPosition3D { int (**x_29_1_1)(); struct OZFactory {} *x_29_1_2; int (**x_29_1_3)(); unsigned int x_29_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_29_1_5; struct PCString {} *x_29_1_6; struct OZChannelFolder {} *x_29_1_7; unsigned long long x_29_1_8; unsigned long long x_29_1_9; void *x_29_1_10; struct __CFString {} *x_29_1_11; struct __CFString {} *x_29_1_12; struct __CFString {} *x_29_1_13; struct OZChannelTimeConverter {} *x_29_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_29_1_15; unsigned int x_29_1_16; unsigned int x_29_1_17; bool x_29_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_29_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_29_1_20; bool x_29_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_29_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_29_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_29_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_29_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_29_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_29_1_27; unsigned int x_29_1_28; struct PCSpinLock { int x_29_2_1; } x_29_1_29; struct vector<double, std::__1::allocator<double> > { double *x_30_2_1; double *x_30_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_30_2_3; } x_29_1_30; bool x_29_1_31; bool x_29_1_32; struct OZChannelDouble { int (**x_33_2_1)(); struct OZFactory {} *x_33_2_2; int (**x_33_2_3)(); unsigned int x_33_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_33_2_5; struct PCString {} *x_33_2_6; struct OZChannelFolder {} *x_33_2_7; unsigned long long x_33_2_8; unsigned long long x_33_2_9; void *x_33_2_10; struct __CFString {} *x_33_2_11; struct __CFString {} *x_33_2_12; struct __CFString {} *x_33_2_13; struct OZChannelTimeConverter {} *x_33_2_14; struct OZChannelImpl {} *x_33_2_15; struct OZChannelImpl {} *x_33_2_16; struct OZChannelInfo {} *x_33_2_17; struct OZChannelInfo {} *x_33_2_18; struct OZCurve {} *x_33_2_19; } x_29_1_33; } x29; struct OZChannel3D { int (**x_30_1_1)(); struct OZFactory {} *x_30_1_2; int (**x_30_1_3)(); unsigned int x_30_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_30_1_5; struct PCString {} *x_30_1_6; struct OZChannelFolder {} *x_30_1_7; unsigned long long x_30_1_8; unsigned long long x_30_1_9; void *x_30_1_10; struct __CFString {} *x_30_1_11; struct __CFString {} *x_30_1_12; struct __CFString {} *x_30_1_13; struct OZChannelTimeConverter {} *x_30_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_30_1_15; unsigned int x_30_1_16; unsigned int x_30_1_17; bool x_30_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_30_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_30_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_30_1_21; } x30; struct OZChannelScale3D { int (**x_31_1_1)(); struct OZFactory {} *x_31_1_2; int (**x_31_1_3)(); unsigned int x_31_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_31_1_5; struct PCString {} *x_31_1_6; struct OZChannelFolder {} *x_31_1_7; unsigned long long x_31_1_8; unsigned long long x_31_1_9; void *x_31_1_10; struct __CFString {} *x_31_1_11; struct __CFString {} *x_31_1_12; struct __CFString {} *x_31_1_13; struct OZChannelTimeConverter {} *x_31_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_31_1_15; unsigned int x_31_1_16; unsigned int x_31_1_17; bool x_31_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_31_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_31_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_31_1_21; } x31; struct OZChannelShear { int (**x_32_1_1)(); struct OZFactory {} *x_32_1_2; int (**x_32_1_3)(); unsigned int x_32_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_32_1_5; struct PCString {} *x_32_1_6; struct OZChannelFolder {} *x_32_1_7; unsigned long long x_32_1_8; unsigned long long x_32_1_9; void *x_32_1_10; struct __CFString {} *x_32_1_11; struct __CFString {} *x_32_1_12; struct __CFString {} *x_32_1_13; struct OZChannelTimeConverter {} *x_32_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_32_1_15; unsigned int x_32_1_16; unsigned int x_32_1_17; bool x_32_1_18; struct OZChannelShearAngle { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_32_1_19; struct OZChannelShearAngle { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_32_1_20; } x32; struct OZChannelPosition3D { int (**x_33_1_1)(); struct OZFactory {} *x_33_1_2; int (**x_33_1_3)(); unsigned int x_33_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_33_1_5; struct PCString {} *x_33_1_6; struct OZChannelFolder {} *x_33_1_7; unsigned long long x_33_1_8; unsigned long long x_33_1_9; void *x_33_1_10; struct __CFString {} *x_33_1_11; struct __CFString {} *x_33_1_12; struct __CFString {} *x_33_1_13; struct OZChannelTimeConverter {} *x_33_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_33_1_15; unsigned int x_33_1_16; unsigned int x_33_1_17; bool x_33_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_33_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_33_1_20; bool x_33_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_33_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_33_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_33_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_33_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_33_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_33_1_27; unsigned int x_33_1_28; struct PCSpinLock { int x_29_2_1; } x_33_1_29; struct vector<double, std::__1::allocator<double> > { double *x_30_2_1; double *x_30_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_30_2_3; } x_33_1_30; bool x_33_1_31; bool x_33_1_32; struct OZChannelDouble { int (**x_33_2_1)(); struct OZFactory {} *x_33_2_2; int (**x_33_2_3)(); unsigned int x_33_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_33_2_5; struct PCString {} *x_33_2_6; struct OZChannelFolder {} *x_33_2_7; unsigned long long x_33_2_8; unsigned long long x_33_2_9; void *x_33_2_10; struct __CFString {} *x_33_2_11; struct __CFString {} *x_33_2_12; struct __CFString {} *x_33_2_13; struct OZChannelTimeConverter {} *x_33_2_14; struct OZChannelImpl {} *x_33_2_15; struct OZChannelImpl {} *x_33_2_16; struct OZChannelInfo {} *x_33_2_17; struct OZChannelInfo {} *x_33_2_18; struct OZCurve {} *x_33_2_19; } x_33_1_33; } x33; double x34; unsigned int x35; struct OZChannelAngle { int (**x_36_1_1)(); struct OZFactory {} *x_36_1_2; int (**x_36_1_3)(); unsigned int x_36_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_36_1_5; struct PCString {} *x_36_1_6; struct OZChannelFolder {} *x_36_1_7; unsigned long long x_36_1_8; unsigned long long x_36_1_9; void *x_36_1_10; struct __CFString {} *x_36_1_11; struct __CFString {} *x_36_1_12; struct __CFString {} *x_36_1_13; struct OZChannelTimeConverter {} *x_36_1_14; struct OZChannelImpl {} *x_36_1_15; struct OZChannelImpl {} *x_36_1_16; struct OZChannelInfo {} *x_36_1_17; struct OZChannelInfo {} *x_36_1_18; struct OZCurve {} *x_36_1_19; } x36; int (**x37)(); struct PCHash128 { unsigned int x_38_1_1[4]; } x38; struct OZChannelFolder { int (**x_39_1_1)(); struct OZFactory {} *x_39_1_2; int (**x_39_1_3)(); unsigned int x_39_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_39_1_5; struct PCString {} *x_39_1_6; struct OZChannelFolder {} *x_39_1_7; unsigned long long x_39_1_8; unsigned long long x_39_1_9; void *x_39_1_10; struct __CFString {} *x_39_1_11; struct __CFString {} *x_39_1_12; struct __CFString {} *x_39_1_13; struct OZChannelTimeConverter {} *x_39_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_39_1_15; unsigned int x_39_1_16; unsigned int x_39_1_17; } x39; struct OZChannelPercent { int (**x_40_1_1)(); struct OZFactory {} *x_40_1_2; int (**x_40_1_3)(); unsigned int x_40_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_40_1_5; struct PCString {} *x_40_1_6; struct OZChannelFolder {} *x_40_1_7; unsigned long long x_40_1_8; unsigned long long x_40_1_9; void *x_40_1_10; struct __CFString {} *x_40_1_11; struct __CFString {} *x_40_1_12; struct __CFString {} *x_40_1_13; struct OZChannelTimeConverter {} *x_40_1_14; struct OZChannelImpl {} *x_40_1_15; struct OZChannelImpl {} *x_40_1_16; struct OZChannelInfo {} *x_40_1_17; struct OZChannelInfo {} *x_40_1_18; struct OZCurve {} *x_40_1_19; } x40; struct OZChannelBlendMode { int (**x_41_1_1)(); struct OZFactory {} *x_41_1_2; int (**x_41_1_3)(); unsigned int x_41_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_41_1_5; struct PCString {} *x_41_1_6; struct OZChannelFolder {} *x_41_1_7; unsigned long long x_41_1_8; unsigned long long x_41_1_9; void *x_41_1_10; struct __CFString {} *x_41_1_11; struct __CFString {} *x_41_1_12; struct __CFString {} *x_41_1_13; struct OZChannelTimeConverter {} *x_41_1_14; struct OZChannelImpl {} *x_41_1_15; struct OZChannelImpl {} *x_41_1_16; struct OZChannelInfo {} *x_41_1_17; struct OZChannelInfo {} *x_41_1_18; struct OZCurve {} *x_41_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_41_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_41_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_41_1_22; unsigned int x_41_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_41_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_41_1_25; } x41; struct OZChannelFolder { int (**x_42_1_1)(); struct OZFactory {} *x_42_1_2; int (**x_42_1_3)(); unsigned int x_42_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_42_1_5; struct PCString {} *x_42_1_6; struct OZChannelFolder {} *x_42_1_7; unsigned long long x_42_1_8; unsigned long long x_42_1_9; void *x_42_1_10; struct __CFString {} *x_42_1_11; struct __CFString {} *x_42_1_12; struct __CFString {} *x_42_1_13; struct OZChannelTimeConverter {} *x_42_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_42_1_15; unsigned int x_42_1_16; unsigned int x_42_1_17; } x42; struct OZChannelDouble { int (**x_43_1_1)(); struct OZFactory {} *x_43_1_2; int (**x_43_1_3)(); unsigned int x_43_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_43_1_5; struct PCString {} *x_43_1_6; struct OZChannelFolder {} *x_43_1_7; unsigned long long x_43_1_8; unsigned long long x_43_1_9; void *x_43_1_10; struct __CFString {} *x_43_1_11; struct __CFString {} *x_43_1_12; struct __CFString {} *x_43_1_13; struct OZChannelTimeConverter {} *x_43_1_14; struct OZChannelImpl {} *x_43_1_15; struct OZChannelImpl {} *x_43_1_16; struct OZChannelInfo {} *x_43_1_17; struct OZChannelInfo {} *x_43_1_18; struct OZCurve {} *x_43_1_19; } x43; struct OZChannelPercent { int (**x_44_1_1)(); struct OZFactory {} *x_44_1_2; int (**x_44_1_3)(); unsigned int x_44_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_44_1_5; struct PCString {} *x_44_1_6; struct OZChannelFolder {} *x_44_1_7; unsigned long long x_44_1_8; unsigned long long x_44_1_9; void *x_44_1_10; struct __CFString {} *x_44_1_11; struct __CFString {} *x_44_1_12; struct __CFString {} *x_44_1_13; struct OZChannelTimeConverter {} *x_44_1_14; struct OZChannelImpl {} *x_44_1_15; struct OZChannelImpl {} *x_44_1_16; struct OZChannelInfo {} *x_44_1_17; struct OZChannelInfo {} *x_44_1_18; struct OZCurve {} *x_44_1_19; } x44; struct OZChannelPercent { int (**x_45_1_1)(); struct OZFactory {} *x_45_1_2; int (**x_45_1_3)(); unsigned int x_45_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_45_1_5; struct PCString {} *x_45_1_6; struct OZChannelFolder {} *x_45_1_7; unsigned long long x_45_1_8; unsigned long long x_45_1_9; void *x_45_1_10; struct __CFString {} *x_45_1_11; struct __CFString {} *x_45_1_12; struct __CFString {} *x_45_1_13; struct OZChannelTimeConverter {} *x_45_1_14; struct OZChannelImpl {} *x_45_1_15; struct OZChannelImpl {} *x_45_1_16; struct OZChannelInfo {} *x_45_1_17; struct OZChannelInfo {} *x_45_1_18; struct OZCurve {} *x_45_1_19; } x45; struct OZChannelEnum { int (**x_46_1_1)(); struct OZFactory {} *x_46_1_2; int (**x_46_1_3)(); unsigned int x_46_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_46_1_5; struct PCString {} *x_46_1_6; struct OZChannelFolder {} *x_46_1_7; unsigned long long x_46_1_8; unsigned long long x_46_1_9; void *x_46_1_10; struct __CFString {} *x_46_1_11; struct __CFString {} *x_46_1_12; struct __CFString {} *x_46_1_13; struct OZChannelTimeConverter {} *x_46_1_14; struct OZChannelImpl {} *x_46_1_15; struct OZChannelImpl {} *x_46_1_16; struct OZChannelInfo {} *x_46_1_17; struct OZChannelInfo {} *x_46_1_18; struct OZCurve {} *x_46_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_46_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_46_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_46_1_22; unsigned int x_46_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_46_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_46_1_25; } x46; struct OZChannelPercent { int (**x_47_1_1)(); struct OZFactory {} *x_47_1_2; int (**x_47_1_3)(); unsigned int x_47_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_47_1_5; struct PCString {} *x_47_1_6; struct OZChannelFolder {} *x_47_1_7; unsigned long long x_47_1_8; unsigned long long x_47_1_9; void *x_47_1_10; struct __CFString {} *x_47_1_11; struct __CFString {} *x_47_1_12; struct __CFString {} *x_47_1_13; struct OZChannelTimeConverter {} *x_47_1_14; struct OZChannelImpl {} *x_47_1_15; struct OZChannelImpl {} *x_47_1_16; struct OZChannelInfo {} *x_47_1_17; struct OZChannelInfo {} *x_47_1_18; struct OZCurve {} *x_47_1_19; } x47; struct OZChannelBool { int (**x_48_1_1)(); struct OZFactory {} *x_48_1_2; int (**x_48_1_3)(); unsigned int x_48_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_48_1_5; struct PCString {} *x_48_1_6; struct OZChannelFolder {} *x_48_1_7; unsigned long long x_48_1_8; unsigned long long x_48_1_9; void *x_48_1_10; struct __CFString {} *x_48_1_11; struct __CFString {} *x_48_1_12; struct __CFString {} *x_48_1_13; struct OZChannelTimeConverter {} *x_48_1_14; struct OZChannelImpl {} *x_48_1_15; struct OZChannelImpl {} *x_48_1_16; struct OZChannelInfo {} *x_48_1_17; struct OZChannelInfo {} *x_48_1_18; struct OZCurve {} *x_48_1_19; } x48; struct OZLightingFolder { int (**x_49_1_1)(); struct OZFactory {} *x_49_1_2; int (**x_49_1_3)(); unsigned int x_49_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_49_1_5; struct PCString {} *x_49_1_6; struct OZChannelFolder {} *x_49_1_7; unsigned long long x_49_1_8; unsigned long long x_49_1_9; void *x_49_1_10; struct __CFString {} *x_49_1_11; struct __CFString {} *x_49_1_12; struct __CFString {} *x_49_1_13; struct OZChannelTimeConverter {} *x_49_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_49_1_15; unsigned int x_49_1_16; unsigned int x_49_1_17; struct OZChannelEnum { int (**x_18_2_1)(); struct OZFactory {} *x_18_2_2; int (**x_18_2_3)(); unsigned int x_18_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_18_2_5; struct PCString {} *x_18_2_6; struct OZChannelFolder {} *x_18_2_7; unsigned long long x_18_2_8; unsigned long long x_18_2_9; void *x_18_2_10; struct __CFString {} *x_18_2_11; struct __CFString {} *x_18_2_12; struct __CFString {} *x_18_2_13; struct OZChannelTimeConverter {} *x_18_2_14; struct OZChannelImpl {} *x_18_2_15; struct OZChannelImpl {} *x_18_2_16; struct OZChannelInfo {} *x_18_2_17; struct OZChannelInfo {} *x_18_2_18; struct OZCurve {} *x_18_2_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_4_1; } x_20_3_1; } x_18_2_20; struct PCString { struct __CFString {} *x_21_3_1; } x_18_2_21; struct vector<int, std::__1::allocator<int> > { int *x_22_3_1; int *x_22_3_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_4_1; } x_22_3_3; } x_18_2_22; unsigned int x_18_2_23; struct PCString { struct __CFString {} *x_24_3_1; } x_18_2_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_3_1; struct PCString {} *x_25_3_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_4_1; } x_25_3_3; } x_18_2_25; } x_49_1_18; struct OZChannelBool { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_49_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_49_1_20; struct OZFolderMaterialProperties { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_21_2_15; unsigned int x_21_2_16; unsigned int x_21_2_17; struct OZChannelDouble { int (**x_18_3_1)(); struct OZFactory {} *x_18_3_2; int (**x_18_3_3)(); unsigned int x_18_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_18_3_5; struct PCString {} *x_18_3_6; struct OZChannelFolder {} *x_18_3_7; unsigned long long x_18_3_8; unsigned long long x_18_3_9; void *x_18_3_10; struct __CFString {} *x_18_3_11; struct __CFString {} *x_18_3_12; struct __CFString {} *x_18_3_13; struct OZChannelTimeConverter {} *x_18_3_14; struct OZChannelImpl {} *x_18_3_15; struct OZChannelImpl {} *x_18_3_16; struct OZChannelInfo {} *x_18_3_17; struct OZChannelInfo {} *x_18_3_18; struct OZCurve {} *x_18_3_19; } x_21_2_18; } x_49_1_21; } x49; struct OZFolderElementShadows { int (**x_50_1_1)(); struct OZFactory {} *x_50_1_2; int (**x_50_1_3)(); unsigned int x_50_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_50_1_5; struct PCString {} *x_50_1_6; struct OZChannelFolder {} *x_50_1_7; unsigned long long x_50_1_8; unsigned long long x_50_1_9; void *x_50_1_10; struct __CFString {} *x_50_1_11; struct __CFString {} *x_50_1_12; struct __CFString {} *x_50_1_13; struct OZChannelTimeConverter {} *x_50_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_50_1_15; unsigned int x_50_1_16; unsigned int x_50_1_17; struct OZChannelBool { int (**x_18_2_1)(); struct OZFactory {} *x_18_2_2; int (**x_18_2_3)(); unsigned int x_18_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_18_2_5; struct PCString {} *x_18_2_6; struct OZChannelFolder {} *x_18_2_7; unsigned long long x_18_2_8; unsigned long long x_18_2_9; void *x_18_2_10; struct __CFString {} *x_18_2_11; struct __CFString {} *x_18_2_12; struct __CFString {} *x_18_2_13; struct OZChannelTimeConverter {} *x_18_2_14; struct OZChannelImpl {} *x_18_2_15; struct OZChannelImpl {} *x_18_2_16; struct OZChannelInfo {} *x_18_2_17; struct OZChannelInfo {} *x_18_2_18; struct OZCurve {} *x_18_2_19; } x_50_1_18; struct OZChannelBool { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_50_1_19; struct OZChannelBool { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_50_1_20; } x50; struct OZChannelFolder { int (**x_51_1_1)(); struct OZFactory {} *x_51_1_2; int (**x_51_1_3)(); unsigned int x_51_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_51_1_5; struct PCString {} *x_51_1_6; struct OZChannelFolder {} *x_51_1_7; unsigned long long x_51_1_8; unsigned long long x_51_1_9; void *x_51_1_10; struct __CFString {} *x_51_1_11; struct __CFString {} *x_51_1_12; struct __CFString {} *x_51_1_13; struct OZChannelTimeConverter {} *x_51_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_51_1_15; unsigned int x_51_1_16; unsigned int x_51_1_17; } x51; struct OZChannelPercent { int (**x_52_1_1)(); struct OZFactory {} *x_52_1_2; int (**x_52_1_3)(); unsigned int x_52_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_52_1_5; struct PCString {} *x_52_1_6; struct OZChannelFolder {} *x_52_1_7; unsigned long long x_52_1_8; unsigned long long x_52_1_9; void *x_52_1_10; struct __CFString {} *x_52_1_11; struct __CFString {} *x_52_1_12; struct __CFString {} *x_52_1_13; struct OZChannelTimeConverter {} *x_52_1_14; struct OZChannelImpl {} *x_52_1_15; struct OZChannelImpl {} *x_52_1_16; struct OZChannelInfo {} *x_52_1_17; struct OZChannelInfo {} *x_52_1_18; struct OZCurve {} *x_52_1_19; } x52; struct OZChannelDouble { int (**x_53_1_1)(); struct OZFactory {} *x_53_1_2; int (**x_53_1_3)(); unsigned int x_53_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_53_1_5; struct PCString {} *x_53_1_6; struct OZChannelFolder {} *x_53_1_7; unsigned long long x_53_1_8; unsigned long long x_53_1_9; void *x_53_1_10; struct __CFString {} *x_53_1_11; struct __CFString {} *x_53_1_12; struct __CFString {} *x_53_1_13; struct OZChannelTimeConverter {} *x_53_1_14; struct OZChannelImpl {} *x_53_1_15; struct OZChannelImpl {} *x_53_1_16; struct OZChannelInfo {} *x_53_1_17; struct OZChannelInfo {} *x_53_1_18; struct OZCurve {} *x_53_1_19; } x53; struct OZChannelFolder { int (**x_54_1_1)(); struct OZFactory {} *x_54_1_2; int (**x_54_1_3)(); unsigned int x_54_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_54_1_5; struct PCString {} *x_54_1_6; struct OZChannelFolder {} *x_54_1_7; unsigned long long x_54_1_8; unsigned long long x_54_1_9; void *x_54_1_10; struct __CFString {} *x_54_1_11; struct __CFString {} *x_54_1_12; struct __CFString {} *x_54_1_13; struct OZChannelTimeConverter {} *x_54_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_54_1_15; unsigned int x_54_1_16; unsigned int x_54_1_17; } x54; struct OZChannelDouble { int (**x_55_1_1)(); struct OZFactory {} *x_55_1_2; int (**x_55_1_3)(); unsigned int x_55_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_55_1_5; struct PCString {} *x_55_1_6; struct OZChannelFolder {} *x_55_1_7; unsigned long long x_55_1_8; unsigned long long x_55_1_9; void *x_55_1_10; struct __CFString {} *x_55_1_11; struct __CFString {} *x_55_1_12; struct __CFString {} *x_55_1_13; struct OZChannelTimeConverter {} *x_55_1_14; struct OZChannelImpl {} *x_55_1_15; struct OZChannelImpl {} *x_55_1_16; struct OZChannelInfo {} *x_55_1_17; struct OZChannelInfo {} *x_55_1_18; struct OZCurve {} *x_55_1_19; } x55; struct OZChannelDouble { int (**x_56_1_1)(); struct OZFactory {} *x_56_1_2; int (**x_56_1_3)(); unsigned int x_56_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_56_1_5; struct PCString {} *x_56_1_6; struct OZChannelFolder {} *x_56_1_7; unsigned long long x_56_1_8; unsigned long long x_56_1_9; void *x_56_1_10; struct __CFString {} *x_56_1_11; struct __CFString {} *x_56_1_12; struct __CFString {} *x_56_1_13; struct OZChannelTimeConverter {} *x_56_1_14; struct OZChannelImpl {} *x_56_1_15; struct OZChannelImpl {} *x_56_1_16; struct OZChannelInfo {} *x_56_1_17; struct OZChannelInfo {} *x_56_1_18; struct OZCurve {} *x_56_1_19; } x56; struct OZChannelDouble { int (**x_57_1_1)(); struct OZFactory {} *x_57_1_2; int (**x_57_1_3)(); unsigned int x_57_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_57_1_5; struct PCString {} *x_57_1_6; struct OZChannelFolder {} *x_57_1_7; unsigned long long x_57_1_8; unsigned long long x_57_1_9; void *x_57_1_10; struct __CFString {} *x_57_1_11; struct __CFString {} *x_57_1_12; struct __CFString {} *x_57_1_13; struct OZChannelTimeConverter {} *x_57_1_14; struct OZChannelImpl {} *x_57_1_15; struct OZChannelImpl {} *x_57_1_16; struct OZChannelInfo {} *x_57_1_17; struct OZChannelInfo {} *x_57_1_18; struct OZCurve {} *x_57_1_19; } x57; struct OZChannelEnum { int (**x_58_1_1)(); struct OZFactory {} *x_58_1_2; int (**x_58_1_3)(); unsigned int x_58_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_58_1_5; struct PCString {} *x_58_1_6; struct OZChannelFolder {} *x_58_1_7; unsigned long long x_58_1_8; unsigned long long x_58_1_9; void *x_58_1_10; struct __CFString {} *x_58_1_11; struct __CFString {} *x_58_1_12; struct __CFString {} *x_58_1_13; struct OZChannelTimeConverter {} *x_58_1_14; struct OZChannelImpl {} *x_58_1_15; struct OZChannelImpl {} *x_58_1_16; struct OZChannelInfo {} *x_58_1_17; struct OZChannelInfo {} *x_58_1_18; struct OZCurve {} *x_58_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_58_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_58_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_58_1_22; unsigned int x_58_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_58_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_58_1_25; } x58; struct OZChannelEnum { int (**x_59_1_1)(); struct OZFactory {} *x_59_1_2; int (**x_59_1_3)(); unsigned int x_59_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_59_1_5; struct PCString {} *x_59_1_6; struct OZChannelFolder {} *x_59_1_7; unsigned long long x_59_1_8; unsigned long long x_59_1_9; void *x_59_1_10; struct __CFString {} *x_59_1_11; struct __CFString {} *x_59_1_12; struct __CFString {} *x_59_1_13; struct OZChannelTimeConverter {} *x_59_1_14; struct OZChannelImpl {} *x_59_1_15; struct OZChannelImpl {} *x_59_1_16; struct OZChannelInfo {} *x_59_1_17; struct OZChannelInfo {} *x_59_1_18; struct OZCurve {} *x_59_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_59_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_59_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_59_1_22; unsigned int x_59_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_59_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_59_1_25; } x59; struct OZChannelFolder { int (**x_60_1_1)(); struct OZFactory {} *x_60_1_2; int (**x_60_1_3)(); unsigned int x_60_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_60_1_5; struct PCString {} *x_60_1_6; struct OZChannelFolder {} *x_60_1_7; unsigned long long x_60_1_8; unsigned long long x_60_1_9; void *x_60_1_10; struct __CFString {} *x_60_1_11; struct __CFString {} *x_60_1_12; struct __CFString {} *x_60_1_13; struct OZChannelTimeConverter {} *x_60_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_60_1_15; unsigned int x_60_1_16; unsigned int x_60_1_17; } x60; struct OZChannelColorNoAlpha { int (**x_61_1_1)(); struct OZFactory {} *x_61_1_2; int (**x_61_1_3)(); unsigned int x_61_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_61_1_5; struct PCString {} *x_61_1_6; struct OZChannelFolder {} *x_61_1_7; unsigned long long x_61_1_8; unsigned long long x_61_1_9; void *x_61_1_10; struct __CFString {} *x_61_1_11; struct __CFString {} *x_61_1_12; struct __CFString {} *x_61_1_13; struct OZChannelTimeConverter {} *x_61_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_61_1_15; unsigned int x_61_1_16; unsigned int x_61_1_17; bool x_61_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_61_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_61_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_61_1_21; struct OZChannelDouble { int (**x_22_2_1)(); struct OZFactory {} *x_22_2_2; int (**x_22_2_3)(); unsigned int x_22_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_22_2_5; struct PCString {} *x_22_2_6; struct OZChannelFolder {} *x_22_2_7; unsigned long long x_22_2_8; unsigned long long x_22_2_9; void *x_22_2_10; struct __CFString {} *x_22_2_11; struct __CFString {} *x_22_2_12; struct __CFString {} *x_22_2_13; struct OZChannelTimeConverter {} *x_22_2_14; struct OZChannelImpl {} *x_22_2_15; struct OZChannelImpl {} *x_22_2_16; struct OZChannelInfo {} *x_22_2_17; struct OZChannelInfo {} *x_22_2_18; struct OZCurve {} *x_22_2_19; } x_61_1_22; struct OZChannelEnum { int (**x_23_2_1)(); struct OZFactory {} *x_23_2_2; int (**x_23_2_3)(); unsigned int x_23_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_23_2_5; struct PCString {} *x_23_2_6; struct OZChannelFolder {} *x_23_2_7; unsigned long long x_23_2_8; unsigned long long x_23_2_9; void *x_23_2_10; struct __CFString {} *x_23_2_11; struct __CFString {} *x_23_2_12; struct __CFString {} *x_23_2_13; struct OZChannelTimeConverter {} *x_23_2_14; struct OZChannelImpl {} *x_23_2_15; struct OZChannelImpl {} *x_23_2_16; struct OZChannelInfo {} *x_23_2_17; struct OZChannelInfo {} *x_23_2_18; struct OZCurve {} *x_23_2_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_4_1; } x_20_3_1; } x_23_2_20; struct PCString { struct __CFString {} *x_21_3_1; } x_23_2_21; struct vector<int, std::__1::allocator<int> > { int *x_22_3_1; int *x_22_3_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_4_1; } x_22_3_3; } x_23_2_22; unsigned int x_23_2_23; struct PCString { struct __CFString {} *x_24_3_1; } x_23_2_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_3_1; struct PCString {} *x_25_3_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_4_1; } x_25_3_3; } x_23_2_25; } x_61_1_23; } x61; struct OZChannelPercent { int (**x_62_1_1)(); struct OZFactory {} *x_62_1_2; int (**x_62_1_3)(); unsigned int x_62_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_62_1_5; struct PCString {} *x_62_1_6; struct OZChannelFolder {} *x_62_1_7; unsigned long long x_62_1_8; unsigned long long x_62_1_9; void *x_62_1_10; struct __CFString {} *x_62_1_11; struct __CFString {} *x_62_1_12; struct __CFString {} *x_62_1_13; struct OZChannelTimeConverter {} *x_62_1_14; struct OZChannelImpl {} *x_62_1_15; struct OZChannelImpl {} *x_62_1_16; struct OZChannelInfo {} *x_62_1_17; struct OZChannelInfo {} *x_62_1_18; struct OZCurve {} *x_62_1_19; } x62; struct OZChannelDouble { int (**x_63_1_1)(); struct OZFactory {} *x_63_1_2; int (**x_63_1_3)(); unsigned int x_63_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_63_1_5; struct PCString {} *x_63_1_6; struct OZChannelFolder {} *x_63_1_7; unsigned long long x_63_1_8; unsigned long long x_63_1_9; void *x_63_1_10; struct __CFString {} *x_63_1_11; struct __CFString {} *x_63_1_12; struct __CFString {} *x_63_1_13; struct OZChannelTimeConverter {} *x_63_1_14; struct OZChannelImpl {} *x_63_1_15; struct OZChannelImpl {} *x_63_1_16; struct OZChannelInfo {} *x_63_1_17; struct OZChannelInfo {} *x_63_1_18; struct OZCurve {} *x_63_1_19; } x63; struct OZChannelDouble { int (**x_64_1_1)(); struct OZFactory {} *x_64_1_2; int (**x_64_1_3)(); unsigned int x_64_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_64_1_5; struct PCString {} *x_64_1_6; struct OZChannelFolder {} *x_64_1_7; unsigned long long x_64_1_8; unsigned long long x_64_1_9; void *x_64_1_10; struct __CFString {} *x_64_1_11; struct __CFString {} *x_64_1_12; struct __CFString {} *x_64_1_13; struct OZChannelTimeConverter {} *x_64_1_14; struct OZChannelImpl {} *x_64_1_15; struct OZChannelImpl {} *x_64_1_16; struct OZChannelInfo {} *x_64_1_17; struct OZChannelInfo {} *x_64_1_18; struct OZCurve {} *x_64_1_19; } x64; struct OZChannelAngle { int (**x_65_1_1)(); struct OZFactory {} *x_65_1_2; int (**x_65_1_3)(); unsigned int x_65_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_65_1_5; struct PCString {} *x_65_1_6; struct OZChannelFolder {} *x_65_1_7; unsigned long long x_65_1_8; unsigned long long x_65_1_9; void *x_65_1_10; struct __CFString {} *x_65_1_11; struct __CFString {} *x_65_1_12; struct __CFString {} *x_65_1_13; struct OZChannelTimeConverter {} *x_65_1_14; struct OZChannelImpl {} *x_65_1_15; struct OZChannelImpl {} *x_65_1_16; struct OZChannelInfo {} *x_65_1_17; struct OZChannelInfo {} *x_65_1_18; struct OZCurve {} *x_65_1_19; } x65; struct OZChannelBool { int (**x_66_1_1)(); struct OZFactory {} *x_66_1_2; int (**x_66_1_3)(); unsigned int x_66_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_66_1_5; struct PCString {} *x_66_1_6; struct OZChannelFolder {} *x_66_1_7; unsigned long long x_66_1_8; unsigned long long x_66_1_9; void *x_66_1_10; struct __CFString {} *x_66_1_11; struct __CFString {} *x_66_1_12; struct __CFString {} *x_66_1_13; struct OZChannelTimeConverter {} *x_66_1_14; struct OZChannelImpl {} *x_66_1_15; struct OZChannelImpl {} *x_66_1_16; struct OZChannelInfo {} *x_66_1_17; struct OZChannelInfo {} *x_66_1_18; struct OZCurve {} *x_66_1_19; } x66; struct OZChannelQuad { int (**x_67_1_1)(); struct OZFactory {} *x_67_1_2; int (**x_67_1_3)(); unsigned int x_67_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_67_1_5; struct PCString {} *x_67_1_6; struct OZChannelFolder {} *x_67_1_7; unsigned long long x_67_1_8; unsigned long long x_67_1_9; void *x_67_1_10; struct __CFString {} *x_67_1_11; struct __CFString {} *x_67_1_12; struct __CFString {} *x_67_1_13; struct OZChannelTimeConverter {} *x_67_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_67_1_15; unsigned int x_67_1_16; unsigned int x_67_1_17; bool x_67_1_18; struct OZChannelPosition { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_19_2_15; unsigned int x_19_2_16; unsigned int x_19_2_17; bool x_19_2_18; struct OZChannelDouble { int (**x_19_3_1)(); struct OZFactory {} *x_19_3_2; int (**x_19_3_3)(); unsigned int x_19_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_19_3_5; struct PCString {} *x_19_3_6; struct OZChannelFolder {} *x_19_3_7; unsigned long long x_19_3_8; unsigned long long x_19_3_9; void *x_19_3_10; struct __CFString {} *x_19_3_11; struct __CFString {} *x_19_3_12; struct __CFString {} *x_19_3_13; struct OZChannelTimeConverter {} *x_19_3_14; struct OZChannelImpl {} *x_19_3_15; struct OZChannelImpl {} *x_19_3_16; struct OZChannelInfo {} *x_19_3_17; struct OZChannelInfo {} *x_19_3_18; struct OZCurve {} *x_19_3_19; } x_19_2_19; struct OZChannelDouble { int (**x_20_3_1)(); struct OZFactory {} *x_20_3_2; int (**x_20_3_3)(); unsigned int x_20_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_20_3_5; struct PCString {} *x_20_3_6; struct OZChannelFolder {} *x_20_3_7; unsigned long long x_20_3_8; unsigned long long x_20_3_9; void *x_20_3_10; struct __CFString {} *x_20_3_11; struct __CFString {} *x_20_3_12; struct __CFString {} *x_20_3_13; struct OZChannelTimeConverter {} *x_20_3_14; struct OZChannelImpl {} *x_20_3_15; struct OZChannelImpl {} *x_20_3_16; struct OZChannelInfo {} *x_20_3_17; struct OZChannelInfo {} *x_20_3_18; struct OZCurve {} *x_20_3_19; } x_19_2_20; bool x_19_2_21; struct PCMatrix44Tmpl<double> { double x_22_3_1[4][4]; } x_19_2_22; struct vector<double, std::__1::allocator<double> > { double *x_23_3_1; double *x_23_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_23_3_3; } x_19_2_23; struct vector<double, std::__1::allocator<double> > { double *x_24_3_1; double *x_24_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_24_3_3; } x_19_2_24; struct vector<double, std::__1::allocator<double> > { double *x_25_3_1; double *x_25_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_25_3_3; } x_19_2_25; struct vector<double, std::__1::allocator<double> > { double *x_26_3_1; double *x_26_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_26_3_3; } x_19_2_26; struct vector<double, std::__1::allocator<double> > { double *x_27_3_1; double *x_27_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_27_3_3; } x_19_2_27; unsigned int x_19_2_28; struct PCSpinLock { int x_29_3_1; } x_19_2_29; } x_67_1_19; struct OZChannelPosition { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_20_2_15; unsigned int x_20_2_16; unsigned int x_20_2_17; bool x_20_2_18; struct OZChannelDouble { int (**x_19_3_1)(); struct OZFactory {} *x_19_3_2; int (**x_19_3_3)(); unsigned int x_19_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_19_3_5; struct PCString {} *x_19_3_6; struct OZChannelFolder {} *x_19_3_7; unsigned long long x_19_3_8; unsigned long long x_19_3_9; void *x_19_3_10; struct __CFString {} *x_19_3_11; struct __CFString {} *x_19_3_12; struct __CFString {} *x_19_3_13; struct OZChannelTimeConverter {} *x_19_3_14; struct OZChannelImpl {} *x_19_3_15; struct OZChannelImpl {} *x_19_3_16; struct OZChannelInfo {} *x_19_3_17; struct OZChannelInfo {} *x_19_3_18; struct OZCurve {} *x_19_3_19; } x_20_2_19; struct OZChannelDouble { int (**x_20_3_1)(); struct OZFactory {} *x_20_3_2; int (**x_20_3_3)(); unsigned int x_20_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_20_3_5; struct PCString {} *x_20_3_6; struct OZChannelFolder {} *x_20_3_7; unsigned long long x_20_3_8; unsigned long long x_20_3_9; void *x_20_3_10; struct __CFString {} *x_20_3_11; struct __CFString {} *x_20_3_12; struct __CFString {} *x_20_3_13; struct OZChannelTimeConverter {} *x_20_3_14; struct OZChannelImpl {} *x_20_3_15; struct OZChannelImpl {} *x_20_3_16; struct OZChannelInfo {} *x_20_3_17; struct OZChannelInfo {} *x_20_3_18; struct OZCurve {} *x_20_3_19; } x_20_2_20; bool x_20_2_21; struct PCMatrix44Tmpl<double> { double x_22_3_1[4][4]; } x_20_2_22; struct vector<double, std::__1::allocator<double> > { double *x_23_3_1; double *x_23_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_23_3_3; } x_20_2_23; struct vector<double, std::__1::allocator<double> > { double *x_24_3_1; double *x_24_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_24_3_3; } x_20_2_24; struct vector<double, std::__1::allocator<double> > { double *x_25_3_1; double *x_25_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_25_3_3; } x_20_2_25; struct vector<double, std::__1::allocator<double> > { double *x_26_3_1; double *x_26_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_26_3_3; } x_20_2_26; struct vector<double, std::__1::allocator<double> > { double *x_27_3_1; double *x_27_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_27_3_3; } x_20_2_27; unsigned int x_20_2_28; struct PCSpinLock { int x_29_3_1; } x_20_2_29; } x_67_1_20; struct OZChannelPosition { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_21_2_15; unsigned int x_21_2_16; unsigned int x_21_2_17; bool x_21_2_18; struct OZChannelDouble { int (**x_19_3_1)(); struct OZFactory {} *x_19_3_2; int (**x_19_3_3)(); unsigned int x_19_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_19_3_5; struct PCString {} *x_19_3_6; struct OZChannelFolder {} *x_19_3_7; unsigned long long x_19_3_8; unsigned long long x_19_3_9; void *x_19_3_10; struct __CFString {} *x_19_3_11; struct __CFString {} *x_19_3_12; struct __CFString {} *x_19_3_13; struct OZChannelTimeConverter {} *x_19_3_14; struct OZChannelImpl {} *x_19_3_15; struct OZChannelImpl {} *x_19_3_16; struct OZChannelInfo {} *x_19_3_17; struct OZChannelInfo {} *x_19_3_18; struct OZCurve {} *x_19_3_19; } x_21_2_19; struct OZChannelDouble { int (**x_20_3_1)(); struct OZFactory {} *x_20_3_2; int (**x_20_3_3)(); unsigned int x_20_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_20_3_5; struct PCString {} *x_20_3_6; struct OZChannelFolder {} *x_20_3_7; unsigned long long x_20_3_8; unsigned long long x_20_3_9; void *x_20_3_10; struct __CFString {} *x_20_3_11; struct __CFString {} *x_20_3_12; struct __CFString {} *x_20_3_13; struct OZChannelTimeConverter {} *x_20_3_14; struct OZChannelImpl {} *x_20_3_15; struct OZChannelImpl {} *x_20_3_16; struct OZChannelInfo {} *x_20_3_17; struct OZChannelInfo {} *x_20_3_18; struct OZCurve {} *x_20_3_19; } x_21_2_20; bool x_21_2_21; struct PCMatrix44Tmpl<double> { double x_22_3_1[4][4]; } x_21_2_22; struct vector<double, std::__1::allocator<double> > { double *x_23_3_1; double *x_23_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_23_3_3; } x_21_2_23; struct vector<double, std::__1::allocator<double> > { double *x_24_3_1; double *x_24_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_24_3_3; } x_21_2_24; struct vector<double, std::__1::allocator<double> > { double *x_25_3_1; double *x_25_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_25_3_3; } x_21_2_25; struct vector<double, std::__1::allocator<double> > { double *x_26_3_1; double *x_26_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_26_3_3; } x_21_2_26; struct vector<double, std::__1::allocator<double> > { double *x_27_3_1; double *x_27_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_27_3_3; } x_21_2_27; unsigned int x_21_2_28; struct PCSpinLock { int x_29_3_1; } x_21_2_29; } x_67_1_21; struct OZChannelPosition { int (**x_22_2_1)(); struct OZFactory {} *x_22_2_2; int (**x_22_2_3)(); unsigned int x_22_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_22_2_5; struct PCString {} *x_22_2_6; struct OZChannelFolder {} *x_22_2_7; unsigned long long x_22_2_8; unsigned long long x_22_2_9; void *x_22_2_10; struct __CFString {} *x_22_2_11; struct __CFString {} *x_22_2_12; struct __CFString {} *x_22_2_13; struct OZChannelTimeConverter {} *x_22_2_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_22_2_15; unsigned int x_22_2_16; unsigned int x_22_2_17; bool x_22_2_18; struct OZChannelDouble { int (**x_19_3_1)(); struct OZFactory {} *x_19_3_2; int (**x_19_3_3)(); unsigned int x_19_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_19_3_5; struct PCString {} *x_19_3_6; struct OZChannelFolder {} *x_19_3_7; unsigned long long x_19_3_8; unsigned long long x_19_3_9; void *x_19_3_10; struct __CFString {} *x_19_3_11; struct __CFString {} *x_19_3_12; struct __CFString {} *x_19_3_13; struct OZChannelTimeConverter {} *x_19_3_14; struct OZChannelImpl {} *x_19_3_15; struct OZChannelImpl {} *x_19_3_16; struct OZChannelInfo {} *x_19_3_17; struct OZChannelInfo {} *x_19_3_18; struct OZCurve {} *x_19_3_19; } x_22_2_19; struct OZChannelDouble { int (**x_20_3_1)(); struct OZFactory {} *x_20_3_2; int (**x_20_3_3)(); unsigned int x_20_3_4; struct PCString { struct __CFString {} *x_5_4_1; } x_20_3_5; struct PCString {} *x_20_3_6; struct OZChannelFolder {} *x_20_3_7; unsigned long long x_20_3_8; unsigned long long x_20_3_9; void *x_20_3_10; struct __CFString {} *x_20_3_11; struct __CFString {} *x_20_3_12; struct __CFString {} *x_20_3_13; struct OZChannelTimeConverter {} *x_20_3_14; struct OZChannelImpl {} *x_20_3_15; struct OZChannelImpl {} *x_20_3_16; struct OZChannelInfo {} *x_20_3_17; struct OZChannelInfo {} *x_20_3_18; struct OZCurve {} *x_20_3_19; } x_22_2_20; bool x_22_2_21; struct PCMatrix44Tmpl<double> { double x_22_3_1[4][4]; } x_22_2_22; struct vector<double, std::__1::allocator<double> > { double *x_23_3_1; double *x_23_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_23_3_3; } x_22_2_23; struct vector<double, std::__1::allocator<double> > { double *x_24_3_1; double *x_24_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_24_3_3; } x_22_2_24; struct vector<double, std::__1::allocator<double> > { double *x_25_3_1; double *x_25_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_25_3_3; } x_22_2_25; struct vector<double, std::__1::allocator<double> > { double *x_26_3_1; double *x_26_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_26_3_3; } x_22_2_26; struct vector<double, std::__1::allocator<double> > { double *x_27_3_1; double *x_27_3_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_4_1; } x_27_3_3; } x_22_2_27; unsigned int x_22_2_28; struct PCSpinLock { int x_29_3_1; } x_22_2_29; } x_67_1_22; } x67; struct OZChannelCrop { int (**x_68_1_1)(); struct OZFactory {} *x_68_1_2; int (**x_68_1_3)(); unsigned int x_68_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_68_1_5; struct PCString {} *x_68_1_6; struct OZChannelFolder {} *x_68_1_7; unsigned long long x_68_1_8; unsigned long long x_68_1_9; void *x_68_1_10; struct __CFString {} *x_68_1_11; struct __CFString {} *x_68_1_12; struct __CFString {} *x_68_1_13; struct OZChannelTimeConverter {} *x_68_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_68_1_15; unsigned int x_68_1_16; unsigned int x_68_1_17; bool x_68_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_68_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_68_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_68_1_21; struct OZChannelDouble { int (**x_22_2_1)(); struct OZFactory {} *x_22_2_2; int (**x_22_2_3)(); unsigned int x_22_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_22_2_5; struct PCString {} *x_22_2_6; struct OZChannelFolder {} *x_22_2_7; unsigned long long x_22_2_8; unsigned long long x_22_2_9; void *x_22_2_10; struct __CFString {} *x_22_2_11; struct __CFString {} *x_22_2_12; struct __CFString {} *x_22_2_13; struct OZChannelTimeConverter {} *x_22_2_14; struct OZChannelImpl {} *x_22_2_15; struct OZChannelImpl {} *x_22_2_16; struct OZChannelInfo {} *x_22_2_17; struct OZChannelInfo {} *x_22_2_18; struct OZCurve {} *x_22_2_19; } x_68_1_22; } x68; struct OZChannelFolder { int (**x_69_1_1)(); struct OZFactory {} *x_69_1_2; int (**x_69_1_3)(); unsigned int x_69_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_69_1_5; struct PCString {} *x_69_1_6; struct OZChannelFolder {} *x_69_1_7; unsigned long long x_69_1_8; unsigned long long x_69_1_9; void *x_69_1_10; struct __CFString {} *x_69_1_11; struct __CFString {} *x_69_1_12; struct __CFString {} *x_69_1_13; struct OZChannelTimeConverter {} *x_69_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_69_1_15; unsigned int x_69_1_16; unsigned int x_69_1_17; } x69; unsigned int x70; unsigned int x71; unsigned int x72; struct list<OZSceneNode *, std::__1::allocator<OZSceneNode *> > { struct __list_node_base<OZSceneNode *, void *> { struct __list_node_base<OZSceneNode *, void *> {} *x_1_2_1; struct __list_node_base<OZSceneNode *, void *> {} *x_1_2_2; } x_73_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZSceneNode *, void *> > > { unsigned long long x_2_2_1; } x_73_1_2; } x73; struct OZChannelFolder { int (**x_74_1_1)(); struct OZFactory {} *x_74_1_2; int (**x_74_1_3)(); unsigned int x_74_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_74_1_5; struct PCString {} *x_74_1_6; struct OZChannelFolder {} *x_74_1_7; unsigned long long x_74_1_8; unsigned long long x_74_1_9; void *x_74_1_10; struct __CFString {} *x_74_1_11; struct __CFString {} *x_74_1_12; struct __CFString {} *x_74_1_13; struct OZChannelTimeConverter {} *x_74_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_74_1_15; unsigned int x_74_1_16; unsigned int x_74_1_17; } x74; struct OZChanFootageRef { int (**x_75_1_1)(); struct OZFactory {} *x_75_1_2; int (**x_75_1_3)(); unsigned int x_75_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_75_1_5; struct PCString {} *x_75_1_6; struct OZChannelFolder {} *x_75_1_7; unsigned long long x_75_1_8; unsigned long long x_75_1_9; void *x_75_1_10; struct __CFString {} *x_75_1_11; struct __CFString {} *x_75_1_12; struct __CFString {} *x_75_1_13; struct OZChannelTimeConverter {} *x_75_1_14; struct OZChannelImpl {} *x_75_1_15; struct OZChannelImpl {} *x_75_1_16; struct OZChannelInfo {} *x_75_1_17; struct OZChannelInfo {} *x_75_1_18; struct OZCurve {} *x_75_1_19; bool x_75_1_20; bool x_75_1_21; bool x_75_1_22; bool x_75_1_23; bool x_75_1_24; bool x_75_1_25; } x75; struct PCHash128 { unsigned int x_76_1_1[4]; } x76; unsigned int x77; unsigned int x78; struct OZChannelFolder { int (**x_79_1_1)(); struct OZFactory {} *x_79_1_2; int (**x_79_1_3)(); unsigned int x_79_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_79_1_5; struct PCString {} *x_79_1_6; struct OZChannelFolder {} *x_79_1_7; unsigned long long x_79_1_8; unsigned long long x_79_1_9; void *x_79_1_10; struct __CFString {} *x_79_1_11; struct __CFString {} *x_79_1_12; struct __CFString {} *x_79_1_13; struct OZChannelTimeConverter {} *x_79_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_79_1_15; unsigned int x_79_1_16; unsigned int x_79_1_17; } x79; struct OZChannelFolder { int (**x_80_1_1)(); struct OZFactory {} *x_80_1_2; int (**x_80_1_3)(); unsigned int x_80_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_80_1_5; struct PCString {} *x_80_1_6; struct OZChannelFolder {} *x_80_1_7; unsigned long long x_80_1_8; unsigned long long x_80_1_9; void *x_80_1_10; struct __CFString {} *x_80_1_11; struct __CFString {} *x_80_1_12; struct __CFString {} *x_80_1_13; struct OZChannelTimeConverter {} *x_80_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_80_1_15; unsigned int x_80_1_16; unsigned int x_80_1_17; } x80; struct OZChannelEnum { int (**x_81_1_1)(); struct OZFactory {} *x_81_1_2; int (**x_81_1_3)(); unsigned int x_81_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_81_1_5; struct PCString {} *x_81_1_6; struct OZChannelFolder {} *x_81_1_7; unsigned long long x_81_1_8; unsigned long long x_81_1_9; void *x_81_1_10; struct __CFString {} *x_81_1_11; struct __CFString {} *x_81_1_12; struct __CFString {} *x_81_1_13; struct OZChannelTimeConverter {} *x_81_1_14; struct OZChannelImpl {} *x_81_1_15; struct OZChannelImpl {} *x_81_1_16; struct OZChannelInfo {} *x_81_1_17; struct OZChannelInfo {} *x_81_1_18; struct OZCurve {} *x_81_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_81_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_81_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_81_1_22; unsigned int x_81_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_81_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_81_1_25; } x81; struct OZChannelEnum { int (**x_82_1_1)(); struct OZFactory {} *x_82_1_2; int (**x_82_1_3)(); unsigned int x_82_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_82_1_5; struct PCString {} *x_82_1_6; struct OZChannelFolder {} *x_82_1_7; unsigned long long x_82_1_8; unsigned long long x_82_1_9; void *x_82_1_10; struct __CFString {} *x_82_1_11; struct __CFString {} *x_82_1_12; struct __CFString {} *x_82_1_13; struct OZChannelTimeConverter {} *x_82_1_14; struct OZChannelImpl {} *x_82_1_15; struct OZChannelImpl {} *x_82_1_16; struct OZChannelInfo {} *x_82_1_17; struct OZChannelInfo {} *x_82_1_18; struct OZCurve {} *x_82_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_82_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_82_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_82_1_22; unsigned int x_82_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_82_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_82_1_25; } x82; struct OZChannelBool { int (**x_83_1_1)(); struct OZFactory {} *x_83_1_2; int (**x_83_1_3)(); unsigned int x_83_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_83_1_5; struct PCString {} *x_83_1_6; struct OZChannelFolder {} *x_83_1_7; unsigned long long x_83_1_8; unsigned long long x_83_1_9; void *x_83_1_10; struct __CFString {} *x_83_1_11; struct __CFString {} *x_83_1_12; struct __CFString {} *x_83_1_13; struct OZChannelTimeConverter {} *x_83_1_14; struct OZChannelImpl {} *x_83_1_15; struct OZChannelImpl {} *x_83_1_16; struct OZChannelInfo {} *x_83_1_17; struct OZChannelInfo {} *x_83_1_18; struct OZCurve {} *x_83_1_19; } x83; struct OZChannelEnum { int (**x_84_1_1)(); struct OZFactory {} *x_84_1_2; int (**x_84_1_3)(); unsigned int x_84_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_84_1_5; struct PCString {} *x_84_1_6; struct OZChannelFolder {} *x_84_1_7; unsigned long long x_84_1_8; unsigned long long x_84_1_9; void *x_84_1_10; struct __CFString {} *x_84_1_11; struct __CFString {} *x_84_1_12; struct __CFString {} *x_84_1_13; struct OZChannelTimeConverter {} *x_84_1_14; struct OZChannelImpl {} *x_84_1_15; struct OZChannelImpl {} *x_84_1_16; struct OZChannelInfo {} *x_84_1_17; struct OZChannelInfo {} *x_84_1_18; struct OZCurve {} *x_84_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_84_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_84_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_84_1_22; unsigned int x_84_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_84_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_84_1_25; } x84; struct OZChannelUint32 { int (**x_85_1_1)(); struct OZFactory {} *x_85_1_2; int (**x_85_1_3)(); unsigned int x_85_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_85_1_5; struct PCString {} *x_85_1_6; struct OZChannelFolder {} *x_85_1_7; unsigned long long x_85_1_8; unsigned long long x_85_1_9; void *x_85_1_10; struct __CFString {} *x_85_1_11; struct __CFString {} *x_85_1_12; struct __CFString {} *x_85_1_13; struct OZChannelTimeConverter {} *x_85_1_14; struct OZChannelImpl {} *x_85_1_15; struct OZChannelImpl {} *x_85_1_16; struct OZChannelInfo {} *x_85_1_17; struct OZChannelInfo {} *x_85_1_18; struct OZCurve {} *x_85_1_19; } x85; struct OZChannelUint32 { int (**x_86_1_1)(); struct OZFactory {} *x_86_1_2; int (**x_86_1_3)(); unsigned int x_86_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_86_1_5; struct PCString {} *x_86_1_6; struct OZChannelFolder {} *x_86_1_7; unsigned long long x_86_1_8; unsigned long long x_86_1_9; void *x_86_1_10; struct __CFString {} *x_86_1_11; struct __CFString {} *x_86_1_12; struct __CFString {} *x_86_1_13; struct OZChannelTimeConverter {} *x_86_1_14; struct OZChannelImpl {} *x_86_1_15; struct OZChannelImpl {} *x_86_1_16; struct OZChannelInfo {} *x_86_1_17; struct OZChannelInfo {} *x_86_1_18; struct OZCurve {} *x_86_1_19; } x86; struct OZChannelUint32 { int (**x_87_1_1)(); struct OZFactory {} *x_87_1_2; int (**x_87_1_3)(); unsigned int x_87_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_87_1_5; struct PCString {} *x_87_1_6; struct OZChannelFolder {} *x_87_1_7; unsigned long long x_87_1_8; unsigned long long x_87_1_9; void *x_87_1_10; struct __CFString {} *x_87_1_11; struct __CFString {} *x_87_1_12; struct __CFString {} *x_87_1_13; struct OZChannelTimeConverter {} *x_87_1_14; struct OZChannelImpl {} *x_87_1_15; struct OZChannelImpl {} *x_87_1_16; struct OZChannelInfo {} *x_87_1_17; struct OZChannelInfo {} *x_87_1_18; struct OZCurve {} *x_87_1_19; } x87; struct OZChannelUint32 { int (**x_88_1_1)(); struct OZFactory {} *x_88_1_2; int (**x_88_1_3)(); unsigned int x_88_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_88_1_5; struct PCString {} *x_88_1_6; struct OZChannelFolder {} *x_88_1_7; unsigned long long x_88_1_8; unsigned long long x_88_1_9; void *x_88_1_10; struct __CFString {} *x_88_1_11; struct __CFString {} *x_88_1_12; struct __CFString {} *x_88_1_13; struct OZChannelTimeConverter {} *x_88_1_14; struct OZChannelImpl {} *x_88_1_15; struct OZChannelImpl {} *x_88_1_16; struct OZChannelInfo {} *x_88_1_17; struct OZChannelInfo {} *x_88_1_18; struct OZCurve {} *x_88_1_19; } x88; struct OZChannelPercent { int (**x_89_1_1)(); struct OZFactory {} *x_89_1_2; int (**x_89_1_3)(); unsigned int x_89_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_89_1_5; struct PCString {} *x_89_1_6; struct OZChannelFolder {} *x_89_1_7; unsigned long long x_89_1_8; unsigned long long x_89_1_9; void *x_89_1_10; struct __CFString {} *x_89_1_11; struct __CFString {} *x_89_1_12; struct __CFString {} *x_89_1_13; struct OZChannelTimeConverter {} *x_89_1_14; struct OZChannelImpl {} *x_89_1_15; struct OZChannelImpl {} *x_89_1_16; struct OZChannelInfo {} *x_89_1_17; struct OZChannelInfo {} *x_89_1_18; struct OZCurve {} *x_89_1_19; } x89; struct OZChannelPercent { int (**x_90_1_1)(); struct OZFactory {} *x_90_1_2; int (**x_90_1_3)(); unsigned int x_90_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_90_1_5; struct PCString {} *x_90_1_6; struct OZChannelFolder {} *x_90_1_7; unsigned long long x_90_1_8; unsigned long long x_90_1_9; void *x_90_1_10; struct __CFString {} *x_90_1_11; struct __CFString {} *x_90_1_12; struct __CFString {} *x_90_1_13; struct OZChannelTimeConverter {} *x_90_1_14; struct OZChannelImpl {} *x_90_1_15; struct OZChannelImpl {} *x_90_1_16; struct OZChannelInfo {} *x_90_1_17; struct OZChannelInfo {} *x_90_1_18; struct OZCurve {} *x_90_1_19; } x90; struct OZChannelPercent { int (**x_91_1_1)(); struct OZFactory {} *x_91_1_2; int (**x_91_1_3)(); unsigned int x_91_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_91_1_5; struct PCString {} *x_91_1_6; struct OZChannelFolder {} *x_91_1_7; unsigned long long x_91_1_8; unsigned long long x_91_1_9; void *x_91_1_10; struct __CFString {} *x_91_1_11; struct __CFString {} *x_91_1_12; struct __CFString {} *x_91_1_13; struct OZChannelTimeConverter {} *x_91_1_14; struct OZChannelImpl {} *x_91_1_15; struct OZChannelImpl {} *x_91_1_16; struct OZChannelInfo {} *x_91_1_17; struct OZChannelInfo {} *x_91_1_18; struct OZCurve {} *x_91_1_19; } x91; struct OZChannelEnum { int (**x_92_1_1)(); struct OZFactory {} *x_92_1_2; int (**x_92_1_3)(); unsigned int x_92_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_92_1_5; struct PCString {} *x_92_1_6; struct OZChannelFolder {} *x_92_1_7; unsigned long long x_92_1_8; unsigned long long x_92_1_9; void *x_92_1_10; struct __CFString {} *x_92_1_11; struct __CFString {} *x_92_1_12; struct __CFString {} *x_92_1_13; struct OZChannelTimeConverter {} *x_92_1_14; struct OZChannelImpl {} *x_92_1_15; struct OZChannelImpl {} *x_92_1_16; struct OZChannelInfo {} *x_92_1_17; struct OZChannelInfo {} *x_92_1_18; struct OZCurve {} *x_92_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_92_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_92_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_92_1_22; unsigned int x_92_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_92_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_92_1_25; } x92; struct OZChannelEnum { int (**x_93_1_1)(); struct OZFactory {} *x_93_1_2; int (**x_93_1_3)(); unsigned int x_93_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_93_1_5; struct PCString {} *x_93_1_6; struct OZChannelFolder {} *x_93_1_7; unsigned long long x_93_1_8; unsigned long long x_93_1_9; void *x_93_1_10; struct __CFString {} *x_93_1_11; struct __CFString {} *x_93_1_12; struct __CFString {} *x_93_1_13; struct OZChannelTimeConverter {} *x_93_1_14; struct OZChannelImpl {} *x_93_1_15; struct OZChannelImpl {} *x_93_1_16; struct OZChannelInfo {} *x_93_1_17; struct OZChannelInfo {} *x_93_1_18; struct OZCurve {} *x_93_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_93_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_93_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_93_1_22; unsigned int x_93_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_93_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_93_1_25; } x93; struct OZChannelEnum { int (**x_94_1_1)(); struct OZFactory {} *x_94_1_2; int (**x_94_1_3)(); unsigned int x_94_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_94_1_5; struct PCString {} *x_94_1_6; struct OZChannelFolder {} *x_94_1_7; unsigned long long x_94_1_8; unsigned long long x_94_1_9; void *x_94_1_10; struct __CFString {} *x_94_1_11; struct __CFString {} *x_94_1_12; struct __CFString {} *x_94_1_13; struct OZChannelTimeConverter {} *x_94_1_14; struct OZChannelImpl {} *x_94_1_15; struct OZChannelImpl {} *x_94_1_16; struct OZChannelInfo {} *x_94_1_17; struct OZChannelInfo {} *x_94_1_18; struct OZCurve {} *x_94_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_94_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_94_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_94_1_22; unsigned int x_94_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_94_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_94_1_25; } x94; struct OZChannelEnum { int (**x_95_1_1)(); struct OZFactory {} *x_95_1_2; int (**x_95_1_3)(); unsigned int x_95_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_95_1_5; struct PCString {} *x_95_1_6; struct OZChannelFolder {} *x_95_1_7; unsigned long long x_95_1_8; unsigned long long x_95_1_9; void *x_95_1_10; struct __CFString {} *x_95_1_11; struct __CFString {} *x_95_1_12; struct __CFString {} *x_95_1_13; struct OZChannelTimeConverter {} *x_95_1_14; struct OZChannelImpl {} *x_95_1_15; struct OZChannelImpl {} *x_95_1_16; struct OZChannelInfo {} *x_95_1_17; struct OZChannelInfo {} *x_95_1_18; struct OZCurve {} *x_95_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_95_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_95_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_95_1_22; unsigned int x_95_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_95_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_95_1_25; } x95; struct OZChannelEnum { int (**x_96_1_1)(); struct OZFactory {} *x_96_1_2; int (**x_96_1_3)(); unsigned int x_96_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_96_1_5; struct PCString {} *x_96_1_6; struct OZChannelFolder {} *x_96_1_7; unsigned long long x_96_1_8; unsigned long long x_96_1_9; void *x_96_1_10; struct __CFString {} *x_96_1_11; struct __CFString {} *x_96_1_12; struct __CFString {} *x_96_1_13; struct OZChannelTimeConverter {} *x_96_1_14; struct OZChannelImpl {} *x_96_1_15; struct OZChannelImpl {} *x_96_1_16; struct OZChannelInfo {} *x_96_1_17; struct OZChannelInfo {} *x_96_1_18; struct OZCurve {} *x_96_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_96_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_96_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_96_1_22; unsigned int x_96_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_96_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_96_1_25; } x96; struct OZChannelEnum { int (**x_97_1_1)(); struct OZFactory {} *x_97_1_2; int (**x_97_1_3)(); unsigned int x_97_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_97_1_5; struct PCString {} *x_97_1_6; struct OZChannelFolder {} *x_97_1_7; unsigned long long x_97_1_8; unsigned long long x_97_1_9; void *x_97_1_10; struct __CFString {} *x_97_1_11; struct __CFString {} *x_97_1_12; struct __CFString {} *x_97_1_13; struct OZChannelTimeConverter {} *x_97_1_14; struct OZChannelImpl {} *x_97_1_15; struct OZChannelImpl {} *x_97_1_16; struct OZChannelInfo {} *x_97_1_17; struct OZChannelInfo {} *x_97_1_18; struct OZCurve {} *x_97_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_97_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_97_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_97_1_22; unsigned int x_97_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_97_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_97_1_25; } x97; struct OZChannelEnum { int (**x_98_1_1)(); struct OZFactory {} *x_98_1_2; int (**x_98_1_3)(); unsigned int x_98_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_98_1_5; struct PCString {} *x_98_1_6; struct OZChannelFolder {} *x_98_1_7; unsigned long long x_98_1_8; unsigned long long x_98_1_9; void *x_98_1_10; struct __CFString {} *x_98_1_11; struct __CFString {} *x_98_1_12; struct __CFString {} *x_98_1_13; struct OZChannelTimeConverter {} *x_98_1_14; struct OZChannelImpl {} *x_98_1_15; struct OZChannelImpl {} *x_98_1_16; struct OZChannelInfo {} *x_98_1_17; struct OZChannelInfo {} *x_98_1_18; struct OZCurve {} *x_98_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_98_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_98_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_98_1_22; unsigned int x_98_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_98_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_98_1_25; } x98; struct OZChannelBool { int (**x_99_1_1)(); struct OZFactory {} *x_99_1_2; int (**x_99_1_3)(); unsigned int x_99_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_99_1_5; struct PCString {} *x_99_1_6; struct OZChannelFolder {} *x_99_1_7; unsigned long long x_99_1_8; unsigned long long x_99_1_9; void *x_99_1_10; struct __CFString {} *x_99_1_11; struct __CFString {} *x_99_1_12; struct __CFString {} *x_99_1_13; struct OZChannelTimeConverter {} *x_99_1_14; struct OZChannelImpl {} *x_99_1_15; struct OZChannelImpl {} *x_99_1_16; struct OZChannelInfo {} *x_99_1_17; struct OZChannelInfo {} *x_99_1_18; struct OZCurve {} *x_99_1_19; } x99; struct OZChannelPercent { int (**x_100_1_1)(); struct OZFactory {} *x_100_1_2; int (**x_100_1_3)(); unsigned int x_100_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_100_1_5; struct PCString {} *x_100_1_6; struct OZChannelFolder {} *x_100_1_7; unsigned long long x_100_1_8; unsigned long long x_100_1_9; void *x_100_1_10; struct __CFString {} *x_100_1_11; struct __CFString {} *x_100_1_12; struct __CFString {} *x_100_1_13; struct OZChannelTimeConverter {} *x_100_1_14; struct OZChannelImpl {} *x_100_1_15; struct OZChannelImpl {} *x_100_1_16; struct OZChannelInfo {} *x_100_1_17; struct OZChannelInfo {} *x_100_1_18; struct OZCurve {} *x_100_1_19; } x100; struct OZChannelDouble { int (**x_101_1_1)(); struct OZFactory {} *x_101_1_2; int (**x_101_1_3)(); unsigned int x_101_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_101_1_5; struct PCString {} *x_101_1_6; struct OZChannelFolder {} *x_101_1_7; unsigned long long x_101_1_8; unsigned long long x_101_1_9; void *x_101_1_10; struct __CFString {} *x_101_1_11; struct __CFString {} *x_101_1_12; struct __CFString {} *x_101_1_13; struct OZChannelTimeConverter {} *x_101_1_14; struct OZChannelImpl {} *x_101_1_15; struct OZChannelImpl {} *x_101_1_16; struct OZChannelInfo {} *x_101_1_17; struct OZChannelInfo {} *x_101_1_18; struct OZCurve {} *x_101_1_19; } x101; struct OZChannelPosition3D { int (**x_102_1_1)(); struct OZFactory {} *x_102_1_2; int (**x_102_1_3)(); unsigned int x_102_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_102_1_5; struct PCString {} *x_102_1_6; struct OZChannelFolder {} *x_102_1_7; unsigned long long x_102_1_8; unsigned long long x_102_1_9; void *x_102_1_10; struct __CFString {} *x_102_1_11; struct __CFString {} *x_102_1_12; struct __CFString {} *x_102_1_13; struct OZChannelTimeConverter {} *x_102_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_102_1_15; unsigned int x_102_1_16; unsigned int x_102_1_17; bool x_102_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_102_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_102_1_20; bool x_102_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_102_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_102_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_102_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_102_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_102_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_102_1_27; unsigned int x_102_1_28; struct PCSpinLock { int x_29_2_1; } x_102_1_29; struct vector<double, std::__1::allocator<double> > { double *x_30_2_1; double *x_30_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_30_2_3; } x_102_1_30; bool x_102_1_31; bool x_102_1_32; struct OZChannelDouble { int (**x_33_2_1)(); struct OZFactory {} *x_33_2_2; int (**x_33_2_3)(); unsigned int x_33_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_33_2_5; struct PCString {} *x_33_2_6; struct OZChannelFolder {} *x_33_2_7; unsigned long long x_33_2_8; unsigned long long x_33_2_9; void *x_33_2_10; struct __CFString {} *x_33_2_11; struct __CFString {} *x_33_2_12; struct __CFString {} *x_33_2_13; struct OZChannelTimeConverter {} *x_33_2_14; struct OZChannelImpl {} *x_33_2_15; struct OZChannelImpl {} *x_33_2_16; struct OZChannelInfo {} *x_33_2_17; struct OZChannelInfo {} *x_33_2_18; struct OZCurve {} *x_33_2_19; } x_102_1_33; } x102; struct OZChannelPosition3D { int (**x_103_1_1)(); struct OZFactory {} *x_103_1_2; int (**x_103_1_3)(); unsigned int x_103_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_103_1_5; struct PCString {} *x_103_1_6; struct OZChannelFolder {} *x_103_1_7; unsigned long long x_103_1_8; unsigned long long x_103_1_9; void *x_103_1_10; struct __CFString {} *x_103_1_11; struct __CFString {} *x_103_1_12; struct __CFString {} *x_103_1_13; struct OZChannelTimeConverter {} *x_103_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_103_1_15; unsigned int x_103_1_16; unsigned int x_103_1_17; bool x_103_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_103_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_103_1_20; bool x_103_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_103_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_103_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_103_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_103_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_103_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_103_1_27; unsigned int x_103_1_28; struct PCSpinLock { int x_29_2_1; } x_103_1_29; struct vector<double, std::__1::allocator<double> > { double *x_30_2_1; double *x_30_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_30_2_3; } x_103_1_30; bool x_103_1_31; bool x_103_1_32; struct OZChannelDouble { int (**x_33_2_1)(); struct OZFactory {} *x_33_2_2; int (**x_33_2_3)(); unsigned int x_33_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_33_2_5; struct PCString {} *x_33_2_6; struct OZChannelFolder {} *x_33_2_7; unsigned long long x_33_2_8; unsigned long long x_33_2_9; void *x_33_2_10; struct __CFString {} *x_33_2_11; struct __CFString {} *x_33_2_12; struct __CFString {} *x_33_2_13; struct OZChannelTimeConverter {} *x_33_2_14; struct OZChannelImpl {} *x_33_2_15; struct OZChannelImpl {} *x_33_2_16; struct OZChannelInfo {} *x_33_2_17; struct OZChannelInfo {} *x_33_2_18; struct OZCurve {} *x_33_2_19; } x_103_1_33; } x103; struct OZChannelDouble { int (**x_104_1_1)(); struct OZFactory {} *x_104_1_2; int (**x_104_1_3)(); unsigned int x_104_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_104_1_5; struct PCString {} *x_104_1_6; struct OZChannelFolder {} *x_104_1_7; unsigned long long x_104_1_8; unsigned long long x_104_1_9; void *x_104_1_10; struct __CFString {} *x_104_1_11; struct __CFString {} *x_104_1_12; struct __CFString {} *x_104_1_13; struct OZChannelTimeConverter {} *x_104_1_14; struct OZChannelImpl {} *x_104_1_15; struct OZChannelImpl {} *x_104_1_16; struct OZChannelInfo {} *x_104_1_17; struct OZChannelInfo {} *x_104_1_18; struct OZCurve {} *x_104_1_19; } x104; struct OZChannel3D { int (**x_105_1_1)(); struct OZFactory {} *x_105_1_2; int (**x_105_1_3)(); unsigned int x_105_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_105_1_5; struct PCString {} *x_105_1_6; struct OZChannelFolder {} *x_105_1_7; unsigned long long x_105_1_8; unsigned long long x_105_1_9; void *x_105_1_10; struct __CFString {} *x_105_1_11; struct __CFString {} *x_105_1_12; struct __CFString {} *x_105_1_13; struct OZChannelTimeConverter {} *x_105_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_105_1_15; unsigned int x_105_1_16; unsigned int x_105_1_17; bool x_105_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_105_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_105_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_105_1_21; } x105; struct OZChannelUint32 { int (**x_106_1_1)(); struct OZFactory {} *x_106_1_2; int (**x_106_1_3)(); unsigned int x_106_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_106_1_5; struct PCString {} *x_106_1_6; struct OZChannelFolder {} *x_106_1_7; unsigned long long x_106_1_8; unsigned long long x_106_1_9; void *x_106_1_10; struct __CFString {} *x_106_1_11; struct __CFString {} *x_106_1_12; struct __CFString {} *x_106_1_13; struct OZChannelTimeConverter {} *x_106_1_14; struct OZChannelImpl {} *x_106_1_15; struct OZChannelImpl {} *x_106_1_16; struct OZChannelInfo {} *x_106_1_17; struct OZChannelInfo {} *x_106_1_18; struct OZCurve {} *x_106_1_19; } x106; struct OZChannelUint32 { int (**x_107_1_1)(); struct OZFactory {} *x_107_1_2; int (**x_107_1_3)(); unsigned int x_107_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_107_1_5; struct PCString {} *x_107_1_6; struct OZChannelFolder {} *x_107_1_7; unsigned long long x_107_1_8; unsigned long long x_107_1_9; void *x_107_1_10; struct __CFString {} *x_107_1_11; struct __CFString {} *x_107_1_12; struct __CFString {} *x_107_1_13; struct OZChannelTimeConverter {} *x_107_1_14; struct OZChannelImpl {} *x_107_1_15; struct OZChannelImpl {} *x_107_1_16; struct OZChannelInfo {} *x_107_1_17; struct OZChannelInfo {} *x_107_1_18; struct OZCurve {} *x_107_1_19; } x107; struct OZChannelDouble { int (**x_108_1_1)(); struct OZFactory {} *x_108_1_2; int (**x_108_1_3)(); unsigned int x_108_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_108_1_5; struct PCString {} *x_108_1_6; struct OZChannelFolder {} *x_108_1_7; unsigned long long x_108_1_8; unsigned long long x_108_1_9; void *x_108_1_10; struct __CFString {} *x_108_1_11; struct __CFString {} *x_108_1_12; struct __CFString {} *x_108_1_13; struct OZChannelTimeConverter {} *x_108_1_14; struct OZChannelImpl {} *x_108_1_15; struct OZChannelImpl {} *x_108_1_16; struct OZChannelInfo {} *x_108_1_17; struct OZChannelInfo {} *x_108_1_18; struct OZCurve {} *x_108_1_19; } x108; struct OZChannelDouble { int (**x_109_1_1)(); struct OZFactory {} *x_109_1_2; int (**x_109_1_3)(); unsigned int x_109_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_109_1_5; struct PCString {} *x_109_1_6; struct OZChannelFolder {} *x_109_1_7; unsigned long long x_109_1_8; unsigned long long x_109_1_9; void *x_109_1_10; struct __CFString {} *x_109_1_11; struct __CFString {} *x_109_1_12; struct __CFString {} *x_109_1_13; struct OZChannelTimeConverter {} *x_109_1_14; struct OZChannelImpl {} *x_109_1_15; struct OZChannelImpl {} *x_109_1_16; struct OZChannelInfo {} *x_109_1_17; struct OZChannelInfo {} *x_109_1_18; struct OZCurve {} *x_109_1_19; } x109; struct OZChannelDouble { int (**x_110_1_1)(); struct OZFactory {} *x_110_1_2; int (**x_110_1_3)(); unsigned int x_110_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_110_1_5; struct PCString {} *x_110_1_6; struct OZChannelFolder {} *x_110_1_7; unsigned long long x_110_1_8; unsigned long long x_110_1_9; void *x_110_1_10; struct __CFString {} *x_110_1_11; struct __CFString {} *x_110_1_12; struct __CFString {} *x_110_1_13; struct OZChannelTimeConverter {} *x_110_1_14; struct OZChannelImpl {} *x_110_1_15; struct OZChannelImpl {} *x_110_1_16; struct OZChannelInfo {} *x_110_1_17; struct OZChannelInfo {} *x_110_1_18; struct OZCurve {} *x_110_1_19; } x110; struct OZChannelAngle { int (**x_111_1_1)(); struct OZFactory {} *x_111_1_2; int (**x_111_1_3)(); unsigned int x_111_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_111_1_5; struct PCString {} *x_111_1_6; struct OZChannelFolder {} *x_111_1_7; unsigned long long x_111_1_8; unsigned long long x_111_1_9; void *x_111_1_10; struct __CFString {} *x_111_1_11; struct __CFString {} *x_111_1_12; struct __CFString {} *x_111_1_13; struct OZChannelTimeConverter {} *x_111_1_14; struct OZChannelImpl {} *x_111_1_15; struct OZChannelImpl {} *x_111_1_16; struct OZChannelInfo {} *x_111_1_17; struct OZChannelInfo {} *x_111_1_18; struct OZCurve {} *x_111_1_19; } x111; struct OZChannelDouble { int (**x_112_1_1)(); struct OZFactory {} *x_112_1_2; int (**x_112_1_3)(); unsigned int x_112_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_112_1_5; struct PCString {} *x_112_1_6; struct OZChannelFolder {} *x_112_1_7; unsigned long long x_112_1_8; unsigned long long x_112_1_9; void *x_112_1_10; struct __CFString {} *x_112_1_11; struct __CFString {} *x_112_1_12; struct __CFString {} *x_112_1_13; struct OZChannelTimeConverter {} *x_112_1_14; struct OZChannelImpl {} *x_112_1_15; struct OZChannelImpl {} *x_112_1_16; struct OZChannelInfo {} *x_112_1_17; struct OZChannelInfo {} *x_112_1_18; struct OZCurve {} *x_112_1_19; } x112; struct OZChannelBool { int (**x_113_1_1)(); struct OZFactory {} *x_113_1_2; int (**x_113_1_3)(); unsigned int x_113_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_113_1_5; struct PCString {} *x_113_1_6; struct OZChannelFolder {} *x_113_1_7; unsigned long long x_113_1_8; unsigned long long x_113_1_9; void *x_113_1_10; struct __CFString {} *x_113_1_11; struct __CFString {} *x_113_1_12; struct __CFString {} *x_113_1_13; struct OZChannelTimeConverter {} *x_113_1_14; struct OZChannelImpl {} *x_113_1_15; struct OZChannelImpl {} *x_113_1_16; struct OZChannelInfo {} *x_113_1_17; struct OZChannelInfo {} *x_113_1_18; struct OZCurve {} *x_113_1_19; } x113; struct OZChannelPercent { int (**x_114_1_1)(); struct OZFactory {} *x_114_1_2; int (**x_114_1_3)(); unsigned int x_114_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_114_1_5; struct PCString {} *x_114_1_6; struct OZChannelFolder {} *x_114_1_7; unsigned long long x_114_1_8; unsigned long long x_114_1_9; void *x_114_1_10; struct __CFString {} *x_114_1_11; struct __CFString {} *x_114_1_12; struct __CFString {} *x_114_1_13; struct OZChannelTimeConverter {} *x_114_1_14; struct OZChannelImpl {} *x_114_1_15; struct OZChannelImpl {} *x_114_1_16; struct OZChannelInfo {} *x_114_1_17; struct OZChannelInfo {} *x_114_1_18; struct OZCurve {} *x_114_1_19; } x114; struct OZChanRotoshapeRef { int (**x_115_1_1)(); struct OZFactory {} *x_115_1_2; int (**x_115_1_3)(); unsigned int x_115_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_115_1_5; struct PCString {} *x_115_1_6; struct OZChannelFolder {} *x_115_1_7; unsigned long long x_115_1_8; unsigned long long x_115_1_9; void *x_115_1_10; struct __CFString {} *x_115_1_11; struct __CFString {} *x_115_1_12; struct __CFString {} *x_115_1_13; struct OZChannelTimeConverter {} *x_115_1_14; struct OZChannelImpl {} *x_115_1_15; struct OZChannelImpl {} *x_115_1_16; struct OZChannelInfo {} *x_115_1_17; struct OZChannelInfo {} *x_115_1_18; struct OZCurve {} *x_115_1_19; bool x_115_1_20; bool x_115_1_21; bool x_115_1_22; bool x_115_1_23; } x115; struct OZChanElementOrFootageRef { int (**x_116_1_1)(); struct OZFactory {} *x_116_1_2; int (**x_116_1_3)(); unsigned int x_116_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_116_1_5; struct PCString {} *x_116_1_6; struct OZChannelFolder {} *x_116_1_7; unsigned long long x_116_1_8; unsigned long long x_116_1_9; void *x_116_1_10; struct __CFString {} *x_116_1_11; struct __CFString {} *x_116_1_12; struct __CFString {} *x_116_1_13; struct OZChannelTimeConverter {} *x_116_1_14; struct OZChannelImpl {} *x_116_1_15; struct OZChannelImpl {} *x_116_1_16; struct OZChannelInfo {} *x_116_1_17; struct OZChannelInfo {} *x_116_1_18; struct OZCurve {} *x_116_1_19; bool x_116_1_20; bool x_116_1_21; bool x_116_1_22; bool x_116_1_23; } x116; struct OZChannelAngle { int (**x_117_1_1)(); struct OZFactory {} *x_117_1_2; int (**x_117_1_3)(); unsigned int x_117_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_117_1_5; struct PCString {} *x_117_1_6; struct OZChannelFolder {} *x_117_1_7; unsigned long long x_117_1_8; unsigned long long x_117_1_9; void *x_117_1_10; struct __CFString {} *x_117_1_11; struct __CFString {} *x_117_1_12; struct __CFString {} *x_117_1_13; struct OZChannelTimeConverter {} *x_117_1_14; struct OZChannelImpl {} *x_117_1_15; struct OZChannelImpl {} *x_117_1_16; struct OZChannelInfo {} *x_117_1_17; struct OZChannelInfo {} *x_117_1_18; struct OZCurve {} *x_117_1_19; } x117; struct OZChannelAngle { int (**x_118_1_1)(); struct OZFactory {} *x_118_1_2; int (**x_118_1_3)(); unsigned int x_118_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_118_1_5; struct PCString {} *x_118_1_6; struct OZChannelFolder {} *x_118_1_7; unsigned long long x_118_1_8; unsigned long long x_118_1_9; void *x_118_1_10; struct __CFString {} *x_118_1_11; struct __CFString {} *x_118_1_12; struct __CFString {} *x_118_1_13; struct OZChannelTimeConverter {} *x_118_1_14; struct OZChannelImpl {} *x_118_1_15; struct OZChannelImpl {} *x_118_1_16; struct OZChannelInfo {} *x_118_1_17; struct OZChannelInfo {} *x_118_1_18; struct OZCurve {} *x_118_1_19; } x118; struct OZChannelAngle { int (**x_119_1_1)(); struct OZFactory {} *x_119_1_2; int (**x_119_1_3)(); unsigned int x_119_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_119_1_5; struct PCString {} *x_119_1_6; struct OZChannelFolder {} *x_119_1_7; unsigned long long x_119_1_8; unsigned long long x_119_1_9; void *x_119_1_10; struct __CFString {} *x_119_1_11; struct __CFString {} *x_119_1_12; struct __CFString {} *x_119_1_13; struct OZChannelTimeConverter {} *x_119_1_14; struct OZChannelImpl {} *x_119_1_15; struct OZChannelImpl {} *x_119_1_16; struct OZChannelInfo {} *x_119_1_17; struct OZChannelInfo {} *x_119_1_18; struct OZCurve {} *x_119_1_19; } x119; struct OZChannelFolder { int (**x_120_1_1)(); struct OZFactory {} *x_120_1_2; int (**x_120_1_3)(); unsigned int x_120_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_120_1_5; struct PCString {} *x_120_1_6; struct OZChannelFolder {} *x_120_1_7; unsigned long long x_120_1_8; unsigned long long x_120_1_9; void *x_120_1_10; struct __CFString {} *x_120_1_11; struct __CFString {} *x_120_1_12; struct __CFString {} *x_120_1_13; struct OZChannelTimeConverter {} *x_120_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_120_1_15; unsigned int x_120_1_16; unsigned int x_120_1_17; } x120; struct OZChannelPercent { int (**x_121_1_1)(); struct OZFactory {} *x_121_1_2; int (**x_121_1_3)(); unsigned int x_121_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_121_1_5; struct PCString {} *x_121_1_6; struct OZChannelFolder {} *x_121_1_7; unsigned long long x_121_1_8; unsigned long long x_121_1_9; void *x_121_1_10; struct __CFString {} *x_121_1_11; struct __CFString {} *x_121_1_12; struct __CFString {} *x_121_1_13; struct OZChannelTimeConverter {} *x_121_1_14; struct OZChannelImpl {} *x_121_1_15; struct OZChannelImpl {} *x_121_1_16; struct OZChannelInfo {} *x_121_1_17; struct OZChannelInfo {} *x_121_1_18; struct OZCurve {} *x_121_1_19; } x121; struct OZChannelBool { int (**x_122_1_1)(); struct OZFactory {} *x_122_1_2; int (**x_122_1_3)(); unsigned int x_122_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_122_1_5; struct PCString {} *x_122_1_6; struct OZChannelFolder {} *x_122_1_7; unsigned long long x_122_1_8; unsigned long long x_122_1_9; void *x_122_1_10; struct __CFString {} *x_122_1_11; struct __CFString {} *x_122_1_12; struct __CFString {} *x_122_1_13; struct OZChannelTimeConverter {} *x_122_1_14; struct OZChannelImpl {} *x_122_1_15; struct OZChannelImpl {} *x_122_1_16; struct OZChannelInfo {} *x_122_1_17; struct OZChannelInfo {} *x_122_1_18; struct OZCurve {} *x_122_1_19; } x122; struct OZChannelPercent { int (**x_123_1_1)(); struct OZFactory {} *x_123_1_2; int (**x_123_1_3)(); unsigned int x_123_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_123_1_5; struct PCString {} *x_123_1_6; struct OZChannelFolder {} *x_123_1_7; unsigned long long x_123_1_8; unsigned long long x_123_1_9; void *x_123_1_10; struct __CFString {} *x_123_1_11; struct __CFString {} *x_123_1_12; struct __CFString {} *x_123_1_13; struct OZChannelTimeConverter {} *x_123_1_14; struct OZChannelImpl {} *x_123_1_15; struct OZChannelImpl {} *x_123_1_16; struct OZChannelInfo {} *x_123_1_17; struct OZChannelInfo {} *x_123_1_18; struct OZCurve {} *x_123_1_19; } x123; struct OZChannelPercent { int (**x_124_1_1)(); struct OZFactory {} *x_124_1_2; int (**x_124_1_3)(); unsigned int x_124_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_124_1_5; struct PCString {} *x_124_1_6; struct OZChannelFolder {} *x_124_1_7; unsigned long long x_124_1_8; unsigned long long x_124_1_9; void *x_124_1_10; struct __CFString {} *x_124_1_11; struct __CFString {} *x_124_1_12; struct __CFString {} *x_124_1_13; struct OZChannelTimeConverter {} *x_124_1_14; struct OZChannelImpl {} *x_124_1_15; struct OZChannelImpl {} *x_124_1_16; struct OZChannelInfo {} *x_124_1_17; struct OZChannelInfo {} *x_124_1_18; struct OZCurve {} *x_124_1_19; } x124; struct OZChannelScale3D { int (**x_125_1_1)(); struct OZFactory {} *x_125_1_2; int (**x_125_1_3)(); unsigned int x_125_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_125_1_5; struct PCString {} *x_125_1_6; struct OZChannelFolder {} *x_125_1_7; unsigned long long x_125_1_8; unsigned long long x_125_1_9; void *x_125_1_10; struct __CFString {} *x_125_1_11; struct __CFString {} *x_125_1_12; struct __CFString {} *x_125_1_13; struct OZChannelTimeConverter {} *x_125_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_125_1_15; unsigned int x_125_1_16; unsigned int x_125_1_17; bool x_125_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_125_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_125_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_125_1_21; } x125; struct OZChannelPercent { int (**x_126_1_1)(); struct OZFactory {} *x_126_1_2; int (**x_126_1_3)(); unsigned int x_126_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_126_1_5; struct PCString {} *x_126_1_6; struct OZChannelFolder {} *x_126_1_7; unsigned long long x_126_1_8; unsigned long long x_126_1_9; void *x_126_1_10; struct __CFString {} *x_126_1_11; struct __CFString {} *x_126_1_12; struct __CFString {} *x_126_1_13; struct OZChannelTimeConverter {} *x_126_1_14; struct OZChannelImpl {} *x_126_1_15; struct OZChannelImpl {} *x_126_1_16; struct OZChannelInfo {} *x_126_1_17; struct OZChannelInfo {} *x_126_1_18; struct OZCurve {} *x_126_1_19; } x126; struct OZChannelPercent { int (**x_127_1_1)(); struct OZFactory {} *x_127_1_2; int (**x_127_1_3)(); unsigned int x_127_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_127_1_5; struct PCString {} *x_127_1_6; struct OZChannelFolder {} *x_127_1_7; unsigned long long x_127_1_8; unsigned long long x_127_1_9; void *x_127_1_10; struct __CFString {} *x_127_1_11; struct __CFString {} *x_127_1_12; struct __CFString {} *x_127_1_13; struct OZChannelTimeConverter {} *x_127_1_14; struct OZChannelImpl {} *x_127_1_15; struct OZChannelImpl {} *x_127_1_16; struct OZChannelInfo {} *x_127_1_17; struct OZChannelInfo {} *x_127_1_18; struct OZCurve {} *x_127_1_19; } x127; struct OZChannelColor { int (**x_128_1_1)(); struct OZFactory {} *x_128_1_2; int (**x_128_1_3)(); unsigned int x_128_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_128_1_5; struct PCString {} *x_128_1_6; struct OZChannelFolder {} *x_128_1_7; unsigned long long x_128_1_8; unsigned long long x_128_1_9; void *x_128_1_10; struct __CFString {} *x_128_1_11; struct __CFString {} *x_128_1_12; struct __CFString {} *x_128_1_13; struct OZChannelTimeConverter {} *x_128_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_128_1_15; unsigned int x_128_1_16; unsigned int x_128_1_17; bool x_128_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_128_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_128_1_20; struct OZChannelDouble { int (**x_21_2_1)(); struct OZFactory {} *x_21_2_2; int (**x_21_2_3)(); unsigned int x_21_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_21_2_5; struct PCString {} *x_21_2_6; struct OZChannelFolder {} *x_21_2_7; unsigned long long x_21_2_8; unsigned long long x_21_2_9; void *x_21_2_10; struct __CFString {} *x_21_2_11; struct __CFString {} *x_21_2_12; struct __CFString {} *x_21_2_13; struct OZChannelTimeConverter {} *x_21_2_14; struct OZChannelImpl {} *x_21_2_15; struct OZChannelImpl {} *x_21_2_16; struct OZChannelInfo {} *x_21_2_17; struct OZChannelInfo {} *x_21_2_18; struct OZCurve {} *x_21_2_19; } x_128_1_21; struct OZChannelDouble { int (**x_22_2_1)(); struct OZFactory {} *x_22_2_2; int (**x_22_2_3)(); unsigned int x_22_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_22_2_5; struct PCString {} *x_22_2_6; struct OZChannelFolder {} *x_22_2_7; unsigned long long x_22_2_8; unsigned long long x_22_2_9; void *x_22_2_10; struct __CFString {} *x_22_2_11; struct __CFString {} *x_22_2_12; struct __CFString {} *x_22_2_13; struct OZChannelTimeConverter {} *x_22_2_14; struct OZChannelImpl {} *x_22_2_15; struct OZChannelImpl {} *x_22_2_16; struct OZChannelInfo {} *x_22_2_17; struct OZChannelInfo {} *x_22_2_18; struct OZCurve {} *x_22_2_19; } x_128_1_22; struct OZChannelEnum { int (**x_23_2_1)(); struct OZFactory {} *x_23_2_2; int (**x_23_2_3)(); unsigned int x_23_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_23_2_5; struct PCString {} *x_23_2_6; struct OZChannelFolder {} *x_23_2_7; unsigned long long x_23_2_8; unsigned long long x_23_2_9; void *x_23_2_10; struct __CFString {} *x_23_2_11; struct __CFString {} *x_23_2_12; struct __CFString {} *x_23_2_13; struct OZChannelTimeConverter {} *x_23_2_14; struct OZChannelImpl {} *x_23_2_15; struct OZChannelImpl {} *x_23_2_16; struct OZChannelInfo {} *x_23_2_17; struct OZChannelInfo {} *x_23_2_18; struct OZCurve {} *x_23_2_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_4_1; } x_20_3_1; } x_23_2_20; struct PCString { struct __CFString {} *x_21_3_1; } x_23_2_21; struct vector<int, std::__1::allocator<int> > { int *x_22_3_1; int *x_22_3_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_4_1; } x_22_3_3; } x_23_2_22; unsigned int x_23_2_23; struct PCString { struct __CFString {} *x_24_3_1; } x_23_2_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_3_1; struct PCString {} *x_25_3_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_4_1; } x_25_3_3; } x_23_2_25; } x_128_1_23; struct OZChannelDouble { int (**x_24_2_1)(); struct OZFactory {} *x_24_2_2; int (**x_24_2_3)(); unsigned int x_24_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_24_2_5; struct PCString {} *x_24_2_6; struct OZChannelFolder {} *x_24_2_7; unsigned long long x_24_2_8; unsigned long long x_24_2_9; void *x_24_2_10; struct __CFString {} *x_24_2_11; struct __CFString {} *x_24_2_12; struct __CFString {} *x_24_2_13; struct OZChannelTimeConverter {} *x_24_2_14; struct OZChannelImpl {} *x_24_2_15; struct OZChannelImpl {} *x_24_2_16; struct OZChannelInfo {} *x_24_2_17; struct OZChannelInfo {} *x_24_2_18; struct OZCurve {} *x_24_2_19; } x_128_1_24; } x128; struct OZChannelPercent { int (**x_129_1_1)(); struct OZFactory {} *x_129_1_2; int (**x_129_1_3)(); unsigned int x_129_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_129_1_5; struct PCString {} *x_129_1_6; struct OZChannelFolder {} *x_129_1_7; unsigned long long x_129_1_8; unsigned long long x_129_1_9; void *x_129_1_10; struct __CFString {} *x_129_1_11; struct __CFString {} *x_129_1_12; struct __CFString {} *x_129_1_13; struct OZChannelTimeConverter {} *x_129_1_14; struct OZChannelImpl {} *x_129_1_15; struct OZChannelImpl {} *x_129_1_16; struct OZChannelInfo {} *x_129_1_17; struct OZChannelInfo {} *x_129_1_18; struct OZCurve {} *x_129_1_19; } x129; struct OZChannelEnum { int (**x_130_1_1)(); struct OZFactory {} *x_130_1_2; int (**x_130_1_3)(); unsigned int x_130_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_130_1_5; struct PCString {} *x_130_1_6; struct OZChannelFolder {} *x_130_1_7; unsigned long long x_130_1_8; unsigned long long x_130_1_9; void *x_130_1_10; struct __CFString {} *x_130_1_11; struct __CFString {} *x_130_1_12; struct __CFString {} *x_130_1_13; struct OZChannelTimeConverter {} *x_130_1_14; struct OZChannelImpl {} *x_130_1_15; struct OZChannelImpl {} *x_130_1_16; struct OZChannelInfo {} *x_130_1_17; struct OZChannelInfo {} *x_130_1_18; struct OZCurve {} *x_130_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_130_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_130_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_130_1_22; unsigned int x_130_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_130_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_130_1_25; } x130; struct OZChannelBool { int (**x_131_1_1)(); struct OZFactory {} *x_131_1_2; int (**x_131_1_3)(); unsigned int x_131_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_131_1_5; struct PCString {} *x_131_1_6; struct OZChannelFolder {} *x_131_1_7; unsigned long long x_131_1_8; unsigned long long x_131_1_9; void *x_131_1_10; struct __CFString {} *x_131_1_11; struct __CFString {} *x_131_1_12; struct __CFString {} *x_131_1_13; struct OZChannelTimeConverter {} *x_131_1_14; struct OZChannelImpl {} *x_131_1_15; struct OZChannelImpl {} *x_131_1_16; struct OZChannelInfo {} *x_131_1_17; struct OZChannelInfo {} *x_131_1_18; struct OZCurve {} *x_131_1_19; } x131; struct OZChannelBool { int (**x_132_1_1)(); struct OZFactory {} *x_132_1_2; int (**x_132_1_3)(); unsigned int x_132_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_132_1_5; struct PCString {} *x_132_1_6; struct OZChannelFolder {} *x_132_1_7; unsigned long long x_132_1_8; unsigned long long x_132_1_9; void *x_132_1_10; struct __CFString {} *x_132_1_11; struct __CFString {} *x_132_1_12; struct __CFString {} *x_132_1_13; struct OZChannelTimeConverter {} *x_132_1_14; struct OZChannelImpl {} *x_132_1_15; struct OZChannelImpl {} *x_132_1_16; struct OZChannelInfo {} *x_132_1_17; struct OZChannelInfo {} *x_132_1_18; struct OZCurve {} *x_132_1_19; } x132; struct OZChannelBool { int (**x_133_1_1)(); struct OZFactory {} *x_133_1_2; int (**x_133_1_3)(); unsigned int x_133_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_133_1_5; struct PCString {} *x_133_1_6; struct OZChannelFolder {} *x_133_1_7; unsigned long long x_133_1_8; unsigned long long x_133_1_9; void *x_133_1_10; struct __CFString {} *x_133_1_11; struct __CFString {} *x_133_1_12; struct __CFString {} *x_133_1_13; struct OZChannelTimeConverter {} *x_133_1_14; struct OZChannelImpl {} *x_133_1_15; struct OZChannelImpl {} *x_133_1_16; struct OZChannelInfo {} *x_133_1_17; struct OZChannelInfo {} *x_133_1_18; struct OZCurve {} *x_133_1_19; } x133; struct OZChannelSeed { int (**x_134_1_1)(); struct OZFactory {} *x_134_1_2; int (**x_134_1_3)(); unsigned int x_134_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_134_1_5; struct PCString {} *x_134_1_6; struct OZChannelFolder {} *x_134_1_7; unsigned long long x_134_1_8; unsigned long long x_134_1_9; void *x_134_1_10; struct __CFString {} *x_134_1_11; struct __CFString {} *x_134_1_12; struct __CFString {} *x_134_1_13; struct OZChannelTimeConverter {} *x_134_1_14; struct OZChannelImpl {} *x_134_1_15; struct OZChannelImpl {} *x_134_1_16; struct OZChannelInfo {} *x_134_1_17; struct OZChannelInfo {} *x_134_1_18; struct OZCurve {} *x_134_1_19; } x134; struct OZChannelBool { int (**x_135_1_1)(); struct OZFactory {} *x_135_1_2; int (**x_135_1_3)(); unsigned int x_135_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_135_1_5; struct PCString {} *x_135_1_6; struct OZChannelFolder {} *x_135_1_7; unsigned long long x_135_1_8; unsigned long long x_135_1_9; void *x_135_1_10; struct __CFString {} *x_135_1_11; struct __CFString {} *x_135_1_12; struct __CFString {} *x_135_1_13; struct OZChannelTimeConverter {} *x_135_1_14; struct OZChannelImpl {} *x_135_1_15; struct OZChannelImpl {} *x_135_1_16; struct OZChannelInfo {} *x_135_1_17; struct OZChannelInfo {} *x_135_1_18; struct OZCurve {} *x_135_1_19; } x135; struct OZChannelPosition { int (**x_136_1_1)(); struct OZFactory {} *x_136_1_2; int (**x_136_1_3)(); unsigned int x_136_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_136_1_5; struct PCString {} *x_136_1_6; struct OZChannelFolder {} *x_136_1_7; unsigned long long x_136_1_8; unsigned long long x_136_1_9; void *x_136_1_10; struct __CFString {} *x_136_1_11; struct __CFString {} *x_136_1_12; struct __CFString {} *x_136_1_13; struct OZChannelTimeConverter {} *x_136_1_14; struct vector<OZChannelBase *, std::__1::allocator<OZChannelBase *> > {} *x_136_1_15; unsigned int x_136_1_16; unsigned int x_136_1_17; bool x_136_1_18; struct OZChannelDouble { int (**x_19_2_1)(); struct OZFactory {} *x_19_2_2; int (**x_19_2_3)(); unsigned int x_19_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_19_2_5; struct PCString {} *x_19_2_6; struct OZChannelFolder {} *x_19_2_7; unsigned long long x_19_2_8; unsigned long long x_19_2_9; void *x_19_2_10; struct __CFString {} *x_19_2_11; struct __CFString {} *x_19_2_12; struct __CFString {} *x_19_2_13; struct OZChannelTimeConverter {} *x_19_2_14; struct OZChannelImpl {} *x_19_2_15; struct OZChannelImpl {} *x_19_2_16; struct OZChannelInfo {} *x_19_2_17; struct OZChannelInfo {} *x_19_2_18; struct OZCurve {} *x_19_2_19; } x_136_1_19; struct OZChannelDouble { int (**x_20_2_1)(); struct OZFactory {} *x_20_2_2; int (**x_20_2_3)(); unsigned int x_20_2_4; struct PCString { struct __CFString {} *x_5_3_1; } x_20_2_5; struct PCString {} *x_20_2_6; struct OZChannelFolder {} *x_20_2_7; unsigned long long x_20_2_8; unsigned long long x_20_2_9; void *x_20_2_10; struct __CFString {} *x_20_2_11; struct __CFString {} *x_20_2_12; struct __CFString {} *x_20_2_13; struct OZChannelTimeConverter {} *x_20_2_14; struct OZChannelImpl {} *x_20_2_15; struct OZChannelImpl {} *x_20_2_16; struct OZChannelInfo {} *x_20_2_17; struct OZChannelInfo {} *x_20_2_18; struct OZCurve {} *x_20_2_19; } x_136_1_20; bool x_136_1_21; struct PCMatrix44Tmpl<double> { double x_22_2_1[4][4]; } x_136_1_22; struct vector<double, std::__1::allocator<double> > { double *x_23_2_1; double *x_23_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_23_2_3; } x_136_1_23; struct vector<double, std::__1::allocator<double> > { double *x_24_2_1; double *x_24_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_24_2_3; } x_136_1_24; struct vector<double, std::__1::allocator<double> > { double *x_25_2_1; double *x_25_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_25_2_3; } x_136_1_25; struct vector<double, std::__1::allocator<double> > { double *x_26_2_1; double *x_26_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_26_2_3; } x_136_1_26; struct vector<double, std::__1::allocator<double> > { double *x_27_2_1; double *x_27_2_2; struct __compressed_pair<double *, std::__1::allocator<double> > { double *x_3_3_1; } x_27_2_3; } x_136_1_27; unsigned int x_136_1_28; struct PCSpinLock { int x_29_2_1; } x_136_1_29; } x136; struct OZChannelBool { int (**x_137_1_1)(); struct OZFactory {} *x_137_1_2; int (**x_137_1_3)(); unsigned int x_137_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_137_1_5; struct PCString {} *x_137_1_6; struct OZChannelFolder {} *x_137_1_7; unsigned long long x_137_1_8; unsigned long long x_137_1_9; void *x_137_1_10; struct __CFString {} *x_137_1_11; struct __CFString {} *x_137_1_12; struct __CFString {} *x_137_1_13; struct OZChannelTimeConverter {} *x_137_1_14; struct OZChannelImpl {} *x_137_1_15; struct OZChannelImpl {} *x_137_1_16; struct OZChannelInfo {} *x_137_1_17; struct OZChannelInfo {} *x_137_1_18; struct OZCurve {} *x_137_1_19; } x137; struct OZChannelEnum { int (**x_138_1_1)(); struct OZFactory {} *x_138_1_2; int (**x_138_1_3)(); unsigned int x_138_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_138_1_5; struct PCString {} *x_138_1_6; struct OZChannelFolder {} *x_138_1_7; unsigned long long x_138_1_8; unsigned long long x_138_1_9; void *x_138_1_10; struct __CFString {} *x_138_1_11; struct __CFString {} *x_138_1_12; struct __CFString {} *x_138_1_13; struct OZChannelTimeConverter {} *x_138_1_14; struct OZChannelImpl {} *x_138_1_15; struct OZChannelImpl {} *x_138_1_16; struct OZChannelInfo {} *x_138_1_17; struct OZChannelInfo {} *x_138_1_18; struct OZCurve {} *x_138_1_19; struct __map_iterator<std::__1::__tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> > { struct __tree_iterator<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, std::__1::__tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> *, long> { struct __tree_node<std::__1::__value_type<PCString, std::__1::vector<PCString, std::__1::allocator<PCString> > >, void *> {} *x_1_3_1; } x_20_2_1; } x_138_1_20; struct PCString { struct __CFString {} *x_21_2_1; } x_138_1_21; struct vector<int, std::__1::allocator<int> > { int *x_22_2_1; int *x_22_2_2; struct __compressed_pair<int *, std::__1::allocator<int> > { int *x_3_3_1; } x_22_2_3; } x_138_1_22; unsigned int x_138_1_23; struct PCString { struct __CFString {} *x_24_2_1; } x_138_1_24; struct vector<PCString, std::__1::allocator<PCString> > { struct PCString {} *x_25_2_1; struct PCString {} *x_25_2_2; struct __compressed_pair<PCString *, std::__1::allocator<PCString> > { struct PCString {} *x_3_3_1; } x_25_2_3; } x_138_1_25; } x138; struct OZChannelBool { int (**x_139_1_1)(); struct OZFactory {} *x_139_1_2; int (**x_139_1_3)(); unsigned int x_139_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_139_1_5; struct PCString {} *x_139_1_6; struct OZChannelFolder {} *x_139_1_7; unsigned long long x_139_1_8; unsigned long long x_139_1_9; void *x_139_1_10; struct __CFString {} *x_139_1_11; struct __CFString {} *x_139_1_12; struct __CFString {} *x_139_1_13; struct OZChannelTimeConverter {} *x_139_1_14; struct OZChannelImpl {} *x_139_1_15; struct OZChannelImpl {} *x_139_1_16; struct OZChannelInfo {} *x_139_1_17; struct OZChannelInfo {} *x_139_1_18; struct OZCurve {} *x_139_1_19; } x139; struct OZChannelBool { int (**x_140_1_1)(); struct OZFactory {} *x_140_1_2; int (**x_140_1_3)(); unsigned int x_140_1_4; struct PCString { struct __CFString {} *x_5_2_1; } x_140_1_5; struct PCString {} *x_140_1_6; struct OZChannelFolder {} *x_140_1_7; unsigned long long x_140_1_8; unsigned long long x_140_1_9; void *x_140_1_10; struct __CFString {} *x_140_1_11; struct __CFString {} *x_140_1_12; struct __CFString {} *x_140_1_13; struct OZChannelTimeConverter {} *x_140_1_14; struct OZChannelImpl {} *x_140_1_15; struct OZChannelImpl {} *x_140_1_16; struct OZChannelInfo {} *x_140_1_17; struct OZChannelInfo {} *x_140_1_18; struct OZCurve {} *x_140_1_19; } x140; bool x141; bool x142; struct shared_ptr<PCBitmap> { struct PCBitmap {} *x_143_1_1; struct __shared_weak_count {} *x_143_1_2; } x143; double x144; double x145; double x146; bool x147[2]; int x148[2]; double x149[2]; int x150; struct PCMutex { int (**x_151_1_1)(); struct _opaque_pthread_mutex_t { long long x_2_2_1; BOOL x_2_2_2[56]; } x_151_1_2; } x151; unsigned int *x152; unsigned int x153; unsigned int x154; struct list<OZSceneNode *, std::__1::allocator<OZSceneNode *> > { struct __list_node_base<OZSceneNode *, void *> { struct __list_node_base<OZSceneNode *, void *> {} *x_1_2_1; struct __list_node_base<OZSceneNode *, void *> {} *x_1_2_2; } x_155_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZSceneNode *, void *> > > { unsigned long long x_2_2_1; } x_155_1_2; } x155; bool x156; bool x157; unsigned int x158; bool x159; }*)arg1 inDoc:(struct OZDocument { int (**x1)(); int (**x2)(); struct PCSafeHandle {} *x3; struct OZScene {} *x4; struct PCString { struct __CFString {} *x_5_1_1; } x5; struct list<OZObjectSelections *, std::__1::allocator<OZObjectSelections *> > { struct __list_node_base<OZObjectSelections *, void *> { struct __list_node_base<OZObjectSelections *, void *> {} *x_1_2_1; struct __list_node_base<OZObjectSelections *, void *> {} *x_1_2_2; } x_6_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<OZObjectSelections *, void *> > > { unsigned long long x_2_2_1; } x_6_1_2; } x6; struct vector<OZChannelRef, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_7_1_1; struct OZChannelRef {} *x_7_1_2; struct __compressed_pair<OZChannelRef *, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_3_2_1; } x_7_1_3; } x7; struct PCString { struct __CFString {} *x_8_1_1; } x8; unsigned int x9; bool x10; bool x11; unsigned int x12; bool x13; int x14; struct PCString { struct __CFString {} *x_15_1_1; } x15; struct PCString { struct __CFString {} *x_16_1_1; } x16; unsigned int x17; unsigned long long x18; struct OZNotificationManager {} *x19; id x20; struct OZViewerState {} *x21[4]; struct OZCanvasState {} *x22; struct OZProjectPanelState {} *x23; struct OZTimelineState {} *x24; struct OZInspectorState {} *x25; bool x26; unsigned int x27; unsigned int x28; struct PCString { struct __CFString {} *x_29_1_1; } x29; bool x30; struct OZRigWidget {} *x31; struct vector<OZChannelRef, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_32_1_1; struct OZChannelRef {} *x_32_1_2; struct __compressed_pair<OZChannelRef *, std::__1::allocator<OZChannelRef> > { struct OZChannelRef {} *x_3_2_1; } x_32_1_3; } x32; int x33; bool x34; }*)arg2; - (bool)validateAction:(SEL)arg1; @end
10,175.9375
160,708
0.753665
[ "vector" ]
b2c0cb5400f72e4688914367360c7ed1cf7ff460
6,237
h
C
UkuvchLang-v2.1.0/vm.h
kosta2222/proj_Ukuvchi_Lang
e9286154a4e075437c66697ed2f0aab90c142b59
[ "BSD-3-Clause" ]
3
2019-05-31T13:55:14.000Z
2019-07-04T18:23:59.000Z
UkuvchLang-v2.1.0/vm.h
kosta2222/proj_Ukuvchi_Lang
e9286154a4e075437c66697ed2f0aab90c142b59
[ "BSD-3-Clause" ]
null
null
null
UkuvchLang-v2.1.0/vm.h
kosta2222/proj_Ukuvchi_Lang
e9286154a4e075437c66697ed2f0aab90c142b59
[ "BSD-3-Clause" ]
null
null
null
#ifndef VM_H_ #define VM_H_ #include <stdio.h> #include <stdbool.h> #include <malloc.h> #include <math.h> #include <string.h> #include "types.h" #ifdef __cplusplus extern "C" { #endif #define DEFAULT_STACK_SIZE 10///<размер стека по умолчанию #define DEFAULT_CALL_STACK_SIZE 100///<размер стека контекстов по умолчанию #define DEFAULT_NUM_LOCALS 26 ///<количество локальных переменных по умолчанию /** опкоды операций */ // десятичное число #define NOOP 0 ///<нет операций 0 #define FADD 1 ///<сложение 1 #define FSUB 2 ///<вычитание 2 #define FMUL 3///<умножение 3 #define FDIV 4 ///<деление 4 #define IREM 5 ///<остаток от деления 5 #define FPOW 6 ///<возведение в степень 6 #define IEQ 7 ///<сравнить на менше 7 #define IEQ 8 ///<сравнить на равенство 8 #define BR 9 ///<прыжок 9 #define BRT 0x0a ///<прыжок при правде 10 #define BRF 0x0b ///<прыжок при неправде 11 #define FCONST 0x0c ///<положить константу на стек 12 #define FLOAD 0x0d ///<загрузить из таблицы локальных переменных на стек 13 #define FGLOAD 0x0e ///<загрузить из таблицы глобальных переменнных на стек 14 #define FSTORE 0x0f ///<сохранить со стека в лакальные переменные 15 #define FGSTORE 0x10 ///<сохранить со стека в глобальные переменные 16 #define PRINT 0x11 ///<печатает локальную переменную 17 #define POP 0x12 ///<убирает вершину стека 18 #define CALL 0x13 ///<вызывает функцию с nargs-количество аргументов:int и сколько переменных-фактических параметров ожидать на стеке:int 19 #define RET 0x14 ///<завершает функцию 20 #define STORE_RESULT 0x15 ///<сохранить результат функции специальный регистр 21 #define LOAD_RESULT 0x16 ///<загрузить результат прошлой функции из специального регистра на стек 22 #define INVOKE_IN_VM 0x17 //< вызвать функцию по номеру в виртуальной машине \todo 23 #define CREATESTRING 0x18 //< создать строку в куче \todo 24 #define NEWARRAY 0x19 //< создать массив в куче,взяв длину со стека 25 #define FASTORE 0x1a //<сохранить значение в массиве 26 #define FALOAD 0x1b //< загрузить значение из массива на стек 27 #define DUP 0x1c // < дублировать вершину стека 28 #define ASTORE 0x1d //< сохранить ссылку на объект в массив переменных(переменные) \todo 29 #define ALOAD 0x1e //< загрузить ссылку на обьект на стек \todo 30 #define INVOKE 0x1f // 31 #define STOP 0x20 ///<остановит виртуальную машину 32 /** Контекст для функции */ typedef struct { /*байт-код контекста*/ u1 * bytecode; /** локальные переменные контекста функции */ Variable locals[DEFAULT_NUM_LOCALS]; } Context; /** Компонент виртуальной машины */ typedef struct { /** глобалные переменные */ Variable *globals; /** количество глобальных переменных */ u1 nglobals; /** Операндовый стек */ Variable stack[DEFAULT_STACK_SIZE]; /** регистр для значения от функции */ Variable registrThatRetFunc; /** стек контекстов */ Context call_stack[DEFAULT_CALL_STACK_SIZE]; } VM; /** * создать виртуальную машину * @param nglobals количество глобальных переменных * @return компонент ВМ */ VM *vm_create(u1 nglobals); /** * освободить память из под виртуальной машины * @param vm компонент ВМ */ void vm_free(VM *vm); /** * инициализируем виртуальную машину * @param vm компонент ВМ * @param nglobals количество глобальных переменных */ void vm_init(VM *vm, u1 nglobals); /** *выполнение инструкций * @param vm компонент ВМ * @param funcName имя функции чтобы взять ее байт-код из карты * @param nargs количество аргументов которые принимает функция * @param trace печатать ли трассу? */ void vm_exec(VM *vm, char *funcName, u1 nargs, bool trace); /** * печатаем инструкцию * @param code данный байт-код * @param ip указатель инструкции */ void vm_print_instr(unsigned char *code, u4 ip); /** * печатаем стек * @param stack стек программы * @param count количество элементов для отпечатки */ void vm_print_stack(Variable *stack, u1 count); /** печатаем глобальные переменные @param globals массив глобальных переменных @param count сколько печатать элементов */ void vm_print_data(Variable *globals, u1 count); /** * вызвать пользовательскую функцию * @param funcid индификатор функции * @param argc количество аргуменов * @param argv массив аргументов * @return вычесленное значение */ Variable call_user(int funcid, int argc, Variable *argv); /** Создание массива в куче \param type тип обьекта \param count количество элементов со стека \return Object для стека там содержится информация где содержится массив */ Object createNewArray(u1 type, u4 count); /** * Разобрать байт-код полученный из файла - подготовить для карты * @param bytecode данный байт-код * @return получилось ли? */ bool parseByteCodeForMap(u1* bytecode); /** * Парсит методы и ложит в карту ИМЯ_ФУНКЦИИ=>БАЙТ_КОД * @return получилось ли */ bool parseMethods(); /** Просто отпечатать кучу */ void dumpHeap(); #ifdef __cplusplus } #endif #endif
38.5
143
0.583454
[ "object" ]
b2c2276dd3228d8191cf74c21968205160923e0a
799
h
C
agent/individual.h
Bender250/ntnu-ai
11c06f6cd575e076290370e6034bed51ac93a0a7
[ "MIT" ]
null
null
null
agent/individual.h
Bender250/ntnu-ai
11c06f6cd575e076290370e6034bed51ac93a0a7
[ "MIT" ]
null
null
null
agent/individual.h
Bender250/ntnu-ai
11c06f6cd575e076290370e6034bed51ac93a0a7
[ "MIT" ]
null
null
null
#ifndef INDIVIDUAL_H #define INDIVIDUAL_H #include "settings.h" #include "neuron.h" #include "flatland.h" #include <vector> struct Layer { std::vector<Neuron> _v; }; class Individual { private: float _fitness; std::vector<Layer> _ann; Flatland _f; uint64_t _food_counter; uint64_t _poisson_counter; void eval_step(); friend class Visualiser; public: Individual(); Individual(std::vector<Layer> ann) : _ann(ann) {} float getFitness() { return _fitness; } float evaluate_fitness(); void mutate(); std::unique_ptr<Individual> cross_over(const std::unique_ptr<Individual> &in) const; std::unique_ptr<Individual> get_copy() const; void print() const; void regenerate_flatland(uint64_t seed); }; #endif // INDIVIDUAL_H
19.975
88
0.682103
[ "vector" ]
b2cf9adca2ef1440a5c34595ec84b3503ee28688
7,050
h
C
SimVascular-master/Code/Source/sv4gui/Modules/Path/sv4gui_PathVtkMapper2D.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
SimVascular-master/Code/Source/sv4gui/Modules/Path/sv4gui_PathVtkMapper2D.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
SimVascular-master/Code/Source/sv4gui/Modules/Path/sv4gui_PathVtkMapper2D.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) Stanford University, The Regents of the University of * California, and others. * * All Rights Reserved. * * See Copyright-SimVascular.txt for additional details. * * 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. * * 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 SV4GUI_PATHVTKMAPPER2D_H #define SV4GUI_PATHVTKMAPPER2D_H #include "SimVascular.h" #include <sv4guiModulePathExports.h> #include "sv4gui_Path.h" #include "mitkVtkMapper.h" #include "mitkBaseRenderer.h" #include "mitkLocalStorageHandler.h" //VTK #include <vtkSmartPointer.h> class vtkActor; class vtkPropAssembly; class vtkPolyData; class vtkPolyDataMapper; class vtkGlyphSource2D; class vtkGlyph3D; class vtkFloatArray; class vtkCellArray; class SV4GUIMODULEPATH_EXPORT sv4guiPathVtkMapper2D : public mitk::VtkMapper { public: mitkClassMacro(sv4guiPathVtkMapper2D, mitk::VtkMapper); itkFactorylessNewMacro(Self) itkCloneMacro(Self) virtual const sv4guiPath* GetInput() const; static bool makePerpendicularVector2D(const mitk::Vector2D& in, mitk::Vector2D& out); virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override; static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); class SV4GUIMODULEPATH_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage { public: LocalStorage(); ~LocalStorage(); // points vtkSmartPointer<vtkPoints> m_UnselectedPoints; vtkSmartPointer<vtkPoints> m_SelectedPoints; // vtkSmartPointer<vtkPoints> m_ContourPoints; vtkSmartPointer<vtkPoints> m_SplinePoints; vtkSmartPointer<vtkPoints> m_SplineConnectingPoints; // scales vtkSmartPointer<vtkFloatArray> m_UnselectedScales; vtkSmartPointer<vtkFloatArray> m_SelectedScales; vtkSmartPointer<vtkFloatArray> m_SplinePointsScales; // distances // vtkSmartPointer<vtkFloatArray> m_DistancesBetweenPoints; // lines // vtkSmartPointer<vtkCellArray> m_ContourLines; vtkSmartPointer<vtkCellArray> m_SplineConnectingLines; // glyph source (provides different shapes for the points) vtkSmartPointer<vtkGlyphSource2D> m_UnselectedGlyphSource2D; vtkSmartPointer<vtkGlyphSource2D> m_SelectedGlyphSource2D; vtkSmartPointer<vtkGlyphSource2D> m_SplineGlyphSource2D; // glyph vtkSmartPointer<vtkGlyph3D> m_UnselectedGlyph3D; vtkSmartPointer<vtkGlyph3D> m_SelectedGlyph3D; vtkSmartPointer<vtkGlyph3D> m_SplineGlyph3D; // polydata vtkSmartPointer<vtkPolyData> m_VtkUnselectedPointsPolyData; vtkSmartPointer<vtkPolyData> m_VtkSelectedPointsPolyData; // vtkSmartPointer<vtkPolyData> m_VtkContourPolyData; vtkSmartPointer<vtkPolyData> m_VtkSplinePointsPolyData; vtkSmartPointer<vtkPolyData> m_VtkSplineConnectingLinesPolyData; // actor vtkSmartPointer<vtkActor> m_UnselectedActor; vtkSmartPointer<vtkActor> m_SelectedActor; // vtkSmartPointer<vtkActor> m_ContourActor; vtkSmartPointer<vtkActor> m_SplinePointsActor; vtkSmartPointer<vtkActor> m_SplineConnectingLinesActor; // vtkSmartPointer<vtkTextActor> m_VtkTextActor; // std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextLabelActors; // std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextDistanceActors; // std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextAngleActors; // mappers vtkSmartPointer<vtkPolyDataMapper> m_VtkUnselectedPolyDataMapper; vtkSmartPointer<vtkPolyDataMapper> m_VtkSelectedPolyDataMapper; // vtkSmartPointer<vtkPolyDataMapper> m_VtkContourPolyDataMapper; vtkSmartPointer<vtkPolyDataMapper> m_VtkSplinePointsPolyDataMapper; vtkSmartPointer<vtkPolyDataMapper> m_VtkSplineConnectingLinesPolyDataMapper; // propassembly vtkSmartPointer<vtkPropAssembly> m_PropAssembly; }; mitk::LocalStorageHandler<LocalStorage> m_LSH; protected: sv4guiPathVtkMapper2D(); virtual ~sv4guiPathVtkMapper2D(); virtual void CreateVTKRenderObjects(mitk::BaseRenderer* renderer); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override; virtual void ResetMapper( mitk::BaseRenderer* renderer ) override; // member variables holding the current value of the properties used in this mapper // bool m_ShowContour; // "show contour" property bool m_ShowSpline; // "show spline" property bool m_ShowSplinePoints; // "show spline points" property // bool m_CloseContour; // "close contour" property bool m_ShowPoints; // "show points" property // bool m_ShowDistances; // "show distances" property // int m_DistancesDecimalDigits; // "distance decimal digits" property // bool m_ShowAngles; // "show angles" property // bool m_ShowDistantLines; // "show distant lines" property int m_LineWidth; // "line width" property int m_PointLineWidth; // "point line width" property float m_Point2DSize; // "point 2D size" property, in display units float m_SplinePoint2DSize; // "spline point 2D size" property, in display units // int m_IDShapeProperty; // ID for mitkPointSetShape Enumeration Property "Pointset.2D.shape" // bool m_FillShape; // "Pointset.2D.fill shape" property float m_DistanceToPlane; // "point 2D distance to plane" property }; #endif // SV4GUI_PATHVTKMAPPER2D_H
39.830508
120
0.725532
[ "shape", "vector" ]
b2d1a5b8ed23079081c23a6a27d31d9aaa212081
9,154
h
C
PrototypeEngine/src/core/PrototypePhysics.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
2
2021-08-19T17:15:49.000Z
2021-12-28T22:48:47.000Z
PrototypeEngine/src/core/PrototypePhysics.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
null
null
null
PrototypeEngine/src/core/PrototypePhysics.h
o-micron/Prototype
5b9d60d9dd80e7c8a1a2b0aaf19c2d90c1814139
[ "Apache-2.0" ]
null
null
null
/// Copyright 2021 Omar Sherif Fathy /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. #pragma once #include <PrototypeCommon/Definitions.h> #include <PrototypeCommon/Maths.h> #include <optional> struct PrototypeScene; struct PrototypeObject; enum class PrototypePhysicsVehicleGear { Reverse = 0, NEUTRAL = 1, FIRST = 2, SECOND = 3, THIRD = 4, FOURTH = 5, FIFTH = 6, SIXTH = 7, SEVENTH = 8, EIGHTH = 9, NINTH = 10, TENTH = 11, ELEVENTH = 12, TWELFTH = 13, THIRTEENTH = 14, FOURTEENTH = 15, FIFTEENTH = 16, SIXTEENTH = 17, SEVENTEENTH = 18, EIGHTEENTH = 19, NINETEENTH = 20, TWENTIETH = 21, TWENTYFIRST = 22, TWENTYSECOND = 23, TWENTYTHIRD = 24, TWENTYFOURTH = 25, TWENTYFIFTH = 26, TWENTYSIXTH = 27, TWENTYSEVENTH = 28, TWENTYEIGHTH = 29, TWENTYNINTH = 30, THIRTIETH = 31 }; struct PROTOTYPE_PURE_ABSTRACT PrototypePhysics { // deconstructor virtual ~PrototypePhysics() = default; // initialize physics virtual bool init() = 0; // de-initialize physics virtual void deInit() = 0; // play or resume physics simulation virtual void play() = 0; // pause physics simulation virtual void pause() = 0; // update the physics simulation (++tick) virtual bool update() = 0; // schedule a physics record pass virtual void scheduleRecordPass() = 0; // start recording instructions virtual void beginRecordPass() = 0; // stop recording instructions virtual void endRecordPass() = 0; // check if simulation is playing virtual bool isPlaying() = 0; // force move the rigidbody from a random transformation, overwrite the simulation constraints and forces etc .. virtual void overrideRigidbodyGlobalPos(PrototypeObject* object) = 0; // shoot a ray to the unknown from a point and a direction and length of the ray virtual std::optional<PrototypeObject*> raycast(const glm::vec3& origin, const glm::vec3& dir, const f32 length) = 0; // get the model matrix for the given rigidbody virtual void fetchModelMatrix(void* rigidbody, void* shape, glm::mat4& model) = 0; // create a new plane collider for the given object virtual void createPlaneCollider(PrototypeObject* object) = 0; // create a new box collider virtual void createBoxCollider(PrototypeObject* object) = 0; // create a new sphere collider for the given object virtual void createSphereCollider(PrototypeObject* object) = 0; // create a new capsule collider for the given object and geometry data virtual void createCapsuleCollider(const float& radius, const float& halfHeight, const float& density, PrototypeObject* object) = 0; // create a new convex mesh collider for the given object and mesh data virtual void createConvexMeshCollider(const std::vector<glm::vec3>& vertices, const std::vector<u32>& indices, PrototypeObject* object) = 0; // create a new static triangulated mesh collider for the given object and mesh data virtual void createTriMeshCollider(const std::vector<glm::vec3>& vertices, const std::vector<u32>& indices, PrototypeObject* object) = 0; // create a new static mesh collider for the given object and mesh data virtual void createStaticCollider(const std::vector<glm::vec3>& vertices, const std::vector<u32>& indices, PrototypeObject* object) = 0; // create a new vehicle for the given objects virtual void createVehicle(const std::vector<glm::vec3>& chasisVertices, const std::vector<u32>& chasisIndices, const std::vector<glm::vec3>& wheelVertices, const std::vector<u32>& wheelIndices, PrototypeObject* chasisObject, PrototypeObject* wheelFRObject, PrototypeObject* wheelFLObject, PrototypeObject* wheelBRObject, PrototypeObject* wheelBLObject) = 0; // control the currently driven vehicle, acceleration, brake, steer wheel .. virtual void updateVehicleController(PrototypeObject* object, f32 acceleration, f32 brake, f32 steer) = 0; // update the rigidbody for whther it's static or dynamic virtual void updateRigidbodyStatic(PrototypeObject* object) = 0; // update the rigidbody for whther it's trigger or not virtual void updateRigidbodyTrigger(PrototypeObject* object) = 0; // overwrite the simulation's linear velocity for the given object's rigidbody virtual void updateRigidbodyLinearVelocity(PrototypeObject* object) = 0; // overwrite the simulation's linear damping for the given object's rigidbody virtual void updateRigidbodyLinearDamping(PrototypeObject* object) = 0; // overwrite the simulation's angular velocity for the given object's rigidbody virtual void updateRigidbodyAngularVelocity(PrototypeObject* object) = 0; // overwrite the simulation's angular damping for the given object's rigidbody virtual void updateRigidbodyAngularDamping(PrototypeObject* object) = 0; // overwrite the simulation's mass for the given object's rigidbody virtual void updateRigidbodyMass(PrototypeObject* object) = 0; // overwrite the simulation's linear velocity lock for the given object's rigidbody virtual void updateRigidbodyLockLinear(PrototypeObject* object) = 0; // overwrite the simulation's angular velocity lock for the given object's rigidbody virtual void updateRigidbodyLockAngular(PrototypeObject* object) = 0; // changes collider for the given object virtual void updateCollider(PrototypeObject* object, const std::string& shapeName) = 0; // scales collider for the given object virtual void scaleCollider(PrototypeObject* object, const glm::vec3& scale) = 0; // creates a new rigidbody from the object's rigidbody and collider traits configuration virtual void createRigidbody(PrototypeObject* object) = 0; // destroys a rigidbody virtual void destroyRigidbody(void* rigidbody) = 0; // spawn a new vehicle virtual void spawnVehicle() = 0; // toggle vehicle access controller virtual void toggleVehicleAccessControl(PrototypeObject* object) = 0; // iterate forward to gain access control to the next vehicle in the scene virtual void requestNextVehicleAccessControl() = 0; // iterate backward to gain access control to the previous vehicle in the scene virtual void requestPreviousVehicleAccessControl() = 0; // set vehicle gears virtual void controlledVehiclesSetGear(PrototypePhysicsVehicleGear gear) = 0; // toggle vehicle gears (forward/backward) virtual void controlledVehiclesToggleGearDirection() = 0; // flips the vehicle back to normal (call in case vehicle is upside down) virtual void controlledVehiclesFlip() = 0; // called when mouse clicks events triggers virtual void onMouse(i32 button, i32 action, i32 mods) = 0; // called when mouse cursor movement event triggers virtual void onMouseMove(f64 x, f64 y) = 0; // called when mouse drag event triggers virtual void onMouseDrag(i32 button, f64 x, f64 y) = 0; // called when mouse scroll event triggers virtual void onMouseScroll(f64 x, f64 y) = 0; // called when keyboard keys events trigger virtual void onKeyboard(i32 key, i32 scancode, i32 action, i32 mods) = 0; // called when window resize event triggers virtual void onWindowResize(i32 width, i32 height) = 0; // called when drag and dropping files event triggers virtual void onWindowDragDrop(i32 numFiles, const char** names) = 0; };
40.504425
122
0.635241
[ "mesh", "geometry", "object", "shape", "vector", "model" ]
b2e56ece79901c623d04fdb8cf805aa7f042b985
4,092
h
C
source/Basic.h
gitlarky/PoreDy
911818ea835ef4166650fd2174c9c596d979b7b3
[ "Apache-2.0" ]
1
2021-03-30T22:09:33.000Z
2021-03-30T22:09:33.000Z
source/Basic.h
gitlarky/PoreDy
911818ea835ef4166650fd2174c9c596d979b7b3
[ "Apache-2.0" ]
null
null
null
source/Basic.h
gitlarky/PoreDy
911818ea835ef4166650fd2174c9c596d979b7b3
[ "Apache-2.0" ]
null
null
null
/* * Basic.h * * Created on: Apr 15, 2014 * Author: david */ #ifndef BASIC_H_ #define BASIC_H_ /*---------------------------------------------------------------------------------------------------- * * include what? * ----------------------------------------------------------------------------------------------------*/ #include <iostream> #include <fstream> #include <sstream> #include <vector> #include <map> #include <string> #include <bitset> #include <iomanip> #include <cstdlib> #include <cmath> #include <limits> #include <algorithm> #include <Eigen/Dense> #include <Eigen/Sparse> /*---------------------------------------------------------------------------------------------------- * * type definition * ----------------------------------------------------------------------------------------------------*/ typedef double numeric_t;//typedef float numeric_t; typedef int index_t; //Range: [-2147483648 , 2147483647]//typedef long index_t; //Range: [-9223372036854775808 , 9223372036854775807] /*---------------------------------------------------------------------------------------------------- * * enumeration definition * ----------------------------------------------------------------------------------------------------*/ enum direction_e {e, n, w, s, ne, nw, sw, se}; enum corner_e {NE, NW, SW, SE}; enum neighbor_e {E, N, W, S, EE, NN, WW, SS, EEE, NNN, WWW, SSS, EEEE, NNNN, WWWW, SSSS}; enum coordinate_e {origin, xAxis, yAxis}; enum parallelLine_e {notParallel, allHorizontal, allVertical}; enum blockType_e {ghost, flowfield, porousmedia}; enum physicsModel_e {incompressibleFLow, isothermalEvaporation, poreNetwork}; enum eqItem_e {convectionItem, diffussionItem, deltaPAVT, RorD}; enum cellType_e {fCell, uvCell, uCell, vCell, cCell, pore}; enum porosityType_e {singlePorosity, downupPorosity, leftrightPorosity, assignPorosity}; enum position_e {liquidSide, inside, meniscus, open}; enum vpStatus_e {none, unknown, found, out, saturated}; //enum sStatus_e {empty, film, partial, liquid}; enum sStatus_e {empty, film, liquid}; enum PDEBCType_e {NoPDEBC, Dirichlet, Neumann, Cauchy}; enum BCType_e {NoBC, Inlet, Outlet, Wall, PeriodicUpstream, PeriodicDownstream, PorousOpen, VelocityInlet, PressureOutlet, ConstConcentration, Symmetry , FixedValueBC, Relation0BC, Relation1BC, Relation2BC}; enum algorithm_e {SIMPLE, SIMPLER, SIMPLEC, PISO, OperatorSplitting, NonOperatorSplitting, ConvectionDiffusion, DiffusionConvection}; enum scheme_e {Upwind, Hybrid, PowerLaw, QUICK, HayaseQUICK, TVD}; enum schemeOrder_e {firstOrder=1, secondOrder=2}; enum shape_e {circle=0, triangle=3, square, pentagon, hexagon}; /*---------------------------------------------------------------------------------------------------- * * constant definition * ----------------------------------------------------------------------------------------------------*/ const size_t outputPrecision(4); const index_t voidIndex(-1); const size_t HowManyCopy(3); const size_t HowManyVariable(4);//u v p c const numeric_t defaultGrowth(1); const size_t defaultSegment(1); const size_t neighborNumber(8), nodeNumber(8), sideNumber(4), cornerNumber(4); const size_t EqComponent(4); const size_t VariableCount(4); const numeric_t pi(3.1415926); const numeric_t UniversalR(8.3144621); const numeric_t atm(1.01325e5); const numeric_t ThroatAverageLength(5.0e-4), ThroatAverageDiameter(9.0e-5); const numeric_t Psat(2.333e3), Csat(0.9592), Cliquid(55394.01); const numeric_t Pa(1.01325e5), Pout(0); const numeric_t dryCriteria(1e-6); const numeric_t VarianceRateTolerance(1e-12); const numeric_t MinDisplayThroatRadius(25e-6), MaxDisplayThroatRadius(50e-6); //---------------------------------------------------------------------------------------------------- #endif /* BASIC_H_ */
37.888889
157
0.533969
[ "vector" ]
b2ea03d07531f409b544e64549e1391236c83b65
60
h
C
PIMPL/PIMPL/Commons.h
jayavardhanravi/DesignPatterns
aa6a37790f447c7caf69c6a1a9c6107074309a03
[ "BSD-2-Clause" ]
8
2020-01-23T23:20:40.000Z
2022-01-08T13:04:08.000Z
PIMPL/PIMPL/Commons.h
jayavardhanravi/DesignPatterns
aa6a37790f447c7caf69c6a1a9c6107074309a03
[ "BSD-2-Clause" ]
null
null
null
PIMPL/PIMPL/Commons.h
jayavardhanravi/DesignPatterns
aa6a37790f447c7caf69c6a1a9c6107074309a03
[ "BSD-2-Clause" ]
1
2020-01-28T14:27:54.000Z
2020-01-28T14:27:54.000Z
#pragma once enum MESH { CYLINDER, SPHERE, CONE, BOX };
7.5
12
0.65
[ "mesh" ]
b2f03826801cfc1ef5e25e169da8a77bc89aec8c
941
h
C
Dev/Engine/Source/Tools/CCSocketManager.h
OrangeLabsBeijing/2c
b503e78495ed04f6d06cb32147a318c8c984e1b4
[ "Apache-2.0" ]
3
2018-05-26T04:38:48.000Z
2020-05-07T12:47:05.000Z
Dev/Engine/Source/Tools/CCSocketManager.h
OrangeLabsBeijing/2c
b503e78495ed04f6d06cb32147a318c8c984e1b4
[ "Apache-2.0" ]
1
2021-06-22T11:18:07.000Z
2021-06-22T11:18:07.000Z
Dev/Engine/Source/Tools/CCSocketManager.h
OrangeLabsBeijing/2c
b503e78495ed04f6d06cb32147a318c8c984e1b4
[ "Apache-2.0" ]
1
2021-06-22T10:29:46.000Z
2021-06-22T10:29:46.000Z
/*----------------------------------------------------------- * 2c - Cross Platform 3D Application Framework *----------------------------------------------------------- * Copyright © 2011 – 2011 France Telecom * This software is distributed under the Apache 2.0 license, * see the "license.txt" file for more details. *----------------------------------------------------------- * File Name : CCSocketManager.h * Description : Handles UDP connections. * Based on this tutorial http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#datagram * * Created : 15/06/11 * Author(s) : Ashraf Samy Hegab *----------------------------------------------------------- */ #ifndef __CCSOCKETMANAGER_H__ #define __CCSOCKETMANAGER_H__ //class CCSocketManager //{ //public: // CCSocketManager(); // ~CCSocketManager(); // // void listen(); // void send(); //}; #endif // __CCSOCKETMANAGER_H__
28.515152
109
0.499469
[ "3d" ]
b2f6d8e9d2cc7bf421642946ae721a3a9304b9ea
15,260
h
C
Client/include/MSL/Client/ModuleC.h
akb825/ModularShaderLanguage
5116afac2a27db5d3e62fac38353fce701c8997b
[ "Apache-2.0" ]
6
2018-12-06T10:17:24.000Z
2020-09-20T16:26:47.000Z
Client/include/MSL/Client/ModuleC.h
akb825/ModularShaderLanguage
5116afac2a27db5d3e62fac38353fce701c8997b
[ "Apache-2.0" ]
2
2020-02-08T09:32:06.000Z
2020-03-30T02:11:21.000Z
Client/include/MSL/Client/ModuleC.h
akb825/ModularShaderLanguage
5116afac2a27db5d3e62fac38353fce701c8997b
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2016-2019 Aaron Barany * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <MSL/Config.h> #include <MSL/Client/Export.h> #include <MSL/Client/TypesC.h> /** * @file * @brief Shader module loading implementation for C. * * Modules can be read by stream with mslModule_readStream(), data pointer with * mslModule_readData(), or file with mslModule_readFile(). When finished with a module, call * mslModule_destroy() to destroy it. * * The module will be created with a single allocation, the size of which can be queried with * mslModule_sizeof(). As a result of this implementation, most queries require computing an offset * within the buffer, including endian swaps on big-endian systems. This can be mitigated by making * sure that values are cached when using them. For example: * * @code * uint32_t pipelineCount = mslModule_pipelineCount(module); * for (uirnt32_t i = 0; i < pipelineCount; ++i) * { * ... * } * @endcode * * When reading a module, errno will be set based on the error that occurred. Typical values are: * - EINVAL: invalid arguments. * - ENOMEM: failed to allocate memory. * - ENOENT: no file found. * - EACCESS: permission denied reading the file. * - EIO: IO error reading the file. This will also be set if the file isn't large enough to read * the buffer size passed in. * - EILSEQ: invalid file format. Since this is a non-standard usage of this error code, it can be * changed by calling mslModule_setInvalidFormatErrno(). */ #ifdef __cplusplus extern "C" { #endif /** * @brief Sets the errno error code for an invalid file format. * * The default is to use EILSEQ. This is non-standard, so this provides applications to set a custom * value instead. * * @param errorCode The error code to use. */ MSL_CLIENT_EXPORT void mslModule_setInvalidFormatErrno(int errorCode); /** * @brief Gets the size that will be allocated for a module. * @param dataSize The size of the module data. * @return The allocated size for the module data and metadata. */ MSL_CLIENT_EXPORT size_t mslModule_sizeof(size_t dataSize); /** * @brief Reads a shader module from a stream. * * This will read exactly size bytes from the stream. This is used in order to allocate the proper * amount of data up-front and guarantee only a single allocation is done. * * @param readFunc The function to read data from. * @param userData The user data to pass to the read function. * @param size The size of the data to read. * @param allocator The allocator. If NULL, malloc will be used instead. * @return The read shader module, or NULL if it couldn't be read. errno will be set on failure. */ MSL_CLIENT_EXPORT mslModule* mslModule_readStream(mslReadFunction readFunc, void* userData, size_t size, const mslAllocator* allocator); /** * @brief Reads a shader module from a data buffer. * * This will copy the contents of the buffer into the created shader module. * * @param data The data buffer to read from. * @param size The size of the data to read. * @param allocator The allocator. If NULL, malloc will be used instead. * @return The read shader module, or NULL if it couldn't be read. errno will be set on failure. */ MSL_CLIENT_EXPORT mslModule* mslModule_readData(const void* data, size_t size, const mslAllocator* allocator); /** * @brief Reads a shader module from a file. * @param fileName The name of the file to read from. * @param allocator The allocator. If NULL, malloc will be used instead. * @return The read shader module, or NULL if it couldn't be read. errno will be set on failure. */ MSL_CLIENT_EXPORT mslModule* mslModule_readFile(const char* fileName, const mslAllocator* allocator); /** * @brief Gets the file version of the module. * @param module The shader module. * @return The file version. */ MSL_CLIENT_EXPORT uint32_t mslModule_version(const mslModule* module); /** * @brief Gets the target ID for a shader module. * @param module The shader module. * @return The target ID. */ MSL_CLIENT_EXPORT uint32_t mslModule_targetId(const mslModule* module); /** * @brief Gets the target version for a shader module. * @param module The shader module. * @return The target version. */ MSL_CLIENT_EXPORT uint32_t mslModule_targetVersion(const mslModule* module); /** * @brief Gets whether or not the bindings are adjustable in the shader module. * @param module The shader module. * @return True if bindings are adjustable. */ MSL_CLIENT_EXPORT bool mslModule_adjustableBindings(const mslModule* module); /** * @brief Gets the number of pipelines within the shader module. * @param module The shader module. * @return The number of pipelines. */ MSL_CLIENT_EXPORT uint32_t mslModule_pipelineCount(const mslModule* module); /** * @brief Gets the info for a pipeline within the shader module. * @param[out] outPipeline The structure to hold the pipeline info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_pipeline(mslPipeline* outPipeline, const mslModule* module, uint32_t pipelineIndex); /** * @brief Gets the info for a struct within a pipeline. * @param[out] outStruct The structure to hold the struct info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param structIndex The index of the struct within the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_struct(mslStruct* outStruct, const mslModule* module, uint32_t pipelineIndex, uint32_t structIndex); /** * @brief Gets the info for a struct member within a pipeline. * @param[out] outStructMember The structure to hold the struct member info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param structIndex The index of the struct within the pipeline. * @param structMemberIndex The index of the struct member within the struct. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_structMember(mslStructMember* outStructMember, const mslModule* module, uint32_t pipelineIndex, uint32_t structIndex, uint32_t structMemberIndex); /** * @brief Gets the array info for a struct member within a pipeline. * @param[out] outArrayInfo The structure to hold the struct member array info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param structIndex The index of the struct within the pipeline. * @param structMemberIndex The index of the struct member within the struct. * @param arrayElement The array element to get the info for. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_structMemberArrayInfo(mslArrayInfo* outArrayInfo, const mslModule* module, uint32_t pipelineIndex, uint32_t structIndex, uint32_t structMemberIndex, uint32_t arrayElement); /** * @brief Gets the info for a sampler state within a pipeline. * @param[out] outSamplerState The structure to hold the sampler state info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param samplerStateIndex The index of the sampler state within the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_samplerState(mslSamplerState* outSamplerState, const mslModule* module, uint32_t pipelineIndex, uint32_t samplerStateIndex); /** * @brief Gets the info for a uniform within a pipeline. * @param[out] outUniform The structure to hold the uniform info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param uniformIndex The index of the uniform within the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_uniform(mslUniform* outUniform, const mslModule* module, uint32_t pipelineIndex, uint32_t uniformIndex); /** * @brief Gets the array info for a uniform within a pipeline. * @param[out] outArrayInfo The structure to hold the uniform array info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param uniformIndex The index of the uniform within the pipeline. * @param arrayElement The array element to get the info for. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_uniformArrayInfo(mslArrayInfo* outArrayInfo, const mslModule* module, uint32_t pipelineIndex, uint32_t uniformIndex, uint32_t arrayElement); /** * @brief Gets the info for a vertex attribute within a pipeline. * @param[out] outAttribute The structure to hold the attribute info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param attributeIndex The index of the attribute within the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_attribute(mslAttribute* outAttribute, const mslModule* module, uint32_t pipelineIndex, uint32_t attributeIndex); /** * @brief Gets the info for a fragment output within a pipeline. * @param[out] outOutput The structure to hold the fragment output info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param outputIndex The index of the fragment output within the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_fragmentOutput(mslFragmentOutput* outOutput, const mslModule* module, uint32_t pipelineIndex, uint32_t outputIndex); /** * @brief Gets the array length for a vertex attribute within a pipeline. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param attributeIndex The index of the attribute within the pipeline. * @param arrayElement The array element to get the info for. * @return The length of the array, or unkown if the parameters are incorrect. */ MSL_CLIENT_EXPORT uint32_t mslModule_attributeArrayLength(const mslModule* module, uint32_t pipelineIndex, uint32_t attributeIndex, uint32_t arrayElement); /** * @brief Gets the render state for a pipeline within the module. * @param[out] outRenderState The structure to hold the rneder state info. * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_renderState(mslRenderState* outRenderState, const mslModule* module, uint32_t pipelineIndex); /** * @brief Gets the uniform ID for a pipeline stage's shader. * * This has different meaning depending on the target: * SPIR-V: The SPIR-V ID for the uniform variable. * Metal: The buffer or texture index for the buffer. * * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param uniformIndex The index of the uniform. * @param stage The shader stage. * @return The unform ID or MSL_UNKNOWN if the uniform is unused, the ID isn't valid for the * current target, or the parameters are incorrect. */ MSL_CLIENT_EXPORT uint32_t mslModule_shaderUniformId(const mslModule* module, uint32_t pipelineIndex, uint32_t uniformIndex, mslStage stage); /** * @brief Sets the descriptor set and binding for a uniform within a pipeline. * * This is only valid when the bindings are adjustable, which itself is only available for SPIR-V * shaders. This will adjust the descriptor set and binding indices within the SPIR-V for each stage * within the pipeline, as well as update the indices requested with mslModule_uniform(). * * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param uniformIndex The index of the uniform within the pipeline. * @param descriptorSet The new descriptor set to use. * @param binding The new binding index set to use. * @return False if the parameters are incorrect or the bindings aren't adjustable. */ MSL_CLIENT_EXPORT bool mslModule_setUniformBinding(mslModule* module, uint32_t pipelineIndex, uint32_t uniformIndex, uint32_t descriptorSet, uint32_t binding); /** * @brief Sets the descriptor set and binding for a uniform within a copy of the shader data for a * pipeline. * * This is only valid for SPIR-V. This operates on a copy of the shader data, allowing for multiple * instances of the shader to have diferent bindings. * * @param module The shader module. * @param pipelineIndex The index of the pipeline. * @param uniformIndex The index of the uniform within the pipeline. * @param descriptorSet The new descriptor set to use. * @param binding The new binding index set to use. * @param shaderData The data for the shader stages. This must have come from the original shader * data. * @return False if the parameters are incorrect. */ MSL_CLIENT_EXPORT bool mslModule_setUniformBindingCopy(const mslModule* module, uint32_t pipelineIndex, uint32_t uniformIndex, uint32_t descriptorSet, uint32_t binding, mslSizedData shaderData[mslStage_Count]); /** * @brief Gets number of shaders within the module. * @param module The shader module. * @return The number of shaders. */ MSL_CLIENT_EXPORT uint32_t mslModule_shaderCount(const mslModule* module); /** * @brief Gets the size of a shader within the module. * @param module The shader module. * @param shaderIndex The index of the shader. * @return The size of the shader in bytes. */ MSL_CLIENT_EXPORT uint32_t mslModule_shaderSize(const mslModule* module, uint32_t shaderIndex); /** * @brief Gets the data of a shader within the module. * @param module The shader module. * @param shaderIndex The index of the shader. * @return The data for the shader. */ MSL_CLIENT_EXPORT const void* mslModule_shaderData(const mslModule* module, uint32_t shaderIndex); /** * @brief Gets whether or not a shader uses push constants * @param module The shader module. * @param shaderIndex The index of the shader. * @return True if the shader uses push constants, false if not. */ MSL_CLIENT_EXPORT bool mslModule_shaderUsesPushConstants(const mslModule* module, uint32_t shaderIndex); /** * @brief Gets the size of the shared data within the module. * @param module The shader module. * @return The size of the shared data in bytes. */ MSL_CLIENT_EXPORT uint32_t mslModule_sharedDataSize(const mslModule* module); /** * @brief Gets the shared data within the module. * @param module The shader module. * @return The shared data. */ MSL_CLIENT_EXPORT const void* mslModule_sharedData(const mslModule* module); /** * @brief Destroys a shader module. * @param module The module to destroy. */ MSL_CLIENT_EXPORT void mslModule_destroy(mslModule* module); #ifdef __cplusplus } #endif
39.843342
100
0.760944
[ "render" ]
b2fabef902f007c0cf42cc843322068e2d622e6f
1,310
h
C
src/engine/renderers/d3d11/d3d11_mesh.h
hvonck/lambda-lilac
c4cf744356c2d2056e8f66da4f95d2268f7c25d0
[ "BSD-3-Clause" ]
1
2019-05-28T16:39:19.000Z
2019-05-28T16:39:19.000Z
src/engine/renderers/d3d11/d3d11_mesh.h
hvonck/lambda-lilac
c4cf744356c2d2056e8f66da4f95d2268f7c25d0
[ "BSD-3-Clause" ]
null
null
null
src/engine/renderers/d3d11/d3d11_mesh.h
hvonck/lambda-lilac
c4cf744356c2d2056e8f66da4f95d2268f7c25d0
[ "BSD-3-Clause" ]
1
2019-05-28T16:39:06.000Z
2019-05-28T16:39:06.000Z
#pragma once #include "assets/mesh.h" #include <wrl/client.h> #include <memory/memory.h> struct ID3D11Device; struct ID3D11DeviceContext; struct ID3D11Buffer; namespace lambda { namespace windows { class D3D11Context; class D3D11RenderBuffer; /////////////////////////////////////////////////////////////////////////// class D3D11Mesh { public: D3D11Mesh(D3D11Context* context); ~D3D11Mesh(); void bind( const Vector<uint32_t>& stages, asset::VioletMeshHandle mesh, const uint32_t& sub_mesh_idx ); void draw(asset::VioletMeshHandle mesh, const uint32_t& sub_mesh_idx, const uint32_t& instance_count); private: void update( const asset::Mesh::Buffer& mesh_buffer, D3D11RenderBuffer*& buffer, bool is_vertex ); void updateBuffer( const void* data, UINT size, D3D11RenderBuffer*& buffer, bool is_vertex ); void generateBuffer( const void* data, UINT size, D3D11RenderBuffer*& buffer, bool is_vertex, bool is_dynamic ); private: D3D11Context* context_; UnorderedMap<uint32_t, D3D11RenderBuffer*> buffer_; }; } }
23.392857
109
0.563359
[ "mesh", "vector" ]
254377d8e0b9921ff56dab3c2ef17d0996d95c57
9,125
c
C
kernel/kernel-4.9/arch/mips/kvm/tlb.c
rubedos/l4t_R32.5.1_viper
6aed0062084d9031546f946e63fc74303555e0a6
[ "MIT" ]
55
2019-12-20T03:25:14.000Z
2022-01-16T07:19:47.000Z
kernel/kernel-4.9/arch/mips/kvm/tlb.c
rubedos/l4t_R32.5.1_viper
6aed0062084d9031546f946e63fc74303555e0a6
[ "MIT" ]
2
2020-11-02T08:01:00.000Z
2022-03-27T02:59:18.000Z
kernel/kernel-4.9/arch/mips/kvm/tlb.c
rubedos/l4t_R32.5.1_viper
6aed0062084d9031546f946e63fc74303555e0a6
[ "MIT" ]
11
2020-08-06T03:59:45.000Z
2022-02-25T02:31:59.000Z
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * KVM/MIPS TLB handling, this file is part of the Linux host kernel so that * TLB handlers run from KSEG0 * * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. * Authors: Sanjay Lal <sanjayl@kymasys.com> */ #include <linux/sched.h> #include <linux/smp.h> #include <linux/mm.h> #include <linux/delay.h> #include <linux/export.h> #include <linux/kvm_host.h> #include <linux/srcu.h> #include <asm/cpu.h> #include <asm/bootinfo.h> #include <asm/mmu_context.h> #include <asm/pgtable.h> #include <asm/cacheflush.h> #include <asm/tlb.h> #include <asm/tlbdebug.h> #undef CONFIG_MIPS_MT #include <asm/r4kcache.h> #define CONFIG_MIPS_MT #define KVM_GUEST_PC_TLB 0 #define KVM_GUEST_SP_TLB 1 atomic_t kvm_mips_instance; EXPORT_SYMBOL_GPL(kvm_mips_instance); static u32 kvm_mips_get_kernel_asid(struct kvm_vcpu *vcpu) { int cpu = smp_processor_id(); return vcpu->arch.guest_kernel_asid[cpu] & cpu_asid_mask(&cpu_data[cpu]); } static u32 kvm_mips_get_user_asid(struct kvm_vcpu *vcpu) { int cpu = smp_processor_id(); return vcpu->arch.guest_user_asid[cpu] & cpu_asid_mask(&cpu_data[cpu]); } inline u32 kvm_mips_get_commpage_asid(struct kvm_vcpu *vcpu) { return vcpu->kvm->arch.commpage_tlb; } /* Structure defining an tlb entry data set. */ void kvm_mips_dump_host_tlbs(void) { unsigned long flags; local_irq_save(flags); kvm_info("HOST TLBs:\n"); dump_tlb_regs(); pr_info("\n"); dump_tlb_all(); local_irq_restore(flags); } EXPORT_SYMBOL_GPL(kvm_mips_dump_host_tlbs); void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu) { struct mips_coproc *cop0 = vcpu->arch.cop0; struct kvm_mips_tlb tlb; int i; kvm_info("Guest TLBs:\n"); kvm_info("Guest EntryHi: %#lx\n", kvm_read_c0_guest_entryhi(cop0)); for (i = 0; i < KVM_MIPS_GUEST_TLB_SIZE; i++) { tlb = vcpu->arch.guest_tlb[i]; kvm_info("TLB%c%3d Hi 0x%08lx ", (tlb.tlb_lo[0] | tlb.tlb_lo[1]) & ENTRYLO_V ? ' ' : '*', i, tlb.tlb_hi); kvm_info("Lo0=0x%09llx %c%c attr %lx ", (u64) mips3_tlbpfn_to_paddr(tlb.tlb_lo[0]), (tlb.tlb_lo[0] & ENTRYLO_D) ? 'D' : ' ', (tlb.tlb_lo[0] & ENTRYLO_G) ? 'G' : ' ', (tlb.tlb_lo[0] & ENTRYLO_C) >> ENTRYLO_C_SHIFT); kvm_info("Lo1=0x%09llx %c%c attr %lx sz=%lx\n", (u64) mips3_tlbpfn_to_paddr(tlb.tlb_lo[1]), (tlb.tlb_lo[1] & ENTRYLO_D) ? 'D' : ' ', (tlb.tlb_lo[1] & ENTRYLO_G) ? 'G' : ' ', (tlb.tlb_lo[1] & ENTRYLO_C) >> ENTRYLO_C_SHIFT, tlb.tlb_mask); } } EXPORT_SYMBOL_GPL(kvm_mips_dump_guest_tlbs); /* XXXKYMA: Must be called with interrupts disabled */ /* set flush_dcache_mask == 0 if no dcache flush required */ int kvm_mips_host_tlb_write(struct kvm_vcpu *vcpu, unsigned long entryhi, unsigned long entrylo0, unsigned long entrylo1, int flush_dcache_mask) { unsigned long flags; unsigned long old_entryhi; int idx; local_irq_save(flags); old_entryhi = read_c0_entryhi(); write_c0_entryhi(entryhi); mtc0_tlbw_hazard(); tlb_probe(); tlb_probe_hazard(); idx = read_c0_index(); if (idx > current_cpu_data.tlbsize) { kvm_err("%s: Invalid Index: %d\n", __func__, idx); kvm_mips_dump_host_tlbs(); local_irq_restore(flags); return -1; } write_c0_entrylo0(entrylo0); write_c0_entrylo1(entrylo1); mtc0_tlbw_hazard(); if (idx < 0) tlb_write_random(); else tlb_write_indexed(); tlbw_use_hazard(); kvm_debug("@ %#lx idx: %2d [entryhi(R): %#lx] entrylo0(R): 0x%08lx, entrylo1(R): 0x%08lx\n", vcpu->arch.pc, idx, read_c0_entryhi(), read_c0_entrylo0(), read_c0_entrylo1()); /* Flush D-cache */ if (flush_dcache_mask) { if (entrylo0 & ENTRYLO_V) { ++vcpu->stat.flush_dcache_exits; flush_data_cache_page((entryhi & VPN2_MASK) & ~flush_dcache_mask); } if (entrylo1 & ENTRYLO_V) { ++vcpu->stat.flush_dcache_exits; flush_data_cache_page(((entryhi & VPN2_MASK) & ~flush_dcache_mask) | (0x1 << PAGE_SHIFT)); } } /* Restore old ASID */ write_c0_entryhi(old_entryhi); mtc0_tlbw_hazard(); local_irq_restore(flags); return 0; } EXPORT_SYMBOL_GPL(kvm_mips_host_tlb_write); int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr, struct kvm_vcpu *vcpu) { kvm_pfn_t pfn; unsigned long flags, old_entryhi = 0, vaddr = 0; unsigned long entrylo[2] = { 0, 0 }; unsigned int pair_idx; pfn = PFN_DOWN(virt_to_phys(vcpu->arch.kseg0_commpage)); pair_idx = (badvaddr >> PAGE_SHIFT) & 1; entrylo[pair_idx] = mips3_paddr_to_tlbpfn(pfn << PAGE_SHIFT) | ((_page_cachable_default >> _CACHE_SHIFT) << ENTRYLO_C_SHIFT) | ENTRYLO_D | ENTRYLO_V; local_irq_save(flags); old_entryhi = read_c0_entryhi(); vaddr = badvaddr & (PAGE_MASK << 1); write_c0_entryhi(vaddr | kvm_mips_get_kernel_asid(vcpu)); write_c0_entrylo0(entrylo[0]); write_c0_entrylo1(entrylo[1]); write_c0_index(kvm_mips_get_commpage_asid(vcpu)); mtc0_tlbw_hazard(); tlb_write_indexed(); tlbw_use_hazard(); kvm_debug("@ %#lx idx: %2d [entryhi(R): %#lx] entrylo0 (R): 0x%08lx, entrylo1(R): 0x%08lx\n", vcpu->arch.pc, read_c0_index(), read_c0_entryhi(), read_c0_entrylo0(), read_c0_entrylo1()); /* Restore old ASID */ write_c0_entryhi(old_entryhi); mtc0_tlbw_hazard(); local_irq_restore(flags); return 0; } EXPORT_SYMBOL_GPL(kvm_mips_handle_commpage_tlb_fault); int kvm_mips_guest_tlb_lookup(struct kvm_vcpu *vcpu, unsigned long entryhi) { int i; int index = -1; struct kvm_mips_tlb *tlb = vcpu->arch.guest_tlb; for (i = 0; i < KVM_MIPS_GUEST_TLB_SIZE; i++) { if (TLB_HI_VPN2_HIT(tlb[i], entryhi) && TLB_HI_ASID_HIT(tlb[i], entryhi)) { index = i; break; } } kvm_debug("%s: entryhi: %#lx, index: %d lo0: %#lx, lo1: %#lx\n", __func__, entryhi, index, tlb[i].tlb_lo[0], tlb[i].tlb_lo[1]); return index; } EXPORT_SYMBOL_GPL(kvm_mips_guest_tlb_lookup); int kvm_mips_host_tlb_lookup(struct kvm_vcpu *vcpu, unsigned long vaddr) { unsigned long old_entryhi, flags; int idx; local_irq_save(flags); old_entryhi = read_c0_entryhi(); if (KVM_GUEST_KERNEL_MODE(vcpu)) write_c0_entryhi((vaddr & VPN2_MASK) | kvm_mips_get_kernel_asid(vcpu)); else { write_c0_entryhi((vaddr & VPN2_MASK) | kvm_mips_get_user_asid(vcpu)); } mtc0_tlbw_hazard(); tlb_probe(); tlb_probe_hazard(); idx = read_c0_index(); /* Restore old ASID */ write_c0_entryhi(old_entryhi); mtc0_tlbw_hazard(); local_irq_restore(flags); kvm_debug("Host TLB lookup, %#lx, idx: %2d\n", vaddr, idx); return idx; } EXPORT_SYMBOL_GPL(kvm_mips_host_tlb_lookup); int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va) { int idx; unsigned long flags, old_entryhi; local_irq_save(flags); old_entryhi = read_c0_entryhi(); write_c0_entryhi((va & VPN2_MASK) | kvm_mips_get_user_asid(vcpu)); mtc0_tlbw_hazard(); tlb_probe(); tlb_probe_hazard(); idx = read_c0_index(); if (idx >= current_cpu_data.tlbsize) BUG(); if (idx > 0) { write_c0_entryhi(UNIQUE_ENTRYHI(idx)); write_c0_entrylo0(0); write_c0_entrylo1(0); mtc0_tlbw_hazard(); tlb_write_indexed(); tlbw_use_hazard(); } write_c0_entryhi(old_entryhi); mtc0_tlbw_hazard(); local_irq_restore(flags); if (idx > 0) kvm_debug("%s: Invalidated entryhi %#lx @ idx %d\n", __func__, (va & VPN2_MASK) | kvm_mips_get_user_asid(vcpu), idx); return 0; } EXPORT_SYMBOL_GPL(kvm_mips_host_tlb_inv); void kvm_mips_flush_host_tlb(int skip_kseg0) { unsigned long flags; unsigned long old_entryhi, entryhi; unsigned long old_pagemask; int entry = 0; int maxentry = current_cpu_data.tlbsize; local_irq_save(flags); old_entryhi = read_c0_entryhi(); old_pagemask = read_c0_pagemask(); /* Blast 'em all away. */ for (entry = 0; entry < maxentry; entry++) { write_c0_index(entry); if (skip_kseg0) { mtc0_tlbr_hazard(); tlb_read(); tlb_read_hazard(); entryhi = read_c0_entryhi(); /* Don't blow away guest kernel entries */ if (KVM_GUEST_KSEGX(entryhi) == KVM_GUEST_KSEG0) continue; write_c0_pagemask(old_pagemask); } /* Make sure all entries differ. */ write_c0_entryhi(UNIQUE_ENTRYHI(entry)); write_c0_entrylo0(0); write_c0_entrylo1(0); mtc0_tlbw_hazard(); tlb_write_indexed(); tlbw_use_hazard(); } write_c0_entryhi(old_entryhi); write_c0_pagemask(old_pagemask); mtc0_tlbw_hazard(); local_irq_restore(flags); } EXPORT_SYMBOL_GPL(kvm_mips_flush_host_tlb); void kvm_local_flush_tlb_all(void) { unsigned long flags; unsigned long old_ctx; int entry = 0; local_irq_save(flags); /* Save old context and create impossible VPN2 value */ old_ctx = read_c0_entryhi(); write_c0_entrylo0(0); write_c0_entrylo1(0); /* Blast 'em all away. */ while (entry < current_cpu_data.tlbsize) { /* Make sure all entries differ. */ write_c0_entryhi(UNIQUE_ENTRYHI(entry)); write_c0_index(entry); mtc0_tlbw_hazard(); tlb_write_indexed(); tlbw_use_hazard(); entry++; } write_c0_entryhi(old_ctx); mtc0_tlbw_hazard(); local_irq_restore(flags); } EXPORT_SYMBOL_GPL(kvm_local_flush_tlb_all);
23.701299
94
0.713753
[ "3d" ]
2546bfefb9cccc308d8914c397fb8901e99218c1
1,707
h
C
str/apps/include/InitialPositionCodeDecoder.h
Tamiyas/etrobocon2018
c2c6921dae4ddd1ea98742bcf992777084e4e5dd
[ "MIT" ]
1
2018-07-29T13:31:03.000Z
2018-07-29T13:31:03.000Z
str/apps/include/InitialPositionCodeDecoder.h
Tamiyas/etrobocon2018
c2c6921dae4ddd1ea98742bcf992777084e4e5dd
[ "MIT" ]
60
2018-07-28T16:29:32.000Z
2019-01-08T06:04:05.000Z
str/apps/include/InitialPositionCodeDecoder.h
Tamiyas/etrobocon2018
c2c6921dae4ddd1ea98742bcf992777084e4e5dd
[ "MIT" ]
2
2018-08-07T08:02:07.000Z
2018-08-23T07:08:54.000Z
/** * @file InitialPositionCodeDecoder.h * @brief 初期位置コードデコーダークラス * @author Keisuke MORI */ #ifndef __INITIAL_POSITION_CODE_DECODER__ #define __INITIAL_POSITION_CODE_DECODER__ #include <cstdint> #include <vector> /** * <p> 5桁から6桁の初期位置コードを初期の位置コードリストにデコードするクラス </p> * * <p> Example </p> * * <pre> * {@code * InitialPositionCodeDecoder ipcd; * std::int32_t initialPositionCode = 74840; // = 1*16^4 + 2*16^3 + 4*16^2 + 5*16^1 + 8 * * ipcd.decode(initialPositionCode); * * std::vector<std::int8_t> decodedColorBlockCodeList = ipcd.getInitialPositionCodeList(); // = {1, 2, 4, 5} * std::int8_t decodedPowerBlockCode = ipcd.getInitialPositionPowerBlockCode(); // = 8 * } * </pre> */ class InitialPositionCodeDecoder { public: /** * <p> 初期位置コードをデコードする </p> * * @param code 初期位置コード <br> 0未満はこのクラスで定義している初期値を返す */ void decode(std::int32_t code); /** * <p> 初期位置コードを取得する </p> * * @return 初期位置コード */ std::int32_t getInitialPositionCode(); /** * <p> 初期の位置コードリストを取得する </p> * * @return 初期の位置コードリスト */ std::vector<std::int8_t> getInitialPositionCodeList(); /** * <p> パワーブロックの初期の位置コードを取得する </p> * * <p> * パワーブロックの初期位置は、1~8のみを取る。 * 計算外の場合は0を返す。 * 計算上、1~15までの値を取る可能性はあるが、9以上の場合は動作未検証である。 * </p> * * @return パワーブロックの初期の位置コード <br> 1~8のみ、 {@link #decode(std::int32_t)} の実行前は0を返す */ std::int8_t getInitialPositionPowerBlockCode(); private: /** * 初期位置コード */ std::int32_t initialPositionCode; /** * 初期の位置コードリスト */ std::vector<std::int8_t> initialPositionCodeList = {0, 0, 0, 0}; /** * パワーブロックの初期位置コード */ std::int8_t initialPositionPowerBlockCode = 0; }; #endif
20.566265
112
0.636204
[ "vector" ]
2546db9e6305e2b0c10ae2e436067a8e3ad62f09
906
h
C
include/read_data.h
Pugavkomm/Projection
fe19682027064e13c716df4a3f7854d2b50a9835
[ "MIT" ]
null
null
null
include/read_data.h
Pugavkomm/Projection
fe19682027064e13c716df4a3f7854d2b50a9835
[ "MIT" ]
null
null
null
include/read_data.h
Pugavkomm/Projection
fe19682027064e13c716df4a3f7854d2b50a9835
[ "MIT" ]
null
null
null
/** * @file read_data.h * @brief Read_Data class interface. * */ #ifndef READ #define READ #include <string> #include <fstream> #include <vector> #include "point.h" /** * @brief Read line from file. * */ class Read_Data { public: /** * @brief Construct a new Read_Data object * * @param namefile file name with points */ Read_Data(const std::string &namefile); /** * @brief open ifstream. * * @param namefile file name with points. */ void open(const std::string &namefile); /** * @brief close if stream. * */ void close(); /** * @brief read point from file and save in @ref line * * @param line input line (sequence of points). */ void read_to_line(std::vector<Point> &line); private: std::ifstream file; }; #endif
17.764706
60
0.539735
[ "object", "vector" ]
2548205243a02a0f912aa9a696f3434dec7e14e0
3,548
h
C
shader_trace/include/ShaderTrace.h
azhirnov/glsl_trace
643b9009d02fd2898ecd966c3b1e964d19f8b3b9
[ "MIT" ]
28
2020-04-05T04:03:03.000Z
2022-03-07T01:16:10.000Z
shader_trace/include/ShaderTrace.h
azhirnov/glsl_trace
643b9009d02fd2898ecd966c3b1e964d19f8b3b9
[ "MIT" ]
null
null
null
shader_trace/include/ShaderTrace.h
azhirnov/glsl_trace
643b9009d02fd2898ecd966c3b1e964d19f8b3b9
[ "MIT" ]
3
2020-08-01T19:33:48.000Z
2021-07-23T03:30:52.000Z
// Copyright (c) 2018-2020, Zhirnov Andrey. For more information see 'LICENSE' /* GLSL Trace project https://github.com/azhirnov/glsl_trace */ #pragma once #include <vector> #include <string> #include <unordered_map> namespace glslang { class TIntermediate; } struct ShaderTrace { public: enum class VariableID : uint32_t { Unknown = ~0u }; struct SourcePoint { uint64_t value; SourcePoint () : value{~0ull} {} SourcePoint (uint32_t line, uint32_t column) : value{(uint64_t(line) << 32) | column } {} uint32_t Line () const { return uint32_t(value >> 32); } uint32_t Column () const { return uint32_t(value & 0xFFFFFFFF); } }; struct SourceLocation { uint32_t sourceId = ~0u; SourcePoint begin; SourcePoint end; SourceLocation () {} SourceLocation (uint32_t sourceId, uint32_t line, uint32_t column) : sourceId{sourceId}, begin{line, column}, end{line, column} {} bool operator == (const SourceLocation &rhs) const { return sourceId == rhs.sourceId && begin.value == rhs.begin.value && end.value == rhs.end.value; } }; struct ExprInfo { VariableID varID = VariableID::Unknown; // ID of output variable uint32_t swizzle = 0; SourceLocation range; // begin and end location of expression SourcePoint point; // location of operator std::vector<VariableID> vars; // all variables IDs in this expression }; struct SourceInfo { using LineRange = std::pair< size_t, size_t >; std::string code; std::vector<LineRange> lines; // offset in bytes for each line in 'code' }; using VarNames_t = std::unordered_map< VariableID, std::string >; using ExprInfos_t = std::vector< ExprInfo >; using Sources_t = std::vector< SourceInfo >; using FileMap_t = std::unordered_map< std::string, uint32_t >; // index in '_sources' static constexpr int TBasicType_Clock = 0xcc; // 4x uint64 static constexpr uint32_t InitialPositionMask = 0x80000000u; private: ExprInfos_t _exprLocations; VarNames_t _varNames; Sources_t _sources; FileMap_t _fileMap; uint64_t _posOffset = 0; uint64_t _dataOffset = 0; uint32_t _initialPosition; public: ShaderTrace () {} ShaderTrace (ShaderTrace &&) = delete; ShaderTrace (const ShaderTrace &) = delete; ShaderTrace& operator = (ShaderTrace &&) = delete; ShaderTrace& operator = (const ShaderTrace &) = delete; // Log all function results, log all function calls, log some operator results. // Use 'ParseShaderTrace' to get trace as string. bool InsertTraceRecording (glslang::TIntermediate &, uint32_t descSetIndex); // Insert time measurement into user-defined functions. // Use 'ParseShaderTrace' to get trace as string. bool InsertFunctionProfiler (glslang::TIntermediate &, uint32_t descSetIndex, bool shaderSubgroupClock, bool shaderDeviceClock); // Insert time measurement into entry function, summarize shader invocation times in storage buffer. bool InsertShaderClockHeatmap (glslang::TIntermediate &, uint32_t descSetIndex); // Converts binary trace into string. bool ParseShaderTrace (const void *ptr, uint64_t maxSize, std::vector<std::string> &result) const; // Source code required for 'ParseShaderTrace' function. void SetSource (const char* const* sources, const size_t *lengths, size_t count); void SetSource (const char* source, size_t length); void IncludeSource (const char* filename, const char* source, size_t length); // if used '#include' void GetSource (std::string &result) const; private: void _AppendSource (const char* source, size_t length); };
31.39823
153
0.724915
[ "vector" ]
254f304d259c5b49d622c2bde958889f8b919681
17,535
c
C
internal_api/storage/persistent_object_api.c
hkandiga/tee-engine
e8f42a4851ae74937f74a1310f8a7c8443adcb91
[ "Apache-2.0" ]
null
null
null
internal_api/storage/persistent_object_api.c
hkandiga/tee-engine
e8f42a4851ae74937f74a1310f8a7c8443adcb91
[ "Apache-2.0" ]
null
null
null
internal_api/storage/persistent_object_api.c
hkandiga/tee-engine
e8f42a4851ae74937f74a1310f8a7c8443adcb91
[ "Apache-2.0" ]
null
null
null
/***************************************************************************** ** Copyright (C) 2015 Open-TEE project. ** ** Copyright (C) 2015-2021 Tanel Dettenborn ** ** Copyright (C) 2015-2021 Brian McGillion ** ** Copyright (C) 2022 Technology Innovation Institute (TII) ** ** ** ** 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 <unistd.h> #include "crypto/operation_handle.h" #include "opentee_internal_api.h" #include "tee_time_api.h" #include "tee_panic.h" #include "tee_storage_api.h" #include "object_handle.h" #include "storage_utils.h" #include "tee_logging.h" static void inc_offset(unsigned char **mem_in, size_t offset) { if (*mem_in != NULL) { *mem_in += offset; } } static size_t memcpy_ret_n(void *dest, void *src, size_t n) { if (dest != NULL){ memcpy(dest, src, n); } return n; } static TEE_Result deserialize_gp_attribute(unsigned char *mem_in, struct gp_attributes *attributes) { uint32_t n = 0; TEE_Attribute attr = {0}; //Counter part: serialize_gp_attribute //Function will malloc gp_attribute buffers. //NOTE!!! NOT GP COMPLIENT. Buffer sizes are not maxObjectSizes! if (attributes == NULL && mem_in == NULL) { return TEE_SUCCESS; } memcpy_ret_n(&attributes->attrs_count, mem_in, sizeof(attributes->attrs_count)); mem_in += sizeof(attributes->attrs_count); if (attributes->attrs_count == 0) { return TEE_SUCCESS; } attributes->attrs = calloc(attributes->attrs_count, sizeof(TEE_Attribute)); if (attributes->attrs == NULL) { goto err; } for (n = 0; n < attributes->attrs_count; ++n) { memcpy_ret_n(&attributes->attrs[n].attributeID, mem_in, sizeof(attr.attributeID)); mem_in += sizeof(attr.attributeID); if (is_value_attribute(attr.attributeID)) { memcpy_ret_n(&attributes->attrs[n].content.value.a, mem_in, sizeof(attr.content.value.a)); mem_in += sizeof(attr.content.value.a); memcpy_ret_n(&attributes->attrs[n].content.value.b, mem_in, sizeof(attr.content.value.b)); mem_in += sizeof(attr.content.value.b); } else { memcpy_ret_n(&attributes->attrs[n].content.ref.length, mem_in, sizeof(attr.content.ref.length)); mem_in += sizeof(attr.content.ref.length); attributes->attrs[n].content.ref.buffer = calloc(1, attributes->attrs[n].content.ref.length); if (attributes->attrs[n].content.ref.buffer == NULL) { goto err; } memcpy_ret_n(attributes->attrs[n].content.ref.buffer, mem_in, attributes->attrs[n].content.ref.length); mem_in += attributes->attrs[n].content.ref.length; } } return TEE_SUCCESS; err: free_gp_attributes(attributes); return TEE_ERROR_OUT_OF_MEMORY; } static size_t serialize_gp_attribute(struct gp_attributes *attributes, unsigned char *mem_in) { TEE_Attribute *attr = NULL; uint32_t n = 0; size_t offset = 0; //If mem_in is NULL, functio serialization size //Note: using offset variable rather pointer arithmetic. //Strategy // // What (size of what) //################################ //# attr count (sizeof) //#--------------------------------- //# attrID (sizeof) //#---------------------------------- //# (if VALUE else REF //# a (sizeof) | lenght (sizeof) //#----------------------- //# b (sizeof) | buffer (lenght) //#----------------------------------- //# attrID.. (as many as attr count) //#--... if (attributes == NULL) { return offset; } if (attributes->attrs_count == 0) { return offset; } offset += memcpy_ret_n(mem_in, &attributes->attrs_count, sizeof(attributes->attrs_count)); inc_offset(&mem_in, sizeof(attributes->attrs_count)); for (n = 0; n < attributes->attrs_count; ++n) { attr = &attributes->attrs[n]; offset += memcpy_ret_n(mem_in, &attr->attributeID, sizeof(attr->attributeID)); inc_offset(&mem_in, sizeof(attributes->attrs_count)); if (is_value_attribute(attr->attributeID)) { offset += memcpy_ret_n(mem_in, &attr->content.value.a, sizeof(attr->content.value.a)); inc_offset(&mem_in, sizeof(attr->content.value.a)); offset += memcpy_ret_n(mem_in, &attr->content.value.b, sizeof(attr->content.value.b)); inc_offset(&mem_in, sizeof(attr->content.value.b)); } else { offset += memcpy_ret_n(mem_in, &attr->content.ref.length, sizeof(attr->content.ref.length)); inc_offset(&mem_in, sizeof(attr->content.ref.length)); offset += memcpy_ret_n(mem_in, attr->content.ref.buffer, attr->content.ref.length); inc_offset(&mem_in, attr->content.ref.length); } } return offset; } static TEE_Result create_persistent_handle(TEE_ObjectHandle *new_object, TEE_ObjectHandle attributes, uint32_t flags) { uint32_t objectType = TEE_TYPE_DATA, maxObjectSize = 0; TEE_Result ret; if (attributes) { objectType = attributes->objectInfo.objectType; maxObjectSize = BYTE2BITS(attributes->key->key_lenght); } ret = TEE_AllocateTransientObject(objectType, maxObjectSize, new_object); if (ret != TEE_SUCCESS) { return ret; } if (attributes) { ret = TEE_PopulateTransientObject(*new_object, attributes->key->gp_attrs.attrs, attributes->key->gp_attrs.attrs_count); if (ret != TEE_SUCCESS) { goto err; } } /* Void operations like ss_file to new object. Change object to persisten object */ if (attributes) { (*new_object)->objectInfo.objectUsage = attributes->objectInfo.objectUsage; } (*new_object)->objectInfo.handleFlags |= (TEE_HANDLE_FLAG_PERSISTENT | TEE_HANDLE_FLAG_INITIALIZED | flags); return TEE_SUCCESS; err: free_object_handle(*new_object); (*new_object) = (TEE_ObjectHandle)NULL; return ret; } TEE_Result TEE_OpenPersistentObject(uint32_t storageID, void *objectID, size_t objectIDLen, uint32_t flags, TEE_ObjectHandle *object) { struct com_mrg_open_persistent *retOpenParams = NULL; struct com_mgr_invoke_cmd_payload payload = {}, returnPayload = {}; TEE_ObjectHandle new_object = (TEE_ObjectHandle)NULL; struct gp_attributes ss_file_gp_attributes = {0}; TEE_Result ret = TEE_SUCCESS; if (object == NULL || objectID == NULL || objectIDLen > TEE_OBJECT_ID_MAX_LEN) { OT_LOG_ERR("TEE_OpenPersistentObject: Object null OR objectID null OR objectIDLen too big\n"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } if (storageID != TEE_STORAGE_PRIVATE) { OT_LOG_ERR("TEE_OpenPersistentObject: Only supported storageID is TEE_STORAGE_PRIVATE\n"); return TEE_ERROR_ITEM_NOT_FOUND; } /* Open object from storage to get the object info. Then we know object type */ payload.size = sizeof(struct com_mrg_open_persistent); payload.data = calloc(1, payload.size); if (payload.data == NULL) { OT_LOG_ERR("Panicking due out of memory\n"); TEE_Panic(TEE_ERROR_OUT_OF_MEMORY); } /* Create message: Fill and send (no init data) */ ((struct com_mrg_open_persistent *)payload.data)->storageID = storageID; ((struct com_mrg_open_persistent *)payload.data)->flags = flags; ((struct com_mrg_open_persistent *)payload.data)->objectIDLen = objectIDLen; memcpy(&((struct com_mrg_open_persistent *)payload.data)->objectID, (uint8_t *)objectID, objectIDLen); ret = TEE_InvokeMGRCommand(TEE_TIMEOUT_INFINITE, COM_MGR_CMD_ID_OPEN_PERSISTENT, &payload, &returnPayload); if (ret != TEE_SUCCESS) { goto out; } retOpenParams = returnPayload.data; ret = TEE_AllocateTransientObject(retOpenParams->info.objectType, retOpenParams->info.keySize, &new_object); if (ret != TEE_SUCCESS) { OT_LOG_ERR("TEE_OpenPersistentObject: Object alloc failed\n"); goto out; } /* Might be a data object */ if (retOpenParams->attrsSize > 0) { if (TEE_SUCCESS != deserialize_gp_attribute((uint8_t *)returnPayload.data + sizeof(struct com_mrg_open_persistent), &ss_file_gp_attributes)) { goto err; } // Function copies attributes to object buffers. ret = TEE_PopulateTransientObject(new_object, ss_file_gp_attributes.attrs, ss_file_gp_attributes.attrs_count); //Need to free due error handling simplicity. //Alloc done in deserialize_gp_attribute free_gp_attributes(&ss_file_gp_attributes); if (ret != TEE_SUCCESS) { OT_LOG_ERR("TEE_OpenPersistentObject: Object alloc failed\n"); goto out; } } memcpy(&new_object->per_object, &retOpenParams->per_object, sizeof(struct persistant_object)); memcpy(&new_object->objectInfo, &retOpenParams->info, sizeof(TEE_ObjectInfo)); *object = new_object; goto out; err: close_persistan_object(objectID, objectIDLen); free_object_handle(new_object); *object = NULL; out: free(payload.data); free(returnPayload.data); return ret; } TEE_Result TEE_CreatePersistentObject(uint32_t storageID, void *objectID, size_t objectIDLen, uint32_t flags, TEE_ObjectHandle attributes, void *initialData, uint32_t initialDataLen, TEE_ObjectHandle *object) { /* serialize to manager */ size_t messageSize = 0, attirbuteSize = 0; struct com_mgr_invoke_cmd_payload payload = {0}, returnPayload = {0}; struct com_mrg_create_persistent *createParams, *respMsg; TEE_ObjectHandle tempHandle = NULL; TEE_Result ret = TEE_SUCCESS; uint8_t *mem_write_start = NULL; if (storageID != TEE_STORAGE_PRIVATE) { OT_LOG_ERR("Only supported storageID is TEE_STORAGE_PRIVATE\n"); return TEE_ERROR_ITEM_NOT_FOUND; } else if (initialData == NULL && initialDataLen > 0) { OT_LOG_ERR("Initial data lenght greater than zero, but initalData pointer null\n"); return TEE_ERROR_BAD_PARAMETERS; } /* Only vital checks */ if (objectID == NULL) { OT_LOG_ERR("Panicking due objectID is NULL"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (objectIDLen > TEE_OBJECT_ID_MAX_LEN) { OT_LOG_ERR("Panicking due objectID len too big"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (attributes && !(attributes->objectInfo.handleFlags & TEE_HANDLE_FLAG_INITIALIZED)) { OT_LOG_ERR("Panicking due object not initilized"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (attributes && (attributes->objectInfo.objectType == TEE_TYPE_CORRUPTED_OBJECT)) { OT_LOG_ERR("Panicking due object corrupted"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (attributes && (attributes->objectInfo.objectType == TEE_TYPE_DATA)) { OT_LOG_ERR("TEE_CreatePersistentObject panicking due attributes object is type TEE_TYPE_DATA\n"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } //Create message: Size messageSize = sizeof(struct com_mrg_create_persistent); messageSize += initialDataLen; if (attributes) { attirbuteSize = serialize_gp_attribute(&attributes->key->gp_attrs, NULL); } messageSize += attirbuteSize; //Create message: Malloc payload.size = messageSize; payload.data = calloc(1, payload.size); if (payload.data == NULL) { OT_LOG_ERR("TEE_CreatePersistentObject panic due out of memory\n"); TEE_Panic(TEE_ERROR_OUT_OF_MEMORY); } //Create message: Fill createParams = payload.data; ((struct com_mrg_create_persistent *)payload.data)->attributeSize = attirbuteSize; ((struct com_mrg_create_persistent *)payload.data)->storageID = storageID; ((struct com_mrg_create_persistent *)payload.data)->flags = flags; ((struct com_mrg_create_persistent *)payload.data)->objectIDLen = objectIDLen; memcpy(&((struct com_mrg_create_persistent *)payload.data)->objectID, (uint8_t *)objectID, objectIDLen); if (attributes) { mem_write_start = (uint8_t *)payload.data + sizeof(struct com_mrg_create_persistent); memcpy(&((struct com_mrg_create_persistent *)payload.data)->info, &attributes->objectInfo, sizeof(TEE_ObjectInfo)); serialize_gp_attribute(&attributes->key->gp_attrs, mem_write_start); } else { createParams->data_object = COM_MGR_PERSISTENT_DATA_OBJECT; } if (initialData) { mem_write_start = (uint8_t *)payload.data + sizeof(struct com_mrg_create_persistent) + attirbuteSize; memcpy(mem_write_start, initialData, initialDataLen); createParams->initialDataLen = initialDataLen; } else { createParams->initialDataLen = 0; } ret = TEE_InvokeMGRCommand(TEE_TIMEOUT_INFINITE, COM_MGR_CMD_ID_CREATE_PERSISTENT, &payload, &returnPayload); if (ret != TEE_SUCCESS) { goto out; //ret is TEE_ERROR_XXX } if (object == NULL) { close_persistan_object(objectID, objectIDLen); goto out; //ret == TEE_SUCCESS } //Resp message: Get respMsg = returnPayload.data; // Needed for initdata write or for return object */ ret = create_persistent_handle(&tempHandle, attributes, flags); if (ret != TEE_SUCCESS) { //TODO: We do not have handle. Need to close file //TEE_CloseAndDeletePersistentObject1(tempHandle); goto out; //Ret some ERROR } memcpy(&tempHandle->per_object, &respMsg->perObj, sizeof(struct persistant_object)); *object = tempHandle; out: free(returnPayload.data); free(payload.data); return ret; } TEE_Result TEE_CloseAndDeletePersistentObject1(TEE_ObjectHandle object) { struct com_mgr_invoke_cmd_payload payload, returnPayload; TEE_Result ret = TEE_ERROR_GENERIC; if (object == NULL) { return TEE_SUCCESS; } //Flags check will be forced by manager if (!(object->objectInfo.handleFlags & TEE_HANDLE_FLAG_PERSISTENT)) { OT_LOG_ERR("TEE_CloseAndDeletePersistentObject1 panics due not a persistan object"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (!(object->objectInfo.handleFlags & TEE_DATA_FLAG_ACCESS_WRITE_META)) { OT_LOG_ERR("TEE_CloseAndDeletePersistentObject1 panics due not opened with TEE_DATA_FLAG_ACCESS_WRITE_META"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } payload.size = sizeof(struct com_mrg_close_persistent); payload.data = calloc(1, payload.size); if (payload.data == NULL) { OT_LOG_ERR("TEE_CloseAndDeletePersistentObject1 panics due out of memory\n"); TEE_Panic(TEE_ERROR_OUT_OF_MEMORY); } ((struct com_mrg_close_persistent *)payload.data)->objectIDLen = object->per_object.obj_id_len; memcpy(&((struct com_mrg_close_persistent *)payload.data)->objectID, &object->per_object.obj_id, object->per_object.obj_id_len); //TODO: Check return value; ret = TEE_InvokeMGRCommand(TEE_TIMEOUT_INFINITE, COM_MGR_CMD_ID_CLOSE_AND_DELETE_PERSISTENT, &payload, &returnPayload); free(payload.data); free_object_handle(object); return ret; } TEE_Result TEE_RenamePersistentObject(TEE_ObjectHandle object, void *newObjectID, size_t newObjectIDLen) { struct com_mgr_invoke_cmd_payload payload = {}, returnPayload = {}; TEE_Result ret; // Only vital checks if (object == NULL) { OT_LOG_ERR("TEE_RenamePersistentObject panics due object is NULL"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (newObjectIDLen > TEE_OBJECT_ID_MAX_LEN) { OT_LOG_ERR("TEE_RenamePersistentObject panics due newObjectIDLen len too big"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (newObjectID == NULL) { OT_LOG_ERR("TEE_RenamePersistentObject panics due newObjectID NULL"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (!(object->objectInfo.handleFlags & TEE_HANDLE_FLAG_PERSISTENT)) { OT_LOG_ERR("TEE_RenamePersistentObject panics due object is not persistant"); TEE_Panic(TEE_ERROR_BAD_PARAMETERS); } else if (!(object->objectInfo.handleFlags & TEE_DATA_FLAG_ACCESS_WRITE_META)) { OT_LOG_ERR("TEE_RenamePersistentObject panics due object does not " "sufficient permissions (missing TEE_DATA_FLAG_ACCESS_WRITE_META)"); TEE_Panic(TEE_ERROR_BAD_STATE); } payload.size = sizeof(struct com_mrg_rename_persistent); payload.data = calloc(1, payload.size); if (payload.data == NULL) { OT_LOG_ERR("Panicking due out of memory\n"); TEE_Panic(TEE_ERROR_OUT_OF_MEMORY); } // Create message: Fill and send (no init data) ((struct com_mrg_rename_persistent *)payload.data)->objectIDLen = object->per_object.obj_id_len; memcpy(&((struct com_mrg_rename_persistent *)payload.data)->objectID, &object->per_object.obj_id, object->per_object.obj_id_len); ((struct com_mrg_rename_persistent *)payload.data)->newObjectIDLen = newObjectIDLen; memcpy(&((struct com_mrg_rename_persistent *)payload.data)->newObjectID, newObjectID, newObjectIDLen); ret = TEE_InvokeMGRCommand(TEE_TIMEOUT_INFINITE, COM_MGR_CMD_ID_RENAME_PERSISTENT, &payload, &returnPayload); if (ret != TEE_SUCCESS) { goto out; } memset(&object->per_object.obj_id, 0, TEE_OBJECT_ID_MAX_LEN); memcpy(&object->per_object.obj_id, newObjectID, newObjectIDLen); object->per_object.obj_id_len = newObjectIDLen; out: free(payload.data); return ret; }
33.527725
129
0.704591
[ "object" ]
256c34f23b0c01a7f314bf08ec12bb6c34421fb0
5,312
c
C
nitan/d/quanzhen/damen.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
1
2019-03-27T07:25:16.000Z
2019-03-27T07:25:16.000Z
nitan/d/quanzhen/damen.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
nitan/d/quanzhen/damen.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
// damen.c 大門 // Winder Oct.10 1998 #include <ansi.h> inherit ROOM; void init(); void close_gate(); int valid_leave(); string look_gate(); int do_knock(string arg); string look_duilian(); void create() { set("short", "全真教大門"); set("long", @LONG 你已走到了終南山半山腰,前面就是全真教的總部重陽宮了。殿 宇依山而築,高低錯落有致。周圍古木森森,翠竹成林,景色清幽。 正前方黃牆碧瓦,飛檐翹檁,正中一道二丈來寬,三丈來高的硃紅杉 木包銅大門(gate),氣勢不凡。門上掛着一塊匾(bian),門前的石柱 上掛着一副對聯(duilian)。 LONG ); set("exits", ([ "westdown" : __DIR__"jiaobei", ])); set("outdoors", "chongyang"); set("item_desc", ([ "gate": "一道三丈來高的"HIR"硃紅杉木"HIY"包銅"NOR"大門。\n", "bian": HIG" ************* **         ** ** 全 真 古 教 ** **         ** ************* \n"NOR, "duilian" : (: look_duilian :), ]) ); set("objects",([ __DIR__"npc/zhike" : 1, ])); set("coor/x", -3130); set("coor/y", 110); set("coor/z", 170); setup(); } void init() { add_action("do_knock", "knock"); } string look_duilian() { return HIR "\n" " ※※※※※※※ ※※※※※※※\n" " ※※※※※※※ ※※※※※※※\n" " ※※ ※※ ※※ ※※\n" " ※※" NOR + HIW " 一 " NOR + HIR "※※ ※※" NOR + HIW " 地 " NOR + HIR "※※\n" " ※※    ※※ ※※ ※※\n" " ※※" NOR + HIW " 生 " NOR + HIR "※※ ※※" NOR + HIW " 法 " NOR + HIR "※※\n" " ※※ ※※ ※※ ※※\n" " ※※" NOR + HIW " 二 " NOR + HIR "※※ ※※" NOR + HIW " 天 " NOR + HIR "※※\n" " ※※ ※※ ※※ ※※\n" " ※※" NOR + HIW " 二 " NOR + HIR "※※ ※※" NOR + HIW " 天 " NOR + HIR "※※\n" " ※※ ※※ ※※ ※※\n" " ※※" NOR + HIW " 生 " NOR + HIR "※※ ※※" NOR + HIW " 法 " NOR + HIR "※※\n" " ※※  ※※ ※※ ※※\n" " ※※" NOR + HIW " 三 " NOR + HIR "※※ ※※" NOR + HIW " 道 " NOR + HIR "※※\n" " ※※  ※※ ※※ ※※\n" " ※※" NOR + HIW " 三 " NOR + HIR "※※ ※※" NOR + HIW " 道 " NOR + HIR "※※\n" " ※※ ※※ ※※ ※※\n" " ※※" NOR + HIW " 生 " NOR + HIR "※※ ※※" NOR + HIW " 法 " NOR + HIR "※※\n" " ※※  ※※ ※※ ※※\n" " ※※" NOR + HIW " 萬 " NOR + HIR "※※ ※※" NOR + HIW " 自 " NOR + HIR "※※\n" " ※※  ※※ ※※ ※※\n" " ※※" NOR + HIW " 物 " NOR + HIR "※※ ※※" NOR + HIW " 然 " NOR + HIR "※※\n" " ※※  ※※ ※※ ※※\n" " ※※※※※※※ ※※※※※※※\n" " ※※※※※※※ ※※※※※※※\n\n" NOR; } int close_gate() { object room; if(!( room = find_object(__DIR__"datang1")) ) room = load_object(__DIR__"datang1"); if(objectp(room)) { delete("exits/east"); message("vision", "乒地一聲,裏面有人把大門關上了。\n", this_object()); delete("exits/south", room); if (objectp(present("qingguan", room))) message("vision", "知客道長上前把大門關了起來。\n", room); else message("vision", "道童上前把大門關了起來。\n", room); } else message("vision", "ERROR: gate not found(close).\n", room); } int do_knock(string arg) { object room; if (query("exits/east")) return notify_fail("大門已經是開着了。\n"); if (!arg || (arg != "gate" && arg != "east")) return notify_fail("你要敲什麼?\n"); if(!( room = find_object(__DIR__"datang1")) ) room = load_object(__DIR__"datang1"); if(objectp(room)) { set("exits/east", __DIR__"datang1"); message_vision("$N輕輕地敲了敲門,只聽吱地一聲," "一位道童應聲打開大門,\n" "他用警惕的目光上上下下打量着$N。\n", this_player()); set("exits/west", __FILE__, room); message("vision", "外面傳來一陣敲門聲,道童應聲上前把大門開。\n", room); remove_call_out("close_gate"); call_out("close_gate", 10); } return 1; } int valid_leave(object me, string dir) { if ( dir != "east" ) { return ::valid_leave(me, dir); } if (!query("exits/east")) return 0; if (!::valid_leave(me, dir)) return 0; if( (query("family/family_name", me) == "全真教") ) { /* if( query("class", me) != "quanzhen" ) { return notify_fail("道童説道:對不起,俗家弟子不得入宮修行。\n"); } */ write("道童側身讓開,説道:師兄辛苦了,請進。\n"); return 1; } else if( present("chongyang ling", me) ) { write("道童打個稽首,側身讓開,説道:原來是貴客駕到,請進請進!\n"); return 1; } if( query("shen", me) >= 0 ) return notify_fail("道童説道:這位施主請回罷,重陽宮不接待俗人。\n"); return notify_fail("道童説道:你等邪魔外道,重陽宮向不接納,請了!\n"); }
31.808383
101
0.35881
[ "object" ]
25734a9a418efedc4d274327a2a3eb02bb4755d3
12,484
h
C
stapl_release/tools/mtl-2.0/mtl/mtl_algo.h
parasol-ppl/PPL_utils
92728bb89692fda1705a0dee436592d97922a6cb
[ "BSD-3-Clause" ]
null
null
null
stapl_release/tools/mtl-2.0/mtl/mtl_algo.h
parasol-ppl/PPL_utils
92728bb89692fda1705a0dee436592d97922a6cb
[ "BSD-3-Clause" ]
null
null
null
stapl_release/tools/mtl-2.0/mtl/mtl_algo.h
parasol-ppl/PPL_utils
92728bb89692fda1705a0dee436592d97922a6cb
[ "BSD-3-Clause" ]
null
null
null
/* // Copyright (c) 2000-2009, Texas Engineering Experiment Station (TEES), a // component of the Texas A&M University System. // All rights reserved. // The information and source code contained herein is the exclusive // property of TEES and may not be disclosed, examined or reproduced // in whole or in part without explicit written authorization from TEES. */ // // Copyright 1997, 1998, 1999 University of Notre Dame. // Authors: Andrew Lumsdaine, Jeremy G. Siek, Lie-Quan Lee // // This file is part of the Matrix Template Library // // You should have received a copy of the License Agreement for the // Matrix Template Library along with the software; see the // file LICENSE. If not, contact Office of Research, University of Notre // Dame, Notre Dame, IN 46556. // // Permission to modify the code and to distribute modified code is // granted, provided the text of this NOTICE is retained, a notice that // the code was modified is included with the above COPYRIGHT NOTICE and // with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE // file is distributed with the modified code. // // LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. // By way of example, but not limitation, Licensor MAKES NO // REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY // PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS // OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS // OR OTHER RIGHTS. // #ifndef MTL_ALGO_H #define MTL_ALGO_H #include "mtl/not_at.h" #include "mtl/mtl_config.h" #include "mtl/fast.h" namespace mtl_algo { // Section 25.2.1.1 -- Copy template <class InputIterator, class OutputIterator> inline OutputIterator copy(InputIterator f, InputIterator l, OutputIterator r) { InputIterator first = f; InputIterator last = l; OutputIterator result = r; while (mtl::not_at(first, last)) *result++ = *first++; return result; } // Section 25.2.1.2 -- Copy backward template <class BidirectionalIterator1, class BidirectionalIterator2> inline BidirectionalIterator2 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) { while (mtl::not_at(first, last)) *--result = *--last; return result; } // Section 25.2.2.1 -- swap template <class T> inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; } // Required for implementing swap_ranges and other functions template <class ForwardIterator1, class ForwardIterator2, class T> inline void __iter_swap(ForwardIterator1 a, ForwardIterator2 b, T*) { T tmp = *a; *a = *b; *b = tmp; } template <class ForwardIterator1, class ForwardIterator2> inline void iter_swap(ForwardIterator1 a, ForwardIterator2 b) { typedef typename std::iterator_traits <ForwardIterator1>::value_type Value; mtl_algo::__iter_swap(a, b, (Value*)0); } // Section 25.2.5 -- Fill template <class ForwardIterator, class T> inline void fill(ForwardIterator first, ForwardIterator last, const T& value) { while (mtl::not_at(first, last)) *first++ = value; } template <class OutputIterator, class Size, class T> inline OutputIterator fill_n(OutputIterator first, Size n, const T& value) { while (n-- > 0) *first++ = value; return first; } // Section 25.2.2.2 -- Swap ranges template <class ForwardIterator1, class ForwardIterator2> inline ForwardIterator2 swap_ranges(ForwardIterator1 f1, ForwardIterator1 l1, ForwardIterator2 f2) { ForwardIterator1 first1 = f1; ForwardIterator1 last1 = l1; ForwardIterator2 first2 = f2; while (mtl::not_at(first1, last1)) mtl_algo::swap(*first1++, *first2++); return first2; } // Section 26.4 -- Generic numeric operations // Section 26.4.1 -- Accumulate template <class InputIterator, class T> inline T accumulate(InputIterator f, InputIterator l, T init) { InputIterator first = f; InputIterator last = l; while (mtl::not_at(first, last)) init = init + *first++; return init; } template <class InputIterator, class T, class BinaryOperation> inline T accumulate(InputIterator f, InputIterator l, T init, BinaryOperation binary_op) { InputIterator first = f; InputIterator last = l; while (mtl::not_at(first, last)) { init = binary_op (init, *first++); } return init; } // Section 26.4.2 -- inner product template <class InputIterator1, class InputIterator2, class T> inline T inner_product(InputIterator1 f1, InputIterator1 l1, InputIterator2 f2, T init) { InputIterator1 first1 = f1; InputIterator1 last1 = l1; InputIterator2 first2 = f2; while (mtl::not_at(first1, last1)) init += (*first1++ * *first2++); return init; } template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2> inline T inner_product(InputIterator1 f1, InputIterator1 l1, InputIterator2 f2, T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2) { InputIterator1 first1 = f1; InputIterator1 last1 = l1; InputIterator2 first2 = f2; while (mtl::not_at(first1, last1)) init = binary_op1 (init, binary_op2 (*first1++, *first2++)); return init; } // Section 26.4.3 -- Partial Sum template <class InputIterator, class OutputIterator> OutputIterator partial_sum(InputIterator first, InputIterator last, OutputIterator result) { typedef typename std::iterator_traits<InputIterator>::value_type sum_type; if( mtl::not_at(first, last) ) { sum_type sum1( *first ); for(;;) { *result = sum1; ++result; if( ++first==last ) break; sum_type sum2( sum1 + *first ); *result = sum2; ++result; if( ++first==last ) break; sum1.~sum_type(); new((void*)&sum1) sum_type( sum2 + *first ); } } return result; } template <class InputIterator, class OutputIterator, class BinaryOperation> OutputIterator partial_sum (InputIterator first, InputIterator last, OutputIterator result, BinaryOperation op) { typedef typename std::iterator_traits<InputIterator>::value_type sum_type; if( mtl::not_at(first, last) ) { sum_type sum1( *first ); for(;;) { *result = sum1; ++result; if( ++first==last ) break; sum_type sum2( op( sum1, *first ) ); *result = sum2; ++result; if( ++first==last ) break; sum1.~sum_type(); new((void*)&sum1) sum_type( op( sum2, *first ) ); } } return result; } // Section 26.4.4 -- Adjacent Difference template <class InputIterator, class OutputIterator> OutputIterator adjacent_difference(InputIterator first, InputIterator last, OutputIterator result) { typedef typename std::iterator_traits <InputIterator>::value_type value_type; if (mtl::not_at(first, last)) { value_type value0( *first ); *result = value0; while( ++result, mtl::not_at(++first, last) ) { value_type value1(*first); *result = value1 - value0; value0.~value_type(); new((void*)&value0) value_type( value1 ); } } return result; } template <class InputIterator, class OutputIterator, class BinaryOperation> OutputIterator adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op) { typedef typename std::iterator_traits <InputIterator>::value_type value_type; if (mtl::not_at(first, last)) { value_type value0( *first ); *result = value0; while( ++result, mtl::not_at(++first, last) ) { value_type value1(*first); *result = binary_op(value1,value0); value0.~value_type(); new((void*)&value0) value_type( value1 ); } } return result; } // Subclause 25.1 -- Non-modifying sequence operations // Section 25.1.1 -- For each template <class InputIterator, class Function> inline Function for_each(InputIterator f, InputIterator l, Function func) { InputIterator first = f; InputIterator last = l; for( ; mtl::not_at(first, last); ++first) func(*first); return func; } // Section 25.2.3 -- Transform template <class InputIterator, class OutputIterator, class UnaryOperation> inline OutputIterator transform(InputIterator f, InputIterator l, OutputIterator r, UnaryOperation op) { InputIterator first = f; InputIterator last = l; OutputIterator result = r; while (mtl::not_at(first, last)) *result++ = op (*first++); return result; } template <class InputIterator, class OutputIterator> inline OutputIterator transform_add(InputIterator f, InputIterator l, OutputIterator r) { InputIterator first = f; InputIterator last = l; OutputIterator result = r; while (mtl::not_at(first, last)) { *result += *first++; ++result; } return result; } #if 0 template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> inline OutputIterator __transform(InputIterator1 f1, InputIterator1 l1, InputIterator2 f2, OutputIterator r, BinaryOperation binary_op, std::random_access_iterator_tag) { InputIterator1 first1 = f1; InputIterator1 last1 = l1; InputIterator2 first2 = f2; OutputIterator result = r; typedef typename std::iterator_traits<InputIterator1>::difference_type diff_t; diff_t n = l1 - f1; const int unroll = 8; diff_t mod = n % unroll; diff_t i; for (i = 0; i < mod; ++i) result[i] = binary_op (first1[i], first2[i]); for (; i < n; i += unroll) fast::transform(first1 + i, fast::count<unroll>(), first2 + i, result + i, binary_op); return result + n; } #endif template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation, class Tag> inline OutputIterator __transform(InputIterator1 f1, InputIterator1 l1, InputIterator2 f2, OutputIterator r, BinaryOperation binary_op, Tag) { InputIterator1 first1 = f1; InputIterator1 last1 = l1; InputIterator2 first2 = f2; OutputIterator result = r; while (mtl::not_at(first1, last1)) { *result = binary_op (*first1, *first2); ++first1; ++first2; ++result; } return result; } template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> inline OutputIterator transform(InputIterator1 f1, InputIterator1 l1, InputIterator2 f2, OutputIterator r, BinaryOperation binary_op) { typedef typename std::iterator_traits<InputIterator1>::iterator_category Cat; return __transform(f1, l1, f2, r, binary_op, Cat()); } template <class ForwardIterator> inline ForwardIterator max_element(ForwardIterator f, ForwardIterator l) { ForwardIterator first = f; ForwardIterator last = l; if (first == last) return first; ForwardIterator result = first; while (mtl::not_at(++first, last)) if (*result < *first) result = first; return result; } template <class ForwardIterator, class Compare> inline ForwardIterator max_element(ForwardIterator f, ForwardIterator l, Compare comp) { ForwardIterator first = f; ForwardIterator last = l; if (first == last) return first; ForwardIterator result = first; while (mtl::not_at(++first, last)) { if (comp (*result, *first)) result = first; } return result; } template <class ForwardIterator> inline ForwardIterator min_element(ForwardIterator f, ForwardIterator l) { ForwardIterator first = f; ForwardIterator last = l; if (first == last) return first; ForwardIterator result = first; while (mtl::not_at(++first, last)) if (*first < *result) result = first; return result; } template <class ForwardIterator, class Compare> inline ForwardIterator min_element(ForwardIterator f, ForwardIterator l, Compare comp) { ForwardIterator first = f; ForwardIterator last = l; if (first == last) return first; ForwardIterator result = first; while (mtl::not_at(++first, last)) if (comp (*first, *result)) result = first; return result; } } /* namespace mtl_algo */ #endif
25.169355
79
0.676466
[ "transform" ]
2581c697579dcadfbda94130fe4122881e1e41cd
1,089
h
C
Plugins/org.mitk.gui.qt.common/src/internal/QmitkDataNodeSelection.h
zhaomengxiao/MITK
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2022-03-03T12:03:32.000Z
2022-03-03T12:03:32.000Z
Plugins/org.mitk.gui.qt.common/src/internal/QmitkDataNodeSelection.h
zhaomengxiao/MITK
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2021-12-22T10:19:02.000Z
2021-12-22T10:19:02.000Z
Plugins/org.mitk.gui.qt.common/src/internal/QmitkDataNodeSelection.h
zhaomengxiao/MITK_lancet
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2020-11-27T09:41:18.000Z
2020-11-27T09:41:18.000Z
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include <mitkDataNodeSelection.h> #include <mitkDataNode.h> #include <berryQtItemSelection.h> #include <vector> class QmitkDataNodeSelection: public mitk::DataNodeSelection, public berry::QtItemSelection { public: berryObjectMacro(QmitkDataNodeSelection); QmitkDataNodeSelection(); QmitkDataNodeSelection(const QItemSelection& sel); berry::Object::Pointer GetFirstElement() const override; iterator Begin() const override; iterator End() const override; int Size() const override; ContainerType::Pointer ToVector() const override; /** * @see berry::ISelection::IsEmpty() */ bool IsEmpty() const override; bool operator==(const berry::Object* obj) const override; };
24.2
91
0.647383
[ "object", "vector" ]
25821209c21b01aacf64f1f6a35269d5d476f008
839
h
C
src/basic/util.h
jiry17/PolyGen
b384e478ec91299d6a14f4681ff3e0850911822b
[ "MIT" ]
1
2021-09-13T04:05:20.000Z
2021-09-13T04:05:20.000Z
src/basic/util.h
jiry17/PolyGen
b384e478ec91299d6a14f4681ff3e0850911822b
[ "MIT" ]
null
null
null
src/basic/util.h
jiry17/PolyGen
b384e478ec91299d6a14f4681ff3e0850911822b
[ "MIT" ]
1
2021-12-01T08:18:21.000Z
2021-12-01T08:18:21.000Z
// // Created by pro on 2020/12/7. // #ifndef CPP_UTIL_H #define CPP_UTIL_H #include "data.h" #include "json/json.h" #include <unistd.h> namespace util { extern std::string dataList2String(const DataList& data); extern std::string loadStringFromFile(const std::string file_name); extern Type string2Type(const std::string name); extern Data parseDataFromJson(Json::Value node); extern Json::Value loadJsonFromFile(std::string file_name); extern std::string type2String(Type type); extern z3::expr getVariable(Type type, z3::context& ctx, std::string name = ""); extern Data getVariableData(Type type, z3::expr& expr, const z3::model& model); extern int getRandomInt(); extern double getTimePeriod(const timeval& start, const timeval& end); extern bool checkTimeOut(); } #endif //CPP_UTIL_H
29.964286
84
0.719905
[ "model" ]
258c0d08fd004014ce7a399d65475b2fb6c28468
56,367
h
C
tools/FMM_3DSMAX_ExportPlugin/extern/maxsdk2010/include/plugapi.h
FrankHB/fancy2d
522a34c53c1c1a29ee53bbdef0771a9b0b51a980
[ "BSD-3-Clause" ]
42
2015-03-01T14:14:48.000Z
2019-10-06T06:02:16.000Z
tools/FMM_3DSMAX_ExportPlugin/extern/maxsdk2010/include/plugapi.h
FrankHB/fancy2d
522a34c53c1c1a29ee53bbdef0771a9b0b51a980
[ "BSD-3-Clause" ]
9
2015-04-07T16:10:14.000Z
2018-05-07T12:42:50.000Z
tools/FMM_3DSMAX_ExportPlugin/extern/maxsdk2010/include/plugapi.h
FrankHB/fancy2d
522a34c53c1c1a29ee53bbdef0771a9b0b51a980
[ "BSD-3-Clause" ]
28
2015-01-31T05:03:37.000Z
2021-08-15T21:27:10.000Z
//**************************************************************************/ // Copyright (c) 1998-2007 Autodesk, Inc. // All rights reserved. // // These coded instructions, statements, and computer programs contain // unpublished proprietary information written by Autodesk, Inc., and are // protected by Federal copyright law. They may not be disclosed to third // parties or copied or duplicated in any form, in whole or in part, without // the prior written consent of Autodesk, Inc. //**************************************************************************/ // DESCRIPTION: Plugin DLL API // AUTHOR: Dan Silva - Nov.30.1994 //***************************************************************************/ #ifndef PLUGAPI_H_DEFINED #define PLUGAPI_H_DEFINED #ifndef _CPPRTTI #error 3ds Max plugins and dlls must compile with run-time type information (RTTI) On.\ RTTI can be turned on via the Language tab in the C++ folder of the \ Visual Studio project settings of your project, or the /GR compiler flag. #endif #include "maxheap.h" #include "maxtypes.h" #include "buildver.h" // russom - 03/08/01 #include "maxversion.h" // 3DSMAX Version number to be compared against that returned by DLL's // LibVersion function to detect obsolete DLLs. //#define VERSION_3DSMAX 100 // changed 4/ 9/96 -- DB //#define VERSION_3DSMAX 110 // changed 7/17/96 -- DS //#define VERSION_3DSMAX 111 // changed 9/24/96 -- DS //#define VERSION_3DSMAX 120 // changed 9/30/96 -- DB //#define VERSION_3DSMAX 200 // changed 10/30/96 -- DS // MAX release number X 1000 //#define MAX_RELEASE 2000 // DDS 9/30/97 //#define MAX_RELEASE 2500 // JMK 2/25/98 //#define MAX_RELEASE 3000 // DDS 9/3/98 //#define MAX_RELEASE 3100 // CCJ 10/21/99 //#define MAX_RELEASE 3900 // CCJ 6/26/00 //#define MAX_RELEASE 4000 // CCJ 11/29/00 //#define MAX_RELEASE 4200 // 010514 --prs. //#define MAX_RELEASE 4900 // for R5 alpha, 011115 --prs. //#define MAX_RELEASE 5000 // for R5, 020604 --prs. //#define MAX_RELEASE 5100 // for R5.1, 020801 --prs. //#define MAX_RELEASE 5900 // for R6 alpha, 030403 --prs. //#define MAX_RELEASE 6000 // for R6, 030806 --prs. //#define MAX_RELEASE_R7_ALPHA 6900 // for R7 alpha #define MAX_RELEASE_R7 7000 // for R7 #define MAX_RELEASE_R8_ALPHA 7800 // for R8 alpha #define MAX_RELEASE_R8 8000 // for R8 #define MAX_RELEASE_R9_ALPHA 8900 // for R9 alpha #define MAX_RELEASE_R9_ALPHA2 8901 // for R9 alpha - file format change #define MAX_RELEASE_R9 9000 // for R9 release #define MAX_RELEASE_R10_ALPHA 9900 // for R10 alpha #define MAX_RELEASE_R10 10000 // for R10 release #define MAX_RELEASE_R11_ALPHA 10900 // for R11 alpha #define MAX_RELEASE_R11 11000 // for R11 release #define MAX_RELEASE_R12_ALPHA 11900 // for R12 alpha #define MAX_RELEASE_R12 12000 // for R12 release #define MAX_RELEASE MAX_RELEASE_R12 // MAX_RELEASE_EXTERNAL is an alternative for MAX_RELEASE // that can be used for UI when the internal version of the product // is different from the branded version number. // MAX_RELEASE_EXTERNAL is defined in maxversion.h #ifndef MAX_RELEASE_EXTERNAL #define MAX_RELEASE_EXTERNAL MAX_RELEASE #endif //! \brief Max SDK version numbers /*! The SDK version number is updated every time a build of Max containing SDK changes is distributed to 3rd party plugin developers. This can be an alpha, beta or release candidate build. Although we make every effort to keep Max backward compatible with plugins built against previous versions of the Max SDK, occasionally plugins are required to be re-built against the latest version of the Max SDK in order for Max to load them. Plugins built against a certain version of the Max SDK will not load in previous versions of Max. Note that the Max SDK version number is encoded in VERSION_3DSMAX. SDK backward compatibility history: - No SDK break between Max R4.x and R5.0, thus plugins built against all R4.x versions will load into Max R5.0 - No SDK break between Max R6.x and R8.0, thus plugins built against all R6.x versions will load into Max R8.0 - Max R9.0 SDK breaks compatibility with previous versions of Max, thus plugins must be re-built in order to load in Max R9.0 - No SDK break between Max R9.x and R10.0 (3ds Max 2008), thus plugins built against all R9.x versions will load into Max R10.0 \see VERSION_3DSMAX \see LibVersion */ // Blocks of values are reserved for specific products that are meant // to have non-compatible APIs. Currently assigned: // 000-??? // 255: temporary use to prevent NOVA plugins from loading in MAX #if defined(GAME_VER) // russom 03/08/01 // API numbers used by plugins to GMax. #define GMAX_API_NUM_MAX_R50 128 // russom 01/17/01 // Plugins to a version of GMax that is based on Max 9 would need to recompile #define GMAX_API_NUM_MAX_R90 129 #define MAX_API_NUM GMAX_API_NUM_MAX_R9 #elif defined(WEBVERSION) // API numbers used by plugins to Plasma #define PLASMA_API_NUM_MAX_R50 144 // russom 02/07/01 // Plugins to a version of Plasma that is based on Max 9 would need to recompile #define PLASMA_API_NUM_MAX_R90 145 #define MAX_API_NUM PLASMA_API_NUM_MAX_R9 #elif defined(RENDER_VER) // API numbers used by plugins to Viz Render #define VIZRENDER_API_NUM_MAX_R50 160 // cleve ard 11/6/02 #define VIZRENDER_API_NUM_MAX_R90 161 #define MAX_API_NUM VIZRENDER_API_NUM_MAX_R9 #else // API numbers used by plugins to Max. The API number needs to be incremented for // every Max build (alpha, beta, final version) that is distributed to 3rd party // developers and contains SDK changes. #define MAX_API_NUM_R20 4 // DDS 9/30/97 #define MAX_API_NUM_R25 5 // DDS 10/06/97 #define MAX_API_NUM_R30 6 // DDS 9/3/98 #define MAX_API_NUM_R31 7 // CCJ 5/14/99 #define MAX_API_NUM_R40 8 // CCJ 11/29/00 - R4 #ifndef MAXIMUS_BUILD // API numbers used by plugins to Max #define MAX_API_NUM_R42 09 // R5 011031 --prs. #define MAX_API_NUM_R50 11 // R5 FCS 020624 --prs. #define MAX_API_NUM_R60_PRE_REL 12 // R6 prerelease 030409 --prs. #define MAX_API_NUM_R60 13 // R6 FCS 030806 --prs. #define MAX_API_NUM_R70_PRE_REL 14 // R7 prerelease 05/18/04 - russom #define MAX_API_NUM_R70 15 // R7 FCS -- 2004-09-02 -- raffenn #define MAX_API_NUM_R80_PRE_REL 16 // R8 pre-release Vesper -- 2005-01-18 -- raffenn #define MAX_API_NUM_R80 17 // R8 FCS max 8 -- 2005-09-01 -- raffenn #define MAX_API_NUM_R90_ALPHA 18 // R9 alpha -- 2005-09-21 -- aszabo #define MAX_API_NUM_R90_BETA1 19 // R9 SDK Freeze for Beta 1 #define MAX_API_NUM_R90_BETA3 20 // R9 SDK Freeze for Beta 3 (skipped beta 2) #define MAX_API_NUM_R90 21 // R9 release - SDK incompatible with Max R8 #define MAX_API_NUM_R100_BETA5 22 // R10.0 Beta 5 - 2007-07-27 - aszabo #define MAX_API_NUM_R100 23 // R10.0 release - SDK compatible with Max R9 #define MAX_API_NUM_R110_ALPHA 24 // R11.0 alpha - SDK is incompatible with Max R10 #define MAX_API_NUM_R110 25 // R11.0 release - SDK is compatible with Max R11 Alpha #define MAX_API_NUM_R120_ALPHA2 26 // R12.0 Alpha 2 - SDK is incompatible with Max R11 (we skipped Alpha 1) #define MAX_API_NUM_R120_ALPHA3 27 // R12.0 Alpha 3 - SDK is incompatible with Max R12 Alpha 2 #define MAX_API_NUM_R120_ALPHA4 28 // R12.0 Alpha 4 - SDK is incompatible with Max R12 Alpha 3 #define MAX_API_NUM_R120_BETA1 29 // R12.0 Beta 1 - SDK is incompatible with Max R12 Alpha 4 #define MAX_API_NUM_R120_BETA3 30 // R12.0 Beta 3 - SDK is compatible with Max R12 Beta 1 (Beta 2 SDK was identical to Beta 1 SDK) #define MAX_API_NUM_R120_BETA4 31 // R12.0 Beta 4 - SDK is compatible with Max R12 Beta 3 #define MAX_API_NUM_R120_BETA5 32 // R12.0 Beta 5 - SDK is compatible with Max R12 Beta 4 #define MAX_API_NUM_R120 33 // R12.0 Release - SDK is compatible with Max R12 Beta 5 #define MAX_API_NUM MAX_API_NUM_R120 #else // if MAXIMUS_BUILD: #define MAXIMUS_API_NUM_MAX_R50 10 // Maximus 020315 --prs. #define MAX_API_NUM MAXIMUS_API_NUM_MAX_R50 #endif // Maximus #endif // products // This denotes the revision of the SDK for a given API. Increment this // when the SDK functionality changes in some significant way (for instance // a new GetProperty() query response is added), but the headers have // not been changed. #define MAX_SDK_REV 0 // DDS 9/20/97 // This value should be returned by the LibVersion() method for DLL's: #define VERSION_3DSMAX ((MAX_RELEASE<<16)+(MAX_API_NUM<<8)+MAX_SDK_REV) #ifdef DESIGN_VER #define VERSION_DMAX ((MAX_RELEASE<<16)+(MAX_API_NUM<<8)+MAX_SDK_REV) #endif // update jagapi.cpp product_app_id if new enums are added enum APPLICATION_ID {kAPP_NONE, kAPP_MAX, kAPP_VIZ, kAPP_GMAX, kAPP_PLASMA, kAPP_VIZR}; //This method returns the ApplicationID, either VIZ or MAX. If a plugin //is designed to work only in one product, then you could use this method //in your IsPublic() call to switch between exposing the plug-in or not. CoreExport APPLICATION_ID GetAppID(); // Macros for extracting parts of VERSION_3DSMAX #define GET_MAX_RELEASE(x) (((x)>>16)&0xffff) #define GET_MAX_API_NUM(x) (((x)>>8)&0xff) #define GET_MAX_SDK_REV(x) ((x)&0xff) #define GET_MAX_SDK_NUMREV(x) ((x)&0xffff) // Internal super classes, that plug-in developers need not know about #define GEN_MODAPP_CLASS_ID 0x00000b #define MODAPP_CLASS_ID 0x00000c #define OBREF_MODAPP_CLASS_ID 0x00000d #define BASENODE_CLASS_ID 0x000001 #define GEN_DERIVOB_CLASS_ID 0x000002 #define DERIVOB_CLASS_ID 0x000003 #define WSM_DERIVOB_CLASS_ID 0x000004 #define PARAMETER_BLOCK_CLASS_ID 0x000008 #define PARAMETER_BLOCK2_CLASS_ID 0x000082 // <JBW> ParamBlocks Ed. 2 #define EASE_LIST_CLASS_ID 0x000009 #define AXIS_DISPLAY_CLASS_ID 0x00000e #define MULT_LIST_CLASS_ID 0x00000f #define NOTETRACK_CLASS_ID 0x0000ff #define TREE_VIEW_CLASS_ID 0xffffff00 #define SCENE_CLASS_ID 0xfffffd00 #define THE_GRIDREF_CLASS_ID 0xfffffe00 #define VIEWREF_CLASS_ID 0xffffff01 #define BITMAPDAD_CLASS_ID 0xffffff02 // for drag/drop of bitmaps #define PARTICLE_SYS_CLASS_ID 0xffffff03 // NOTE: this is for internal use only. Particle systems return GEOMOBJECT_CLASS_ID -- use IsParticleObject() to determine if an object is a particle system. #define AGGMAN_CLASS_ID 0xffffff05 // Object aggregation, VIZ #define MAXSCRIPT_WRAPPER_CLASS_ID 0xffffff06 // JBW, 5/14/99, MAX object wrappers within MAXScript #define TRACKBAR_CLASS_ID 0xffffff07 // nleonard 22-DEC-05 the trackbar #define MAKEREF_REST_CLASS_ID 0x9876544 // the superclassid for MakeRefRestore #define DELREF_REST_CLASS_ID 0x9876543 // the superclassid for DeleteRefRestore #define ASSIGNREF_REST_CLASS_ID 0x121242 // the superclassid for AssignMtlRestore //------------------------------------------- // Super-classes that are plugable. #define GEOMOBJECT_CLASS_ID 0x000010 #define CAMERA_CLASS_ID 0x000020 #define LIGHT_CLASS_ID 0x000030 #define SHAPE_CLASS_ID 0x000040 #define HELPER_CLASS_ID 0x000050 #define SYSTEM_CLASS_ID 0x000060 #define REF_MAKER_CLASS_ID 0x000100 #define REF_TARGET_CLASS_ID 0x000200 #define OSM_CLASS_ID 0x000810 #define WSM_CLASS_ID 0x000820 #define WSM_OBJECT_CLASS_ID 0x000830 #define SCENE_IMPORT_CLASS_ID 0x000A10 #define SCENE_EXPORT_CLASS_ID 0x000A20 #define BMM_STORAGE_CLASS_ID 0x000B10 #define BMM_FILTER_CLASS_ID 0x000B20 #define BMM_IO_CLASS_ID 0x000B30 #define BMM_DITHER_CLASS_ID 0x000B40 #define BMM_COLORCUT_CLASS_ID 0x000B50 #define USERDATATYPE_CLASS_ID 0x000B60 #define MATERIAL_CLASS_ID 0x000C00 // Materials #define TEXMAP_CLASS_ID 0x000C10 // Texture maps #define UVGEN_CLASS_ID 0x0000C20 // UV Generator #define XYZGEN_CLASS_ID 0x0000C30 // XYZ Generator #define TEXOUTPUT_CLASS_ID 0x0000C40 // Texture output filter #define SOUNDOBJ_CLASS_ID 0x000D00 #define FLT_CLASS_ID 0x000E00 #define RENDERER_CLASS_ID 0x000F00 #define BEZFONT_LOADER_CLASS_ID 0x001000 #define ATMOSPHERIC_CLASS_ID 0x001010 #define UTILITY_CLASS_ID 0x001020 // Utility plug-ins #define TRACKVIEW_UTILITY_CLASS_ID 0x001030 #define FRONTEND_CONTROL_CLASS_ID 0x001040 #define MOT_CAP_DEV_CLASS_ID 0x001060 #define MOT_CAP_DEVBINDING_CLASS_ID 0x001050 #define OSNAP_CLASS_ID 0x001070 #define TEXMAP_CONTAINER_CLASS_ID 0x001080 // Texture map container #define RENDER_EFFECT_CLASS_ID 0x001090 // Render post-effects #define FILTER_KERNEL_CLASS_ID 0x0010a0 // AA Filter kernel #define SHADER_CLASS_ID 0x0010b0 // plugable shading into stdmtl #define COLPICK_CLASS_ID 0x0010c0 // color picker #define SHADOW_TYPE_CLASS_ID 0x0010d0 // shadow generators #define GUP_CLASS_ID 0x0010e0 // Global Utility Plug-In #define LAYER_CLASS_ID 0x0010f0 #define SCHEMATICVIEW_UTILITY_CLASS_ID 0x001100 #define SAMPLER_CLASS_ID 0x001110 #define ASSOC_CLASS_ID 0x001120 #define GLOBAL_ASSOC_CLASS_ID 0x001130 #define IK_SOLVER_CLASS_ID 0x001140 #define RENDER_ELEMENT_CLASS_ID 0x001150 // render output elements #define BAKE_ELEMENT_CLASS_ID 0x001151 // texture bake output elements #define CUST_ATTRIB_CLASS_ID 0x001160 // Custom attributes #define RADIOSITY_CLASS_ID 0x001170 // global illumination plugins #define TONE_OPERATOR_CLASS_ID 0x001180 // tone operator plugins #define MPASS_CAM_EFFECT_CLASS_ID 0x001190 // multi-pass camera effect plugins #define MR_SHADER_CLASS_ID_DEFUNCT 0x0011a0 // mental ray shaders (defunct, kept for file compatibility) // Super-class ID's of various controls #define CTRL_SHORT_CLASS_ID 0x9001 #define CTRL_INTEGER_CLASS_ID 0x9002 #define CTRL_FLOAT_CLASS_ID 0x9003 #define CTRL_POINT2_CLASS_ID 0x9004 #define CTRL_POINT3_CLASS_ID 0x9005 #define CTRL_POS_CLASS_ID 0x9006 #define CTRL_QUAT_CLASS_ID 0x9007 #define CTRL_MATRIX3_CLASS_ID 0x9008 #define CTRL_COLOR_CLASS_ID 0x9009 // float color (RGB) #define CTRL_COLOR24_CLASS_ID 0x900A // 24 bit color #define CTRL_POSITION_CLASS_ID 0x900B #define CTRL_ROTATION_CLASS_ID 0x900C #define CTRL_SCALE_CLASS_ID 0x900D #define CTRL_MORPH_CLASS_ID 0x900E #define CTRL_USERTYPE_CLASS_ID 0x900F // User defined type #define CTRL_MASTERPOINT_CLASS_ID 0x9010 #define MASTERBLOCK_SUPER_CLASS_ID 0x9011 #define CTRL_POINT4_CLASS_ID 0x9012 #define CTRL_FRGBA_CLASS_ID 0x9013 // float color (RGBA) //------------------------------------------------------------------------------ // Pseudo-super-class ids #define DEFORM_OBJ_CLASS_ID 0x000005 // Deformable object psuedo-super-class #define MAPPABLE_OBJ_CLASS_ID 0x000006 // Mappable object psuedo-super-class #define GENERIC_SHAPE_CLASS_ID 0x0000ab // Shape psuedo-super-class //------------------------------------------------------------------------------ // Class ID's of built-in classes. The value is the first ULONG of the // 8 byte Class ID: the second ULONG is 0 for all built-in classes. // NOTE: Only built-in classes should have the second ULONG == 0. #define PATH_CONTROL_CLASS_ID 0x2011 #define EULER_CONTROL_CLASS_ID 0x2012 #define EXPR_POS_CONTROL_CLASS_ID 0x2013 #define EXPR_P3_CONTROL_CLASS_ID 0x2014 #define EXPR_FLOAT_CONTROL_CLASS_ID 0x2015 #define EXPR_SCALE_CONTROL_CLASS_ID 0x2016 #define EXPR_ROT_CONTROL_CLASS_ID 0x2017 #define LOCAL_EULER_CONTROL_CLASS_ID 0x2018 #define POSITION_CONSTRAINT_CLASS_ID 0x2019 // AG added for Position Constraint 4/21/2000 #define ORIENTATION_CONSTRAINT_CLASS_ID 0x2020 // AG added for Position Constraint 5/04/2000 #define LOOKAT_CONSTRAINT_CLASS_ID 0x2021 // AG added for new LookAt Constraint 5/24/2000 #define ADDITIVE_EULER_CONTROL_CLASS_ID 0x2022 // 000830 --prs. #define BOOLCNTRL_CLASS_ID Class_ID(0x5ed56fc5, 0x6af0e521) // AG added for the new Boolean Controller 11/08/2001 #define FLOATNOISE_CONTROL_CLASS_ID 0x87a6df24 #define POSITIONNOISE_CONTROL_CLASS_ID 0x87a6df25 #define POINT3NOISE_CONTROL_CLASS_ID 0x87a6df26 #define ROTATIONNOISE_CONTROL_CLASS_ID 0x87a6df27 #define SCALENOISE_CONTROL_CLASS_ID 0x87a6df28 #define SURF_CONTROL_CLASSID Class_ID(0xe8334011,0xaeb330c8) #define LINKCTRL_CLASSID Class_ID(0x873fe764,0xaabe8601) #define ATTACH_CONTROL_CLASS_ID Class_ID(0xbb27e611,0xa72f43e7) #define FLOATLIMITCTRL_CLASS_ID 0x17127e3e #define DUMMYCHANNEL_CLASS_ID 0xefffffff // used by PB and PB2 - superclass is CTRL_USERTYPE_CLASS_ID #define RINGARRAY_CLASS_ID 0x9120 // use it as Class_ID(RINGARRAY_CLASS_ID,0); #define SUNLIGHT_CLASS_ID Class_ID(0x5897670e, 0x61b5008d) #define DAYLIGHT_CLASS_ID Class_ID(0x18147db5, 0x20f17194) #define CUSTATTRIB_CONTAINER_CLASS_ID Class_ID(0x5ddb3626, 0x23b708db) // CustAttribContainer class id // subclasses of GEOMOBJECT_CLASS_ID: // Built into CORE #define TRIOBJ_CLASS_ID 0x0009 #define EDITTRIOBJ_CLASS_ID 0xe44f10b3 // base triangle mesh #define POLYOBJ_CLASS_ID 0x5d21369a // polygon mesh #define PATCHOBJ_CLASS_ID 0x1030 #define NURBSOBJ_CLASS_ID 0x4135 // editable poly #define EPOLYOBJ_CLASS_ID Class_ID(0x1bf8338d,0x192f6098) // Primitives // xavier robitaille | 03.02.15 // Prevents the user from creating box/cylinder/sphere objects without // removing them completely (we need them for the material editor). #ifndef NO_OBJECT_STANDARD_PRIMITIVES #define BOXOBJ_CLASS_ID 0x0010 #define SPHERE_CLASS_ID 0x0011 #define CYLINDER_CLASS_ID 0x0012 #define PLANE_CLASS_ID Class_ID(0x81f1dfc, 0x77566f65) #define PYRAMID_CLASS_ID Class_ID(0x76bf318a, 0x4bf37b10) #define GSPHERE_CLASS_ID Class_ID(0, 32670) #else #define BOXOBJ_CLASS_ID 0x108f1589 #define SPHERE_CLASS_ID 0x72ce5ad6 #define CYLINDER_CLASS_ID 0x759e40e1 #endif #define CONE_CLASS_ID 0xa86c23dd #define TORUS_CLASS_ID 0x0020 #define TUBE_CLASS_ID 0x7B21 #define HEDRA_CLASS_ID 0xf21c5e23 #define BOOLOBJ_CLASS_ID 0x387BB2BB // Above used in obselete Boolean -- henceforth use following: #define NEWBOOL_CLASS_ID Class_ID(0x51db4f2f,0x1c596b1a) // Class ID for XRef object #define XREFOBJ_CLASS_ID Class_ID(0x92aab38c, 0) // Class ID for Xref atmospherics #define XREFATMOS_CLASS_ID Class_ID(0x4869d60f, 0x21af2ae4) // Class ID for Xref Materials #define XREFMATERIAL_CLASS_ID Class_ID(0x272c0d4b, 0x432a414b) // Class ID for Xref Controllers #define XREFCTRL_CLASS_ID Class_ID(0x32fb4637, 0x65fd482b) //Subclasses of object snaps. #define GRID_OSNAP_CLASS_ID Class_ID(0x62f565d6, 0x110a1f97) // The teapot is unique in that it uses both DWORDs in its class IDs // Note that this is what 3rd party plug-ins SHOULD do. #define TEAPOT_CLASS_ID1 0xACAD13D3 #define TEAPOT_CLASS_ID2 0xACAD26D9 #define PATCHGRID_CLASS_ID 0x1070 // New procedural bone object for Magma (subclass of GeomObject) #define BONE_OBJ_CLASSID Class_ID(0x28bf6e8d, 0x2ecca840) // Particles #define RAIN_CLASS_ID 0x9bd61aa0 #define SNOW_CLASS_ID 0x9bd61aa1 // Space Warp Objects #define WAVEOBJ_CLASS_ID 0x0013 // The basic lofter class #define LOFTOBJ_CLASS_ID 0x1035 #define LOFT_DEFCURVE_CLASS_ID 0x1036 // Our implementation of the lofter #define LOFT_GENERIC_CLASS_ID 0x10B0 #define TARGET_CLASS_ID 0x1020 // should this be a helper? #define MORPHOBJ_CLASS_ID 0x1021 // Subclasses of SHAPE_CLASS_ID #define SPLINESHAPE_CLASS_ID 0x00000a #define LINEARSHAPE_CLASS_ID 0x0000aa #define SPLINE3D_CLASS_ID 0x1040 #define NGON_CLASS_ID 0x1050 #define DONUT_CLASS_ID 0x1060 #define STAR_CLASS_ID 0x1995 #define RECTANGLE_CLASS_ID 0x1065 #define HELIX_CLASS_ID 0x1994 #define ELLIPSE_CLASS_ID 0x1097 #define CIRCLE_CLASS_ID 0x1999 #define TEXT_CLASS_ID 0x1993 #define ARC_CLASS_ID 0x1996 #define HALF_ROUND_CLASS_ID 0x1997 #define QUARTER_ROUND_CLASS_ID 0x1998 #define PIPE_CLASS_ID 0x199A #define WALLED_RECTANGLE_CLASS_ID 0xd8bff66c #define CHANNEL_CLASS_ID 0x7dbc0e96 #define ANGLE_CLASS_ID 0x93257030 #define TEE_CLASS_ID 0xfaead70c #define WIDE_FLANGE_CLASS_ID 0xa2b72ef6 // subclasses of CAMERA_CLASS_ID: #define SIMPLE_CAM_CLASS_ID 0x1001 #define LOOKAT_CAM_CLASS_ID 0x1002 // subclasses of LIGHT_CLASS_ID: #define OMNI_LIGHT_CLASS_ID 0x1011 #define SPOT_LIGHT_CLASS_ID 0x1012 #define DIR_LIGHT_CLASS_ID 0x1013 #define FSPOT_LIGHT_CLASS_ID 0x1014 #define TDIR_LIGHT_CLASS_ID 0x1015 // subclasses of HELPER_CLASS_ID #define DUMMY_CLASS_ID 0x876234 #define BONE_CLASS_ID 0x8a63c0 #define TAPEHELP_CLASS_ID 0x02011 #define GRIDHELP_CLASS_ID 0x02010 #define POINTHELP_CLASS_ID 0x02013 #define PROTHELP_CLASS_ID 0x02014 //subclasses of UVGEN_CLASS_ID #define STDUV_CLASS_ID 0x0000100 //subclasses of XYZGEN_CLASS_ID #define STDXYZ_CLASS_ID 0x0000100 //subclasses of TEXOUT_CLASS_ID #define STDTEXOUT_CLASS_ID 0x0000100 // subclasses of MATERIAL_CLASS_ID #define DMTL_CLASS_ID 0x00000002 // Origninal Stdmtl #define DMTL2_CLASS_ID 0x00000003 // R2.5 stdmtl #ifndef NO_MTL_TOPBOTTOM // orb 01-07-2001 #define CMTL_CLASS_ID 0x0000100 // top-bottom material #endif // NO_MTL_TOPBOTTOM #define MULTI_CLASS_ID 0x0000200 // super class ID multi material // the actual Class_ID used by the multi-sub-object material #define MULTI_MATERIAL_CLASS_ID Class_ID(MULTI_CLASS_ID, 0) #define DOUBLESIDED_CLASS_ID 0x0000210 // double-sided mtl #define MIXMAT_CLASS_ID 0x0000250 // blend mtl #define BAKE_SHELL_CLASS_ID 0x0000255 // 2 material shell for baking #ifndef NO_MTL_MATTESHADOW // orb 01-07-2001 #define MATTE_CLASS_ID 0x0000260 // Matte mtl #endif // NO_MTL_MATTESHADOW // subclasses of TEXMAP_CLASS_ID #define CHECKER_CLASS_ID 0x0000200 #define MARBLE_CLASS_ID 0x0000210 #define MASK_CLASS_ID 0x0000220 // mask texture #define MIX_CLASS_ID 0x0000230 #define NOISE_CLASS_ID 0x0000234 #ifndef NO_MAPTYPE_GRADIENT // orb 01-07-2001 #define GRADIENT_CLASS_ID 0x0000270 #endif // NO_MAPTYPE_GRADIENT #ifndef NO_MAPTYPE_RGBTINT // orb 01-07-2001 #define TINT_CLASS_ID 0x0000224 // Tint texture #endif // NO_MAPTYPE_RGBTINT #define BMTEX_CLASS_ID 0x0000240 // Bitmap texture #ifndef NO_MAPTYPE_REFLECTREFRACT // orb 01-07-2001 #define ACUBIC_CLASS_ID 0x0000250 // Reflect/refract #endif // NO_MAPTYPE_REFLECTREFRACT #ifndef NO_MAPTYPE_FLATMIRROR // orb 01-07-2001 #define MIRROR_CLASS_ID 0x0000260 // Flat mirror #endif // NO_MAPTYPE_FLATMIRROR #define COMPOSITE_CLASS_ID 0x0000280 // Composite texture #define COMPOSITE_MATERIAL_CLASS_ID Class_ID(0x61dc0cd7, 0x13640af6) // Composite Material #ifndef NO_MAPTYPE_RGBMULT // orb 01-07-2001 #define RGBMULT_CLASS_ID 0x0000290 // RGB Multiply texture #endif //NO_MAPTYPE_RGBMULT #define FALLOFF_CLASS_ID 0x00002A0 // Falloff texture #ifndef NO_MAPTYPE_OUTPUT // orb 01-07-2001 #define OUTPUT_CLASS_ID 0x00002B0 // Output texture #endif // NO_MAPTYPE_OUTPUT #define PLATET_CLASS_ID 0x00002C0 // Plate glass texture #define COLORCORRECTION_CLASS_ID 0x00002D0 // Color Correction texture #ifndef NO_MAPTYPE_VERTCOLOR // orb 01-07-2001 #define VCOL_CLASS_ID 0x0934851 // Vertex color map #endif // NO_MAPTYPE_VERTCOLOR // Subclasses of SHADER_CLASS_ID #define STDSHADERS_CLASS_ID 0x00000035 // to 39 // Subclasses of SHADOW_TYPE_CLASS_ID #define STD_SHADOW_MAP_CLASS_ID 0x0000100 #define STD_RAYTRACE_SHADOW_CLASS_ID 0x0000200 // subclasses of RENDERER_CLASS_ID #define SREND_CLASS_ID 0x000001 // default scan-line renderer // subclasses of BAKE_ELEMENT_CLASS_ID #define COMPLETE_BAKE_ELEMENT_CLASS_ID 0x00010001 #define SPECULAR_BAKE_ELEMENT_CLASS_ID 0x00010002 #define DIFFUSE_BAKE_ELEMENT_CLASS_ID 0x00010003 #define REFLECT_REFRACT_BAKE_ELEMENT_CLASS_ID 0x00010004 #define SHADOW_BAKE_ELEMENT_CLASS_ID 0x00010005 #define LIGHT_BAKE_ELEMENT_CLASS_ID 0x00010006 #define NORMALS_ELEMENT_CLASS_ID 0x00010007 #define BLEND_BAKE_ELEMENT_CLASS_ID 0x00010008 #define ALPHA_BAKE_ELEMENT_CLASS_ID 0x00010009 #define HEIGHT_BAKE_ELEMENT_CLASS_ID 0x0001000A #define AMBIENTOCCLUSION_BAKE_ELEMENT_CLASS_ID 0x0001000B // subclasses of REF_MAKER_CLASS_ID #define MTL_LIB_CLASS_ID 0x001111 #define MTLBASE_LIB_CLASS_ID 0x003333 #define THE_SCENE_CLASS_ID 0x002222 #define MEDIT_CLASS_ID 0x000C80 #define MTL_CATEGORY_CLASS_ID Class_ID(0xb8e3b2d, 0x19854ad2) // subclass of all classes #define STANDIN_CLASS_ID 0xffffffff // subclass of all super classes // Default sound object #define DEF_SOUNDOBJ_CLASS_ID 0x0000001 // Default atmosphere #define FOG_CLASS_ID 0x10000001 //------------------ Modifier sub classes -------- #define SKEWOSM_CLASS_ID 0x6f3cc2aa #define BENDOSM_CLASS_ID 0x00010 #define TAPEROSM_CLASS_ID 0x00020 #define TWISTOSM_CLASS_ID 0x00090 #define SPLINEIKCONTROL_CLASS_ID Class_ID(0x5f43ba4, 0x55fe9305) //AG added : 01/08/02 #define UVWMAPOSM_CLASS_ID 0xf72b1 #define SELECTOSM_CLASS_ID 0xf8611 #define MATERIALOSM_CLASS_ID 0xf8612 #define SMOOTHOSM_CLASS_ID 0xf8613 #define NORMALOSM_CLASS_ID 0xf8614 #define OPTIMIZEOSM_CLASS_ID 0xc4d31 #define AFFECTREGION_CLASS_ID 0xc4e32 #define SUB_EXTRUDE_CLASS_ID 0xc3a32 #define TESSELLATE_CLASS_ID 0xa3b26ff2 #define DELETE_CLASS_ID 0xf826ee01 #define MESHSELECT_CLASS_ID 0x73d8ff93 #define UVW_XFORM_CLASS_ID 0x5f32de12 #define UVW_XFORM2_CLASS_ID 0x5f32de13 //SS 11/20/2002: added #define EXTRUDEOSM_CLASS_ID 0x000A0 #define SURFREVOSM_CLASS_ID 0x000B0 #define DISPLACEOSM_CLASS_ID 0xc4d32 #define DISPLACE_OBJECT_CLASS_ID 0xe5240 #define DISPLACE_WSM_CLASS_ID 0xe5241 #define SINEWAVE_OBJECT_CLASS_ID 0x00030 #define SINEWAVE_CLASS_ID 0x00040 #define SINEWAVE_OMOD_CLASS_ID 0x00045 #define LINWAVE_OBJECT_CLASS_ID 0x00035 #define LINWAVE_CLASS_ID 0x00042 #define LINWAVE_OMOD_CLASS_ID 0x00047 #define GRAVITYOBJECT_CLASS_ID 0xe523c #define GRAVITYMOD_CLASS_ID 0xe523d #define WINDOBJECT_CLASS_ID 0xe523e #define WINDMOD_CLASS_ID 0xe523f #define DEFLECTOBJECT_CLASS_ID 0xe5242 #define DEFLECTMOD_CLASS_ID 0xe5243 #define BOMB_OBJECT_CLASS_ID 0xf2e32 #define BOMB_CLASS_ID 0xf2e42 // These are the FFD Modifier's class ID's #define FFDNMOSSQUARE_CLASS_ID Class_ID(0x8ab36cc5,0x82d7fe74) #define FFDNMWSSQUARE_CLASS_ID Class_ID(0x67ea40b3,0xfe7a30c4) #define FFDNMWSSQUARE_MOD_CLASS_ID Class_ID(0xd6636ea2,0x9aa42bf3) #define FFDNMOSCYL_CLASS_ID Class_ID(0x98f37a63,0x3ffe9bca) #define FFDNMWSCYL_CLASS_ID Class_ID(0xfa4700be,0xbbe85051) #define FFDNMWSCYL_MOD_CLASS_ID Class_ID(0xf1c630a3,0xaa8ff601) #define FFD44_CLASS_ID Class_ID(0x21325596, 0x2cd10bd8) #define FFD33_CLASS_ID Class_ID(0x21325596, 0x2cd10bd9) #define FFD22_CLASS_ID Class_ID(0x21325596, 0x2cd10bd0) //JH Association context modifiers //GEOM TO GEOM #define ACMOD_GEOM_GEOM_BOOLADD_CID 0x4e0f483a #define ACMOD_GEOM_GEOM_BOOLSUB_CID 0x61661a5c #define ACMOD_GEOM_GEOM_BOOLINT_CID 0x2a4f3945 #define ACMOD_GEOM_GEOM_SIMPAGG_CID 0x40cb05ab //SHAPE To GEOM #define ACMOD_SHAPE_GEOM_HOLE_CID 0x366307b0 #define ACMOD_SHAPE_GEOM_INT_CID 0x782d8d50 #define ACMOD_SHAPE_GEOM_EMBOSS_CID 0x7a13397c #define ACMOD_SHAPE_GEOM_REVEAL_CID 0x55ed658c //JH Solids #define GENERIC_AMSOLID_CLASS_ID Class_ID(0x5bb661e8, 0xa2c27f02) //------------------ Controller sub classes -------- #define LININTERP_FLOAT_CLASS_ID 0x2001 #define LININTERP_POSITION_CLASS_ID 0x2002 #define LININTERP_ROTATION_CLASS_ID 0x2003 #define LININTERP_SCALE_CLASS_ID 0x2004 #define PRS_CONTROL_CLASS_ID 0x2005 #define LOOKAT_CONTROL_CLASS_ID 0x2006 #define HYBRIDINTERP_FLOAT_CLASS_ID 0x2007 #define HYBRIDINTERP_POSITION_CLASS_ID 0x2008 #define HYBRIDINTERP_ROTATION_CLASS_ID 0x2009 #define HYBRIDINTERP_POINT3_CLASS_ID 0x200A #define HYBRIDINTERP_SCALE_CLASS_ID 0x2010 #define HYBRIDINTERP_COLOR_CLASS_ID 0x2011 #define HYBRIDINTERP_POINT4_CLASS_ID 0x2012 #define HYBRIDINTERP_FRGBA_CLASS_ID 0x2013 #define TCBINTERP_FLOAT_CLASS_ID 0x442311 #define TCBINTERP_POSITION_CLASS_ID 0x442312 #define TCBINTERP_ROTATION_CLASS_ID 0x442313 #define TCBINTERP_POINT3_CLASS_ID 0x442314 #define TCBINTERP_SCALE_CLASS_ID 0x442315 #define TCBINTERP_POINT4_CLASS_ID 0x442316 #define MASTERPOINTCONT_CLASS_ID 0xd9c20ff //------------------ PF sub classes --------------- #define PF_SUBCLASS_ID_PARTB 0x1eb34000 //-------------------sub class part A #define PF_OPERATOR_SUBCLASS_ID 0x74f93a02 #define PF_OPERATOR3D_SUBCLASS_ID 0x74f93a03 #define PF_TEST_SUBCLASS_ID 0x74f93a04 #define PF_TEST3D_SUBCLASS_ID 0x74f93a05 #define PF_ITEM_SUBCLASS_ID 0x74f93a06 #define PF_OBJECT_SUBCLASS_ID 0x74f93a07 //-------------------------------------------------- class ISave; class ILoad; class Interface; class ActionTable; typedef short BlockID; class ParamBlockDesc2; class IParamBlock2; class IObjParam; class Animatable; class ParamMap2UserDlgProc; class IParamMap2; class FPInterface; class Manipulator; class ReferenceTarget; // System keeps a list of the DLL's found on startup. // This is the interface to a single class /*! \sa Class ClassDesc2, Class IParamBlock2, Class ParamBlockDesc2, Class ILoad, Class ISave, Class Interface, Class Class_ID.\n\n \par Description: Class descriptors provide the system with information about the plug-in classes in the DLL. The developer creates a class descriptor by deriving a class from <b>ClassDesc</b> and implementing several of its methods.\n\n In release 3.0 and later there are new methods which are supplied and implemented by ClassDesc2. These methods relate to the parameter block2 system.\n\n In release 4.0 plug-ins wishing to use the new Function Publishing system must use <b>ClassDesc2</b> rather than this class for their class descriptors. See <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>. \par Method Groups: See <a href="class_class_desc_groups.html">Method Groups for Class ClassDesc</a>. */ class ClassDesc: public MaxHeapOperators { private: Tab<FPInterface*> interfaces; // the FnPub interfaces published by this plugin public: virtual ~ClassDesc() {} /*! \remarks Controls if the plug-in shows up in lists from the user to choose from. \return If the plug-in can be picked and assigned by the user, as is usually the case, return TRUE. Certain plug-ins may be used privately by other plug-ins implemented in the same DLL and should not appear in lists for user to choose from. These plug-ins would return FALSE. */ virtual int IsPublic()=0; // Show this in create branch? /*! \remarks 3ds Max calls this method when it needs a pointer to a new instance of the plug-in class. For example, if 3ds Max is loading a file from disk containing a previously used plug-in (procedural object, modifier, controller, etc...), it will call the plug-in's <b>Create()</b> method. The plug-in responds by allocating a new instance of its plug-in class. See the Advanced Topic section on <a href="ms-its:3dsmaxsdk.chm::/alloc_memory_allocation.html">Memory Allocation</a> for more details. \param loading This parameter is a flag indicating if the class being created is going to be loaded from a disk file. If the flag is TRUE, the plug-in may not have to perform any initialization of the object because the loading process will take care of it. See the Advanced Topics section on <a href="ms-its:3dsmaxsdk.chm::/loading_and_saving.html">Loading and Saving</a> for more information.\n\n Note: If this parameter is TRUE, developers must initialize their references to NULL. Otherwise 3ds Max may crash.\n\n 3ds Max provides a default plug-in object creation process. Many plug-ins fit this form. When the system is about to create an instance of the plug-in object it calls a method <b>BaseObject::GetCreateMouseCallBack()</b>.This method returns a callback object whose <b>proc()</b> method handles the mouse input during its creation phase. Most of the work is then handled by the system. The procedural sphere is an example of this type of plug-in. Certain plug-ins may have special creation needs however. The target camera is an example of such a plug-in. Because it needs to create two nodes in the scene (the camera and the target) it requires a custom creation process. To support these plug-ins the following two methods are provided. They allow the plug-in to manage the creation process themselves. See <a href="ms-its:3dsmaxsdk.chm::/nodes_object_creation_methods.html">Object Creation Methods</a> for more details. */ virtual void * Create(BOOL loading=FALSE)=0; // return a pointer to an instance of the class. /*! \remarks The custom creation process of the plug-in object is handled by this method. For example, a plug-in can create a custom command mode and push it on the command stack to handle the creation process.\n\n Important Note: A plug-in that doesn't want to participate in the standard object creation mechanism using CreateMouseCallBack <b>must</b> push a CommandMode on the stack in this method and remove it in <b>EndCreate()</b>. This is true even if the plug-in doesn't do anything inside the mode. A mode has to be pushed on the stack and then later popped off otherwise a crash will occur (if the default implementation of this method is not used). For more details on object creation see the Advanced Topics section <a href="ms-its:3dsmaxsdk.chm::/nodes_object_creation_methods.html">Object Creation Methods</a>. \param i An interface pointer the plug-in may use to call functions in 3ds Max. \return To use the default creation process (the system implementation for this method) return 0; Return nonzero if the plug-in implements this method. \par Default Implementation: <b>{ return 0; }</b> */ virtual int BeginCreate(Interface *i) {return 0;} /*! \remarks The termination of the custom creation process is managed by the implementation of this method. For example, the plug-in could remove a custom command mode from the command stack. See the Advanced Topics section on <a href="ms-its:3dsmaxsdk.chm::/nodes_object_creation_methods.html">Object Creation Methods</a> for more details. \param i An interface pointer the plug-in may use to call functions in 3ds Max. \return To use the system implementation for this method return 0; Return nonzero if the plug-in implements this method. \par Default Implementation: <b>{ return 0; }</b> */ virtual int EndCreate(Interface *i) {return 0;}; /*! \remarks This method returns the name of the class. This name appears in the button for the plug-in in the 3ds Max user interface. \return The name of the class. */ virtual const MCHAR* ClassName()=0; /*! \remarks This method returns a system defined constant describing the class this plug-in class was derived from. For example, the Bend modifier returns <b>OSM_CLASS_ID</b>. This super class ID is used by all object space modifiers. See <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_super_class_ids.html">List of SuperClassIDs</a>. \return The SuperClassID of the plug-in. */ virtual SClass_ID SuperClassID()=0; /*! \remarks This method must return the <b>unique</b> ID for the object. If two ClassIDs conflict, the system will only load the first one it finds. The ClassID consists of two unsigned 32-bit quantities. The constructor assigns a value to each of these, for example <b>Class_ID(0xA1C8E1D1, 0xE7AA2BE5)</b>. A developer should use the random Class_ID generator to avoid conflicts (Generate a random Class_ID). See Class Class_ID for more information. \return The unique ClassID of the plug-in. */ virtual Class_ID ClassID()=0; /*! \remarks This methods returns a string describing the category a plug-in fits into. The category is usually selected in the drop down list in the create, or utility branch of the command panel. In the create branch, if this is set to be an existing category (i.e. "Standard Primitives", "Splines", ...) then the plug-in will appear in that category. If the category doesn't yet exists then it is created. If the plug-in does not need to appear in the list, it may simply return a null string as in <b>_M("")</b>.\n\n In the modify branch, the category determines which group it appears in the Configure Button Sets / Modifiers list. These are the categories such as "MAX STANDARD", "MAX EDIT", and "MAX SURFACE".\n\n This method is also used to distinguish between the various types of texture maps so they can be separated in the Material/Map Browser. The appropriate string should be returned by this method of the Texmap. For example:\n\n <b>const MCHAR* Category() { return TEXMAP_CAT_3D; }</b>\n\n The options for texture maps are:\n\n <b>MCHAR TEXMAP_CAT_2D[]; -</b> 2D maps.\n\n <b>MCHAR TEXMAP_CAT_3D[]; -</b> 3D maps.\n\n <b>MCHAR TEXMAP_CAT_COMP[]; -</b> Composite.\n\n <b>MCHAR TEXMAP_CAT_COLMOD[]; -</b> Color modifier.\n\n <b>MCHAR TEXMAP_CAT_ENV[]; -</b> Environment. */ virtual const MCHAR* Category()=0; // primitive/spline/loft/ etc /*! \remarks This method is used to enable or disable the button that allows the plug-ins class to be created. For example, at certain times it is not appropriate to for the Boolean object to be created. When there is not an object of the appropriate type selected the Boolean object cannot be created. At these times the button should be disabled (the button will appear as grayed out in the Create branch of the command panel). The button should be enabled if there is an object of the appropriate type selected. This method allows a plug-in to control the state of the button. \param i An interface pointer the plug-in may use to call functions in 3ds Max. \return TRUE to enable the class creation button; FALSE to disable it. \par Default Implementation: <b>{ return TRUE; }</b> \par Sample Code: The following code from <b>/MAXSDK/SAMPLES/OBJECTS/BOOLOBJ.CPP</b> demonstrates an implementation of this method. If there is not a node selected, it is not OK to use the command so the button should appear disabled. To disable the button <b>OkToCreate()</b> returns FALSE. If the object that is selected is not of the appropriate type it the button is disabled as well.\n\n \code BOOL BoolObjClassDesc::OkToCreate(Interface *i) { if (i->GetSelNodeCount()!=1) return FALSE; ObjectState os = i->GetSelNode(0)->GetObjectRef()->Eval(i->GetTime()); if (os.obj->SuperClassID()!=GEOMOBJECT_CLASS_ID) { return FALSE; } return TRUE; } \endcode */ virtual BOOL OkToCreate(Interface *i) { return TRUE; } // return FALSE to disable create button /*! \remarks If a plug-in class has default parameters that it needs to allow the user to edit, TRUE should be returned and <b>EditClassParams()</b> and <b>ResetClassParams()</b> should be implemented. Otherwise return FALSE (the default). See the description above. \par Default Implementation: <b>{return FALSE;}</b> */ virtual BOOL HasClassParams() {return FALSE;} /*! \remarks If the user picks the class from the list this method is called. The plug-in should put up a modal dialog that allows the user to edit the plug-ins default parameters. The plug-in should not return until the user has finished editing the parameters. See the description above. \param hParent The parent window handle. */ virtual void EditClassParams(HWND hParent) {} /*! \remarks When the user executes File / Reset or presses the 'Reset to Factory Settings...' button in the File / Preferences... / Animation tab / Controller Defaults section this method is called. The plug-in can respond by resetting itself to use its default values. See the description above. \param fileReset When TRUE, the user has performed a File / Reset operation. When FALSE, the user is in the Preferences... dialog doing a reset controller defaults operation. */ virtual void ResetClassParams(BOOL fileReset=FALSE) {} // These functions return keyboard action tables that plug-ins can use /*! \remarks This method is called at Dll-load time to get the number of action tables from a plug-in. Note: If more than one class uses the table only one of the classes should export the table, but they can all use them. See Class ActionTable. \par Default Implementation: <b>{ return 0; }</b> */ virtual int NumActionTables() { return 0; } /*! \remarks Returns a pointer to the 'i-th' action table. See Class ActionTable. \param i The zero based index of the table to return. \par Default Implementation: <b>{ return NULL; }</b> */ virtual ActionTable* GetActionTable(int i) { return NULL; } // Manipulator Interface // Returns true of the class implements a manipulator object. /*! \remarks This methods is what is used by the system to determine whether the ClassDesc describes a manipulator. Returns TRUE if the class implements a manipulator object; otherwise FALSE. \par Default Implementation: <b>{ return FALSE; }</b> */ virtual BOOL IsManipulator() { return FALSE; } /*! \remarks The method returns true if the class is a manipulator and it manipulates the given base object, modifier or controller. When starting "Manipulate" mode, this is called on selected nodes for the base object, all modifiers, the TM controller and the position, rotation and scale controllers, if the TM controller is a PRSController. \param hTarget A pointer to a reference target. \par Default Implementation: <b>{ return FALSE; }</b> */ virtual BOOL CanManipulate(ReferenceTarget* hTarget) { return FALSE; } /*! \remarks Returns TRUE if the manipulator applies to the given node; otherwise FALSE. This method can be used to indicate that the manipulator works on a part of an object that is not covered by BOOL CanManipulate(ReferenceTarget* hTarget) such as the visibility controller of a node. \param pNode The node to check. \par Default Implementation: <b>{ return FALSE; }</b> */ virtual BOOL CanManipulateNode(INode* pNode) { return FALSE; } /*! \brief Creates a manipulator object When a manipulator returns TRUE to CanManipulate(ReferenceTarget* hTarget), the system calls this version of CreateManipulator() to create an instance of the manipulator. \param hTarget - The ReferenceTarget for which a manipulator is requested \param pNode - The node that the manipulator needs to manipulate (know about) \return - Pointer to the newly created manipulator, or NULL if the creation failed. \code Manipulator* BendManipClassDesc::CreateManipulator(ReferenceTarget* hTarget, INode* node) { if (hTarget->ClassID() != Class_ID(BENDOSM_CLASS_ID, 0)) return NULL; return (new BendManip((SimpleMod2*)hTarget, node)); } \endcode */ virtual Manipulator* CreateManipulator( ReferenceTarget* hTarget, INode* pNode) { return NULL; } /*! \brief Creates a manipulator object When a manipulator returns TRUE to CanManipulateNode(INode* pNode), the system calls this version of CreateManipulator() to create an instance of the manipulator. \param pNode - The node that the manipulator needs to manipulate (know about) \return - Pointer to the newly created manipulator, or NULL if the creation failed. */ virtual Manipulator* CreateManipulator(INode* pNode) {return NULL;} // Class IO /*! \remarks Returns TRUE if there is data associated with the class that needs to be saved in the 3ds Max file. If this is so, implement the <b>Save()</b> and <b>Load()</b> methods below. If there is no class data to save return FALSE. \par Default Implementation: <b>{ return FALSE; }</b> */ virtual BOOL NeedsToSave() { return FALSE; } /*! \remarks If <b>NeedsToSave()</b> returns TRUE then this method should be implemented to save the data associated with the class. \param isave A pointer that may be used to call methods to save data to disk. \return <b>IO_OK</b> if the save was successful; otherwise <b>IO_ERROR</b>. */ virtual IOResult Save(ISave *isave) { return IO_OK; } /*! \remarks If <b>NeedsToSave()</b> returns TRUE then this method should be implemented to load the data associated with the class. \param iload A pointer that may be used to load data from a file. \return <b>IO_OK</b> if the load was successful; otherwise <b>IO_ERROR</b>. */ virtual IOResult Load(ILoad *iload) { return IO_OK; } // bits of dword set indicate corrresponding rollup page is closed. // the value 0x7fffffff is returned by the default implementation so the // command panel can detect this method is not being overridden, and just leave // the rollups as is. /*! \remarks This method returns a DWORD which is used to initialize the rollup state in both the create branch and the modify branch. The semantics are different, however for these two cases. Whenever the rollups are created in the create branch, their state will be that specified by this method. In the modify branch, the first time an object of this type is modified the state will be that of this method, but after that it will remain what it was last set to. \return The bits of this DWORD set indicate the corrresponding rollup page is closed. The zero bit corresponds to the plug-ins first rollup, the first bit is the second rollup, etc. The value <b>0x7fffffff</b> is returned by the default implementation so the command panel can detect this method is not being overridden, and just leave the rollups as is. \par Default Implementation: <b>{ return 0x7fffffff; }</b> */ virtual DWORD InitialRollupPageState() { return 0x7fffffff; } // ParamBlock2-related metadata interface, supplied & implemented in ClassDesc2 (see maxsdk\include\iparamb2.h) /*! \remarks Returns a string which provides a fixed, machine parsable internal name for the plug-in. This name is used by MAXScript. \par Default Implementation: <b>{ return NULL; }</b> */ virtual const MCHAR* InternalName() { return NULL; } /*! \remarks Returns the DLL instance handle of the plug-in. This is used so that string resources can be loaded by the ParamBlock2 system. \par Default Implementation: <b>{ return NULL; }</b> */ virtual HINSTANCE HInstance() { return NULL; } // access parameter block descriptors for this class /*! \remarks Implemented by the System.\n\n Returns the number or ParamBlockDesc2s used by the plug-in. \par Default Implementation: <b>{ return 0; }</b> */ virtual int NumParamBlockDescs() { return 0; } /*! \remarks Implemented by the System.\n\n Returns a pointer to the 'i-th' parameter block 2 descriptor. \param i The zero based index of the descriptor to return. \par Default Implementation: <b>{ return NULL; }</b> */ virtual ParamBlockDesc2* GetParamBlockDesc(int i) { return NULL; } /*! \remarks Implemented by the System.\n\n Returns a pointer to the specified parameter block 2 descriptor. \param id The ID of the parameter block. \par Default Implementation: <b>{ return NULL; }</b> */ virtual ParamBlockDesc2* GetParamBlockDescByID(BlockID id) { return NULL; } /*! \remarks Implemented by the System.\n\n Adds the specified parameter block 2 descriptor to the list of those maintained by the class. \param pbd Points to the parameter block 2 descriptor to add. \par Default Implementation: <b>{ }</b> */ virtual void AddParamBlockDesc(ParamBlockDesc2* pbd) { } // automatic UI management /*! \remarks Implemented by the System.\n\n This method is called to handle the beginning of the automatic command panel user interface management provided by the param map 2 system. This method is called by the plug-in from its <b>Animatable::BeginEditParams()</b> method. The parameters passed to that method are simply passed along to this method. \param ip The interface pointer passed to the plug-in. \param obj Points to the plug-in class calling this method. \param flags The flags passed along to the plug-in in <b>Animatable::BeginEditParams()</b>. \param prev The pointer passed to the plug-in in <b>Animatable::BeginEditParams()</b>. \par Default Implementation: <b>{ }</b> */ virtual void BeginEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev) { } /*! \remarks Implemented by the System.\n\n This method is called to handle the ending of the automatic command panel user interface management provided by the param map 2 system. This method is called by the plug-in from its <b>Animatable::EndEditParams()</b> method. The parameters passed to that method are simply passed along to this method. \param ip The interface pointer passed to the plug-in. \param obj Points to the plug-in class calling this method. \param flags The flags passed along to the plug-in in <b>Animatable::EndEditParams()</b>. \param prev The pointer passed to the plug-in in <b>Animatable::EndEditParams()</b>. \par Default Implementation: <b>{ }</b> */ virtual void EndEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev) { } /*! \remarks Implemented by the System.\n\n Invalidates the user interface for the rollup or dialog managed by the specified descriptor. This will cause the controls in that rollup to be redrawn. \param pbd Points to the parameter block 2 descriptor whose corresponding UI is invalidated. \par Default Implementation: <b>{ }</b> */ virtual void InvalidateUI(ParamBlockDesc2* pbd) { } CoreExport virtual MCHAR* GetRsrcString(INT_PTR id); // automatic ParamBlock construction /*! \remarks Implemented by the System.\n\n This method creates the automatic parameter blocks for the specified plug-in. These are the ones with the <b>ParamBlockDesc2.flags P_AUTO_CONSTRUCT</b> bit set. \param owner Points to the owner of the parameter block. \par Default Implementation: <b>{ }</b> */ virtual void MakeAutoParamBlocks(ReferenceMaker* owner) { } // access automatically-maintained ParamMaps, by simple index or by associated ParamBlockDesc /*! \remarks Implemented by the System.\n\n Returns the number of parameter map2s used by the plug-in. \par Default Implementation: <b>{ return 0; }</b> */ virtual int NumParamMaps() { return 0; } /*! \remarks Implemented by the System.\n\n Returns a pointer to the 'i-th' parameter map2. \param i The zero based index of the parameter map2 to return. \par Default Implementation: <b>{ return NULL; }</b> */ virtual IParamMap2* GetParamMap(int i) { return NULL; } /*! \remarks Implemented by the System.\n\n Returns a pointer to the parameter map2 whose descriptor is passed. \param pbd Points to the parameter block2 descriptor. \par Default Implementation: <b>{ return NULL; }</b> */ virtual IParamMap2* GetParamMap(ParamBlockDesc2* pbd) { return NULL; } // maintain user dialog procs on automatically-maintained ParamMaps /*! \remarks Implemented by the System.\n\n Sets the parameter map 2 user dialog proc for the specified descriptor. \param pbd Points to the parameter block 2 descriptor. \param proc This object manages user interface control that require special processing. See Class ParamMap2UserDlgProc. \par Default Implementation: <b>{ }</b> */ virtual void SetUserDlgProc(ParamBlockDesc2* pbd, ParamMap2UserDlgProc* proc=NULL) { } /*! \remarks Implemented by the System.\n\n Returns a pointer to the parameter map 2 user dialog proc (if any) for the specified descriptor. \param pbd Points to the parameter block 2 descriptor. \return See Class ParamMap2UserDlgProc. \par Default Implementation: <b>{ return NULL; }</b> */ virtual ParamMap2UserDlgProc* GetUserDlgProc(ParamBlockDesc2* pbd) { return NULL; } // Class can draw an image to represent itself graphically... /*! \remarks This method allows this plug-in class to provide a custom image for display in Schematic %View. \param bkColor The background color. See <a href="ms-its:listsandfunctions.chm::/idx_R_colorref.html">COLORREF-DWORD format</a>. \param hDC The handle for the device context. \param rect The rectangle to draw in. \return TRUE if this class can draw an image to represent itself graphically; otherwise FALSE. \par Default Implementation: <b>{ return FALSE; }</b> */ virtual bool DrawRepresentation(COLORREF bkColor, HDC hDC, Rect &rect) { return FALSE; } // Function Publishing interfaces - jbw 3.13.00 /*! \remarks Implemented by the System.\n\n Returns the number of function publishing interfaces maintained by the class descriptor. */ virtual int NumInterfaces() { return interfaces.Count(); } virtual FPInterface* GetInterfaceAt(int i) { return interfaces[i]; } /*! \remarks Returns a pointer to the function publishing interface whose ID is specified. \param id The inteface ID. */ CoreExport virtual FPInterface* GetInterface(Interface_ID id); /*! \remarks Returns a pointer to the function publishing interface whose name is specified. \param name The name of the interface. */ CoreExport virtual FPInterface* GetInterface(MCHAR* name); /*! \remarks Adds the specified interface to the list maintained by this class descriptor. \param fpi Points to the interface to add. */ CoreExport virtual void AddInterface(FPInterface* fpi); /*! \remarks Deletes all the interfaces maintained by the class descriptor. */ virtual void ClearInterfaces() { interfaces.ZeroCount(); } // This method can be used for further categorizing plugin's. If a plugin has // sub-plugins(like light > shadows, particles > operators), this method can be // used to differentiate them. sub-plugins can be derived off reference target // but return a particular class ID published by the parent plugins SDK headers. // Then parent plugin can get a list of all reference targets whose SubClassID // matches the published SubClassID /*! \remarks This method can be used for further categorizing plugin's. If a plugin has sub-plugins(like light \> shadows, particles \> operators), this method can be used to differentiate them. sub-plugins can be derived off reference target but return a particular class ID published by the parent plugins SDK headers. Then parent plugin can get a list of all reference targets whose SubClassID matches the published SubClassID \par Default Implementation: <b>{ return Class_ID(); }</b> */ virtual Class_ID SubClassID() { return Class_ID(); } // Generic expansion function virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; } }; // ClassDesc::Execute cmd values #define I_EXEC_CTRL_BYPASS_TREE_VIEW 1001 // return 1 to hide your controller in track view // arg1 is expected to be bool* The bool gets set to true or false // depending whether sub-obj anim is or not enabled for that object type. // The Execute method returns TRUE if the arg1 is set successfully, otherwise FALSE #define I_EXEC_GET_SOA_STATE 1002 // arg1 is expected to be a TimeValue* The TimeValue gets set appropriately, // depending on whether sub-obj animation is allowed of not for that object type. // The Execute method returns TRUE if the arg1 is set successfully, otherwise FALSE #define I_EXEC_EVAL_SOA_TIME 1003 // Create instance of the specified class CoreExport void* CreateInstance(SClass_ID superID, Class_ID classID); //! \brief CallParam data for NOTIFY_CLASSDESC_REPLACED broadcasts. /*! A pointer to an instance of this structure is passed to BroadcastNotification after a DataClassDesc is replaced by a ClassDesc in a ClassDirectory. This occurs when the dll containing a deferred loaded plugin is loaded. \see NOTIFY_CLASSDESC_REPLACED */ struct ClassDescReplaced: public MaxHeapOperators { //! the old class descriptor const ClassDesc* oldClassDesc; //! the new class descriptor const ClassDesc* newClassDesc; }; #endif
45.604369
199
0.756134
[ "mesh", "render", "object", "shape", "3d" ]
2593a9ddc10724690df7eb6013190c4618c8de22
3,328
h
C
dali/devel-api/adaptor-framework/web-engine-context-menu.h
dalihub/dali-adaptor
b7943ae5aeb7ddd069be7496a1c1cee186b740c5
[ "Apache-2.0", "BSD-3-Clause" ]
6
2016-11-18T10:26:46.000Z
2021-11-01T12:29:05.000Z
dali/devel-api/adaptor-framework/web-engine-context-menu.h
dalihub/dali-adaptor
b7943ae5aeb7ddd069be7496a1c1cee186b740c5
[ "Apache-2.0", "BSD-3-Clause" ]
5
2020-07-15T11:30:49.000Z
2020-12-11T19:13:46.000Z
dali/devel-api/adaptor-framework/web-engine-context-menu.h
dalihub/dali-adaptor
b7943ae5aeb7ddd069be7496a1c1cee186b740c5
[ "Apache-2.0", "BSD-3-Clause" ]
7
2019-05-17T07:14:40.000Z
2021-05-24T07:25:26.000Z
#ifndef DALI_WEB_ENGINE_CONTEXT_MENU_H #define DALI_WEB_ENGINE_CONTEXT_MENU_H /* * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ // EXTERNAL INCLUDES #include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h> #include <dali/public-api/math/vector2.h> #include <memory> #include <string> #include <vector> namespace Dali { /** * @brief A class WebEngineContextMenu for context menu of web engine. */ class WebEngineContextMenu { public: /** * @brief Constructor. */ WebEngineContextMenu() = default; /** * @brief Destructor. */ virtual ~WebEngineContextMenu() = default; /** * @brief Count the number of the context menu item. * * @return The number of current context menu item */ virtual uint32_t GetItemCount() const = 0; /** * @brief Return the nth item in a context menu. * * @param[in] index The number of the item * * @return The nth item of context menu */ virtual std::unique_ptr<WebEngineContextMenuItem> GetItemAt(uint32_t index) const = 0; /** * @brief Get the list of items. * * @return item list of context menu */ virtual std::vector<std::unique_ptr<WebEngineContextMenuItem>> GetItemList() const = 0; /** * @brief Remove the item from the context menu. * * @param[in] item The context menu item to be removed * * @return true if succeeded, false otherwise */ virtual bool RemoveItem(WebEngineContextMenuItem& item) = 0; /** * @brief Add the item to the context menu. * * @param[in] tag The tag of context menu item * @param[in] title The title of context menu item * @param[in] enabled If true the context menu item is enabled, false otherwise * * @return true if succeeded, false otherwise */ virtual bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) = 0; /** * @brief Add the item to the context menu. * * @param[in] tag The tag of context menu item * @param[in] title The title of context menu item * @param[in] iconFile The path of icon to be set on context menu item * @param[in] enabled If true the context menu item is enabled, false otherwise * * @return true if succeeded, false otherwise */ virtual bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) = 0; /** * @brief Select the item from the context menu. * * @return true if succeeded, false otherwise */ virtual bool SelectItem(WebEngineContextMenuItem& item) = 0; /** * @brief Hide the context menu. * * @return true if succeeded, false otherwise */ virtual bool Hide() = 0; }; } // namespace Dali #endif // DALI_WEB_ENGINE_CONTEXT_MENU_H
27.966387
138
0.694712
[ "vector" ]
0543f61b6ab0a4057d68f1790c2505e07e675f78
839
h
C
Cylinder.h
dahah9138/Opengl-geometries
835a06060f6b06114cb8715bf6c5914b97b68de0
[ "MIT" ]
null
null
null
Cylinder.h
dahah9138/Opengl-geometries
835a06060f6b06114cb8715bf6c5914b97b68de0
[ "MIT" ]
null
null
null
Cylinder.h
dahah9138/Opengl-geometries
835a06060f6b06114cb8715bf6c5914b97b68de0
[ "MIT" ]
null
null
null
#ifndef CYLINDER_H #define CYLINDER_H #define _USE_MATH_DEFINES #include <math.h> #include "Polygon.h" class Cylinder : public Polygon { public: Cylinder(float R = 0.5f, float h = 3.0f, glm::vec3 center = glm::vec3(0.0f), int rs = 20, bool createCaps = true, bool wire = false) : _R(R), _topCap(0), _bottomCap(0), _height(h), _useCaps(createCaps) { _center = center; _root_size = rs; _useWire = wire; } ~Cylinder() { if (_mesh != 0) { delete _mesh; } if (_topCap != 0) { delete _topCap; } if (_bottomCap != 0) { delete _bottomCap; } } void init(); void draw(); private: void capInit(const char* cap); float _R; float _height; Mesh* _topCap; // mesh for the top cap Mesh* _bottomCap; // mesh for the bottom cap bool _useCaps; // Decide whether or not to create caps }; #endif
24.676471
136
0.640048
[ "mesh" ]
0545daf06b813c42f5d1a3f3315216ca93ffbe8f
3,103
h
C
Source/RendererCore/Vulkan/VulkanSwapchain.h
DavidTheFighter/KalosEngine
4c550114066bee1c41d08f38f5b692e567e96c27
[ "MIT" ]
1
2018-12-16T21:19:58.000Z
2018-12-16T21:19:58.000Z
Source/RendererCore/Vulkan/VulkanSwapchain.h
DavidTheFighter/KalosEngine
4c550114066bee1c41d08f38f5b692e567e96c27
[ "MIT" ]
null
null
null
Source/RendererCore/Vulkan/VulkanSwapchain.h
DavidTheFighter/KalosEngine
4c550114066bee1c41d08f38f5b692e567e96c27
[ "MIT" ]
null
null
null
#ifndef RENDERING_VULKAN_VULKANSWAPCHAIN_H_ #define RENDERING_VULKAN_VULKANSWAPCHAIN_H_ #include <RendererCore/Vulkan/vulkan_common.h> #if BUILD_VULKAN_BACKEND class Window; typedef struct SwapchainSupportDetails { VkSurfaceCapabilitiesKHR capabilities; std::vector<VkSurfaceFormatKHR> formats; std::vector<VkPresentModeKHR> presentModes; } SwapchainSupportDetails; typedef struct WindowSwapchain { Window *window; VkSwapchainKHR swapchain; VkSurfaceKHR surface; VkExtent2D swapchainExtent; SwapchainSupportDetails swapchainDetails; VkFormat swapchainImageFormat; VkSemaphore swapchainNextImageAvailableSemaphore; VkSemaphore swapchainDoneRenderingSemaphore; std::vector<VkImage> swapchainImages; std::vector<VkImageView> swapchainImageViews; std::vector<VkFramebuffer> swapchainFramebuffers; std::vector<VkCommandBuffer> swapchainCommandBuffers; VkDescriptorPool swapchainDescriptorPool; VkDescriptorSet swapchainDescriptorSet; VkRenderPass swapchainRenderPass; VkPipeline swapchainPipeline; } WindowSwapchain; class VulkanRenderer; class VulkanSwapchain { public: Window *mainWindow; std::vector<Window*> extraWindows; std::map<Window*, WindowSwapchain> swapchains; VulkanSwapchain (VulkanRenderer* vulkanRendererParent); virtual ~VulkanSwapchain (); void init(); void initSwapchain(Window *wnd); void presentToSwapchain(Window *wnd, std::vector<VkSemaphore> externalWaitSemaphores); void createSwapchain(Window *wnd); void destroySwapchain(Window *wnd); void recreateSwapchain(Window *wnd); void setSwapchainSourceImage(Window *wnd, VkImageView imageView, VkSampler sampler, VkImageLayout imageLayout, bool rewriteCommandBuffers = true); SwapchainSupportDetails querySwapchainSupport (VkPhysicalDevice device, VkSurfaceKHR surface); private: VkCommandPool swapchainCommandPool; VkImage swapchainDummySourceImage; VkImageView swapchainDummySourceImageView; VmaAllocation swapchainDummySourceImageMemory; VkSampler swapchainDummySampler; VkDescriptorSetLayout swapchainDescriptorLayout; VkShaderModule swapchainVertShader; VkShaderModule swapchainFragShader; VkPipelineLayout swapchainPipelineLayout; VulkanRenderer* renderer; void createDescriptors(WindowSwapchain &swapchain); void createFramebuffers(WindowSwapchain &swapchain); void createSyncPrimitives(WindowSwapchain &swapchain); void prerecordCommandBuffers(WindowSwapchain &swapchain); void createRenderPass(WindowSwapchain &swapchain); void createGraphicsPipeline(WindowSwapchain &swapchain); void createDummySourceImage (); VkSurfaceFormatKHR chooseSwapSurfaceFormat (const std::vector<VkSurfaceFormatKHR>& availableFormats); VkPresentModeKHR chooseSwapPresentMode (const std::vector<VkPresentModeKHR> availablePresentModes); VkExtent2D chooseSwapExtent (const VkSurfaceCapabilitiesKHR& capabilities, uint32_t windowWidth, uint32_t windowHeight); }; #endif #endif /* RENDERING_VULKAN_VULKANSWAPCHAIN_H_ */
30.722772
149
0.802127
[ "vector" ]
054abbc4f42bfd7b1b6a31ea020195b120f38103
737
h
C
src/utils/xrAI/space_restrictor_wrapper_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
2
2015-02-23T10:43:02.000Z
2015-06-11T14:45:08.000Z
src/utils/xrAI/space_restrictor_wrapper_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
17
2022-01-25T08:58:23.000Z
2022-03-28T17:18:28.000Z
src/utils/xrAI/space_restrictor_wrapper_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
1
2015-06-05T20:04:00.000Z
2015-06-05T20:04:00.000Z
//////////////////////////////////////////////////////////////////////////// // Module : space_restrictor_wrapper_inline.h // Created : 28.11.2005 // Modified : 28.11.2005 // Author : Dmitriy Iassenev // Description : space restrictor wrapper inline functions //////////////////////////////////////////////////////////////////////////// #pragma once IC CSpaceRestrictorWrapper::object_type& CSpaceRestrictorWrapper::object() const { VERIFY(m_object); return (*m_object); } IC CLevelGraph& CSpaceRestrictorWrapper::level_graph() const { VERIFY(m_level_graph); return (*m_level_graph); } IC CGraphEngine& CSpaceRestrictorWrapper::graph_engine() const { VERIFY(m_graph_engine); return (*m_graph_engine); }
26.321429
80
0.583446
[ "object" ]
054b06382e48aa8ad1fcefa6fa2448e71ed3d8ab
3,193
h
C
pc/src/processor.h
Zestyrien/me88
ceef9d6f370d669ce765f1cfc4e7a7088fc7c352
[ "MIT" ]
null
null
null
pc/src/processor.h
Zestyrien/me88
ceef9d6f370d669ce765f1cfc4e7a7088fc7c352
[ "MIT" ]
null
null
null
pc/src/processor.h
Zestyrien/me88
ceef9d6f370d669ce765f1cfc4e7a7088fc7c352
[ "MIT" ]
null
null
null
#pragma once #include "bus.h" #include <unordered_map> #include <vector> #include <string> enum class Star { //fetch phase fetch0 = 0, fetch1, fetch2, fetch3, fetchF0_0, fetchF1_0, fetchF1_1, fetchF1_2, fetchF2_0, fetchF3_0, fetchF3_1, fetchF3_2, fetchF4_0, fetchF4_1, fetchF4_2, fetchF4_3, fetchF4_4, fetchF4_5, fetchF4_6, fetchF4_7, fetchF5_0, fetchF5_1, fetchF5_2, fetchF5_3, fetchF5_4, fetchF6_0, fetchF6_1, fetchF6_2, fetchF6_3, fetchF6_4, fetchF7_0, fetchF7_1, fetchF7_2, fetchF7_3, fetchF7_4, fetchF7_5, fetchF7_6, fetchF7_7, fetchF7_8, nvi0, //something went wrong //execution phase nop0, //NOP hlt0, //HLT ldah0, //MOV AL,AH ldal0, //MOV AH,AL ldds0, //MOV AX,DS ldss0, //MOV AX,SS ldsp0, //MOV AX,SP lddi0, //MOV AX,DI ldax0, //MOV DS,AX ldax1, //MOV SS,AX ldax2, //MOV SP,AX ldax3, //MOV DI,AX //MOV AL,DS:(DI) ld0, ld1, ld2, //OUT AL,offset out0, out1, out2, //ADD, SUB, AND, OR, CMP, SHR, SAL... arit_log0, //MOV, IN ldal1, //JMP, JA, JAE... jmp0, //PUSH AL push0, push1, push2, //POP AL pop0, pop1, pop2, //CALL selector:offset call0, call1, call2, call3, call4, call5, call6, call7, call8, call9, call10, call11, call12, //RETN, RETF ret0, ret1, ret2, ret3, ret4, ret5, ret6, ret7, ret8, //INT int0, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, int14, int15, int16, int17, int18, int19, int20, int21, int22, int23, int24, //IRET iret0, iret1, iret2, iret3, iret4, iret5, iret6, iret7, iret8, iret9, iret10, iret11, //CLI cli0, //STI sti0, //LDPSR ldpsr0, //STUM stum0, //new statement nvma0, //interruption fetch phase pre_tipo0, pre_tipo1 }; class Processor { public: struct Status { int star; int mjr; int d7d0; int cs; int ip; int opcode; int source; int ss; int sp; int ds; int di; int destSel; int destOff; int al; bool cf; bool of; bool sf; bool zf; std::string mar; int mbr; int mr_; int mw_; std::vector<std::string> log; }; Processor() = delete; Processor(Bus& bus); void OnClock(); void OnReset(); Status GetStatus() const; private: Bus& m_Bus; std::vector<std::string> m_Log; std::bitset<8> m_d7_d0; //TO DO this is set from an external interface bool m_intr; //Registers std::bitset<20> m_MAR; bool m_MR_; //memory read bool m_MW_; //memory write bool m_IOR_; //i/o read bool m_IOW_; //i/o write bool m_INTA; //interrupt bool m_DIR; std::bitset<6> m_F; //flags std::bitset<8> m_AL, m_AH, m_MBR, m_OPCODE, m_SOURCE; std::bitset<16> m_DI, m_DS, m_CS, m_IP, m_SS, m_SP, m_DEST_OFF, m_DEST_SEL, m_PREV_SS, m_PREV_SP; Star m_STAR, m_MJR; //status register // flags void SetCF(bool val); //carry void SetZF(bool val); //zero void SetSF(bool val); //sign void SetOF(bool val); //overflow void SetIF(bool val); //interrupt void SetUS(bool val); //user/sistem 1=user bool GetCF() const; bool GetZF() const; bool GetSF() const; bool GetOF() const; bool GetIF() const; bool GetUS() const; std::bitset<8> GetFlags(); bool IsConditionMatch(); void ExecuteALU(); };
12.140684
98
0.649546
[ "vector" ]
057381b438422ab92445c23e2a180f94106307e8
15,218
c
C
gurba/lib/std/combat.c
DEFCON-MUD/defcon-28-mud-source
b25b5bd15fee6a4acda5119ea864bde4dff62714
[ "Unlicense" ]
4
2021-07-21T17:49:01.000Z
2022-03-11T20:50:59.000Z
gurba/lib/std/combat.c
DEFCON-MUD/defcon-28-mud-source
b25b5bd15fee6a4acda5119ea864bde4dff62714
[ "Unlicense" ]
null
null
null
gurba/lib/std/combat.c
DEFCON-MUD/defcon-28-mud-source
b25b5bd15fee6a4acda5119ea864bde4dff62714
[ "Unlicense" ]
1
2021-12-31T00:55:05.000Z
2021-12-31T00:55:05.000Z
static object *targets; static int fighting; static object target; int kills; mapping killed_by; object killer; int wimpy; int wimpy_hp; string wimpy_dir; #define FIGHTING_TIMEOUT 60 /* Amount of Endurance required to Attack */ #define ATTACK_COST 1 /* Uncomment this to get extra info in combat */ /* #define DEBUG_COMBAT 1 */ void create(void) { targets = ({ }); fighting = 0; wimpy = 0; wimpy_hp = 0; wimpy_dir = ""; } int is_fighting(void) { return fighting; } object query_killer(void) { return killer; } mapping query_killed_by(void) { if (!mappingp(killed_by)) { killed_by = ([]); } return killed_by; } void increment_kills(void) { kills++; } int query_kills(void) { return kills; } void add_killed_by(object who, int t) { string str; if (!mappingp(killed_by)) { killed_by = ([]); } killed_by[t] = who->file_name(); #ifdef DO_STATS str = "killed: " + this_object()->file_name() + " by " + who->query_Name() + "(" + who->file_name() + "):" + t + "\n"; LOG_D->write_log("stats.raw", str); #endif } int query_killed(void) { if (!mappingp(killed_by)) { killed_by = ([]); } return sizeof(map_indices(killed_by)); } void set_wimpy(int w) { wimpy = w; } int query_wimpy() { return wimpy; } void set_wimpy_dir(string where) { wimpy_dir = where; } string query_wimpy_dir() { return wimpy_dir; } void set_wimpy_hp(int w) { wimpy_hp = w; } int query_wimpy_hp() { return wimpy_hp; } void halt_fight(void) { fighting = 0; targets = ({ }); } int run_away(void) { string dir, error; string *exits; int x, y; if (!empty_str(wimpy_dir) && this_object()->query_environment()->query_exit(wimpy_dir)) { write("You attempt to run " + wimpy_dir + ".\n"); error = this_object()->this_environment()->body_exit(this_object(), wimpy_dir); if (error) { write(error); } else { return 1; } } else if (!empty_str(wimpy_dir) && this_object()->query_environment()->query_hidden_exit(wimpy_dir)) { write("You attempt to run " + wimpy_dir + ".\n"); error = this_object()->this_environment()->body_exit(this_object(), wimpy_dir); if (error) { write(error); } else { return 1; } } else { exits = this_object()->query_environment()->query_exit_indices(); if (exits) { x = sizeof(exits); if (x < 1) { write("You attempt to run away but can not find " + "an exit.\n"); } else { if (x > 1) { y = random(x); } else { y = 0; } this_object()->message("RUNAWAY : " + exits[y] + "\n"); write("You attempt to run " + exits[y] + ".\n"); error = this_object()->this_environment()->body_exit(this_object(), exits[y]); if (error) { write(error); } else { return 1; } } } else { write("You attempt to run away but can not find " + "an exit.\n"); } } return 0; } void receive_damage(object who, int dam) { int x, when; this_object()->message("%^RED%^You took " + dam + " damage from " + who->query_id() + ".%^RESET%^"); if (this_object()->query_hp() <= dam) { x = this_object()->query_max_hp(); killer = who; when = time(); this_object()->add_killed_by(killer, when); this_object()->halt_fight(); who->halt_fight(); who->increment_kills(); who->increase_expr(x); /* make sure they are dead */ this_object()->decrease_hp(x); } this_object()->decrease_hp(dam); } void damage_target(int dam, object who) { int target_hp; target_hp = who->query_hp(); /* award expr for damage inflicted to target */ if (dam > target_hp) { this_object()->increase_expr(target_hp); } else { this_object()->increase_expr(dam); } /* damage target */ who->receive_damage(this_object(), dam); } int query_defense(void) { int me, i, max, skill; object *armor; /* this section needed to prevent defence from going infinite */ /* random(0) causes the full range to be used */ skill = (this_object()->query_skill("combat/defense") / 50); if (skill == 0) { skill = 1; } me = random(skill); me += this_object()->query_statbonus("dex"); armor = this_object()->query_equipment(); max = sizeof(armor); for (i = 0; i < max; i++) { if (armor[i]->is_armor()) { me += armor[i]->query_ac(); } } armor = this_object()->query_wielded(); max = sizeof(armor); for (i = 0; i < max; i++) { if (armor[i]->is_armor()) { me += armor[i]->query_ac(); } } return me; } int do_swing(int me) { int opponent, me_roll, opponent_roll; if (me < 3) { me = 3; } me_roll = random(me + 1); opponent = target->query_defense(); opponent_roll = random(opponent + 1); #ifdef DEBUG_COMBAT this_object()->message("Roll [%^RED%^" + me_roll + "%^RESET%^/%^GREEN%^" + me + "%^RESET%^ vs %^RED%^" + opponent_roll + "%^RESET%^/%^GREEN%^" + opponent + "%^RESET%^]"); #endif if (me_roll > opponent_roll) { return 1; } return 0; } object get_target(object targ) { int i, max; if (targ) { if (targ->is_dead()) { targets -= ({ targ }); if (sizeof(targets) == 0) { fighting = 0; } } else if (targ->query_environment() == this_object()->query_environment()) { fighting = FIGHTING_TIMEOUT; return targ; } } max = sizeof(targets); for (i = 0; i < max; i++) { if (targets[i] && targets[i]->is_dead()) { targets -= ({targets[i]}); i--; max--; /* shorten up our array.... */ if (sizeof(targets) == 0) { fighting = 0; i = max; } } if (i < sizeof(targets) && targets[i] && (targets[i]->query_environment() == this_object()->query_environment())) { fighting = FIGHTING_TIMEOUT; return targets[i]; } } fighting = fighting - 1; if (fighting < 1) { targets = ({ }); } return nil; } int damage_hook(object victim, object weapon, int damage) { int extra_damage; int alvl, vlvl, ldiff; extra_damage = damage; if (!nilp(weapon) && victim->is_vulnerable(weapon->query_materials())) { extra_damage += (damage / 3); } if (victim->query_race() == "fed") { alvl = this_object()->query_level(); vlvl = victim->query_level(); if (alvl > vlvl) { ldiff = alvl - vlvl; } else { ldiff = 1; } extra_damage += ldiff; } return extra_damage; } int after_damage_hook(object aggressor, object weapon, int damage) { return damage; } private void handle_performance_enhancement_expires() { if (this_object()->has_performance_enhancement()) { this_object()->decrease_performance_enhancement(1); if (!this_object()->has_performance_enhancement()) { this_object()->message("You no longer feel like you could " + "fight forever."); } } } void attack_with(string skill, object weapon, object target) { int me, tmp, damage, hardmode; string race; race = target->query_race(); if (race == "fed") { hardmode = 1; } else { hardmode = 0; } if ( (wimpy == 1) && (wimpy_hp > this_object()->query_hp())) { run_away(); return; } me = this_object()->query_end(); if (me < ATTACK_COST) { this_object()->message("You are too tired to attack.\n"); return; } else { handle_performance_enhancement_expires(); if (!this_object()->has_performance_enhancement()) { this_object()->decrease_end(ATTACK_COST); } } if (!weapon) { me = (this_object()->query_skill("combat/unarmed") / 50) + this_object()->query_statbonus("str"); } else { me = (this_object()->query_skill(weapon->query_weapon_skill()) / 50) + this_object()->query_statbonus("str") + weapon->query_hit_bonus(); } if (do_swing(me) == 1) { if (!weapon) { damage = random(3) + this_object()->query_statbonus("str"); tmp = this_object()->query_skill("combat/unarmed") + this_object()->query_skill("combat/unarmed") / 2; if (tmp <= target->query_skill("combat/defense")) { this_object()->learn_skill("combat/unarmed"); #ifdef DEBUG_COMBAT this_object()->message("Learn: hit_skill, " + this_object()->query_skill("combat/unarmed")); #endif } damage = damage_hook(target, nil, damage); damage = target->after_damage_hook(this_object(), nil, damage); if (damage == 0) { this_object()->targeted_action("$N $v" + this_object()->query_hit_string() + " $T, but $vdo no " + "damage!", target); } else { this_object()->targeted_action("$N $v" + this_object()->query_hit_string() + " $T.", target); } } else { damage = this_object()->query_statbonus("str") + weapon->query_weapon_damage(); tmp = this_object()->query_skill(weapon->query_weapon_skill()) + this_object()->query_skill(weapon->query_weapon_skill()) / 2; if (tmp <= target->query_skill("combat/defense")) { this_object()->learn_skill(weapon->query_weapon_skill()); #ifdef DEBUG_COMBAT this_object()->message("Learn: hit_skill, " + this_object()->query_skill(weapon->query_weapon_skill())); #endif } damage = damage_hook(target, weapon, damage); damage = target->after_damage_hook(this_object(), weapon, damage); if (damage == 0) { this_object()->targeted_action("$N " + "$v" + weapon->query_weapon_action() + " $T with a " + weapon->query_id() + ", but $vdo no damage!", target); } else { this_object()->targeted_action("$N " + "$v" + weapon->query_weapon_action() + " $T with a " + weapon->query_id() + ".", target); } } this_object()->damage_target(damage, target); } else { string miss; if (weapon) { miss = weapon->query_weapon_miss(); } if (!miss) { this_object()->targeted_action("$N $vmiss $T.", target); } else { this_object()->targeted_action("$N " + miss + " $T.", target); } if (!weapon) { tmp = this_object()->query_skill("combat/unarmed") + this_object()->query_skill("combat/unarmed") / 2; } else { tmp = this_object()->query_skill(weapon->query_weapon_skill()) + this_object()->query_skill(weapon->query_weapon_skill()) / 2; } if (target->query_skill("combat/defense") <= tmp) { target->learn_skill("combat/defense"); #ifdef DEBUG_COMBAT target->message("Learn: defense, " + this_object()->query_skill("combat/defense")); #endif } } } void cast_spell(object target) { int damage; string message; damage = random(this_object()->query_spell_damage()) + 1; message = this_object()->query_spell_message(); if (!message || (message == "")) { message = "Casts an unamed spell at $t."; } message = replace_string(message, "$t", target->query_name()); target->query_environment()->tell_room(this_object(), message); this_object()->damage_target(damage, target); } string get_color(int x, int maxx) { int y, z; z = (maxx / 3) + 1; y = maxx - z; if (x > y) { return "%^GREEN%^"; } else if (x <= z) { return "%^RED%^"; } else { return "%^YELLOW%^"; } } string get_status(object thing) { int tmp, tmpmax; string col, line; if (!objectp(thing)) { return ""; } tmp = thing->query_hp(); tmpmax = thing->query_max_hp(); col = get_color(tmp, tmpmax); line = col + "HP[" + tmp + "/" + tmpmax + "]%^RESET%^"; tmp = thing->query_mana(); tmpmax = thing->query_max_mana(); col = get_color(tmp, tmpmax); line += " " + col + "MANA[" + tmp + "/" + tmpmax + "]%^RESET%^"; tmp = thing->query_end(); tmpmax = thing->query_max_end(); col = get_color(tmp, tmpmax); line += " " + col + "END[" + tmp + "/" + tmpmax + "]%^RESET%^"; line += "\tEXP: " + thing->query_expr(); return line; } void do_fight(void) { int i, max, x; object *weapons; string line; target = get_target(target); if (target) { if (!this_object()->is_player()) { x = this_object()->query_spell_chance(); if (x && (random(100) <= x)) { cast_spell(target); } } weapons = this_object()->query_wielded(); max = sizeof(weapons); if (max == 0) { this_object()->attack_with("combat/unarmed", nil, target); } else { for (i = 0; i < max; i++) { if (!weapons[i]->query_offensive()) { continue; } this_object()->attack_with(weapons[i]->query_weapon_skill(), weapons[i], target); } } /* Need to check target again, because target may have died. */ line = get_status(this_object()); #ifdef DEBUG_COMBAT line += " " + get_status(target); #endif this_object()->message(line); } } void attacked_by(object who) { if (!targets) { targets = ({ }); } targets += ({ who }); target = who; fighting = FIGHTING_TIMEOUT; } void attack(object who) { if (!targets) { targets = ({ }); } if (who->is_dead()) { return; } targets += ({ who }); fighting = FIGHTING_TIMEOUT; target = who; who->attacked_by(this_object()); do_fight(); } string *summarise_killers(void) { string retval, killer_name, *killers, *lines; mapping killer_count, killer_map; object tmp_killer; int i, dim, done, *killed_times; killer_map = this_object()->query_killed_by(); killed_times = map_indices(killer_map); killer_count = ([ ]); killers = ({ }); done = 0; lines = ({ "Summary of your killers:" }); lines += ({ "------------------------" }); for (i = 0, dim = sizeof(killed_times); i < dim; i++) { tmp_killer = clone_object(killer_map[killed_times[i]]); tmp_killer->setup(); killer_name = tmp_killer->query_Name(); destruct_object(tmp_killer); if (!killer_count[killer_name]) { killer_count[killer_name] = 1; } else { killer_count[killer_name]++; } done = 1; } if (!done) { lines += ({ "So far you have been spared, count yourself lucky.\n" }); } else { killers = map_indices(killer_count); dim = sizeof(killers); for (i = 0; i < dim; i++) { lines += ({ killers[i] + " killed you " + killer_count[killers[i]] + " time(s).\n" }); } } return lines; }
24.387821
79
0.550138
[ "object" ]
058633b173cc4f8a2582b9ffce37693f055e0e88
1,208
h
C
GOSX Lite/source/Engine/FeatureManager/Features/Chams.h
pwnedboi/GO-SX-Internal-Lite
7a75e1aaa2972b4fa60c2fc7f931f8180ff71782
[ "Apache-2.0" ]
1
2021-09-28T14:53:20.000Z
2021-09-28T14:53:20.000Z
GOSX Lite/source/Engine/FeatureManager/Features/Chams.h
p0hjan/GO-SX-Internal-Pro
7a75e1aaa2972b4fa60c2fc7f931f8180ff71782
[ "Apache-2.0" ]
null
null
null
GOSX Lite/source/Engine/FeatureManager/Features/Chams.h
p0hjan/GO-SX-Internal-Pro
7a75e1aaa2972b4fa60c2fc7f931f8180ff71782
[ "Apache-2.0" ]
null
null
null
#pragma once #ifndef feature_chams_h #define feature_chams_h #include "SDK/SDK.h" #include "SDK/Func.h" #include "SDK/CCSPlayer.h" #include "Engine/HookManager/hooks.h" class CChams { public: CChams(); static std::map<int, const char*> GetChamList(); static std::map<int, const char*> GetChamValues(); void apply( IMatRenderContext* oriContext, const DrawModelState_t &oriState, const ModelRenderInfo_t &oriPInfo, matrix3x4_t *oriPCustomBoneToWorld ); private: void ForceMaterial(IMaterial* material, Color color, bool immune); void AddMaterial(std::string filename, std::string type, std::string texture, bool ignorez, bool nofog, bool model, bool nocull, bool halflambert, bool gluelook); IMaterial* CreateMaterial(bool ignorez, bool flat, bool nofog, bool model, bool nocull, bool halflambert, bool gluelook); void* oriContext; void* oriState; ModelRenderInfo_t oriPInfo; matrix3x4_t *oriPCustomBoneToWorld; IMaterial* visible_flat = nullptr; IMaterial* visible_tex = nullptr; IMaterial* hidden_flat = nullptr; IMaterial* hidden_tex = nullptr; IMaterial* arms = nullptr; }; #endif // !feature_chams_h
31.789474
166
0.719371
[ "model" ]
058666579bc0eb5a3dcdda1fb3d601bbc34fdf0f
1,349
h
C
native/engine/source/rendering/CCModel3ds.h
drdavient/multi
2700c50ec15c1e1790f549e3d5a490df051e0ccb
[ "Apache-2.0" ]
1
2015-06-03T21:54:51.000Z
2015-06-03T21:54:51.000Z
native/engine/source/rendering/CCModel3ds.h
drdavient/multi
2700c50ec15c1e1790f549e3d5a490df051e0ccb
[ "Apache-2.0" ]
null
null
null
native/engine/source/rendering/CCModel3ds.h
drdavient/multi
2700c50ec15c1e1790f549e3d5a490df051e0ccb
[ "Apache-2.0" ]
null
null
null
/*----------------------------------------------------------- * http://softwareispoetry.com *----------------------------------------------------------- * This software is distributed under the Apache 2.0 license. *----------------------------------------------------------- * File Name : CCModel3ds.h * Description : Loads and handles a 3ds model. * * Created : 05/08/11 * Author(s) : Ashraf Samy Hegab *----------------------------------------------------------- */ #ifndef __CCMODEL3DS_H__ #define __CCMODEL3DS_H__ #include "3dsloader.h" class CCPrimitive3ds : public CCPrimitive3D { typedef CCPrimitive3D super; public: CCPrimitive3ds(); virtual void destruct(); bool load(const char *file); public: virtual void renderVertices(const bool textured); }; class CCModel3ds : public CCModelBase { public: typedef CCModelBase super; CCModel3ds(const char *file, const char *texture1, const CCResourceType resourceType=Resource_Packaged, const bool mipmap=false, const bool alwaysResident=false, const char *texture2=NULL); float getWidth() { return primitive3ds->getWidth(); } float getHeight() { return primitive3ds->getHeight(); } float getDepth() { return primitive3ds->getDepth(); } public: CCPrimitive3ds *primitive3ds; }; #endif // __CCMODEL3DS_H__
26.45098
100
0.579689
[ "model" ]
0592fea62d1530d460982fc9f83dfe9b003c7d6d
4,998
h
C
flang/lib/Optimizer/CodeGen/DescriptorModel.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
605
2019-10-18T01:15:54.000Z
2022-03-31T14:31:04.000Z
flang/lib/Optimizer/CodeGen/DescriptorModel.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
3,180
2019-10-18T01:21:21.000Z
2022-03-31T23:25:41.000Z
flang/lib/Optimizer/CodeGen/DescriptorModel.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
275
2019-10-18T05:27:22.000Z
2022-03-30T09:04:21.000Z
//===-- DescriptorModel.h -- model of descriptors for codegen ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // LLVM IR dialect models of C++ types. // // This supplies a set of model builders to decompose the C declaration of a // descriptor (as encoded in ISO_Fortran_binding.h and elsewhere) and // reconstruct that type in the LLVM IR dialect. // // TODO: It is understood that this is deeply incorrect as far as building a // portability layer for cross-compilation as these reflected types are those of // the build machine and not necessarily that of either the host or the target. // This assumption that build == host == target is actually pervasive across the // compiler (https://llvm.org/PR52418). // //===----------------------------------------------------------------------===// #ifndef OPTIMIZER_DESCRIPTOR_MODEL_H #define OPTIMIZER_DESCRIPTOR_MODEL_H #include "flang/ISO_Fortran_binding.h" #include "flang/Runtime/descriptor.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "llvm/Support/ErrorHandling.h" #include <tuple> namespace fir { using TypeBuilderFunc = mlir::Type (*)(mlir::MLIRContext *); /// Get the LLVM IR dialect model for building a particular C++ type, `T`. template <typename T> TypeBuilderFunc getModel(); template <> TypeBuilderFunc getModel<void *>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::LLVM::LLVMPointerType::get(mlir::IntegerType::get(context, 8)); }; } template <> TypeBuilderFunc getModel<unsigned>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(unsigned) * 8); }; } template <> TypeBuilderFunc getModel<int>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(int) * 8); }; } template <> TypeBuilderFunc getModel<unsigned long>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(unsigned long) * 8); }; } template <> TypeBuilderFunc getModel<unsigned long long>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(unsigned long long) * 8); }; } template <> TypeBuilderFunc getModel<long long>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(long long) * 8); }; } template <> TypeBuilderFunc getModel<Fortran::ISO::CFI_rank_t>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(Fortran::ISO::CFI_rank_t) * 8); }; } template <> TypeBuilderFunc getModel<Fortran::ISO::CFI_type_t>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(Fortran::ISO::CFI_type_t) * 8); }; } template <> TypeBuilderFunc getModel<long>() { return [](mlir::MLIRContext *context) -> mlir::Type { return mlir::IntegerType::get(context, sizeof(long) * 8); }; } template <> TypeBuilderFunc getModel<Fortran::ISO::CFI_dim_t>() { return [](mlir::MLIRContext *context) -> mlir::Type { auto indexTy = getModel<Fortran::ISO::CFI_index_t>()(context); return mlir::LLVM::LLVMArrayType::get(indexTy, 3); }; } template <> TypeBuilderFunc getModel<Fortran::ISO::cfi_internal::FlexibleArray<Fortran::ISO::CFI_dim_t>>() { return getModel<Fortran::ISO::CFI_dim_t>(); } //===----------------------------------------------------------------------===// // Descriptor reflection //===----------------------------------------------------------------------===// /// Get the type model of the field number `Field` in an ISO CFI descriptor. template <int Field> static constexpr TypeBuilderFunc getDescFieldTypeModel() { Fortran::ISO::Fortran_2018::CFI_cdesc_t dummyDesc{}; // check that the descriptor is exactly 8 fields as specified in CFI_cdesc_t // in flang/include/flang/ISO_Fortran_binding.h. auto [a, b, c, d, e, f, g, h] = dummyDesc; auto tup = std::tie(a, b, c, d, e, f, g, h); auto field = std::get<Field>(tup); return getModel<decltype(field)>(); } /// An extended descriptor is defined by a class in runtime/descriptor.h. The /// three fields in the class are hard-coded here, unlike the reflection used on /// the ISO parts, which are a POD. template <int Field> static constexpr TypeBuilderFunc getExtendedDescFieldTypeModel() { if constexpr (Field == 8) { return getModel<void *>(); } else if constexpr (Field == 9) { return getModel<Fortran::runtime::typeInfo::TypeParameterValue>(); } else { llvm_unreachable("extended ISO descriptor only has 10 fields"); } } } // namespace fir #endif // OPTIMIZER_DESCRIPTOR_MODEL_H
35.446809
80
0.651861
[ "model" ]
059a330024ed527372ca032598b51b49dbb3d9ae
6,609
h
C
include/permlib/search/partition/matrix_refinement2.h
peterlietz/PermLib
c2c0ae7e078df6c91c16c7326081c483700fde75
[ "BSD-3-Clause" ]
6
2015-05-22T13:07:10.000Z
2021-06-18T04:31:39.000Z
include/permlib/search/partition/matrix_refinement2.h
peterlietz/PermLib
c2c0ae7e078df6c91c16c7326081c483700fde75
[ "BSD-3-Clause" ]
3
2018-12-29T12:40:58.000Z
2021-09-07T22:56:33.000Z
include/permlib/search/partition/matrix_refinement2.h
peterlietz/PermLib
c2c0ae7e078df6c91c16c7326081c483700fde75
[ "BSD-3-Clause" ]
null
null
null
// --------------------------------------------------------------------------- // // This file is part of PermLib. // // Copyright (c) 2009-2011 Thomas Rehn <thomas@carmen76.de> // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // 3. The name of the author may not be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 MATRIXREFINEMENT2_H_ #define MATRIXREFINEMENT2_H_ #include <permlib/predicate/pointwise_stabilizer_predicate.h> #include <permlib/search/partition/refinement.h> #include <map> namespace permlib { namespace partition { /// concrete \f$\mathcal P\f$-refinement for symmetric matrix automorphisms /** * implements [Leon1991] Section 9 (g) */ template<class PERM,class MATRIX> class MatrixRefinement2 : public Refinement<PERM> { public: /// constructor explicit MatrixRefinement2(unsigned long n, const MATRIX& matrix); virtual unsigned int apply(Partition& pi) const; virtual bool init(Partition& pi); private: const MATRIX& m_matrix; /// distribution of element frequency across a matrix row or column class Fingerprint { public: Fingerprint(unsigned long k) : m_fingerprint(k) {} /// lex-min ordering bool operator<(const Fingerprint& f) const { BOOST_ASSERT(f.m_fingerprint.size() == m_fingerprint.size()); for (unsigned int i=0; i<m_fingerprint.size(); ++i) { if (m_fingerprint[i] < f.m_fingerprint[i]) return true; if (m_fingerprint[i] > f.m_fingerprint[i]) return false; } return false; } bool operator==(const Fingerprint& f) const { BOOST_ASSERT(f.m_fingerprint.size() == m_fingerprint.size()); for (unsigned int i=0; i<m_fingerprint.size(); ++i) { if (m_fingerprint[i] != f.m_fingerprint[i]) return false; } return true; } unsigned long& operator[](unsigned long i) { BOOST_ASSERT(i < m_fingerprint.size()); return m_fingerprint[i]; } const unsigned long& operator[](unsigned long i) const { BOOST_ASSERT(i < m_fingerprint.size()); return m_fingerprint[i]; } private: std::vector<unsigned long> m_fingerprint; }; unsigned int splitCell(Partition& pi, unsigned long i) const; void computeFingerprint(const Partition& pi, unsigned long i, unsigned long j, std::map<Fingerprint,std::list<unsigned long> >& map) const; }; template<class PERM,class MATRIX> MatrixRefinement2<PERM,MATRIX>::MatrixRefinement2(unsigned long n, const MATRIX& matrix) : Refinement<PERM>(n, Default), m_matrix(matrix) { } template<class PERM,class MATRIX> unsigned int MatrixRefinement2<PERM,MATRIX>::apply(Partition& pi) const { BOOST_ASSERT( this->initialized() ); unsigned int ret = 0; std::list<int>::const_iterator cellPairIt = Refinement<PERM>::m_cellPairs.begin(); while (cellPairIt != Refinement<PERM>::m_cellPairs.end()) { unsigned long i = *cellPairIt++; ret += splitCell(pi, static_cast<unsigned long>(i)); } return ret; } template<class PERM,class MATRIX> bool MatrixRefinement2<PERM,MATRIX>::init(Partition& pi) { for (unsigned long i = 0; i < pi.cells(); ++i) { if (splitCell(pi, i)) Refinement<PERM>::m_cellPairs.push_back(i); } if (!Refinement<PERM>::m_cellPairs.empty()) { typename Refinement<PERM>::RefinementPtr ref(new MatrixRefinement2<PERM,MATRIX>(*this)); Refinement<PERM>::m_backtrackRefinements.push_back(ref); return true; } return false; } template<class PERM,class MATRIX> unsigned int MatrixRefinement2<PERM,MATRIX>::splitCell(Partition& pi, unsigned long i) const { unsigned long ret = 0; if (pi.cellSize(i) < 2) return ret; for (unsigned long j = 0; j < pi.cells(); ++j) { std::map<Fingerprint,std::list<unsigned long> > map; computeFingerprint(pi, i, j, map); if (map.size() > 1) { PERMLIB_DEBUG(std::cout << "split " << i << " because of " << j << " in " << pi << std::endl;) typename std::map<Fingerprint,std::list<unsigned long> >::const_iterator fit; for (fit = map.begin(); fit != map.end(); ++fit) { std::pair<Fingerprint, std::list<unsigned long> > splitCellPair = *fit; /*std::cout << "FOO "; BOOST_FOREACH(unsigned long a, splitCellPair.second) { std::cout << (a+1) << " "; } std::cout << std::endl; std::cout << "GOO "; BOOST_FOREACH(unsigned long a, splitCellPair.first.m_fingerprint) { std::cout << (a) << " "; } std::cout << std::endl;*/ if (pi.intersect(splitCellPair.second.begin(), splitCellPair.second.end(), i)) { ++ret; } } break; } } return ret; } template<class PERM,class MATRIX> void MatrixRefinement2<PERM,MATRIX>::computeFingerprint(const Partition& pi, unsigned long i, unsigned long j, std::map<Fingerprint,std::list<unsigned long> >& map) const { for (Partition::CellIt cellI = pi.cellBegin(i); cellI != pi.cellEnd(i); ++cellI) { Fingerprint f(m_matrix.k()); for (Partition::CellIt cellJ = pi.cellBegin(j); cellJ != pi.cellEnd(j); ++cellJ) { ++f[m_matrix.at(*cellI, *cellJ)]; } std::pair<typename std::map<Fingerprint,std::list<unsigned long> >::iterator, bool> p = map.insert(std::pair<Fingerprint, std::list<unsigned long> >(f, std::list<unsigned long>())); std::list<unsigned long>& l = p.first->second; l.push_back(*cellI); } } } } #endif // -- MATRIXREFINEMENT2_H_
35.342246
172
0.682554
[ "vector" ]
05b033a7462a82c0941b63649974c9fd76619c3a
27,474
h
C
src/jit/jitstd/hashtable.h
elinor-fung/coreclr
c1801e85024add717f518feb6a9caed60d54500f
[ "MIT" ]
6
2017-09-22T06:55:45.000Z
2021-07-02T07:07:08.000Z
src/jit/jitstd/hashtable.h
elinor-fung/coreclr
c1801e85024add717f518feb6a9caed60d54500f
[ "MIT" ]
3
2018-01-03T00:57:25.000Z
2018-10-05T16:17:52.000Z
src/jit/jitstd/hashtable.h
elinor-fung/coreclr
c1801e85024add717f518feb6a9caed60d54500f
[ "MIT" ]
2
2020-01-16T10:14:30.000Z
2020-02-09T08:48:51.000Z
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. // ==++== // // // // ==--== /*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX XX hashtable<K,V,H,P,A,KO> XX XX XX XX Implemented using a vector of list iterators begin and end whose range XX XX is a single bucket. A chain of buckets is maintained in a linked list XX XX (doubly) for holding the key-value pairs. XX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ #pragma once #include "hash.h" #include "functional.h" #include "allocator.h" #include "vector.h" #include "list.h" #include "pair.h" namespace jitstd { static const float kflDefaultLoadFactor = 3.0f; template <typename Key, typename Value = Key, typename Hash = jitstd::hash<Key>, typename Pred = jitstd::equal_to<Key>, typename Alloc = jitstd::allocator<Value>, typename KeyOf = jitstd::identity<Value>> class hashtable { public: typedef Key key_type; typedef Value value_type; typedef Hash hasher; typedef Pred key_equal; typedef Alloc allocator_type; typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef typename list<Value, Alloc>::iterator iterator; typedef typename list<Value, Alloc>::reverse_iterator reverse_iterator; typedef typename list<Value, Alloc>::const_iterator const_iterator; typedef typename list<Value, Alloc>::iterator local_iterator; protected: hashtable(); typedef pair<iterator, iterator> BucketEntry; typedef vector<BucketEntry, typename Alloc::template rebind<BucketEntry>::allocator> Buckets; typedef list<Value, typename Alloc::template rebind<Value>::allocator> Elements; protected: explicit hashtable(size_type, const allocator_type& a, const KeyOf& keyOf = KeyOf()); hashtable(size_type n, const hasher& hf, const key_equal& eq, const allocator_type& a, const KeyOf& keyOf = KeyOf()); template<typename InputIterator> hashtable( InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eq, const allocator_type& a, const KeyOf& keyOf = KeyOf()); explicit hashtable(const allocator_type& a, const KeyOf& keyOf = KeyOf()); hashtable(const hashtable& other); ~hashtable(); public: hashtable& operator=(const hashtable& other); allocator_type get_allocator() const; bool empty() const; size_type size() const; size_type max_size() const; iterator begin(); iterator end(); // Even though we have an unordered set and there is no concept of forward and // reverse, rbegin will just return the first element inserted. This is not in STL. reverse_iterator rbegin(); reverse_iterator rend(); const_iterator begin() const; const_iterator end() const; const_iterator cbegin() const; const_iterator cend() const; local_iterator begin(size_type size); local_iterator end(size_type size); pair<iterator, bool> insert(const value_type& value); iterator insert(const_iterator, const value_type& value); template<typename InputIterator> void insert(InputIterator first, InputIterator last); iterator erase(iterator position); size_type erase(const key_type& key); iterator erase(iterator first, iterator last); void clear(); void swap(hashtable& table); hasher hash_function() const; key_equal key_eq() const; const_iterator find(const key_type& key) const; iterator find(const key_type& key); size_type count(const key_type& key) const; size_type bucket_count() const; size_type max_bucket_count() const; size_type bucket_size(size_type size) const; size_type bucket(const key_type& key) const; float load_factor() const; float max_load_factor() const; void max_load_factor(float); void rehash(size_type); protected: template <typename Compare> iterator find(const key_type&, const Compare& comp); // helpers bool check_load(); void copy_helper(const hashtable& other); size_type hash_helper(const key_type& value, size_type buckets) const; pair<iterator, bool> insert_helper(const value_type& value, Buckets& buckets, Elements& elements, bool fRehashing); iterator erase_helper(const_iterator position); void dump_helper(); void debug_check(); private: // member objects Hash m_hasher; Alloc m_allocator; Pred m_pred; Buckets m_buckets; Elements m_elements; size_type m_nSize; KeyOf m_keyOf; // metadata float m_flMaxLoadFactor; }; } // end of namespace jitstd namespace jitstd { template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::dump_helper() { for (size_type i = 0; i < m_buckets.size(); ++i) { printf("\n"); printf("--------------=BEGIN=--------------\n"); printf("Load factor = %f\n", load_factor()); printf("-----------------------------------\n"); printf("Bucket number = %d %p %p\n", i, *((ptrdiff_t*)&(m_buckets[i].first)), *((ptrdiff_t*)&(m_buckets[i].second))); printf("-----------------------------------\n"); for (typename Elements::iterator value = (m_buckets[i]).first; value != (m_buckets[i]).second; ++value) { printf("%d, ", *((ptrdiff_t*)&value), *value); } printf("-----------------------------------\n"); } } // We can't leave this permanently enabled -- it makes algorithms cubic, and causes tests to time out. // Enable when/if you have reason to believe there's a problem in hashtable. #define JITSTD_DO_HASHTABLE_DEBUGCHECK 0 template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::debug_check() { #if JITSTD_DO_HASHTABLE_DEBUGCHECK for (iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter) { size_type nHash = hash_helper(m_keyOf(*iter), m_buckets.size()); BucketEntry& entry = m_buckets[nHash]; iterator iter2 = entry.first; bool present = false; while (iter2 != entry.second) { if (iter2 == iter) { present = true; } iter2++; } if (!present) { present = false; } assert(present); } #endif } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> template <typename Compare> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::find(const key_type& key, const Compare& comp) { if (empty()) { return end(); } size_type nHash = hash_helper(key, m_buckets.size()); BucketEntry& entry = m_buckets[nHash]; for (iterator i = entry.first; i != entry.second; ++i) { if (comp(m_keyOf(*i), key)) { return i; } } return end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> bool hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::check_load() { float flLoadFactor = load_factor(); if (flLoadFactor > m_flMaxLoadFactor) { rehash(m_buckets.size()); return true; } return false; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::erase_helper(const_iterator position) { const Key& key = m_keyOf(*position); size_type nHash = hash_helper(key, m_buckets.size()); BucketEntry& entry = m_buckets[nHash]; iterator eraseNext = end(); for (iterator first = entry.first; first != entry.second; ++first) { if (m_pred(m_keyOf(*first), key)) { if (first == entry.first) { if (first != m_elements.begin()) { iterator update = first; update--; size_type nUpdateHash = hash_helper(m_keyOf(*update), m_buckets.size()); if (nUpdateHash != nHash) { BucketEntry& updateEntry = m_buckets[nUpdateHash]; if (updateEntry.second == first) { updateEntry.second = first; updateEntry.second++; } if (updateEntry.first == first) { updateEntry.first = first; updateEntry.first++; } } } entry.first = m_elements.erase(first); eraseNext = entry.first; } else { eraseNext = m_elements.erase(first); } --m_nSize; #ifdef DEBUG debug_check(); #endif return eraseNext; } } return end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> pair<typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator, bool> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::insert_helper( const Value& value, Buckets& buckets, Elements& elements, bool fRehashing) { const Key& key = m_keyOf(value); size_t nHash = hash_helper(key, buckets.size()); BucketEntry& entry = buckets[nHash]; iterator ret; if (entry.first == entry.second) { entry.first = elements.insert(elements.begin(), value); entry.second = entry.first; entry.second++; // end iterator is one past always. ret = entry.first; } else { for (iterator first = entry.first; first != entry.second; ++first) { if (m_pred(m_keyOf(*first), key)) { return pair<iterator, bool>(first, false); } } iterator firstNext = entry.first; firstNext++; ret = elements.insert(firstNext, value); if (entry.second == entry.first) { entry.second = firstNext; } } bool fRehashed = false; if (!fRehashing) { m_nSize += 1; fRehashed = check_load(); } #ifdef DEBUG debug_check(); #endif return pair<iterator, bool>(fRehashed ? find(key, m_pred) : ret, true); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hash_helper( const key_type& key, size_type buckets) const { return m_hasher(key) % buckets; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::rehash(size_type n) { size_type nCurBuckets = m_buckets.size(); float flLoadFactor = load_factor(); if (nCurBuckets >= n && flLoadFactor <= m_flMaxLoadFactor) { return; } size_type nBuckets = max(nCurBuckets, 1); if (flLoadFactor > m_flMaxLoadFactor) { nBuckets *= 2; } if (nBuckets < n) { nBuckets = n; } Buckets buckets(m_allocator); Elements elements(m_allocator); buckets.resize(nBuckets, BucketEntry(m_elements.end(), m_elements.end())); // both equal means empty. for (typename Elements::iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter) { (void) insert_helper(*iter, buckets, elements, true); } m_buckets.swap(buckets); m_elements.swap(elements); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hashtable( size_type n, allocator_type const& allocator, const KeyOf& keyOf) : m_allocator(allocator) , m_buckets(Alloc::template rebind<hashtable::BucketEntry>::allocator(allocator)) , m_elements(allocator) , m_flMaxLoadFactor(kflDefaultLoadFactor) , m_nSize(0) , m_keyOf(keyOf) { rehash(n); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hashtable( size_type n, hasher const& hf, key_equal const& eq, allocator_type const& allocator, const KeyOf& keyOf) : m_hasher(hf) , m_pred(eq) , m_allocator(allocator) , m_buckets(Alloc::template rebind<BucketEntry>::allocator(allocator)) , m_elements(allocator) , m_flMaxLoadFactor(kflDefaultLoadFactor) , m_nSize(0) , m_keyOf(keyOf) { rehash(n); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> template<typename InputIterator> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hashtable( InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eq, const allocator_type& allocator, const KeyOf& keyOf) : m_hasher(hf) , m_pred(eq) , m_allocator(allocator) , m_buckets(Alloc::template rebind<BucketEntry>::allocator(allocator)) , m_elements(allocator) , m_flMaxLoadFactor(kflDefaultLoadFactor) , m_nSize(0) , m_keyOf(keyOf) { rehash(n); insert(this->first, this->last); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hashtable(const allocator_type& allocator, const KeyOf& keyOf) : m_allocator(allocator) , m_buckets(Alloc::template rebind<BucketEntry>::allocator(allocator)) , m_elements(allocator) , m_flMaxLoadFactor(kflDefaultLoadFactor) , m_nSize(0) , m_keyOf(keyOf) { } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::copy_helper(const hashtable& other) { m_buckets.clear(); m_elements.clear(); m_nSize = 0; rehash(other.m_buckets.size()); for (const_iterator i = other.m_elements.begin(); i != other.m_elements.end(); ++i) { insert_helper(*i, m_buckets, m_elements, false); } m_nSize = other.m_nSize; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hashtable(const hashtable& other) : m_hasher(other.m_hasher) , m_pred(other.m_pred) , m_allocator(other.m_allocator) , m_flMaxLoadFactor(other.m_flMaxLoadFactor) , m_keyOf(other.m_keyOf) , m_elements(other.m_allocator) , m_buckets(other.m_allocator) { copy_helper(other); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::~hashtable() { } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>& hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::operator=(hashtable const& other) { m_hasher = other.m_hasher; m_pred = other.m_pred; m_allocator = other.m_allocator; m_flMaxLoadFactor = other.m_flMaxLoadFactor; m_keyOf = other.m_keyOf; copy_helper(other); return *this; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::allocator_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::get_allocator() const { return m_allocator; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> bool hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::empty() const { return m_nSize == 0; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size() const { return m_nSize; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::max_size() const { return ((size_type)(-1)) >> 1; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::begin() { return m_elements.begin(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::reverse_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::rbegin() { return m_elements.rbegin(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::end() { return m_elements.end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::reverse_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::rend() { return m_elements.rend(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::const_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::begin() const { return m_elements.begin(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::const_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::end() const { return m_elements.end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::const_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::cbegin() const { return m_elements.begin(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::const_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::cend() const { return m_elements.end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> jitstd::pair<typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator, bool> hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::insert(const Value& val) { // Allocate some space first. rehash(2); return insert_helper(val, m_buckets, m_elements, false); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::insert(const_iterator position, const Value& value) { // Allocate some space first. rehash(2); // We will not use the hint here, we can consider doing this later. return insert_helper(this->val, m_buckets, m_elements, false).first; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> template<typename InputIterator> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::insert(InputIterator first, InputIterator last) { // Allocate some space first. rehash(2); while (first != last) { (void) insert_helper(*first, m_buckets, m_elements, false); ++first; } } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::erase(iterator position) { return erase_helper(position); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::erase(const key_type& key) { iterator iter = erase_helper(find(key)); return iter == end() ? 0 : 1; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::erase(iterator first, iterator last) { iterator iter = end(); while (first != last) { iter = erase_helper(find(m_keyOf(*first))); ++first; } return iter; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::clear() { m_buckets.clear(); m_elements.clear(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::swap(hashtable& set) { std::swap(set.m_buckets, m_buckets); std::swap(set.m_elements, m_elements); std::swap(set.m_flLoadFactor, this->m_flLoadFactor); std::swap(set.m_flMaxLoadFactor, this->m_flMaxLoadFactor); std::swap(set.m_keyOf, this->m_keyOf); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hasher hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::hash_function() const { return m_hasher; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::key_equal hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::key_eq() const { return m_pred; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::const_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::find(const key_type& key) const { if (empty()) { return end(); } size_type nHash = hash_helper(key, m_buckets.size()); BucketEntry& entry = m_buckets[nHash]; for (iterator i = entry.first; i != entry.second; ++i) { if (m_pred(m_keyOf(*i), key)) { return i; } } return end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::find(const key_type& key) { if (empty()) { return end(); } size_type nHash = hash_helper(key, m_buckets.size()); BucketEntry& entry = m_buckets[nHash]; for (iterator i = entry.first; i != entry.second; ++i) { if (m_pred(m_keyOf(*i), key)) { return i; } } return end(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::count(const key_type& key) const { size_type nCount = 0; size_type nHash = hash_helper(key, m_buckets.size()); BucketEntry& bucket = m_buckets[nHash]; for (iterator i = bucket.first; i != bucket.second; ++i) { if (m_pred(m_keyOf(*i), key)) { ++nCount; } } return nCount; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::bucket_count() const { return m_buckets.size(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::max_bucket_count() const { return m_buckets.size(); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::bucket_size(size_type size) const { rehash(size); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::size_type hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::bucket(const key_type& key) const { return hash_helper(key, m_buckets.size()); } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::local_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::begin(size_type size) { return m_buckets[size].first; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> typename hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::local_iterator hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::end(size_type size) { return m_buckets[size].second; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> float hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::load_factor() const { return m_nSize ? (((float) m_nSize) / m_buckets.size()) : 0; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> float hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::max_load_factor() const { return m_flMaxLoadFactor; } template <typename Key, typename Value, typename Hash, typename Pred, typename Alloc, typename KeyOf> void hashtable<Key, Value, Hash, Pred, Alloc, KeyOf>::max_load_factor(float flLoadFactor) { m_flMaxLoadFactor = flLoadFactor; rehash(m_buckets.size()); } } // end of namespace jitstd.
33.382746
125
0.667249
[ "vector" ]
05cea7137fc674dea2f5e96b1e3cb11ce9fed692
2,622
h
C
Source/VoxelGraph/Public/VoxelNodes/VoxelWorldGeneratorSamplerNodes.h
SolarStormInteractive/VoxelPlugin
b0b8a1838262227fa586fbcb1b46a6184cdf1e8c
[ "MIT" ]
null
null
null
Source/VoxelGraph/Public/VoxelNodes/VoxelWorldGeneratorSamplerNodes.h
SolarStormInteractive/VoxelPlugin
b0b8a1838262227fa586fbcb1b46a6184cdf1e8c
[ "MIT" ]
null
null
null
Source/VoxelGraph/Public/VoxelNodes/VoxelWorldGeneratorSamplerNodes.h
SolarStormInteractive/VoxelPlugin
b0b8a1838262227fa586fbcb1b46a6184cdf1e8c
[ "MIT" ]
null
null
null
// Copyright 2020 Phyronnaz #pragma once #include "CoreMinimal.h" #include "VoxelNodeHelper.h" #include "VoxelNodeHelperMacros.h" #include "VoxelExposedNodes.h" #include "VoxelWorldGenerators/VoxelWorldGeneratorPicker.h" #include "VoxelGraphErrorReporter.h" #include "VoxelWorldGeneratorSamplerNodes.generated.h" UCLASS(Abstract, Category = "World Generator") class VOXELGRAPH_API UVoxelNode_WorldGeneratorSamplerBase : public UVoxelExposedNode { GENERATED_BODY() public: // Seeds to send to the world generators UPROPERTY(EditAnywhere, Category = "Config", meta = (ReconstructNode)) TArray<FName> Seeds; //~ Begin UVoxelNode Interface virtual EVoxelPinCategory GetInputPinCategory(int32 PinIndex) const override; virtual FName GetInputPinName(int32 PinIndex) const override; virtual int32 GetMinInputPins() const override; virtual int32 GetMaxInputPins() const override; //~ End UVoxelNode Interface }; UCLASS(Abstract) class VOXELGRAPH_API UVoxelNode_SingleWorldGeneratorSamplerBase : public UVoxelNode_WorldGeneratorSamplerBase { GENERATED_BODY() public: UPROPERTY(EditAnywhere, Category = "Config") FVoxelWorldGeneratorPicker WorldGenerator; UVoxelNode_SingleWorldGeneratorSamplerBase(); //~ Begin UVoxelNode Interface virtual void LogErrors(FVoxelGraphErrorReporter& ErrorReporter) override; virtual FText GetTitle() const override; //~ End UVoxelNode Interface #if WITH_EDITOR //~ Begin UVoxelExposedNode Interface virtual bool TryImportFromProperty(UProperty* Property, UObject* Object) override; //~ End UVoxelExposedNode Interface #endif }; UCLASS(DisplayName = "Get World Generator Value") class VOXELGRAPH_API UVoxelNode_GetWorldGeneratorValue : public UVoxelNode_SingleWorldGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetWorldGeneratorValue(); }; UCLASS(DisplayName = "Get World Generator Material") class VOXELGRAPH_API UVoxelNode_GetWorldGeneratorMaterial : public UVoxelNode_SingleWorldGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetWorldGeneratorMaterial(); }; UCLASS(DisplayName = "Get World Generator Custom Output") class VOXELGRAPH_API UVoxelNode_GetWorldGeneratorCustomOutput : public UVoxelNode_SingleWorldGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetWorldGeneratorCustomOutput(); UPROPERTY(EditAnywhere, Category = "Config") FName OutputName = "Value"; //~ Begin UVoxelNode Interface virtual FText GetTitle() const override; //~ End UVoxelNode Interface };
30.488372
114
0.794432
[ "object" ]
05d1fae07188125519248fae8bb4945cd2aea799
5,109
h
C
pigasus/software/src/network_inspectors/appid/app_info_table.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
pigasus/software/src/network_inspectors/appid/app_info_table.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
pigasus/software/src/network_inspectors/appid/app_info_table.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
//-------------------------------------------------------------------------- // Copyright (C) 2014-2018 Cisco and/or its affiliates. All rights reserved. // Copyright (C) 2005-2013 Sourcefire, Inc. // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License Version 2 as published // by the Free Software Foundation. You may not use, modify or distribute // this program under any other version of the GNU General Public License. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //-------------------------------------------------------------------------- // app_info_table.h author Sourcefire Inc. #ifndef APP_INFO_TABLE_H #define APP_INFO_TABLE_H #include <unordered_map> #include <vector> #include "application_ids.h" #include "flow/flow.h" #include "framework/counts.h" #include "main/thread.h" #include "target_based/snort_protocols.h" #include "utils/util.h" #define APP_PRIORITY_DEFAULT 2 #define SF_APPID_MAX 40000 #define SF_APPID_BUILDIN_MAX 30000 #define SF_APPID_CSD_MIN 1000000 #define SF_APPID_DYNAMIC_MIN 2000000 class AppIdModuleConfig; class ClientDetector; class ServiceDetector; enum AppInfoFlags { APPINFO_FLAG_SERVICE_ADDITIONAL = (1<<0), APPINFO_FLAG_SERVICE_UDP_REVERSED = (1<<1), APPINFO_FLAG_CLIENT_ADDITIONAL = (1<<2), APPINFO_FLAG_CLIENT_USER = (1<<3), APPINFO_FLAG_ACTIVE = (1<<4), APPINFO_FLAG_SSL_INSPECT = (1<<5), APPINFO_FLAG_REFERRED = (1<<6), APPINFO_FLAG_DEFER = (1<<7), APPINFO_FLAG_IGNORE = (1<<8), APPINFO_FLAG_SSL_SQUELCH = (1<<9), APPINFO_FLAG_PERSISTENT = (1<<10), APPINFO_FLAG_TP_CLIENT = (1<<11), APPINFO_FLAG_DEFER_PAYLOAD = (1<<12), APPINFO_FLAG_SEARCH_ENGINE = (1<<13), APPINFO_FLAG_SUPPORTED_SEARCH = (1<<14) }; class AppInfoTableEntry { public: AppInfoTableEntry(AppId id, char* name); AppInfoTableEntry(AppId id, char* name, AppId sid, AppId cid, AppId pid); ~AppInfoTableEntry(); AppId appId; uint32_t serviceId; uint32_t clientId; uint32_t payloadId; SnortProtocolId snort_protocol_id = UNKNOWN_PROTOCOL_ID; uint32_t flags = 0; uint32_t priority = APP_PRIORITY_DEFAULT; ClientDetector* client_detector = nullptr; ServiceDetector* service_detector = nullptr; char* app_name = nullptr; char* app_name_key = nullptr; }; typedef std::unordered_map<AppId, AppInfoTableEntry*> AppInfoTable; typedef std::unordered_map<std::string, AppInfoTableEntry*> AppInfoNameTable; class AppInfoManager { public: static inline AppInfoManager& get_instance() { static AppInfoManager instance; return instance; } AppInfoTableEntry* get_app_info_entry(AppId); AppInfoTableEntry* add_dynamic_app_entry(const char* app_name); AppId get_appid_by_service_id(uint32_t); AppId get_appid_by_client_id(uint32_t); AppId get_appid_by_payload_id(uint32_t); void set_app_info_active(AppId); const char* get_app_name(AppId); const char* get_app_name_key(AppId); static char * strdup_to_lower(const char *app_name); int32_t get_appid_by_name(const char* app_name); bool configured(); void set_app_info_flags(AppId appId, unsigned flags) { AppInfoTableEntry* entry = get_app_info_entry(appId); if ( entry ) entry->flags |= flags; } void clear_app_info_flags(AppId appId, unsigned flags) { AppInfoTableEntry* entry = get_app_info_entry(appId); if ( entry ) entry->flags &= (~flags); } unsigned get_app_info_flags(AppId app_id, unsigned flags) { AppInfoTableEntry* entry = get_app_info_entry(app_id); return entry ? entry->flags & flags : 0; } void set_app_info_priority(AppId appId, unsigned priority) { AppInfoTableEntry* entry = get_app_info_entry(appId); if ( entry ) entry->priority |= priority; } unsigned get_priority(AppId app_id) { AppInfoTableEntry* entry = get_app_info_entry(app_id); return entry ? entry->priority : 0; } void init_appid_info_table(AppIdModuleConfig*, snort::SnortConfig*); void cleanup_appid_info_table(); void dump_app_info_table(); SnortProtocolId add_appid_protocol_reference(const char* protocol, snort::SnortConfig*); private: inline AppInfoManager() = default; void load_appid_config(AppIdModuleConfig*, const char* path); AppInfoTableEntry* get_app_info_entry(AppId appId, const AppInfoTable&); }; #endif
32.75
92
0.679781
[ "vector" ]
05d26cd9e21eaaedc5c3dcc0b512e0ddbeb64e69
20,426
h
C
waterbox/ares64/ares/thirdparty/mame/emu/video/rgbvmx.h
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
153
2020-07-25T17:55:29.000Z
2021-10-01T23:45:01.000Z
waterbox/ares64/ares/thirdparty/mame/emu/video/rgbvmx.h
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
245
2021-10-08T09:14:46.000Z
2022-03-31T08:53:13.000Z
waterbox/ares64/ares/thirdparty/mame/emu/video/rgbvmx.h
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
44
2020-07-25T08:51:55.000Z
2021-09-25T16:09:01.000Z
// license:BSD-3-Clause // copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbvmx.h VMX/Altivec optimised RGB utilities. ***************************************************************************/ #ifndef MAME_EMU_VIDEO_RGBVMX_H #define MAME_EMU_VIDEO_RGBVMX_H #pragma once #include <altivec.h> /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ class rgbaint_t { protected: typedef __vector signed char VECS8; typedef __vector unsigned char VECU8; typedef __vector signed short VECS16; typedef __vector unsigned short VECU16; typedef __vector signed int VECS32; typedef __vector unsigned int VECU32; public: rgbaint_t() { set(0, 0, 0, 0); } explicit rgbaint_t(u32 rgba) { set(rgba); } rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgb) { set(rgb); } explicit rgbaint_t(VECS32 rgba) : m_value(rgba) { } rgbaint_t(const rgbaint_t& other) = default; rgbaint_t &operator=(const rgbaint_t& other) = default; void set(const rgbaint_t& other) { m_value = other.m_value; } void set(u32 rgba) { const VECU32 zero = { 0, 0, 0, 0 }; #ifdef __LITTLE_ENDIAN__ const VECS8 temp = *reinterpret_cast<const VECS8 *>(&rgba); m_value = VECS32(vec_mergeh(VECS16(vec_mergeh(temp, VECS8(zero))), VECS16(zero))); #else const VECS8 temp = VECS8(vec_perm(vec_lde(0, &rgba), zero, vec_lvsl(0, &rgba))); m_value = VECS32(vec_mergeh(VECS16(zero), VECS16(vec_mergeh(VECS8(zero), temp)))); #endif } void set(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 result = { b, g, r, a }; #else const VECS32 result = { a, r, g, b }; #endif m_value = result; } void set(const rgb_t& rgb) { const VECU32 zero = { 0, 0, 0, 0 }; #ifdef __LITTLE_ENDIAN__ const VECS8 temp = *reinterpret_cast<const VECS8 *>(rgb.ptr()); m_value = VECS32(vec_mergeh(VECS16(vec_mergeh(temp, VECS8(zero))), VECS16(zero))); #else const VECS8 temp = VECS8(vec_perm(vec_lde(0, rgb.ptr()), zero, vec_lvsl(0, rgb.ptr()))); m_value = VECS32(vec_mergeh(VECS16(zero), VECS16(vec_mergeh(VECS8(zero), temp)))); #endif } // This function sets all elements to the same val void set_all(const s32& val) { set(val, val, val, val); } // This function zeros all elements void zero() { set_all(0); } // This function zeros only the alpha element void zero_alpha() { set_a(0); } inline rgb_t to_rgba() const { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); u32 result; vec_ste(temp, 0, &result); return result; } inline rgb_t to_rgba_clamp() const { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); u32 result; vec_ste(temp, 0, &result); return result; } void set_a16(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } void set_a(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } void set_r(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, red_perm); } void set_g(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, green_perm); } void set_b(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, blue_perm); } u8 get_a() const { u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 12), 0, &result); #else vec_ste(vec_splat(VECU8(m_value), 3), 0, &result); #endif return result; } u8 get_r() const { u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 8), 0, &result); #else vec_ste(vec_splat(VECU8(m_value), 7), 0, &result); #endif return result; } u8 get_g() const { u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 4), 0, &result); #else vec_ste(vec_splat(VECU8(m_value), 11), 0, &result); #endif return result; } u8 get_b() const { u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 0), 0, &result); #else vec_ste(vec_splat(VECU8(m_value), 15), 0, &result); #endif return result; } s32 get_a32() const { s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 3), 0, &result); #else vec_ste(vec_splat(m_value, 0), 0, &result); #endif return result; } s32 get_r32() const { s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 2), 0, &result); #else vec_ste(vec_splat(m_value, 1), 0, &result); #endif return result; } s32 get_g32() const { s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 1), 0, &result); #else vec_ste(vec_splat(m_value, 2), 0, &result); #endif return result; } s32 get_b32() const { s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 0), 0, &result); #else vec_ste(vec_splat(m_value, 3), 0, &result); #endif return result; } // These selects return an rgbaint_t with all fields set to the element choosen (a, r, g, or b) rgbaint_t select_alpha32() const { return rgbaint_t(get_a32(), get_a32(), get_a32(), get_a32()); } rgbaint_t select_red32() const { return rgbaint_t(get_r32(), get_r32(), get_r32(), get_r32()); } rgbaint_t select_green32() const { return rgbaint_t(get_g32(), get_g32(), get_g32(), get_g32()); } rgbaint_t select_blue32() const { return rgbaint_t(get_b32(), get_b32(), get_b32(), get_b32()); } inline void add(const rgbaint_t& color2) { m_value = vec_add(m_value, color2.m_value); } inline void add_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_add(m_value, temp); } inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_add(m_value, temp); } inline void sub(const rgbaint_t& color2) { m_value = vec_sub(m_value, color2.m_value); } inline void sub_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(m_value, temp); } inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_sub(m_value, temp); } inline void subr(const rgbaint_t& color2) { m_value = vec_sub(color2.m_value, m_value); } inline void subr_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(temp, m_value); } inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_sub(temp, m_value); } inline void mul(const rgbaint_t& color) { const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(color.m_value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mule(VECU16(m_value), VECU16(color.m_value)))); #else m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mulo(VECU16(m_value), VECU16(color.m_value)))); #endif } inline void mul_imm(const s32 imm) { const VECU32 value = { u32(imm), u32(imm), u32(imm), u32(imm) }; const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mule(VECU16(m_value), VECU16(value)))); #else m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mulo(VECU16(m_value), VECU16(value)))); #endif } inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECU32 value = { u32(b), u32(g), u32(r), u32(a) }; #else const VECU32 value = { u32(a), u32(r), u32(g), u32(b) }; #endif const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mule(VECU16(m_value), VECU16(value)))); #else m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mulo(VECU16(m_value), VECU16(value)))); #endif } inline void shl(const rgbaint_t& shift) { const VECU32 limit = { 32, 32, 32, 32 }; m_value = vec_and(vec_sl(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } inline void shl_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sl(m_value, temp); } inline void shr(const rgbaint_t& shift) { const VECU32 limit = { 32, 32, 32, 32 }; m_value = vec_and(vec_sr(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } inline void shr_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sr(m_value, temp); } inline void sra(const rgbaint_t& shift) { const VECU32 limit = { 31, 31, 31, 31 }; m_value = vec_sra(m_value, vec_min(VECU32(shift.m_value), limit)); } inline void sra_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sra(m_value, temp); } inline void or_reg(const rgbaint_t& color2) { m_value = vec_or(m_value, color2.m_value); } inline void or_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_or(m_value, temp); } inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_or(m_value, temp); } inline void and_reg(const rgbaint_t& color) { m_value = vec_and(m_value, color.m_value); } inline void andnot_reg(const rgbaint_t& color) { m_value = vec_andc(m_value, color.m_value); } inline void and_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_and(m_value, temp); } inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_and(m_value, temp); } inline void xor_reg(const rgbaint_t& color2) { m_value = vec_xor(m_value, color2.m_value); } inline void xor_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_xor(m_value, temp); } inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = vec_xor(m_value, temp); } inline void clamp_and_clear(const u32 sign) { const VECS32 vzero = { 0, 0, 0, 0 }; VECS32 vsign = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_and(m_value, vec_cmpeq(vec_and(m_value, vsign), vzero)); vsign = vec_nor(vec_sra(vsign, vec_splat_u32(1)), vzero); const VECS32 mask = VECS32(vec_cmpgt(m_value, vsign)); m_value = vec_or(vec_and(vsign, mask), vec_and(m_value, vec_nor(mask, vzero))); } inline void clamp_to_uint8() { const VECU32 zero = { 0, 0, 0, 0 }; m_value = VECS32(vec_packs(m_value, m_value)); m_value = VECS32(vec_packsu(VECS16(m_value), VECS16(m_value))); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_mergeh(VECU8(m_value), VECU8(zero))); m_value = VECS32(vec_mergeh(VECS16(m_value), VECS16(zero))); #else m_value = VECS32(vec_mergeh(VECU8(zero), VECU8(m_value))); m_value = VECS32(vec_mergeh(VECS16(zero), VECS16(m_value))); #endif } inline void sign_extend(const u32 compare, const u32 sign) { const VECS32 compare_vec = { s32(compare), s32(compare), s32(compare), s32(compare) }; const VECS32 compare_mask = VECS32(vec_cmpeq(vec_and(m_value, compare_vec), compare_vec)); const VECS32 sign_vec = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_or(m_value, vec_and(sign_vec, compare_mask)); } inline void min(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_min(m_value, temp); } inline void max(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_max(m_value, temp); } void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); void scale_imm_and_clamp(const s32 scale); void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) { mul(scale); sra_imm(8); add(other); clamp_to_uint8(); } void scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) { rgbaint_t color2(other); color2.mul(scale2); mul(scale); add(color2); sra_imm(8); clamp_to_uint8(); } inline void cmpeq(const rgbaint_t& value) { m_value = VECS32(vec_cmpeq(m_value, value.m_value)); } inline void cmpeq_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpeq(m_value, temp)); } inline void cmpeq_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = VECS32(vec_cmpeq(m_value, temp)); } inline void cmpgt(const rgbaint_t& value) { m_value = VECS32(vec_cmpgt(m_value, value.m_value)); } inline void cmpgt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpgt(m_value, temp)); } inline void cmpgt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = VECS32(vec_cmpgt(m_value, temp)); } inline void cmplt(const rgbaint_t& value) { m_value = VECS32(vec_cmplt(m_value, value.m_value)); } inline void cmplt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmplt(m_value, temp)); } inline void cmplt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; #else const VECS32 temp = { a, r, g, b }; #endif m_value = VECS32(vec_cmplt(m_value, temp)); } inline rgbaint_t& operator+=(const rgbaint_t& other) { m_value = vec_add(m_value, other.m_value); return *this; } inline rgbaint_t& operator+=(const s32 other) { const VECS32 temp = { other, other, other, other }; m_value = vec_add(m_value, temp); return *this; } inline rgbaint_t& operator-=(const rgbaint_t& other) { m_value = vec_sub(m_value, other.m_value); return *this; } inline rgbaint_t& operator*=(const rgbaint_t& other) { const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(other.m_value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mule(VECU16(m_value), VECU16(other.m_value)))); #else m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mulo(VECU16(m_value), VECU16(other.m_value)))); #endif return *this; } inline rgbaint_t& operator*=(const s32 other) { const VECS32 value = { other, other, other, other }; const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mule(VECU16(m_value), VECU16(value)))); #else m_value = VECS32(vec_add(vec_sl(temp, shift), vec_mulo(VECU16(m_value), VECU16(value)))); #endif return *this; } inline rgbaint_t& operator>>=(const s32 shift) { const VECU32 temp = { u32(shift), u32(shift), u32(shift), u32(shift) }; m_value = vec_sra(m_value, temp); return *this; } inline void merge_alpha16(const rgbaint_t& alpha) { m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } inline void merge_alpha(const rgbaint_t& alpha) { m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } static u32 bilinear_filter(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); // put each packed value into first element of a vector register #ifdef __LITTLE_ENDIAN__ VECS32 color00 = *reinterpret_cast<const VECS32 *>(&rgb00); VECS32 color01 = *reinterpret_cast<const VECS32 *>(&rgb01); VECS32 color10 = *reinterpret_cast<const VECS32 *>(&rgb10); VECS32 color11 = *reinterpret_cast<const VECS32 *>(&rgb11); #else VECS32 color00 = vec_perm(VECS32(vec_lde(0, &rgb00)), zero, vec_lvsl(0, &rgb00)); VECS32 color01 = vec_perm(VECS32(vec_lde(0, &rgb01)), zero, vec_lvsl(0, &rgb01)); VECS32 color10 = vec_perm(VECS32(vec_lde(0, &rgb10)), zero, vec_lvsl(0, &rgb10)); VECS32 color11 = vec_perm(VECS32(vec_lde(0, &rgb11)), zero, vec_lvsl(0, &rgb11)); #endif // interleave color01/color00 and color10/color11 at the byte level then zero-extend color01 = VECS32(vec_mergeh(VECU8(color01), VECU8(color00))); color11 = VECS32(vec_mergeh(VECU8(color11), VECU8(color10))); #ifdef __LITTLE_ENDIAN__ color01 = VECS32(vec_mergeh(VECU8(color01), VECU8(zero))); color11 = VECS32(vec_mergeh(VECU8(color11), VECU8(zero))); #else color01 = VECS32(vec_mergeh(VECU8(zero), VECU8(color01))); color11 = VECS32(vec_mergeh(VECU8(zero), VECU8(color11))); #endif color01 = vec_msum(VECS16(color01), scale_table[u], zero); color11 = vec_msum(VECS16(color11), scale_table[u], zero); color01 = vec_sl(color01, vec_splat_u32(15)); color11 = vec_sr(color11, vec_splat_u32(1)); color01 = VECS32(vec_max(VECS16(color01), VECS16(color11))); color01 = vec_msum(VECS16(color01), scale_table[v], zero); color01 = vec_sr(color01, vec_splat_u32(15)); color01 = VECS32(vec_packs(color01, color01)); color01 = VECS32(vec_packsu(VECS16(color01), VECS16(color01))); u32 result; vec_ste(VECU32(color01), 0, &result); return result; } void bilinear_filter_rgbaint(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); // put each packed value into first element of a vector register #ifdef __LITTLE_ENDIAN__ VECS32 color00 = *reinterpret_cast<const VECS32 *>(&rgb00); VECS32 color01 = *reinterpret_cast<const VECS32 *>(&rgb01); VECS32 color10 = *reinterpret_cast<const VECS32 *>(&rgb10); VECS32 color11 = *reinterpret_cast<const VECS32 *>(&rgb11); #else VECS32 color00 = vec_perm(VECS32(vec_lde(0, &rgb00)), zero, vec_lvsl(0, &rgb00)); VECS32 color01 = vec_perm(VECS32(vec_lde(0, &rgb01)), zero, vec_lvsl(0, &rgb01)); VECS32 color10 = vec_perm(VECS32(vec_lde(0, &rgb10)), zero, vec_lvsl(0, &rgb10)); VECS32 color11 = vec_perm(VECS32(vec_lde(0, &rgb11)), zero, vec_lvsl(0, &rgb11)); #endif // interleave color01/color00 and color10/color11 at the byte level then zero-extend color01 = VECS32(vec_mergeh(VECU8(color01), VECU8(color00))); color11 = VECS32(vec_mergeh(VECU8(color11), VECU8(color10))); #ifdef __LITTLE_ENDIAN__ color01 = VECS32(vec_mergeh(VECU8(color01), VECU8(zero))); color11 = VECS32(vec_mergeh(VECU8(color11), VECU8(zero))); #else color01 = VECS32(vec_mergeh(VECU8(zero), VECU8(color01))); color11 = VECS32(vec_mergeh(VECU8(zero), VECU8(color11))); #endif color01 = vec_msum(VECS16(color01), scale_table[u], zero); color11 = vec_msum(VECS16(color11), scale_table[u], zero); color01 = vec_sl(color01, vec_splat_u32(15)); color11 = vec_sr(color11, vec_splat_u32(1)); color01 = VECS32(vec_max(VECS16(color01), VECS16(color11))); color01 = vec_msum(VECS16(color01), scale_table[v], zero); m_value = vec_sr(color01, vec_splat_u32(15)); } protected: VECS32 m_value; static const VECU8 alpha_perm; static const VECU8 red_perm; static const VECU8 green_perm; static const VECU8 blue_perm; static const VECS16 scale_table[256]; }; // altivec.h somehow redefines "bool" in a bad way. really. #ifdef vector #undef vector #endif #ifdef bool #undef bool #endif #ifdef pixel #undef pixel #endif #endif // MAME_EMU_VIDEO_RGBVMX_H
28.019204
113
0.685401
[ "vector" ]
397ecac4b0145593b305378ce60b381d587ba9ce
14,153
h
C
wbs/src/Basic/xml/zenxml/dom.h
RNCan/WeatherBasedSimulationFramework
19df207d11b1dddf414d78e52bece77f31d45df8
[ "MIT" ]
6
2017-05-26T21:19:41.000Z
2021-09-03T14:17:29.000Z
wbs/src/Basic/xml/zenxml/dom.h
RNCan/WeatherBasedSimulationFramework
19df207d11b1dddf414d78e52bece77f31d45df8
[ "MIT" ]
5
2016-02-18T12:39:58.000Z
2016-03-13T12:57:45.000Z
wbs/src/Basic/xml/zenxml/dom.h
RNCan/WeatherBasedSimulationFramework
19df207d11b1dddf414d78e52bece77f31d45df8
[ "MIT" ]
1
2019-06-16T02:49:20.000Z
2019-06-16T02:49:20.000Z
// ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef ZEN_XML_DOM_HEADER_82085720723894567204564256 #define ZEN_XML_DOM_HEADER_82085720723894567204564256 #include <string> #include <map> #include "basic/xml/zen/fixed_list.h" #include "basic/xml/zenXml/cvrt_text.h" namespace zen { class XmlDoc; /// An XML element class XmlElement { public: XmlElement() : parent_(nullptr) {} //Construct an empty XML element template <class String> explicit XmlElement(const String& name, XmlElement* parentElement = nullptr) : name_(utfCvrtTo<std::string>(name)), parent_(parentElement) {} ///Retrieve the name of this XML element. /** \tparam String Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... \returns Name of the XML element. */ template <class String> String getNameAs() const { return utfCvrtTo<String>(name_); } ///Get the value of this element as a user type. /** \tparam T Arbitrary user data type: e.g. any string class, all built-in arithmetic numbers, STL container, ... \returns "true" if Xml element was successfully converted to value, cannot fail for string-like types */ template <class T> bool getValue(T& value) const { return readStruc(*this, value); } ///Set the value of this element. /** \tparam T Arbitrary user data type: e.g. any string-like type, all built-in arithmetic numbers, STL container, ... */ template <class T> void setValue(const T& value) { writeStruc(value, *this); } ///Retrieve an attribute by name. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... \tparam T String-convertible user data type: e.g. any string class, all built-in arithmetic numbers \param name The name of the attribute to retrieve. \param value The value of the attribute converted to T. \return "true" if value was retrieved successfully. */ template <class String, class T> bool getAttribute(const String& name, T& value) const { auto it = attributes.find(utfCvrtTo<std::string>(name)); return it == attributes.end() ? false : readText(it->second, value); } ///Create or update an XML attribute. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... \tparam T String-convertible user data type: e.g. any string-like type, all built-in arithmetic numbers \param name The name of the attribute to create or update. \param value The value to set. */ template <class String, class T> void setAttribute(const String& name, const T& value) { std::string attrValue; writeText(value, attrValue); attributes[utfCvrtTo<std::string>(name)] = attrValue; } ///Remove the attribute with the given name. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... */ template <class String> void removeAttribute(const String& name) { attributes.erase(utfCvrtTo<std::string>(name)); } ///Create a new child element and return a reference to it. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... \param name The name of the child element to be created. */ template <class String> XmlElement& addChild(const String& name) { std::string utf8Name = utfCvrtTo<std::string>(name); childElements.emplace_back(utf8Name, this); XmlElement& newElement = childElements.back(); childElementsSorted.emplace(utf8Name, &newElement); return newElement; } ///Retrieve a child element with the given name. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... \param name The name of the child element to be retrieved. \return A pointer to the child element or nullptr if none was found. */ template <class String> const XmlElement* getChild(const String& name) const { auto it = childElementsSorted.find(utfCvrtTo<std::string>(name)); return it == childElementsSorted.end() ? nullptr : it->second; } ///\sa getChild template <class String> XmlElement* getChild(const String& name) { return const_cast<XmlElement*>(static_cast<const XmlElement*>(this)->getChild(name)); } template < class IterTy, //underlying iterator type class T, //target object type class AccessPolicy > //access policy: see AccessPtrMap class PtrIter : public std::iterator<std::input_iterator_tag, T>, private AccessPolicy //get rid of shared_ptr indirection { public: PtrIter(IterTy it) : it_(it) {} PtrIter(const PtrIter& other) : it_(other.it_) {} PtrIter& operator++() { ++it_; return *this; } PtrIter operator++(int) { PtrIter tmp(*this); operator++(); return tmp; } inline friend bool operator==(const PtrIter& lhs, const PtrIter& rhs) { return lhs.it_ == rhs.it_; } inline friend bool operator!=(const PtrIter& lhs, const PtrIter& rhs) { return !(lhs == rhs); } T& operator* () { return AccessPolicy::template objectRef<T>(it_); } T* operator->() { return &AccessPolicy::template objectRef<T>(it_); } private: IterTy it_; }; struct AccessMapElement { template <class T, class IterTy> T& objectRef(const IterTy& it) { return *(it->second); } }; typedef PtrIter<std::multimap<std::string, XmlElement*>::iterator, XmlElement, AccessMapElement> ChildIter2; typedef PtrIter<std::multimap<std::string, XmlElement*>::const_iterator, const XmlElement, AccessMapElement> ChildIterConst2; ///Access all child elements with the given name via STL iterators. /** \code auto iterPair = elem.getChildren("Item"); std::for_each(iterPair.first, iterPair.second, [](const XmlElement& child) { ... }); \endcode \param name The name of the child elements to be retrieved. \return A pair of STL begin/end iterators to access the child elements sequentially. */ template <class String> std::pair<ChildIterConst2, ChildIterConst2> getChildren(const String& name) const { return childElementsSorted.equal_range(utfCvrtTo<std::string>(name)); } ///\sa getChildren template <class String> std::pair<ChildIter2, ChildIter2> getChildren(const String& name) { return childElementsSorted.equal_range(utfCvrtTo<std::string>(name)); } struct AccessListElement { template <class T, class IterTy> T& objectRef(const IterTy& it) { return *it; } }; typedef PtrIter<FixedList<XmlElement>::iterator, XmlElement, AccessListElement> ChildIter; typedef PtrIter<FixedList<XmlElement>::const_iterator, const XmlElement, AccessListElement> ChildIterConst; ///Access all child elements sequentially via STL iterators. /** \code auto iterPair = elem.getChildren(); std::for_each(iterPair.first, iterPair.second, [](const XmlElement& child) { ... }); \endcode \return A pair of STL begin/end iterators to access all child elements sequentially. */ std::pair<ChildIterConst, ChildIterConst> getChildren() const { return std::make_pair(childElements.begin(), childElements.end()); } ///\sa getChildren std::pair<ChildIter, ChildIter> getChildren() { return std::make_pair(childElements.begin(), childElements.end()); } ///Get parent XML element, may be nullptr for root element XmlElement* parent() { return parent_; }; ///Get parent XML element, may be nullptr for root element const XmlElement* parent() const { return parent_; }; typedef std::map<std::string, std::string>::const_iterator AttrIter; /* -> disabled documentation extraction \brief Get all attributes associated with the element. \code auto iterPair = elem.getAttributes(); for (auto it = iterPair.first; it != iterPair.second; ++it) std::cout << "name: " << it->first << " value: " << it->second << "\n"; \endcode \return A pair of STL begin/end iterators to access all attributes sequentially as a list of name/value pairs of std::string. */ std::pair<AttrIter, AttrIter> getAttributes() const { return std::make_pair(attributes.begin(), attributes.end()); } //swap two elements while keeping references to parent. -> disabled documentation extraction void swapSubtree(XmlElement& other) { name_ .swap(other.name_); value_ .swap(other.value_); attributes.swap(other.attributes); childElements.swap(other.childElements); childElementsSorted.swap(other.childElementsSorted); //std::swap(parent_, other.parent_); -> parent is physical location; update children's parent reference instead: for (XmlElement& child : childElements) child.parent_ = this; for (XmlElement& child : other.childElements) child.parent_ = &other; } private: XmlElement (const XmlElement&) = delete; XmlElement& operator=(const XmlElement&) = delete; std::string name_; std::string value_; std::map<std::string, std::string> attributes; FixedList<XmlElement> childElements; //all child elements in order of creation std::multimap<std::string, XmlElement*> childElementsSorted; //alternate key: sorted by element name XmlElement* parent_; }; //XmlElement::setValue<T>() calls zen::writeStruc() which calls XmlElement::setValue() ... => these two specializations end the circle template <> inline void XmlElement::setValue(const std::string& value) { value_ = value; } template <> inline bool XmlElement::getValue(std::string& value) const { value = value_; return true; } ///The complete XML document class XmlDoc { public: ///Default constructor setting up an empty XML document with a standard declaration: <?xml version="1.0" encoding="UTF-8" ?> XmlDoc() : version_("1.0"), encoding_("UTF-8"), rootElement("Root") {} XmlDoc(XmlDoc&& tmp) { swap(tmp); } XmlDoc& operator=(XmlDoc&& tmp) { swap(tmp); return *this; } //Setup an empty XML document /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... \param rootName The name of the XML document's root element. */ template <class String> XmlDoc(String rootName) : version_("1.0"), encoding_("UTF-8"), rootElement(rootName) {} ///Get a const reference to the document's root element. const XmlElement& root() const { return rootElement; } ///Get a reference to the document's root element. XmlElement& root() { return rootElement; } ///Get the version used in the XML declaration. /** \tparam String Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... */ template <class String> String getVersionAs() const { return utfCvrtTo<String>(version_); } ///Set the version used in the XML declaration. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... */ template <class String> void setVersion(const String& version) { version_ = utfCvrtTo<std::string>(version); } ///Get the encoding used in the XML declaration. /** \tparam String Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... */ template <class String> String getEncodingAs() const { return utfCvrtTo<String>(encoding_); } ///Set the encoding used in the XML declaration. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... */ template <class String> void setEncoding(const String& encoding) { encoding_ = utfCvrtTo<std::string>(encoding); } ///Get the standalone string used in the XML declaration. /** \tparam String Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... */ template <class String> String getStandaloneAs() const { return utfCvrtTo<String>(standalone_); } ///Set the standalone string used in the XML declaration. /** \tparam String Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... */ template <class String> void setStandalone(const String& standalone) { standalone_ = utfCvrtTo<std::string>(standalone); } //Transactionally swap two elements. -> disabled documentation extraction void swap(XmlDoc& other) { version_ .swap(other.version_); encoding_ .swap(other.encoding_); standalone_.swap(other.standalone_); rootElement.swapSubtree(other.rootElement); } private: XmlDoc (const XmlDoc&) = delete; //not implemented, thanks to XmlElement::parent_ XmlDoc& operator=(const XmlDoc&) = delete; std::string version_; std::string encoding_; std::string standalone_; XmlElement rootElement; }; } #endif //ZEN_XML_DOM_HEADER_82085720723894567204564256
42.374251
160
0.644598
[ "object" ]
3981ec944f0f04cc9149647203714de986d2dedd
1,773
h
C
globals/error_list.h
ngeiswei/zytrax
31a6962a61af32d7a9ee2e6950b2a54467193918
[ "MIT" ]
197
2019-05-17T17:09:06.000Z
2022-03-29T06:45:42.000Z
globals/error_list.h
ngeiswei/zytrax
31a6962a61af32d7a9ee2e6950b2a54467193918
[ "MIT" ]
12
2019-06-08T04:56:00.000Z
2021-02-20T16:29:04.000Z
globals/error_list.h
ngeiswei/zytrax
31a6962a61af32d7a9ee2e6950b2a54467193918
[ "MIT" ]
9
2019-06-05T08:33:12.000Z
2021-02-21T19:04:25.000Z
#ifndef ERROR_LIST_H #define ERROR_LIST_H /** Error List. Please never compare an error against FAILED * Either do result != OK , or !result. This way, Error fail * values can be more detailed in the future. * * This is a generic error list, mainly for organizing a language of returning errors. */ enum Error { OK, FAILED, ///< Generic fail error ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable ERR_UNCONFIGURED, ///< The object being used hasnt been properly set up yet ERR_UNAUTHORIZED, ///< Missing credentials for requested resource ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range ERR_OUT_OF_MEMORY, ///< Out of memory ERR_FILE_NOT_FOUND, ERR_FILE_BAD_DRIVE, ERR_FILE_BAD_PATH, ERR_FILE_NO_PERMISSION, ERR_FILE_ALREADY_IN_USE, ERR_FILE_CANT_OPEN, ERR_FILE_CANT_WRITE, ERR_FILE_CANT_READ, ERR_FILE_UNRECOGNIZED, ERR_FILE_TOO_NEW, ERR_FILE_CORRUPT, ERR_FILE_EOF, ERR_CANT_OPEN, ///< Can't open a resource/socket/file ERROR_QUERY_FAILED, ERR_ALREADY_IN_USE, ERR_LOCKED, ///< resource is locked ERR_TIMEOUT, ERR_CANT_AQUIRE_RESOURCE, ERR_INVALID_DATA, ///< Data passed is invalid ERR_INVALID_PARAMETER, ///< Parameter passed is invalid ERR_ALREADY_EXISTS, ///< When adding, item already exists ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist ERR_DATABASE_CANT_READ, ///< database is full ERR_DATABASE_CANT_WRITE, ///< database is full ERR_COMPILATION_FAILED, ERR_LINK_FAILED, ERR_VERSION_MISMATCH, ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though ERR_WTF = ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above }; #endif
34.096154
110
0.778906
[ "object" ]
39827b17b59b52fcd0639adc3dcb4c954c5eaaec
4,462
h
C
aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/ExecuteTransactionResult.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-10T08:06:54.000Z
2022-02-10T08:06:54.000Z
aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/ExecuteTransactionResult.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2021-10-14T16:57:00.000Z
2021-10-18T10:47:24.000Z
aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/ExecuteTransactionResult.h
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/dynamodb/DynamoDB_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/dynamodb/model/ItemResponse.h> #include <aws/dynamodb/model/ConsumedCapacity.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace DynamoDB { namespace Model { class AWS_DYNAMODB_API ExecuteTransactionResult { public: ExecuteTransactionResult(); ExecuteTransactionResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ExecuteTransactionResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The response to a PartiQL transaction.</p> */ inline const Aws::Vector<ItemResponse>& GetResponses() const{ return m_responses; } /** * <p>The response to a PartiQL transaction.</p> */ inline void SetResponses(const Aws::Vector<ItemResponse>& value) { m_responses = value; } /** * <p>The response to a PartiQL transaction.</p> */ inline void SetResponses(Aws::Vector<ItemResponse>&& value) { m_responses = std::move(value); } /** * <p>The response to a PartiQL transaction.</p> */ inline ExecuteTransactionResult& WithResponses(const Aws::Vector<ItemResponse>& value) { SetResponses(value); return *this;} /** * <p>The response to a PartiQL transaction.</p> */ inline ExecuteTransactionResult& WithResponses(Aws::Vector<ItemResponse>&& value) { SetResponses(std::move(value)); return *this;} /** * <p>The response to a PartiQL transaction.</p> */ inline ExecuteTransactionResult& AddResponses(const ItemResponse& value) { m_responses.push_back(value); return *this; } /** * <p>The response to a PartiQL transaction.</p> */ inline ExecuteTransactionResult& AddResponses(ItemResponse&& value) { m_responses.push_back(std::move(value)); return *this; } /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline const Aws::Vector<ConsumedCapacity>& GetConsumedCapacity() const{ return m_consumedCapacity; } /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline void SetConsumedCapacity(const Aws::Vector<ConsumedCapacity>& value) { m_consumedCapacity = value; } /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline void SetConsumedCapacity(Aws::Vector<ConsumedCapacity>&& value) { m_consumedCapacity = std::move(value); } /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline ExecuteTransactionResult& WithConsumedCapacity(const Aws::Vector<ConsumedCapacity>& value) { SetConsumedCapacity(value); return *this;} /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline ExecuteTransactionResult& WithConsumedCapacity(Aws::Vector<ConsumedCapacity>&& value) { SetConsumedCapacity(std::move(value)); return *this;} /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline ExecuteTransactionResult& AddConsumedCapacity(const ConsumedCapacity& value) { m_consumedCapacity.push_back(value); return *this; } /** * <p>The capacity units consumed by the entire operation. The values of the list * are ordered according to the ordering of the statements.</p> */ inline ExecuteTransactionResult& AddConsumedCapacity(ConsumedCapacity&& value) { m_consumedCapacity.push_back(std::move(value)); return *this; } private: Aws::Vector<ItemResponse> m_responses; Aws::Vector<ConsumedCapacity> m_consumedCapacity; }; } // namespace Model } // namespace DynamoDB } // namespace Aws
35.696
152
0.706186
[ "vector", "model" ]
39831c9b373e4c4bd7f86634a09449f633e35654
8,034
c
C
src/mice/src/cspice/dcyldr.c
jared711/meteoroid_orbits
84428bc33a695fb4bebee383f5094b80ae1d7193
[ "MIT" ]
9
2018-03-28T16:03:28.000Z
2022-01-30T20:36:00.000Z
src/mice/src/cspice/dcyldr.c
jared711/meteoroid_orbits
84428bc33a695fb4bebee383f5094b80ae1d7193
[ "MIT" ]
null
null
null
src/mice/src/cspice/dcyldr.c
jared711/meteoroid_orbits
84428bc33a695fb4bebee383f5094b80ae1d7193
[ "MIT" ]
2
2021-01-25T10:11:10.000Z
2022-01-09T06:37:06.000Z
/* dcyldr.f -- translated by f2c (version 19980913). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ #include "f2c.h" /* $Procedure DCYLDR (Derivative of cylindrical w.r.t. rectangular ) */ /* Subroutine */ int dcyldr_(doublereal *x, doublereal *y, doublereal *z__, doublereal *jacobi) { doublereal long__, r__; extern /* Subroutine */ int chkin_(char *, ftnlen), vpack_(doublereal *, doublereal *, doublereal *, doublereal *); doublereal injacb[9] /* was [3][3] */, rectan[3]; extern /* Subroutine */ int reccyl_(doublereal *, doublereal *, doublereal *, doublereal *), drdcyl_(doublereal *, doublereal *, doublereal *, doublereal *); doublereal zz; extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen), setmsg_(char *, ftnlen); extern logical return_(void); extern /* Subroutine */ int invort_(doublereal *, doublereal *); /* $ Abstract */ /* This routine computes the Jacobian of the transformation from */ /* rectangular to cylindrical coordinates. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* COORDINATES */ /* DERIVATIVES */ /* MATRIX */ /* $ Declarations */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* X I X-coordinate of point. */ /* Y I Y-coordinate of point. */ /* Z I Z-coordinate of point. */ /* JACOBI O Matrix of partial derivatives. */ /* $ Detailed_Input */ /* X, */ /* Y, */ /* Z are the rectangular coordinates of the point at */ /* which the Jacobian of the map from rectangular */ /* to cylindrical coordinates is desired. */ /* $ Detailed_Output */ /* JACOBI is the matrix of partial derivatives of the conversion */ /* between rectangular and cylindrical coordinates. It */ /* has the form */ /* .- -. */ /* | dr /dx dr /dy dr /dz | */ /* | dlong/dx dlong/dy dlong/dz | */ /* | dz /dx dz /dy dz /dz | */ /* `- -' */ /* evaluated at the input values of X, Y, and Z. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If the input point is on the Z-axis (X and Y = 0), the */ /* Jacobian is undefined. The error SPICE(POINTONZAXIS) */ /* will be signaled. */ /* $ Files */ /* None. */ /* $ Particulars */ /* When performing vector calculations with velocities it is */ /* usually most convenient to work in rectangular coordinates. */ /* However, once the vector manipulations have been performed, */ /* it is often desirable to convert the rectangular representations */ /* into cylindrical coordinates to gain insights about phenomena */ /* in this coordinate frame. */ /* To transform rectangular velocities to derivatives of coordinates */ /* in a cylindrical system, one uses the Jacobian of the */ /* transformation between the two systems. */ /* Given a state in rectangular coordinates */ /* ( x, y, z, dx, dy, dz ) */ /* the velocity in cylindrical coordinates is given by the matrix */ /* equation: */ /* t | t */ /* (dr, dlong, dz) = JACOBI| * (dx, dy, dz) */ /* |(x,y,z) */ /* This routine computes the matrix */ /* | */ /* JACOBI| */ /* |(x,y,z) */ /* $ Examples */ /* Suppose one is given the bodyfixed rectangular state of an object */ /* (x(t), y(t), z(t), dx(t), dy(t), dz(t)) as a function of time t. */ /* To find the derivatives of the coordinates of the object in */ /* bodyfixed cylindrical coordinates, one simply multiplies the */ /* Jacobian of the transformation from rectangular to cylindrical */ /* coordinates (evaluated at x(t), y(t), z(t)) by the rectangular */ /* velocity vector of the object at time t. */ /* In code this looks like: */ /* C */ /* C Load the rectangular velocity vector vector RECV. */ /* C */ /* RECV(1) = DX_DT ( T ) */ /* RECV(2) = DY_DT ( T ) */ /* RECV(3) = DZ_DT ( T ) */ /* C */ /* C Determine the Jacobian of the transformation from */ /* C rectangular to cylindrical coordinates at the */ /* C given rectangular coordinates at time T. */ /* C */ /* CALL DCYLDR ( X(T), Y(T), Z(T), JACOBI ) */ /* C */ /* C Multiply the Jacobian on the right by the rectangular */ /* C velocity to obtain the cylindrical coordinate derivatives */ /* C CYLV. */ /* C */ /* CALL MXV ( JACOBI, RECV, CYLV ) */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.0, 19-JUL-2001 (WLT) */ /* -& */ /* $ Index_Entries */ /* Jacobian of cylindrical w.r.t. rectangular coordinates */ /* -& */ /* $ Revisions */ /* None. */ /* -& */ /* SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("DCYLDR", (ftnlen)6); } /* There is a singularity of the Jacobian for points on the z-axis. */ if (*x == 0. && *y == 0.) { setmsg_("The Jacobian of the transformation from rectangular to cyli" "ndrical coordinates is not defined for points on the z-axis.", (ftnlen)119); sigerr_("SPICE(POINTONZAXIS)", (ftnlen)19); chkout_("DCYLDR", (ftnlen)6); return 0; } /* We will get the Jacobian of rectangular to cylindrical by */ /* implicit differentiation. */ /* First move the X,Y and Z coordinates into a vector. */ vpack_(x, y, z__, rectan); /* Convert from rectangular to cylindrical coordinates. */ reccyl_(rectan, &r__, &long__, &zz); /* Get the Jacobian from cylindrical to rectangular coordinates at */ /* R, LONG, Z. */ drdcyl_(&r__, &long__, &zz, injacb); /* Now invert INJACB to get the Jacobian from rectangular to */ /* cylindrical coordinates. */ invort_(injacb, jacobi); chkout_("DCYLDR", (ftnlen)6); return 0; } /* dcyldr_ */
31.880952
77
0.569455
[ "object", "vector", "transform" ]
39915ea7f5f7127c65b15ca69fb8b1c7ec4e6682
77,550
h
C
examples_tests/common/CommonAPI.h
deprilula28/Nabla
6b5de216221718191713dcf6de8ed6407182ddf0
[ "Apache-2.0" ]
null
null
null
examples_tests/common/CommonAPI.h
deprilula28/Nabla
6b5de216221718191713dcf6de8ed6407182ddf0
[ "Apache-2.0" ]
null
null
null
examples_tests/common/CommonAPI.h
deprilula28/Nabla
6b5de216221718191713dcf6de8ed6407182ddf0
[ "Apache-2.0" ]
null
null
null
#define _NBL_STATIC_LIB_ #include <nabla.h> // TODO: get these all included by the appropriate namespace headers! #include "nbl/system/IApplicationFramework.h" #include "nbl/ui/CGraphicalApplicationAndroid.h" #include "nbl/ui/CWindowManagerAndroid.h" #include "nbl/ui/IGraphicalApplicationFramework.h" #if defined(_NBL_PLATFORM_WINDOWS_) #include <nbl/system/CColoredStdoutLoggerWin32.h> #elif defined(_NBL_PLATFORM_ANDROID_) #include <nbl/system/CStdoutLoggerAndroid.h> #endif #include "nbl/system/CSystemAndroid.h" #include "nbl/system/CSystemLinux.h" #include "nbl/system/CSystemWin32.h" // TODO: make these include themselves via `nabla.h` class CommonAPI { CommonAPI() = delete; public: class CommonAPIEventCallback; class InputSystem : public nbl::core::IReferenceCounted { public: template <class ChannelType> struct Channels { nbl::core::mutex lock; std::condition_variable added; nbl::core::vector<nbl::core::smart_refctd_ptr<ChannelType>> channels; nbl::core::vector<std::chrono::microseconds> timeStamps; uint32_t defaultChannelIndex = 0; }; // TODO: move to "nbl/ui/InputEventChannel.h" once the interface of this utility struct matures, also maybe rename to `Consumer` ? template <class ChannelType> struct ChannelReader { template<typename F> inline void consumeEvents(F&& processFunc, nbl::system::logger_opt_ptr logger=nullptr) { auto events = channel->getEvents(); const auto frontBufferCapacity = channel->getFrontBufferCapacity(); if (events.size()>consumedCounter+frontBufferCapacity) { logger.log( "Detected overflow, %d unconsumed events in channel of size %d!", nbl::system::ILogger::ELL_ERROR,events.size()-consumedCounter,frontBufferCapacity ); consumedCounter = events.size()-frontBufferCapacity; } typename ChannelType::range_t rng(events.begin() + consumedCounter, events.end()); processFunc(rng); consumedCounter = events.size(); } nbl::core::smart_refctd_ptr<ChannelType> channel = nullptr; uint64_t consumedCounter = 0ull; }; InputSystem(nbl::system::logger_opt_smart_ptr&& logger) : m_logger(std::move(logger)) {} void getDefaultMouse(ChannelReader<nbl::ui::IMouseEventChannel>* reader) { getDefault(m_mouse,reader); } void getDefaultKeyboard(ChannelReader<nbl::ui::IKeyboardEventChannel>* reader) { getDefault(m_keyboard,reader); } template<class ChannelType> void add(Channels<ChannelType>& channels, nbl::core::smart_refctd_ptr<ChannelType>&& channel) { std::unique_lock lock(channels.lock); channels.channels.push_back(std::move(channel)); using namespace std::chrono; auto timeStamp = duration_cast<microseconds>(steady_clock::now().time_since_epoch()); channels.timeStamps.push_back(timeStamp); channels.added.notify_all(); } template<class ChannelType> void remove(Channels<ChannelType>& channels, const ChannelType* channel) { std::unique_lock lock(channels.lock); auto to_remove_itr = std::find_if( channels.channels.begin(),channels.channels.end(),[channel](const auto& chan)->bool{return chan.get()==channel;} ); auto index = std::distance(channels.channels.begin(), to_remove_itr); channels.timeStamps.erase(channels.timeStamps.begin() + index); channels.channels.erase(to_remove_itr); } template<class ChannelType> void getDefault(Channels<ChannelType>& channels, ChannelReader<ChannelType>* reader) { /* * TODO: Improve default device switching. * For nice results, we should actually make a multi-channel reader, * and then keep a consumed counter together with a last consumed event from each channel. * If there is considerable pause in events received by our current chosen channel or * we can detect some other channel of the same "compatible class" is producing more events, * Switch the channel choice, but prune away all events younger than the old default's consumption timestamp. * (Basically switch keyboards but dont try to process events older than the events you've processed from the old keyboard) */ std::unique_lock lock(channels.lock); while (channels.channels.empty()) { m_logger.log("Waiting For Input Device to be connected...",nbl::system::ILogger::ELL_INFO); channels.added.wait(lock); } uint64_t consumedCounter = 0ull; using namespace std::chrono; constexpr long long DefaultChannelTimeoutInMicroSeconds = 100*1e3; // 100 mili-seconds auto nowTimeStamp = duration_cast<microseconds>(steady_clock::now().time_since_epoch()); // Update Timestamp of all channels for(uint32_t ch = 0u; ch < channels.channels.size(); ++ch) { auto & channel = channels.channels[ch]; auto & timeStamp = channels.timeStamps[ch]; auto events = channel->getEvents(); if(events.size() > 0) { auto lastEventTimeStamp = (*(events.end() - 1)).timeStamp; // last event timestamp timeStamp = lastEventTimeStamp; } } auto defaultIdx = channels.defaultChannelIndex; if(defaultIdx >= channels.channels.size()) { defaultIdx = 0; } auto defaultChannel = channels.channels[defaultIdx]; auto defaultChannelEvents = defaultChannel->getEvents(); auto timeDiff = (nowTimeStamp - channels.timeStamps[defaultIdx]).count(); constexpr size_t RewindBackEvents = 50u; // If the current one hasn't been active for a while if(defaultChannel->empty()) { if(timeDiff > DefaultChannelTimeoutInMicroSeconds) { // Look for the most active channel (the channel which has got the most events recently) auto newDefaultIdx = defaultIdx; microseconds maxEventTimeStamp = microseconds(0); for(uint32_t chIdx = 0; chIdx < channels.channels.size(); ++chIdx) { if(defaultIdx != chIdx) { auto channelTimeDiff = (nowTimeStamp - channels.timeStamps[chIdx]).count(); // Check if was more recently active than the current most active if(channelTimeDiff < DefaultChannelTimeoutInMicroSeconds) { auto & channel = channels.channels[chIdx]; auto channelEvents = channel->getEvents(); auto channelEventSize = channelEvents.size(); const auto frontBufferCapacity = channel->getFrontBufferCapacity(); size_t rewindBack = std::min(RewindBackEvents, frontBufferCapacity); rewindBack = std::min(rewindBack, channelEventSize); auto oldEvent = *(channelEvents.end() - rewindBack); // Which oldEvent of channels are most recent. if(oldEvent.timeStamp > maxEventTimeStamp) { maxEventTimeStamp = oldEvent.timeStamp; newDefaultIdx = chIdx; } } } } if(defaultIdx != newDefaultIdx) { m_logger.log("Default InputChannel for ChannelType changed from %u to %u",nbl::system::ILogger::ELL_INFO, defaultIdx, newDefaultIdx); defaultIdx = newDefaultIdx; channels.defaultChannelIndex = newDefaultIdx; defaultChannel = channels.channels[newDefaultIdx]; consumedCounter = defaultChannel->getEvents().size() - defaultChannel->getFrontBufferCapacity(); // to not get overflow in reader when consuming. } } } if (reader->channel==defaultChannel) return; reader->channel = defaultChannel; reader->consumedCounter = consumedCounter; } nbl::system::logger_opt_smart_ptr m_logger; Channels<nbl::ui::IMouseEventChannel> m_mouse; Channels<nbl::ui::IKeyboardEventChannel> m_keyboard; }; // TODO: can you guys just use one callback!? class ICommonAPIEventCallback : public nbl::ui::IWindow::IEventCallback { public: virtual void setLogger(nbl::system::logger_opt_smart_ptr& logger) = 0; }; class CTemporaryEventCallback : public ICommonAPIEventCallback { nbl::system::logger_opt_smart_ptr m_logger = nullptr; public: void setLogger(nbl::system::logger_opt_smart_ptr& logger) override { m_logger = logger; } private: bool onWindowShown_impl() override { m_logger.log("Window Shown"); return true; } bool onWindowHidden_impl() override { m_logger.log("Window hidden"); return true; } bool onWindowMoved_impl(int32_t x, int32_t y) override { m_logger.log("Window window moved to { %d, %d }", nbl::system::ILogger::ELL_WARNING, x, y); return true; } bool onWindowResized_impl(uint32_t w, uint32_t h) override { m_logger.log("Window resized to { %u, %u }", nbl::system::ILogger::ELL_DEBUG, w, h); return true; } bool onWindowMinimized_impl() override { m_logger.log("Window minimized", nbl::system::ILogger::ELL_ERROR); return true; } bool onWindowMaximized_impl() override { m_logger.log("Window maximized", nbl::system::ILogger::ELL_PERFORMANCE); return true; } void onGainedMouseFocus_impl() override { m_logger.log("Window gained mouse focus", nbl::system::ILogger::ELL_INFO); } void onLostMouseFocus_impl() override { m_logger.log("Window lost mouse focus", nbl::system::ILogger::ELL_INFO); } void onGainedKeyboardFocus_impl() override { m_logger.log("Window gained keyboard focus", nbl::system::ILogger::ELL_INFO); } void onLostKeyboardFocus_impl() override { m_logger.log("Window lost keyboard focus", nbl::system::ILogger::ELL_INFO); } void onMouseConnected_impl(nbl::core::smart_refctd_ptr<nbl::ui::IMouseEventChannel>&& mch) override { m_logger.log("A mouse has been connected", nbl::system::ILogger::ELL_INFO); } void onMouseDisconnected_impl(nbl::ui::IMouseEventChannel* mch) override { m_logger.log("A mouse has been disconnected", nbl::system::ILogger::ELL_INFO); } void onKeyboardConnected_impl(nbl::core::smart_refctd_ptr<nbl::ui::IKeyboardEventChannel>&& kbch) override { m_logger.log("A keyboard has been connected", nbl::system::ILogger::ELL_INFO); } void onKeyboardDisconnected_impl(nbl::ui::IKeyboardEventChannel* kbch) override { m_logger.log("A keyboard has been disconnected", nbl::system::ILogger::ELL_INFO); } bool onWindowClosed_impl() override { m_logger.log("Window closed"); return true; } }; class CommonAPIEventCallback : public ICommonAPIEventCallback { public: CommonAPIEventCallback(nbl::core::smart_refctd_ptr<InputSystem>&& inputSystem, nbl::system::logger_opt_smart_ptr&& logger) : m_inputSystem(std::move(inputSystem)), m_logger(std::move(logger)), m_gotWindowClosedMsg(false){} CommonAPIEventCallback() {} bool isWindowOpen() const {return !m_gotWindowClosedMsg;} void setLogger(nbl::system::logger_opt_smart_ptr& logger) override { m_logger = logger; } void setInputSystem(nbl::core::smart_refctd_ptr<InputSystem>&& inputSystem) { m_inputSystem = std::move(inputSystem); } private: bool onWindowShown_impl() override { m_logger.log("Window Shown"); return true; } bool onWindowHidden_impl() override { m_logger.log("Window hidden"); return true; } bool onWindowMoved_impl(int32_t x, int32_t y) override { m_logger.log("Window window moved to { %d, %d }", nbl::system::ILogger::ELL_WARNING, x, y); return true; } bool onWindowResized_impl(uint32_t w, uint32_t h) override { m_logger.log("Window resized to { %u, %u }", nbl::system::ILogger::ELL_DEBUG, w, h); return true; } bool onWindowMinimized_impl() override { m_logger.log("Window minimized", nbl::system::ILogger::ELL_ERROR); return true; } bool onWindowMaximized_impl() override { m_logger.log("Window maximized", nbl::system::ILogger::ELL_PERFORMANCE); return true; } void onGainedMouseFocus_impl() override { m_logger.log("Window gained mouse focus", nbl::system::ILogger::ELL_INFO); } void onLostMouseFocus_impl() override { m_logger.log("Window lost mouse focus", nbl::system::ILogger::ELL_INFO); } void onGainedKeyboardFocus_impl() override { m_logger.log("Window gained keyboard focus", nbl::system::ILogger::ELL_INFO); } void onLostKeyboardFocus_impl() override { m_logger.log("Window lost keyboard focus", nbl::system::ILogger::ELL_INFO); } bool onWindowClosed_impl() override { m_logger.log("Window closed"); m_gotWindowClosedMsg = true; return true; } void onMouseConnected_impl(nbl::core::smart_refctd_ptr<nbl::ui::IMouseEventChannel>&& mch) override { m_logger.log("A mouse %p has been connected", nbl::system::ILogger::ELL_INFO, mch.get()); m_inputSystem.get()->add(m_inputSystem.get()->m_mouse,std::move(mch)); } void onMouseDisconnected_impl(nbl::ui::IMouseEventChannel* mch) override { m_logger.log("A mouse %p has been disconnected", nbl::system::ILogger::ELL_INFO, mch); m_inputSystem.get()->remove(m_inputSystem.get()->m_mouse,mch); } void onKeyboardConnected_impl(nbl::core::smart_refctd_ptr<nbl::ui::IKeyboardEventChannel>&& kbch) override { m_logger.log("A keyboard %p has been connected", nbl::system::ILogger::ELL_INFO, kbch.get()); m_inputSystem.get()->add(m_inputSystem.get()->m_keyboard,std::move(kbch)); } void onKeyboardDisconnected_impl(nbl::ui::IKeyboardEventChannel* kbch) override { m_logger.log("A keyboard %p has been disconnected", nbl::system::ILogger::ELL_INFO, kbch); m_inputSystem.get()->remove(m_inputSystem.get()->m_keyboard,kbch); } private: nbl::core::smart_refctd_ptr<InputSystem> m_inputSystem = nullptr; nbl::system::logger_opt_smart_ptr m_logger = nullptr; bool m_gotWindowClosedMsg; }; static nbl::core::smart_refctd_ptr<nbl::system::ISystem> createSystem() { using namespace nbl; using namespace system; nbl::core::smart_refctd_ptr<nbl::system::ISystemCaller> caller = nullptr; #ifdef _NBL_PLATFORM_WINDOWS_ caller = nbl::core::make_smart_refctd_ptr<nbl::system::CSystemCallerWin32>(); #endif #ifdef _NBL_PLATFORM_WINDOWS_ return nbl::core::make_smart_refctd_ptr<nbl::system::CSystemWin32>(std::move(caller)); #elif defined(_NBL_PLATFORM_ANDROID_) #if 0 return nbl::core::make_smart_refctd_ptr<nbl::system::CSystemAndroid>(std::move(caller)); #endif #endif return nullptr; } // Used to help with queue selection struct QueueFamilyProps { static constexpr uint32_t InvalidIndex = ~0u; uint32_t index = InvalidIndex; uint32_t dedicatedQueueCount = 0u; uint32_t score = 0u; bool supportsGraphics : 1; bool supportsCompute : 1; bool supportsTransfer : 1; bool supportsSparseBinding : 1; bool supportsPresent : 1; bool supportsProtected : 1; }; struct GPUInfo { std::vector<nbl::video::ISurface::SFormat> availableSurfaceFormats; nbl::video::ISurface::E_PRESENT_MODE availablePresentModes; nbl::video::ISurface::SCapabilities surfaceCapabilities; struct { QueueFamilyProps graphics; QueueFamilyProps compute; QueueFamilyProps transfer; QueueFamilyProps present; } queueFamilyProps; bool hasSurfaceCapabilities = false; bool isSwapChainSupported = false; }; static std::vector<GPUInfo> extractGPUInfos( nbl::core::SRange<nbl::video::IPhysicalDevice* const> gpus, nbl::core::smart_refctd_ptr<nbl::video::ISurface> surface, const bool headlessCompute = false) { using namespace nbl; using namespace nbl::video; std::vector<GPUInfo> extractedInfos = std::vector<GPUInfo>(gpus.size()); for (size_t i = 0ull; i < gpus.size(); ++i) { auto& extractedInfo = extractedInfos[i]; extractedInfo = {}; auto gpu = gpus.begin()[i]; // Find queue family indices { const auto& queueFamilyProperties = gpu->getQueueFamilyProperties(); std::vector<uint32_t> remainingQueueCounts = std::vector<uint32_t>(queueFamilyProperties.size(), 0u); for (uint32_t familyIndex = 0u; familyIndex < queueFamilyProperties.size(); ++familyIndex) { const auto& familyProperty = queueFamilyProperties.begin()[familyIndex]; remainingQueueCounts[familyIndex] = familyProperty.queueCount; } // Select Graphics Queue Family Index if(!headlessCompute) { // Select Graphics Queue Family Index for (uint32_t familyIndex = 0u; familyIndex < queueFamilyProperties.size(); ++familyIndex) { const auto& familyProperty = queueFamilyProperties.begin()[familyIndex]; auto& outFamilyProp = extractedInfo.queueFamilyProps; const uint32_t currentFamilyQueueCount = familyProperty.queueCount; if(currentFamilyQueueCount <= 0) continue; bool supportsPresent = surface && surface->isSupportedForPhysicalDevice(gpu, familyIndex); bool hasGraphicsFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_GRAPHICS_BIT).value != 0; bool hasComputeFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_COMPUTE_BIT).value != 0; bool hasTransferFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_TRANSFER_BIT).value != 0; bool hasSparseBindingFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_SPARSE_BINDING_BIT).value != 0; bool hasProtectedFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_PROTECTED_BIT).value != 0; const uint32_t remainingQueueCount = remainingQueueCounts[familyIndex]; const bool hasEnoughQueues = remainingQueueCount >= 1u; /* * Examples: * -> score is 0 for every queueFam with no Graphics support * -> If both queue families !hasEnoughtQueues -> score will be equal but this doesn't/shouldn't happen -> there should be a queueFamily with "enoughQueues" for graphics. * -> if both queue families hasEnoughQueues and have similar support for present and compute: Queue Family with more remainingQueueCount is preferred. * -> if both queue families hasEnoughQueues with the same number of remainingQueueCount -> "QueueFamily with present and no compute" >>>> "QueueFamily with compute and no present" * -> if both queue families hasEnoughQueues -> "QueueFamily with compute and no present and 16 remainingQueues" ==== "QueueFamily with present and no compute and 1 remaining Queue" * -> if both queue families hasEnoughQueues -> "QueueFamily with present and compute and 1 remaining Queue" ==== "QueueFamily with no compute and no present and 34 remaining Queues xD" */ uint32_t score = 0u; if(hasGraphicsFlag) { score++; if(hasEnoughQueues) { score += 1u * remainingQueueCount; if(supportsPresent) { score += 32u; // more important to have present than compute (presentSupport is larger in scoring to 16 extra compute queues) } if(hasComputeFlag) { score += 1u * remainingQueueCount; } } } if(score > outFamilyProp.graphics.score) { outFamilyProp.graphics.index = familyIndex; outFamilyProp.graphics.supportsGraphics = hasGraphicsFlag; outFamilyProp.graphics.supportsCompute = hasComputeFlag; outFamilyProp.graphics.supportsTransfer = true; // Reporting this is optional for Vk Graphics-Capable QueueFam, but Its support is guaranteed. outFamilyProp.graphics.supportsSparseBinding = hasSparseBindingFlag; outFamilyProp.graphics.supportsPresent = supportsPresent; outFamilyProp.graphics.supportsProtected = hasProtectedFlag; outFamilyProp.graphics.dedicatedQueueCount = 1u; outFamilyProp.graphics.score = score; } } assert(extractedInfo.queueFamilyProps.graphics.index != QueueFamilyProps::InvalidIndex); remainingQueueCounts[extractedInfo.queueFamilyProps.graphics.index] -= extractedInfo.queueFamilyProps.graphics.dedicatedQueueCount; } // Select Compute Queue Family Index for (uint32_t familyIndex = 0u; familyIndex < queueFamilyProperties.size(); ++familyIndex) { const auto& familyProperty = queueFamilyProperties.begin()[familyIndex]; auto& outFamilyProp = extractedInfo.queueFamilyProps; const uint32_t currentFamilyQueueCount = familyProperty.queueCount; if(currentFamilyQueueCount <= 0) continue; bool supportsPresent = surface && surface->isSupportedForPhysicalDevice(gpu, familyIndex); bool hasGraphicsFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_GRAPHICS_BIT).value != 0; bool hasComputeFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_COMPUTE_BIT).value != 0; bool hasTransferFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_TRANSFER_BIT).value != 0; bool hasSparseBindingFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_SPARSE_BINDING_BIT).value != 0; bool hasProtectedFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_PROTECTED_BIT).value != 0; const uint32_t remainingQueueCount = remainingQueueCounts[familyIndex]; const bool hasExtraQueues = remainingQueueCount >= 1u; /* * Examples: * -> If both !hasEnoughExtraQueues: "queue family that supports graphics" >>>> "queue family that doesn't support graphics" * -> If both queueFams supports Graphics and hasEnoughExtraQueues: "Graphics-capable QueueFamily equal to the selected Graphics QueueFam" >>>> "Any other Graphics-capable QueueFamily" * -> If both support Graphics (not equal to graphicsQueueFamIndex): "queue family that hasEnoughExtraQueues" >>>> "queue family that !hasEnoughExtraQueues" * -> If both support Graphics and hasEnoughExtraQueues (not equal to graphicsQueueFamIndex): both are adequate enough, depends on the order of the queueFams. * -> "Compute-capable QueueFam with hasEnoughExtraQueues" >>>> "Compute-capable QueueFam with graphics capability and ==graphicsQueueFamIdx with no extra dedicated queues" */ uint32_t score = 0u; if(hasComputeFlag) { score++; if(hasExtraQueues) { score += 3; } if(!headlessCompute && hasGraphicsFlag) { score++; if(familyIndex == outFamilyProp.graphics.index) { score++; } } } if(score > outFamilyProp.compute.score) { outFamilyProp.compute.index = familyIndex; outFamilyProp.compute.supportsGraphics = hasGraphicsFlag; outFamilyProp.compute.supportsCompute = hasComputeFlag; outFamilyProp.compute.supportsTransfer = true; // Reporting this is optional for Vk Compute-Capable QueueFam, but Its support is guaranteed. outFamilyProp.compute.supportsSparseBinding = hasSparseBindingFlag; outFamilyProp.compute.supportsPresent = supportsPresent; outFamilyProp.compute.supportsProtected = hasProtectedFlag; outFamilyProp.compute.dedicatedQueueCount = (hasExtraQueues) ? 1u : 0u; outFamilyProp.compute.score = score; } } assert(extractedInfo.queueFamilyProps.compute.index != QueueFamilyProps::InvalidIndex); remainingQueueCounts[extractedInfo.queueFamilyProps.compute.index] -= extractedInfo.queueFamilyProps.compute.dedicatedQueueCount; // Select Transfer Queue Family Index for (uint32_t familyIndex = 0u; familyIndex < queueFamilyProperties.size(); ++familyIndex) { const auto& familyProperty = queueFamilyProperties.begin()[familyIndex]; auto& outFamilyProp = extractedInfo.queueFamilyProps; const uint32_t currentFamilyQueueCount = familyProperty.queueCount; if(currentFamilyQueueCount <= 0) continue; bool supportsPresent = surface && surface->isSupportedForPhysicalDevice(gpu, familyIndex); bool hasGraphicsFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_GRAPHICS_BIT).value != 0; bool hasComputeFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_COMPUTE_BIT).value != 0; bool hasTransferFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_TRANSFER_BIT).value != 0; bool hasSparseBindingFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_SPARSE_BINDING_BIT).value != 0; bool hasProtectedFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_PROTECTED_BIT).value != 0; const uint32_t extraQueueCount = nbl::core::min(remainingQueueCounts[familyIndex], 2u); // UP + DOWN const bool hasExtraQueues = extraQueueCount >= 1u; /* * Examples: * -> score is 0 for every queueFam with no Transfer support * -> If both have similar hasEnoughExtraQueues, compute and graphics support: the one with more remainingQueueCount is preferred * -> If both support Transfer: "QueueFam with >=1 extra queues and graphics and compute support" >>>> (less probable)"QueueFam with no extra queues and transfer-only(no compute and graphics support)" * -> If both support Transfer: "QueueFam with >=0 extra queues and only compute" >>>> "QueueFam with >=0 extra queues and only graphics" */ uint32_t score = 0u; if(hasTransferFlag) { score += 1u; uint32_t notHavingComputeScore = 1u; uint32_t notHavingGraphicsScore = 2u; if(hasExtraQueues) { // Having extra queues to have seperate up/down transfer queues is more important score += 4u * extraQueueCount; notHavingComputeScore *= extraQueueCount; notHavingGraphicsScore *= extraQueueCount; } if(!hasGraphicsFlag) { score += notHavingGraphicsScore; } if(!hasComputeFlag) { score += notHavingComputeScore; } } if(score > outFamilyProp.transfer.score) { outFamilyProp.transfer.index = familyIndex; outFamilyProp.transfer.supportsGraphics = hasGraphicsFlag; outFamilyProp.transfer.supportsCompute = hasComputeFlag; outFamilyProp.transfer.supportsTransfer = hasTransferFlag; outFamilyProp.transfer.supportsSparseBinding = hasSparseBindingFlag; outFamilyProp.transfer.supportsPresent = supportsPresent; outFamilyProp.transfer.supportsProtected = hasProtectedFlag; outFamilyProp.transfer.dedicatedQueueCount = extraQueueCount; outFamilyProp.transfer.score = score; } } assert(extractedInfo.queueFamilyProps.transfer.index != QueueFamilyProps::InvalidIndex); remainingQueueCounts[extractedInfo.queueFamilyProps.transfer.index] -= extractedInfo.queueFamilyProps.transfer.dedicatedQueueCount; // Select Present Queue Family Index if(!headlessCompute) { if(extractedInfo.queueFamilyProps.graphics.supportsPresent && extractedInfo.queueFamilyProps.graphics.index != QueueFamilyProps::InvalidIndex) { extractedInfo.queueFamilyProps.present = extractedInfo.queueFamilyProps.graphics; extractedInfo.queueFamilyProps.present.dedicatedQueueCount = 0u; } else { const uint32_t maxNeededQueueCountForPresent = 1u; for (uint32_t familyIndex = 0u; familyIndex < queueFamilyProperties.size(); ++familyIndex) { const auto& familyProperty = queueFamilyProperties.begin()[familyIndex]; auto& outFamilyProp = extractedInfo.queueFamilyProps; const uint32_t currentFamilyQueueCount = familyProperty.queueCount; if(currentFamilyQueueCount <= 0) continue; bool supportsPresent = surface && surface->isSupportedForPhysicalDevice(gpu, familyIndex); bool hasGraphicsFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_GRAPHICS_BIT).value != 0; bool hasComputeFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_COMPUTE_BIT).value != 0; bool hasTransferFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_TRANSFER_BIT).value != 0; bool hasSparseBindingFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_SPARSE_BINDING_BIT).value != 0; bool hasProtectedFlag = (familyProperty.queueFlags & IPhysicalDevice::EQF_PROTECTED_BIT).value != 0; const uint32_t remainingQueueCount = remainingQueueCounts[familyIndex]; const bool hasEnoughExtraQueues = remainingQueueCount >= 1u; /* this will only lead here if selected graphics queue can't support present * Examples: * -> score is 0 for every queueFam with no Present support * -> If both queue families support Present -> "graphics support is preferred rather than extra dedicated queues" * -> graphics support is equal in scoring to 100 extra queues with no graphics support * -> If both queue families !hasEnoughExtraQueues -> "graphics support is preferred" * -> If both queue families hasEnoughExtraQueues and have similar support for graphics -> "queue family with more remainingQueueCount is preferred" */ uint32_t score = 0u; if(supportsPresent) { score += 1u; uint32_t graphicsSupportScore = 100u; if(hasEnoughExtraQueues) { score += 1u * remainingQueueCount; graphicsSupportScore *= remainingQueueCount; } if(hasGraphicsFlag) { score += graphicsSupportScore; // graphics support is larger in scoring than 100 extra queues with no graphics support } } if(score > outFamilyProp.present.score) { outFamilyProp.present.index = familyIndex; outFamilyProp.present.supportsGraphics = hasGraphicsFlag; outFamilyProp.present.supportsCompute = hasComputeFlag; outFamilyProp.present.supportsTransfer = hasTransferFlag; outFamilyProp.present.supportsSparseBinding = hasSparseBindingFlag; outFamilyProp.present.supportsPresent = supportsPresent; outFamilyProp.present.supportsProtected = hasProtectedFlag; outFamilyProp.present.dedicatedQueueCount = (hasEnoughExtraQueues) ? 1u : 0u; outFamilyProp.present.score = score; } } } assert(extractedInfo.queueFamilyProps.present.index != QueueFamilyProps::InvalidIndex); remainingQueueCounts[extractedInfo.queueFamilyProps.present.index] -= extractedInfo.queueFamilyProps.present.dedicatedQueueCount; } if(!headlessCompute) assert(extractedInfo.queueFamilyProps.graphics.supportsTransfer && "This shouldn't happen"); assert(extractedInfo.queueFamilyProps.compute.supportsTransfer && "This shouldn't happen"); } extractedInfo.isSwapChainSupported = gpu->isSwapchainSupported(); // Check if the surface is adequate if(surface) { uint32_t surfaceFormatCount; surface->getAvailableFormatsForPhysicalDevice(gpu, surfaceFormatCount, nullptr); extractedInfo.availableSurfaceFormats = std::vector<nbl::video::ISurface::SFormat>(surfaceFormatCount); surface->getAvailableFormatsForPhysicalDevice(gpu, surfaceFormatCount, extractedInfo.availableSurfaceFormats.data()); extractedInfo.availablePresentModes = surface->getAvailablePresentModesForPhysicalDevice(gpu); // TODO: @achal OpenGL shouldn't fail this extractedInfo.surfaceCapabilities = {}; if (surface->getSurfaceCapabilitiesForPhysicalDevice(gpu, extractedInfo.surfaceCapabilities)) extractedInfo.hasSurfaceCapabilities = true; } } return extractedInfos; } // TODO: also implement a function:findBestGPU // Returns an index into gpus info vector static uint32_t findSuitableGPU(const std::vector<GPUInfo>& extractedInfos, const bool headlessCompute) { uint32_t ret = ~0u; for(uint32_t i = 0; i < extractedInfos.size(); ++i) { bool isGPUSuitable = false; const auto& extractedInfo = extractedInfos[i]; if(!headlessCompute) { if ((extractedInfo.queueFamilyProps.graphics.index != QueueFamilyProps::InvalidIndex) && (extractedInfo.queueFamilyProps.compute.index != QueueFamilyProps::InvalidIndex) && (extractedInfo.queueFamilyProps.transfer.index != QueueFamilyProps::InvalidIndex) && (extractedInfo.queueFamilyProps.present.index != QueueFamilyProps::InvalidIndex)) isGPUSuitable = true; if(extractedInfo.isSwapChainSupported == false) isGPUSuitable = false; if(extractedInfo.hasSurfaceCapabilities == false) isGPUSuitable = false; } else { if ((extractedInfo.queueFamilyProps.compute.index != QueueFamilyProps::InvalidIndex) && (extractedInfo.queueFamilyProps.transfer.index != QueueFamilyProps::InvalidIndex)) isGPUSuitable = true; } if(isGPUSuitable) { // find the first suitable GPU ret = i; break; } } if(ret == ~0u) { //_NBL_DEBUG_BREAK_IF(true); ret = 0; } return ret; } template <typename FeatureType> struct SFeatureRequest { uint32_t count = 0u; FeatureType* features = nullptr; }; struct InitOutput { enum E_QUEUE_TYPE { EQT_GRAPHICS = 0, EQT_COMPUTE, EQT_TRANSFER_UP, EQT_TRANSFER_DOWN, EQT_COUNT }; static constexpr uint32_t MaxQueuesInFamily = 32; static constexpr uint32_t MaxQueuesCount = EQT_COUNT; static constexpr uint32_t MaxSwapChainImageCount = 4; nbl::core::smart_refctd_ptr<nbl::ui::IWindow> window; nbl::core::smart_refctd_ptr<CommonAPIEventCallback> windowCb; nbl::core::smart_refctd_ptr<nbl::video::IAPIConnection> apiConnection; nbl::core::smart_refctd_ptr<nbl::video::ISurface> surface; nbl::core::smart_refctd_ptr<nbl::video::IUtilities> utilities; nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice> logicalDevice; nbl::video::IPhysicalDevice* physicalDevice; std::array<nbl::video::IGPUQueue*, MaxQueuesCount> queues = { nullptr, nullptr, nullptr, nullptr }; std::array<nbl::core::smart_refctd_ptr<nbl::video::IGPUCommandPool>, MaxQueuesCount> commandPools; // TODO: Multibuffer and reset the commandpools nbl::core::smart_refctd_ptr<nbl::video::ISwapchain> swapchain; nbl::core::smart_refctd_ptr<nbl::video::IGPURenderpass> renderpass; std::array<nbl::core::smart_refctd_ptr<nbl::video::IGPUFramebuffer>, MaxSwapChainImageCount> fbo; nbl::core::smart_refctd_ptr<nbl::system::ISystem> system; nbl::core::smart_refctd_ptr<nbl::asset::IAssetManager> assetManager; nbl::video::IGPUObjectFromAssetConverter::SParams cpu2gpuParams; nbl::core::smart_refctd_ptr<nbl::system::ILogger> logger; nbl::core::smart_refctd_ptr<InputSystem> inputSystem; }; template<typename AppClassName> static void main(int argc, char** argv) { #ifndef _NBL_PLATFORM_ANDROID_ nbl::system::path CWD = nbl::system::path(argv[0]).parent_path().generic_string() + "/"; nbl::system::path sharedInputCWD = CWD / "../../media/"; nbl::system::path sharedOutputCWD = CWD / "../../tmp/";; nbl::system::path localInputCWD = CWD / "../assets"; nbl::system::path localOutputCWD = CWD; auto app = nbl::core::make_smart_refctd_ptr<AppClassName>(localInputCWD, localOutputCWD, sharedInputCWD, sharedOutputCWD); for (size_t i = 0; i < argc; ++i) app->argv.push_back(std::string(argv[i])); app->onAppInitialized(); while (app->keepRunning()) { app->workLoopBody(); } app->onAppTerminated(); #endif } #ifdef _NBL_PLATFORM_ANDROID_ static void recreateSurface(nbl::ui::CGraphicalApplicationAndroid* framework) { using namespace nbl; android_app* app = framework->getApp(); auto apiConnection = framework->getAPIConnection(); auto window = framework->getWindow(); auto logicalDevice = framework->getLogicalDevice(); auto surface = nbl::video::CSurfaceGLAndroid::create(nbl::core::smart_refctd_ptr<nbl::video::COpenGLESConnection>((nbl::video::COpenGLESConnection*)apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowAndroid>(static_cast<nbl::ui::IWindowAndroid*>(window))); auto renderpass = framework->getRenderpass(); nbl::asset::E_FORMAT depthFormat = framework->getDepthFormat(); framework->setSurface(surface); uint32_t width = ANativeWindow_getWidth(app->window); uint32_t height = ANativeWindow_getHeight(app->window); uint32_t scImageCount = framework->getSwapchainImageCount(); nbl::video::ISurface::SFormat requestedFormat; // Temporary to make previous examples work requestedFormat.format = nbl::asset::EF_R8G8B8A8_SRGB; requestedFormat.colorSpace.eotf = nbl::asset::EOTF_sRGB; requestedFormat.colorSpace.primary = nbl::asset::ECP_SRGB; auto gpus = apiConnection->getPhysicalDevices(); assert(!gpus.empty()); auto extractedInfos = extractGPUInfos(gpus, surface); auto suitableGPUIndex = findSuitableGPU(extractedInfos, true); auto gpu = gpus.begin()[suitableGPUIndex]; const auto& gpuInfo = extractedInfos[suitableGPUIndex]; auto swapchain = createSwapchain(nbl::video::EAT_OPENGL_ES, gpuInfo, scImageCount, width, height, nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>(logicalDevice), surface, nbl::asset::IImage::E_USAGE_FLAGS::EUF_NONE, nbl::video::ISurface::EPM_FIFO_RELAXED, requestedFormat ); auto fbo = [&]() { auto fbos = createFBOWithSwapchainImages(scImageCount, width, height, nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>(logicalDevice), swapchain, nbl::core::smart_refctd_ptr<nbl::video::IGPURenderpass>(renderpass), depthFormat ); std::vector<nbl::core::smart_refctd_ptr<video::IGPUFramebuffer>> data; for(auto it : fbos) data.push_back(it); return data; }(); framework->setSwapchain(std::move(swapchain)); framework->setFBOs(fbo); } #endif template<bool gpuInit = true, class EventCallback = CommonAPIEventCallback> static void Init( InitOutput& result, nbl::video::E_API_TYPE api_type, const std::string_view app_name, const SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE>& requiredInstanceFeatures, const SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE>& optionalInstanceFeatures, const SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE>& requiredDeviceFeatures, const SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE>& optionalDeviceFeatures, uint32_t window_width = 0u, uint32_t window_height = 0u, uint32_t sc_image_count = 0u, nbl::asset::IImage::E_USAGE_FLAGS swapchainImageUsage = nbl::asset::IImage::E_USAGE_FLAGS::EUF_NONE, nbl::video::ISurface::SFormat surfaceFormat = nbl::video::ISurface::SFormat(nbl::asset::EF_UNKNOWN, nbl::asset::ECP_COUNT, nbl::asset::EOTF_UNKNOWN), nbl::asset::E_FORMAT depthFormat = nbl::asset::EF_UNKNOWN) { using namespace nbl; using namespace nbl::video; bool headlessCompute = (swapchainImageUsage == nbl::asset::IImage::E_USAGE_FLAGS::EUF_NONE || sc_image_count <= 0u || window_width <= 0u || window_height <= 0u); auto logLevelMask = nbl::core::bitflag(system::ILogger::ELL_DEBUG) | system::ILogger::ELL_PERFORMANCE | system::ILogger::ELL_WARNING | system::ILogger::ELL_ERROR | system::ILogger::ELL_INFO; #ifdef _NBL_PLATFORM_WINDOWS_ result.system = createSystem(); result.logger = nbl::core::make_smart_refctd_ptr<system::CColoredStdoutLoggerWin32>(logLevelMask); // we should let user choose it? #elif defined(_NBL_PLATFORM_ANDROID_) result.logger = nbl::core::make_smart_refctd_ptr<system::CStdoutLoggerAndroid>(logLevelMask); // we should let user choose it? #endif result.inputSystem = nbl::core::make_smart_refctd_ptr<InputSystem>(system::logger_opt_smart_ptr(nbl::core::smart_refctd_ptr(result.logger))); result.assetManager = nbl::core::make_smart_refctd_ptr<nbl::asset::IAssetManager>(nbl::core::smart_refctd_ptr(result.system)); // we should let user choose it? if(!headlessCompute) { #ifndef _NBL_PLATFORM_ANDROID_ auto windowManager = nbl::core::make_smart_refctd_ptr<nbl::ui::CWindowManagerWin32>(); // should we store it in result? result.windowCb = nbl::core::make_smart_refctd_ptr<EventCallback>(nbl::core::smart_refctd_ptr(result.inputSystem), system::logger_opt_smart_ptr(nbl::core::smart_refctd_ptr(result.logger))); nbl::ui::IWindow::SCreationParams windowsCreationParams; windowsCreationParams.width = window_width; windowsCreationParams.height = window_height; windowsCreationParams.x = 64u; windowsCreationParams.y = 64u; windowsCreationParams.system = nbl::core::smart_refctd_ptr(result.system); windowsCreationParams.flags = nbl::ui::IWindow::ECF_NONE; windowsCreationParams.windowCaption = app_name.data(); windowsCreationParams.callback = result.windowCb; result.window = windowManager->createWindow(std::move(windowsCreationParams)); result.windowCb->setInputSystem(nbl::core::smart_refctd_ptr(result.inputSystem)); #else result.windowCb = nbl::core::smart_refctd_ptr<EventCallback>((CommonAPIEventCallback*)result.window->getEventCallback()); result.windowCb->setInputSystem(nbl::core::smart_refctd_ptr(result.inputSystem)); #endif } if constexpr (gpuInit) { if (api_type == EAT_VULKAN) { auto _apiConnection = nbl::video::CVulkanConnection::create( nbl::core::smart_refctd_ptr(result.system), 0, app_name.data(), requiredInstanceFeatures.count, requiredInstanceFeatures.features, optionalInstanceFeatures.count, optionalInstanceFeatures.features, nbl::core::smart_refctd_ptr(result.logger), true); if(!headlessCompute) { #ifdef _NBL_PLATFORM_WINDOWS_ result.surface = nbl::video::CSurfaceVulkanWin32::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowWin32>(static_cast<nbl::ui::IWindowWin32*>(result.window.get()))); #elif defined(_NBL_PLATFORM_ANDROID_) ////result.surface = nbl::video::CSurfaceVulkanAndroid::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowAndroid>(static_cast<nbl::ui::IWindowAndroid*>(result.window.get()))); #endif } result.apiConnection = _apiConnection; } else if (api_type == EAT_OPENGL) { auto _apiConnection = nbl::video::COpenGLConnection::create(nbl::core::smart_refctd_ptr(result.system), 0, app_name.data(), nbl::video::COpenGLDebugCallback(nbl::core::smart_refctd_ptr(result.logger))); if(!headlessCompute) { #ifdef _NBL_PLATFORM_WINDOWS_ result.surface = nbl::video::CSurfaceGLWin32::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowWin32>(static_cast<nbl::ui::IWindowWin32*>(result.window.get()))); #elif defined(_NBL_PLATFORM_ANDROID_) result.surface = nbl::video::CSurfaceGLAndroid::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowAndroid>(static_cast<nbl::ui::IWindowAndroid*>(result.window.get()))); #endif } result.apiConnection = _apiConnection; } else if (api_type == EAT_OPENGL_ES) { auto _apiConnection = nbl::video::COpenGLESConnection::create(nbl::core::smart_refctd_ptr(result.system), 0, app_name.data(), nbl::video::COpenGLDebugCallback(nbl::core::smart_refctd_ptr(result.logger))); if(!headlessCompute) { #ifdef _NBL_PLATFORM_WINDOWS_ result.surface = nbl::video::CSurfaceGLWin32::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowWin32>(static_cast<nbl::ui::IWindowWin32*>(result.window.get()))); #elif defined(_NBL_PLATFORM_ANDROID_) result.surface = nbl::video::CSurfaceGLAndroid::create(nbl::core::smart_refctd_ptr(_apiConnection), nbl::core::smart_refctd_ptr<nbl::ui::IWindowAndroid>(static_cast<nbl::ui::IWindowAndroid*>(result.window.get()))); #endif } result.apiConnection = _apiConnection; } else { _NBL_TODO(); } auto gpus = result.apiConnection->getPhysicalDevices(); assert(!gpus.empty()); auto extractedInfos = extractGPUInfos(gpus, result.surface, headlessCompute); auto suitableGPUIndex = findSuitableGPU(extractedInfos, headlessCompute); auto gpu = gpus.begin()[suitableGPUIndex]; const auto& gpuInfo = extractedInfos[suitableGPUIndex]; // Fill QueueCreationParams constexpr uint32_t MaxQueuesInFamily = 32; float queuePriorities[MaxQueuesInFamily]; std::fill(queuePriorities, queuePriorities + MaxQueuesInFamily, IGPUQueue::DEFAULT_QUEUE_PRIORITY); constexpr uint32_t MaxQueueFamilyCount = 4; nbl::video::ILogicalDevice::SQueueCreationParams qcp[MaxQueueFamilyCount] = {}; uint32_t actualQueueParamsCount = 0u; uint32_t queuesIndexInFamily[InitOutput::EQT_COUNT]; uint32_t presentQueueIndexInFamily = 0u; // Graphics Queue if(!headlessCompute) { uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.graphics.dedicatedQueueCount; assert(dedicatedQueuesInFamily >= 1u); qcp[0].familyIndex = gpuInfo.queueFamilyProps.graphics.index; qcp[0].count = dedicatedQueuesInFamily; qcp[0].flags = static_cast<nbl::video::IGPUQueue::E_CREATE_FLAGS>(0); qcp[0].priorities = queuePriorities; queuesIndexInFamily[InitOutput::EQT_GRAPHICS] = 0u; actualQueueParamsCount++; } // Compute Queue bool foundComputeInOtherFamily = false; for(uint32_t i = 0; i < actualQueueParamsCount; ++i) { auto& otherQcp = qcp[i]; uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.compute.dedicatedQueueCount; if(otherQcp.familyIndex == gpuInfo.queueFamilyProps.compute.index) { if(dedicatedQueuesInFamily >= 1) { queuesIndexInFamily[InitOutput::EQT_COMPUTE] = otherQcp.count + 0u; } else { queuesIndexInFamily[InitOutput::EQT_COMPUTE] = 0u; } otherQcp.count += dedicatedQueuesInFamily; foundComputeInOtherFamily = true; break; // If works correctly no need to check other family indices as they are unique } } if(!foundComputeInOtherFamily) { uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.compute.dedicatedQueueCount; assert(dedicatedQueuesInFamily == 1u); queuesIndexInFamily[InitOutput::EQT_COMPUTE] = 0u; auto & computeQcp = qcp[actualQueueParamsCount]; computeQcp.familyIndex = gpuInfo.queueFamilyProps.compute.index; computeQcp.count = dedicatedQueuesInFamily; computeQcp.flags = static_cast<nbl::video::IGPUQueue::E_CREATE_FLAGS>(0); computeQcp.priorities = queuePriorities; actualQueueParamsCount++; } // Transfer Queue bool foundTransferInOtherFamily = false; for(uint32_t i = 0; i < actualQueueParamsCount; ++i) { auto& otherQcp = qcp[i]; uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.transfer.dedicatedQueueCount; if(otherQcp.familyIndex == gpuInfo.queueFamilyProps.transfer.index) { if(dedicatedQueuesInFamily >= 2u) { queuesIndexInFamily[InitOutput::EQT_TRANSFER_UP] = otherQcp.count + 0u; queuesIndexInFamily[InitOutput::EQT_TRANSFER_DOWN] = otherQcp.count + 1u; } else if(dedicatedQueuesInFamily >= 1u) { queuesIndexInFamily[InitOutput::EQT_TRANSFER_UP] = otherQcp.count + 0u; queuesIndexInFamily[InitOutput::EQT_TRANSFER_DOWN] = otherQcp.count + 0u; } else if(dedicatedQueuesInFamily == 0u) { queuesIndexInFamily[InitOutput::EQT_TRANSFER_UP] = 0u; queuesIndexInFamily[InitOutput::EQT_TRANSFER_DOWN] = 0u; } otherQcp.count += dedicatedQueuesInFamily; foundTransferInOtherFamily = true; break; // If works correctly no need to check other family indices as they are unique } } if(!foundTransferInOtherFamily) { uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.transfer.dedicatedQueueCount; assert(dedicatedQueuesInFamily >= 1u); if(dedicatedQueuesInFamily >= 2u) { queuesIndexInFamily[InitOutput::EQT_TRANSFER_UP] = 0u; queuesIndexInFamily[InitOutput::EQT_TRANSFER_DOWN] = 1u; } else if(dedicatedQueuesInFamily >= 1u) { queuesIndexInFamily[InitOutput::EQT_TRANSFER_UP] = 0u; queuesIndexInFamily[InitOutput::EQT_TRANSFER_DOWN] = 0u; } else { assert(false); } auto & transferQcp = qcp[actualQueueParamsCount]; transferQcp.familyIndex = gpuInfo.queueFamilyProps.transfer.index; transferQcp.count = dedicatedQueuesInFamily; transferQcp.flags = static_cast<nbl::video::IGPUQueue::E_CREATE_FLAGS>(0); transferQcp.priorities = queuePriorities; actualQueueParamsCount++; } // Present Queue if(!headlessCompute) { bool foundPresentInOtherFamily = false; for(uint32_t i = 0; i < actualQueueParamsCount; ++i) { auto& otherQcp = qcp[i]; if(otherQcp.familyIndex == gpuInfo.queueFamilyProps.present.index) { if(otherQcp.familyIndex == gpuInfo.queueFamilyProps.graphics.index) { presentQueueIndexInFamily = 0u; } else { uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.present.dedicatedQueueCount; if(dedicatedQueuesInFamily >= 1u) { presentQueueIndexInFamily = otherQcp.count + 0u; } else if(dedicatedQueuesInFamily == 0u) { presentQueueIndexInFamily = 0u; } otherQcp.count += dedicatedQueuesInFamily; } foundPresentInOtherFamily = true; break; // If works correctly no need to check other family indices as they are unique } } if(!foundPresentInOtherFamily) { uint32_t dedicatedQueuesInFamily = gpuInfo.queueFamilyProps.present.dedicatedQueueCount; assert(dedicatedQueuesInFamily == 1u); presentQueueIndexInFamily = 0u; auto & presentQcp = qcp[actualQueueParamsCount]; presentQcp.familyIndex = gpuInfo.queueFamilyProps.present.index; presentQcp.count = dedicatedQueuesInFamily; presentQcp.flags = static_cast<nbl::video::IGPUQueue::E_CREATE_FLAGS>(0); presentQcp.priorities = queuePriorities; actualQueueParamsCount++; } } nbl::video::ILogicalDevice::SCreationParams dev_params; dev_params.queueParamsCount = actualQueueParamsCount; dev_params.queueParams = qcp; dev_params.requiredFeatureCount = requiredDeviceFeatures.count; dev_params.requiredFeatures = requiredDeviceFeatures.features; dev_params.optionalFeatureCount = optionalDeviceFeatures.count; dev_params.optionalFeatures = optionalDeviceFeatures.features; result.logicalDevice = gpu->createLogicalDevice(dev_params); result.utilities = nbl::core::make_smart_refctd_ptr<nbl::video::IUtilities>(nbl::core::smart_refctd_ptr(result.logicalDevice)); if(!headlessCompute) result.queues[InitOutput::EQT_GRAPHICS] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.graphics.index, queuesIndexInFamily[InitOutput::EQT_GRAPHICS]); result.queues[InitOutput::EQT_COMPUTE] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.compute.index, queuesIndexInFamily[InitOutput::EQT_COMPUTE]); // TEMP_FIX #ifdef EXAMPLES_CAN_HANDLE_TRANSFER_WITHOUT_GRAPHICS result.queues[InitOutput::EQT_TRANSFER_UP] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.transfer.index, queuesIndexInFamily[EQT_TRANSFER_UP]); result.queues[InitOutput::EQT_TRANSFER_DOWN] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.transfer.index, queuesIndexInFamily[EQT_TRANSFER_DOWN]); #else if(!headlessCompute) { result.queues[InitOutput::EQT_TRANSFER_UP] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.graphics.index, 0u); result.queues[InitOutput::EQT_TRANSFER_DOWN] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.graphics.index, 0u); } else { result.queues[InitOutput::EQT_TRANSFER_UP] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.compute.index, queuesIndexInFamily[InitOutput::EQT_COMPUTE]); result.queues[InitOutput::EQT_TRANSFER_DOWN] = result.logicalDevice->getQueue(gpuInfo.queueFamilyProps.compute.index, queuesIndexInFamily[InitOutput::EQT_COMPUTE]); } #endif if(!headlessCompute) { nbl::video::ISurface::SFormat requestedFormat = surfaceFormat; if(api_type == EAT_VULKAN) { if (requestedFormat.format == nbl::asset::EF_UNKNOWN || requestedFormat.format == asset::EF_R8G8B8A8_SRGB) { requestedFormat.format = nbl::asset::EF_B8G8R8A8_SRGB; requestedFormat.colorSpace.eotf = nbl::asset::EOTF_sRGB; requestedFormat.colorSpace.primary = nbl::asset::ECP_SRGB; } } else { if (requestedFormat.format == nbl::asset::EF_UNKNOWN) { requestedFormat.format = nbl::asset::EF_R8G8B8A8_SRGB; requestedFormat.colorSpace.eotf = nbl::asset::EOTF_sRGB; requestedFormat.colorSpace.primary = nbl::asset::ECP_SRGB; } } result.swapchain = createSwapchain(api_type, gpuInfo, sc_image_count, window_width, window_height, result.logicalDevice, result.surface, swapchainImageUsage, nbl::video::ISurface::EPM_FIFO_RELAXED, requestedFormat); assert(result.swapchain); nbl::asset::E_FORMAT swapChainFormat = result.swapchain->getCreationParameters().surfaceFormat.format; result.renderpass = createRenderpass(result.logicalDevice, swapChainFormat, depthFormat); result.fbo = createFBOWithSwapchainImages(result.swapchain->getImageCount(), window_width, window_height, result.logicalDevice, result.swapchain, result.renderpass, depthFormat); } for(uint32_t i = 0; i < InitOutput::EQT_COUNT; ++i) { const IGPUQueue* queue = result.queues[i]; if(queue != nullptr) { result.commandPools[i] = result.logicalDevice->createCommandPool(queue->getFamilyIndex(), IGPUCommandPool::ECF_RESET_COMMAND_BUFFER_BIT); assert(result.commandPools[i]); } } result.physicalDevice = gpu; uint32_t mainQueueFamilyIndex = (headlessCompute) ? gpuInfo.queueFamilyProps.compute.index : gpuInfo.queueFamilyProps.graphics.index; result.cpu2gpuParams.assetManager = result.assetManager.get(); result.cpu2gpuParams.device = result.logicalDevice.get(); result.cpu2gpuParams.finalQueueFamIx = mainQueueFamilyIndex; result.cpu2gpuParams.limits = result.physicalDevice->getLimits(); result.cpu2gpuParams.pipelineCache = nullptr; result.cpu2gpuParams.sharingMode = nbl::asset::ESM_EXCLUSIVE; result.cpu2gpuParams.utilities = result.utilities.get(); result.cpu2gpuParams.perQueue[nbl::video::IGPUObjectFromAssetConverter::EQU_TRANSFER].queue = result.queues[InitOutput::EQT_TRANSFER_UP]; result.cpu2gpuParams.perQueue[nbl::video::IGPUObjectFromAssetConverter::EQU_COMPUTE].queue = result.queues[InitOutput::EQT_COMPUTE]; const uint32_t transferUpQueueFamIndex = result.queues[InitOutput::EQT_TRANSFER_UP]->getFamilyIndex(); const uint32_t computeQueueFamIndex = result.queues[InitOutput::EQT_COMPUTE]->getFamilyIndex(); auto pool_transfer = result.logicalDevice->createCommandPool(transferUpQueueFamIndex, IGPUCommandPool::ECF_RESET_COMMAND_BUFFER_BIT); nbl::core::smart_refctd_ptr<IGPUCommandPool> pool_compute; if(transferUpQueueFamIndex == computeQueueFamIndex) pool_compute = pool_transfer; else pool_compute = result.logicalDevice->createCommandPool(result.queues[InitOutput::EQT_COMPUTE]->getFamilyIndex(), IGPUCommandPool::ECF_RESET_COMMAND_BUFFER_BIT); nbl::core::smart_refctd_ptr<IGPUCommandBuffer> transferCmdBuffer; nbl::core::smart_refctd_ptr<IGPUCommandBuffer> computeCmdBuffer; result.logicalDevice->createCommandBuffers(pool_transfer.get(), IGPUCommandBuffer::EL_PRIMARY, 1u, &transferCmdBuffer); result.logicalDevice->createCommandBuffers(pool_compute.get(), IGPUCommandBuffer::EL_PRIMARY, 1u, &computeCmdBuffer); result.cpu2gpuParams.perQueue[IGPUObjectFromAssetConverter::EQU_TRANSFER].cmdbuf = transferCmdBuffer; result.cpu2gpuParams.perQueue[IGPUObjectFromAssetConverter::EQU_COMPUTE].cmdbuf = computeCmdBuffer; } else { result.cpu2gpuParams.device = nullptr; result.cpu2gpuParams.finalQueueFamIx = 0u; result.cpu2gpuParams.limits = {}; result.cpu2gpuParams.pipelineCache = nullptr; result.cpu2gpuParams.sharingMode = nbl::asset::ESM_EXCLUSIVE; result.cpu2gpuParams.utilities = nullptr; } } // Usefull Abstraction for initializing with no extension template<bool gpuInit = true, class EventCallback = CommonAPIEventCallback> static void InitWithNoExt( InitOutput& result, nbl::video::E_API_TYPE api_type, const std::string_view app_name) { SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> requiredInstanceFeatures = {}; SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> optionalInstanceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> requiredDeviceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> optionalDeviceFeatures = {}; Init<gpuInit, EventCallback>( result, api_type, app_name, requiredInstanceFeatures, optionalInstanceFeatures, requiredDeviceFeatures, optionalDeviceFeatures); } // Usefull Abstraction for most examples that only need to init with default swapchain and surface extension and nothing more. template<bool gpuInit = true, class EventCallback = CommonAPIEventCallback> static void InitWithDefaultExt( InitOutput& result, nbl::video::E_API_TYPE api_type, const std::string_view app_name, uint32_t window_width = 0u, uint32_t window_height = 0u, uint32_t sc_image_count = 0u, nbl::asset::IImage::E_USAGE_FLAGS swapchainImageUsage = nbl::asset::IImage::E_USAGE_FLAGS::EUF_NONE, nbl::video::ISurface::SFormat surfaceFormat = nbl::video::ISurface::SFormat(nbl::asset::EF_UNKNOWN, nbl::asset::ECP_COUNT, nbl::asset::EOTF_UNKNOWN), nbl::asset::E_FORMAT depthFormat = nbl::asset::EF_UNKNOWN) { SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> requiredInstanceFeatures = {}; SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> optionalInstanceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> requiredDeviceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> optionalDeviceFeatures = {}; #ifndef _NBL_PLATFORM_ANDROID_ nbl::video::IAPIConnection::E_FEATURE requiredFeatures_Instance[] = { nbl::video::IAPIConnection::EF_SURFACE }; requiredInstanceFeatures.features = requiredFeatures_Instance; requiredInstanceFeatures.count = 1u; nbl::video::ILogicalDevice::E_FEATURE requiredFeatures_Device[] = { nbl::video::ILogicalDevice::EF_SWAPCHAIN }; requiredDeviceFeatures.features = requiredFeatures_Device; requiredDeviceFeatures.count = 1u; #endif Init<gpuInit, EventCallback>( result, api_type, app_name, requiredInstanceFeatures, optionalInstanceFeatures, requiredDeviceFeatures, optionalDeviceFeatures, window_width, window_height, sc_image_count, swapchainImageUsage, surfaceFormat, depthFormat); } // Usefull Abstraction for Raytracing Examples template<bool gpuInit = true, class EventCallback = CommonAPIEventCallback> static void InitWithRaytracingExt( InitOutput& result, nbl::video::E_API_TYPE api_type, const std::string_view app_name, uint32_t window_width = 0u, uint32_t window_height = 0u, uint32_t sc_image_count = 0u, nbl::asset::IImage::E_USAGE_FLAGS swapchainImageUsage = nbl::asset::IImage::E_USAGE_FLAGS::EUF_NONE, nbl::video::ISurface::SFormat surfaceFormat = nbl::video::ISurface::SFormat(nbl::asset::EF_UNKNOWN, nbl::asset::ECP_COUNT, nbl::asset::EOTF_UNKNOWN), nbl::asset::E_FORMAT depthFormat = nbl::asset::EF_UNKNOWN) { SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> requiredInstanceFeatures = {}; SFeatureRequest<nbl::video::IAPIConnection::E_FEATURE> optionalInstanceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> requiredDeviceFeatures = {}; SFeatureRequest<nbl::video::ILogicalDevice::E_FEATURE> optionalDeviceFeatures = {}; #ifndef _NBL_PLATFORM_ANDROID_ nbl::video::IAPIConnection::E_FEATURE requiredFeatures_Instance[] = { nbl::video::IAPIConnection::EF_SURFACE }; requiredInstanceFeatures.features = requiredFeatures_Instance; requiredInstanceFeatures.count = 1u; nbl::video::ILogicalDevice::E_FEATURE requiredFeatures_Device[] = { nbl::video::ILogicalDevice::EF_SWAPCHAIN, nbl::video::ILogicalDevice::EF_ACCELERATION_STRUCTURE, nbl::video::ILogicalDevice::EF_RAY_QUERY }; requiredDeviceFeatures.features = requiredFeatures_Device; requiredDeviceFeatures.count = 3u; #endif Init<gpuInit, EventCallback>( result, api_type, app_name, requiredInstanceFeatures, optionalInstanceFeatures, requiredDeviceFeatures, optionalDeviceFeatures, window_width, window_height, sc_image_count, swapchainImageUsage, surfaceFormat, depthFormat); } static nbl::core::smart_refctd_ptr<nbl::video::ISwapchain> createSwapchain( nbl::video::E_API_TYPE api_type, const GPUInfo& gpuInfo, uint32_t& imageCount, uint32_t width, uint32_t height, const nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>& device, const nbl::core::smart_refctd_ptr<nbl::video::ISurface>& surface, nbl::asset::IImage::E_USAGE_FLAGS imageUsage, nbl::video::ISurface::E_PRESENT_MODE requestedPresentMode = nbl::video::ISurface::EPM_FIFO_RELAXED, nbl::video::ISurface::SFormat requestedSurfaceFormat = nbl::video::ISurface::SFormat(nbl::asset::EF_B8G8R8A8_SRGB, nbl::asset::ECP_SRGB, nbl::asset::EOTF_sRGB)) { using namespace nbl; asset::E_SHARING_MODE imageSharingMode; if (gpuInfo.queueFamilyProps.graphics.index == gpuInfo.queueFamilyProps.present.index) imageSharingMode = asset::ESM_EXCLUSIVE; else imageSharingMode = asset::ESM_CONCURRENT; nbl::video::ISurface::SFormat surfaceFormat; if(api_type == nbl::video::EAT_VULKAN) { // Deduce format features from imageUsage param nbl::video::IPhysicalDevice::SFormatImageUsage requiredFormatUsages = {}; if (imageUsage & asset::IImage::EUF_STORAGE_BIT) requiredFormatUsages.storageImage = 1; _NBL_DEBUG_BREAK_IF((device->getPhysicalDevice()->getImageFormatUsagesOptimal(requestedSurfaceFormat.format) & requiredFormatUsages) != requiredFormatUsages); // requested format doesn't support requiredFormatFeatures for TILING_OPTIMAL uint32_t found_format_and_colorspace = ~0u; uint32_t found_format = ~0u; uint32_t found_colorspace = ~0u; for(uint32_t i = 0; i < gpuInfo.availableSurfaceFormats.size(); ++i) { const auto& supportedFormat = gpuInfo.availableSurfaceFormats[i]; const bool hasMatchingFormats = requestedSurfaceFormat.format == supportedFormat.format; const bool hasMatchingColorspace = requestedSurfaceFormat.colorSpace.eotf == supportedFormat.colorSpace.eotf && requestedSurfaceFormat.colorSpace.primary == supportedFormat.colorSpace.primary; const auto supportedFormatUsages = device->getPhysicalDevice()->getImageFormatUsagesOptimal(supportedFormat.format); const bool supportedFormatSupportsFeatures = ((supportedFormatUsages & requiredFormatUsages) == requiredFormatUsages); if(!supportedFormatSupportsFeatures) continue; if(hasMatchingFormats) { if(found_format == ~0u) found_format = i; if(hasMatchingColorspace) { found_format_and_colorspace = i; break; } } else if (hasMatchingColorspace) { // format with matching eotf and colorspace, but with wider bitdepth is an acceptable substitute uint32_t supportedFormatChannelCount = getFormatChannelCount(supportedFormat.format); uint32_t requestedFormatChannelCount = getFormatChannelCount(requestedSurfaceFormat.format); if(supportedFormatChannelCount >= requestedFormatChannelCount) { bool channelsMatch = true; for(uint32_t c = 0; c < requestedFormatChannelCount; ++c) { float requestedFormatChannelPrecision = getFormatPrecision<float>(requestedSurfaceFormat.format, c, 0.0f); float supportedFormatChannelPrecision = getFormatPrecision<float>(supportedFormat.format, c, 0.0f); if(supportedFormatChannelPrecision < requestedFormatChannelPrecision) { channelsMatch = false; break; } } if(channelsMatch) found_colorspace = i; } } } if(found_format_and_colorspace != ~0u) { surfaceFormat = gpuInfo.availableSurfaceFormats[found_format_and_colorspace]; } else if(found_format != ~0u) // fallback { _NBL_DEBUG_BREAK_IF(true); // "Fallback: requested 'colorspace' is not supported." surfaceFormat = gpuInfo.availableSurfaceFormats[found_format]; } else if(found_colorspace != ~0u) // fallback { _NBL_DEBUG_BREAK_IF(true); // "Fallback: requested 'format' was not supported, but same colorspace and wider bitdepth was chosen." surfaceFormat = gpuInfo.availableSurfaceFormats[found_colorspace]; } else { _NBL_DEBUG_BREAK_IF(true); // "Fallback: requested 'format' and 'colorspace' is not supported." surfaceFormat = gpuInfo.availableSurfaceFormats[0]; } bool presentModeSupported = (gpuInfo.availablePresentModes & requestedPresentMode) != 0; if(!presentModeSupported) // fallback { requestedPresentMode = nbl::video::ISurface::E_PRESENT_MODE::EPM_FIFO; _NBL_DEBUG_BREAK_IF(true); // "Fallback: requested 'present mode' is not supported." } } else { surfaceFormat = requestedSurfaceFormat; } nbl::video::ISwapchain::SCreationParams sc_params = {}; sc_params.width = width; sc_params.height = height; sc_params.arrayLayers = 1u; sc_params.minImageCount = imageCount; sc_params.presentMode = requestedPresentMode; sc_params.imageUsage = imageUsage; sc_params.surface = surface; sc_params.imageSharingMode = imageSharingMode; sc_params.preTransform = nbl::video::ISurface::EST_IDENTITY_BIT; sc_params.compositeAlpha = nbl::video::ISurface::ECA_OPAQUE_BIT; sc_params.surfaceFormat = surfaceFormat; auto swapchain = device->createSwapchain(std::move(sc_params)); imageCount = swapchain->getImageCount(); return swapchain; } static nbl::core::smart_refctd_ptr<nbl::video::IGPURenderpass> createRenderpass(const nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>& device, nbl::asset::E_FORMAT colorAttachmentFormat, nbl::asset::E_FORMAT depthFormat) { using namespace nbl; bool useDepth = asset::isDepthOrStencilFormat(depthFormat); nbl::video::IGPURenderpass::SCreationParams::SAttachmentDescription attachments[2]; attachments[0].initialLayout = asset::EIL_UNDEFINED; attachments[0].finalLayout = asset::EIL_PRESENT_SRC; attachments[0].format = colorAttachmentFormat; attachments[0].samples = asset::IImage::ESCF_1_BIT; attachments[0].loadOp = nbl::video::IGPURenderpass::ELO_CLEAR; attachments[0].storeOp = nbl::video::IGPURenderpass::ESO_STORE; attachments[1].initialLayout = asset::EIL_UNDEFINED; attachments[1].finalLayout = asset::EIL_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; attachments[1].format = depthFormat; attachments[1].samples = asset::IImage::ESCF_1_BIT; attachments[1].loadOp = nbl::video::IGPURenderpass::ELO_CLEAR; attachments[1].storeOp = nbl::video::IGPURenderpass::ESO_STORE; nbl::video::IGPURenderpass::SCreationParams::SSubpassDescription::SAttachmentRef colorAttRef; colorAttRef.attachment = 0u; colorAttRef.layout = asset::EIL_COLOR_ATTACHMENT_OPTIMAL; nbl::video::IGPURenderpass::SCreationParams::SSubpassDescription::SAttachmentRef depthStencilAttRef; depthStencilAttRef.attachment = 1u; depthStencilAttRef.layout = asset::EIL_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; nbl::video::IGPURenderpass::SCreationParams::SSubpassDescription sp; sp.pipelineBindPoint = asset::EPBP_GRAPHICS; sp.colorAttachmentCount = 1u; sp.colorAttachments = &colorAttRef; if(useDepth) { sp.depthStencilAttachment = &depthStencilAttRef; } else { sp.depthStencilAttachment = nullptr; } sp.flags = nbl::video::IGPURenderpass::ESDF_NONE; sp.inputAttachmentCount = 0u; sp.inputAttachments = nullptr; sp.preserveAttachmentCount = 0u; sp.preserveAttachments = nullptr; sp.resolveAttachments = nullptr; nbl::video::IGPURenderpass::SCreationParams rp_params; rp_params.attachmentCount = (useDepth) ? 2u : 1u; rp_params.attachments = attachments; rp_params.dependencies = nullptr; rp_params.dependencyCount = 0u; rp_params.subpasses = &sp; rp_params.subpassCount = 1u; return device->createGPURenderpass(rp_params); } static auto createFBOWithSwapchainImages( size_t imageCount, uint32_t width, uint32_t height, const nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>& device, nbl::core::smart_refctd_ptr<nbl::video::ISwapchain> swapchain, nbl::core::smart_refctd_ptr<nbl::video::IGPURenderpass> renderpass, nbl::asset::E_FORMAT depthFormat = nbl::asset::EF_UNKNOWN)->std::array<nbl::core::smart_refctd_ptr<nbl::video::IGPUFramebuffer>, InitOutput::MaxSwapChainImageCount> { using namespace nbl; bool useDepth = asset::isDepthOrStencilFormat(depthFormat); std::array<nbl::core::smart_refctd_ptr<nbl::video::IGPUFramebuffer>, InitOutput::MaxSwapChainImageCount> fbo; auto sc_images = swapchain->getImages(); assert(sc_images.size() == imageCount); for (uint32_t i = 0u; i < imageCount; ++i) { nbl::core::smart_refctd_ptr<nbl::video::IGPUImageView> view[2] = {}; auto img = sc_images.begin()[i]; { nbl::video::IGPUImageView::SCreationParams view_params; view_params.format = img->getCreationParameters().format; view_params.viewType = asset::IImageView<nbl::video::IGPUImage>::ET_2D; view_params.subresourceRange.aspectMask = asset::IImage::EAF_COLOR_BIT; view_params.subresourceRange.baseMipLevel = 0u; view_params.subresourceRange.levelCount = 1u; view_params.subresourceRange.baseArrayLayer = 0u; view_params.subresourceRange.layerCount = 1u; view_params.image = std::move(img); view[0] = device->createGPUImageView(std::move(view_params)); assert(view[0]); } if(useDepth) { nbl::video::IGPUImage::SCreationParams imgParams; imgParams.flags = static_cast<asset::IImage::E_CREATE_FLAGS>(0u); imgParams.type = asset::IImage::ET_2D; imgParams.format = depthFormat; imgParams.extent = {width, height, 1}; imgParams.usage = asset::IImage::E_USAGE_FLAGS::EUF_DEPTH_STENCIL_ATTACHMENT_BIT; imgParams.mipLevels = 1u; imgParams.arrayLayers = 1u; imgParams.samples = asset::IImage::ESCF_1_BIT; nbl::core::smart_refctd_ptr<nbl::video::IGPUImage> depthImg = device->createDeviceLocalGPUImageOnDedMem(std::move(imgParams)); nbl::video::IGPUImageView::SCreationParams view_params; view_params.format = depthFormat; view_params.viewType = asset::IImageView<nbl::video::IGPUImage>::ET_2D; view_params.subresourceRange.aspectMask = asset::IImage::EAF_DEPTH_BIT; view_params.subresourceRange.baseMipLevel = 0u; view_params.subresourceRange.levelCount = 1u; view_params.subresourceRange.baseArrayLayer = 0u; view_params.subresourceRange.layerCount = 1u; view_params.image = std::move(depthImg); view[1] = device->createGPUImageView(std::move(view_params)); assert(view[1]); } nbl::video::IGPUFramebuffer::SCreationParams fb_params; fb_params.width = width; fb_params.height = height; fb_params.layers = 1u; fb_params.renderpass = renderpass; fb_params.flags = static_cast<nbl::video::IGPUFramebuffer::E_CREATE_FLAGS>(0); fb_params.attachmentCount = (useDepth) ? 2u : 1u; fb_params.attachments = view; fbo[i] = device->createGPUFramebuffer(std::move(fb_params)); assert(fbo[i]); } return fbo; } static constexpr nbl::asset::E_PIPELINE_STAGE_FLAGS DefaultSubmitWaitStage = nbl::asset::EPSF_COLOR_ATTACHMENT_OUTPUT_BIT; static void Submit(nbl::video::ILogicalDevice* device, nbl::video::ISwapchain* sc, nbl::video::IGPUCommandBuffer* cmdbuf, nbl::video::IGPUQueue* queue, nbl::video::IGPUSemaphore* const waitSemaphore, // usually the image acquire semaphore nbl::video::IGPUSemaphore* const renderFinishedSemaphore, nbl::video::IGPUFence* fence=nullptr, const nbl::core::bitflag<nbl::asset::E_PIPELINE_STAGE_FLAGS> waitDstStageMask=DefaultSubmitWaitStage // only matters if `waitSemaphore` not null ) { using namespace nbl; nbl::video::IGPUQueue::SSubmitInfo submit; { submit.commandBufferCount = 1u; submit.commandBuffers = &cmdbuf; nbl::video::IGPUSemaphore* signalsem = renderFinishedSemaphore; submit.signalSemaphoreCount = waitSemaphore ? 1u:0u; submit.pSignalSemaphores = &signalsem; nbl::video::IGPUSemaphore* waitsem = waitSemaphore; asset::E_PIPELINE_STAGE_FLAGS dstWait = waitDstStageMask.value; submit.waitSemaphoreCount = 1u; submit.pWaitSemaphores = &waitsem; submit.pWaitDstStageMask = &dstWait; queue->submit(1u,&submit,fence); } } static void Present(nbl::video::ILogicalDevice* device, nbl::video::ISwapchain* sc, nbl::video::IGPUQueue* queue, nbl::video::IGPUSemaphore* waitSemaphore, // usually the render finished semaphore uint32_t imageNum) { using namespace nbl; nbl::video::IGPUQueue::SPresentInfo present; { present.swapchainCount = 1u; present.imgIndices = &imageNum; nbl::video::ISwapchain* swapchain = sc; present.swapchains = &swapchain; present.waitSemaphoreCount = waitSemaphore ? 1u:0u; present.waitSemaphores = &waitSemaphore; queue->present(present); } } static std::pair<nbl::core::smart_refctd_ptr<nbl::video::IGPUImage>, nbl::core::smart_refctd_ptr<nbl::video::IGPUImageView>> createEmpty2DTexture( const nbl::core::smart_refctd_ptr<nbl::video::ILogicalDevice>& device, uint32_t width, uint32_t height, nbl::asset::E_FORMAT format = nbl::asset::E_FORMAT::EF_R8G8B8A8_UNORM) { nbl::video::IGPUImage::SCreationParams gpu_image_params; gpu_image_params.mipLevels = 1; gpu_image_params.extent = { width, height, 1 }; gpu_image_params.format = format; gpu_image_params.arrayLayers = 1u; gpu_image_params.type = nbl::asset::IImage::ET_2D; gpu_image_params.samples = nbl::asset::IImage::ESCF_1_BIT; gpu_image_params.flags = static_cast<nbl::asset::IImage::E_CREATE_FLAGS>(0u); nbl::core::smart_refctd_ptr image = device->createGPUImageOnDedMem(std::move(gpu_image_params), device->getDeviceLocalGPUMemoryReqs()); nbl::video::IGPUImageView::SCreationParams creation_params; creation_params.format = image->getCreationParameters().format; creation_params.image = image; creation_params.viewType = nbl::video::IGPUImageView::ET_2D; creation_params.subresourceRange = { static_cast<nbl::asset::IImage::E_ASPECT_FLAGS>(0u), 0, 1, 0, 1 }; creation_params.flags = static_cast<nbl::video::IGPUImageView::E_CREATE_FLAGS>(0u); nbl::core::smart_refctd_ptr image_view = device->createGPUImageView(std::move(creation_params)); return std::pair(image, image_view); } static int getQueueFamilyIndex(const nbl::video::IPhysicalDevice* gpu, uint32_t requiredQueueFlags) { auto props = gpu->getQueueFamilyProperties(); int currentIndex = 0; for (const auto& property : props) { if ((property.queueFlags.value & requiredQueueFlags) == requiredQueueFlags) { return currentIndex; } ++currentIndex; } return -1; } }; #ifndef _NBL_PLATFORM_ANDROID_ class GraphicalApplication : public nbl::system::IApplicationFramework, public nbl::ui::IGraphicalApplicationFramework { protected: ~GraphicalApplication() {} public: GraphicalApplication( const std::filesystem::path& _localInputCWD, const std::filesystem::path& _localOutputCWD, const std::filesystem::path& _sharedInputCWD, const std::filesystem::path& _sharedOutputCWD ) : nbl::system::IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} void recreateSurface() override { } }; #else class GraphicalApplication : public nbl::ui::CGraphicalApplicationAndroid { protected: ~GraphicalApplication() {} public: GraphicalApplication( android_app* app, JNIEnv* env, const std::filesystem::path& _localInputCWD, const std::filesystem::path& _localOutputCWD, const std::filesystem::path& _sharedInputCWD, const std::filesystem::path& _sharedOutputCWD ) : nbl::ui::CGraphicalApplicationAndroid(app, env, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} void recreateSurface() override { CommonAPI::recreateSurface(this); } }; #endif //***** Application framework macros ****** #ifdef _NBL_PLATFORM_ANDROID_ using ApplicationBase = GraphicalApplication; using NonGraphicalApplicationBase = nbl::system::CApplicationAndroid; #define APP_CONSTRUCTOR(type) type(android_app* app, JNIEnv* env, const nbl::system::path& _localInputCWD,\ const nbl::system::path& _localOutputCWD,\ const nbl::system::path& _sharedInputCWD,\ const nbl::system::path& _sharedOutputCWD) : ApplicationBase(app, env, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} #define NON_GRAPHICAL_APP_CONSTRUCTOR(type) type(android_app* app, JNIEnv* env, const nbl::system::path& _localInputCWD,\ const nbl::system::path& _localOutputCWD,\ const nbl::system::path& _sharedInputCWD,\ const nbl::system::path& _sharedOutputCWD) : NonGraphicalApplicationBase(app, env, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} #define NBL_COMMON_API_MAIN(android_app_class) NBL_ANDROID_MAIN_FUNC(android_app_class, CommonAPI::CommonAPIEventCallback) #else using ApplicationBase = GraphicalApplication; using NonGraphicalApplicationBase = nbl::system::IApplicationFramework; #define APP_CONSTRUCTOR(type) type(const nbl::system::path& _localInputCWD,\ const nbl::system::path& _localOutputCWD,\ const nbl::system::path& _sharedInputCWD,\ const nbl::system::path& _sharedOutputCWD) : ApplicationBase(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} #define NON_GRAPHICAL_APP_CONSTRUCTOR(type) type(const nbl::system::path& _localInputCWD,\ const nbl::system::path& _localOutputCWD,\ const nbl::system::path& _sharedInputCWD,\ const nbl::system::path& _sharedOutputCWD) : NonGraphicalApplicationBase(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {} #define NBL_COMMON_API_MAIN(app_class) int main(int argc, char** argv){\ CommonAPI::main<app_class>(argc, argv);\ } #endif //***** Application framework macros ******
41.648765
267
0.740077
[ "render", "vector" ]
39948d969ec2bc4a5e57319c12e3e7092ec0923e
27,128
c
C
src/NRCRoutines.c
tidymodels/survivalauc
936dbe5660f81feb365dd7d725eafba68eb3299a
[ "MIT" ]
1
2021-09-20T18:27:45.000Z
2021-09-20T18:27:45.000Z
src/NRCRoutines.c
tidymodels/survivalauc
936dbe5660f81feb365dd7d725eafba68eb3299a
[ "MIT" ]
1
2021-09-08T00:36:56.000Z
2021-09-08T00:36:56.000Z
src/NRCRoutines.c
tidymodels/survivalauc
936dbe5660f81feb365dd7d725eafba68eb3299a
[ "MIT" ]
null
null
null
#include "nrutil.h" #include <stdio.h> #include <stdlib.h> #include <math.h> #include <R.h> /* * Routines from Numerical Recipes in C */ #define NR_END 1 int ludcmp_flag, flag; void nrerror(char error_text[]) /* Numerical Recipes standard error handler */ { //fprintf(stderr,"Numerical Recipes run-time error...\n"); //fprintf(stderr,"%s\n",error_text); //fprintf(stderr,"...now exiting to system...\n"); //exit(1); } float *vector(long nl, long nh) /* allocate a float vector with subscript range v[nl..nh] */ { float *v; v=(float *)R_alloc((size_t) ((nh-nl+1+NR_END)), sizeof(float)); if (!v) nrerror("allocation failure in vector()"); return v-nl+NR_END; } int *ivector(long nl, long nh) /* allocate an int vector with subscript range v[nl..nh] */ { int *v; v=(int *)R_alloc((size_t) ((nh-nl+1+NR_END)), sizeof(int)); if (!v) nrerror("allocation failure in ivector()"); return v-nl+NR_END; } unsigned char *cvector(long nl, long nh) /* allocate an unsigned char vector with subscript range v[nl..nh] */ { unsigned char *v; v=(unsigned char *)R_alloc((size_t) ((nh-nl+1+NR_END)), sizeof(unsigned char)); if (!v) nrerror("allocation failure in cvector()"); return v-nl+NR_END; } unsigned long *lvector(long nl, long nh) /* allocate an unsigned long vector with subscript range v[nl..nh] */ { unsigned long *v; v=(unsigned long *)R_alloc((size_t) ((nh-nl+1+NR_END)), sizeof(long)); if (!v) nrerror("allocation failure in lvector()"); return v-nl+NR_END; } double *dvector(long nl, long nh) /* allocate a double vector with subscript range v[nl..nh] */ { double *v; v=(double *)R_alloc((size_t) ((nh-nl+1+NR_END)), sizeof(double)); if (!v) nrerror("allocation failure in dvector()"); return v-nl+NR_END; } double **dmatrix(long nrl, long nrh, long ncl, long nch) /* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; double **m; /* allocate pointers to rows */ m=(double **) R_alloc((size_t)((nrow+NR_END)), sizeof(double*)); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl]=(double *) R_alloc((size_t)((nrow*ncol+NR_END)), sizeof(double)); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; } int **imatrix(long nrl, long nrh, long ncl, long nch) /* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; int **m; /* allocate pointers to rows */ m=(int **) R_alloc((size_t)((nrow+NR_END)), sizeof(int*)); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl]=(int *) R_alloc((size_t)((nrow*ncol+NR_END)), sizeof(int)); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; } float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch, long newrl, long newcl) /* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */ { long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl; float **m; /* allocate array of pointers to rows */ m=(float **) R_alloc((size_t) ((nrow+NR_END)), sizeof(float*)); if (!m) nrerror("allocation failure in submatrix()"); m += NR_END; m -= newrl; /* set pointers to rows */ for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol; /* return pointer to array of pointers to rows */ return m; } double **subdmatrix(double **a, long oldrl, long oldrh, long oldcl, long oldch, long newrl, long newcl) /* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */ { long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl; double **m; /* allocate array of pointers to rows */ m=(double **) R_alloc((size_t) ((nrow+NR_END)), sizeof(double*)); if (!m) nrerror("allocation failure in submatrix()"); m += NR_END; m -= newrl; /* set pointers to rows */ for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol; /* return pointer to array of pointers to rows */ return m; } float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch) /* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1 and ncol=nch-ncl+1. The routine should be called with the address &a[0][0] as the first argument. */ { long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1; float **m; /* allocate pointers to rows */ m=(float **) R_alloc((size_t) ((nrow+NR_END)), sizeof(float*)); if (!m) nrerror("allocation failure in convert_matrix()"); m += NR_END; m -= nrl; /* set pointers to rows */ m[nrl]=a-ncl; for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol; /* return pointer to array of pointers to rows */ return m; } float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh) /* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */ { long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1; float ***t; /* allocate pointers to pointers to rows */ t=(float ***) R_alloc((size_t)((nrow+NR_END)), sizeof(float**)); if (!t) nrerror("allocation failure 1 in f3tensor()"); t += NR_END; t -= nrl; /* allocate pointers to rows and set pointers to them */ t[nrl]=(float **) R_alloc((size_t)((nrow*ncol+NR_END)), sizeof(float*)); if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()"); t[nrl] += NR_END; t[nrl] -= ncl; /* allocate rows and set pointers to them */ t[nrl][ncl]=(float *) R_alloc((size_t)((nrow*ncol*ndep+NR_END)), sizeof(float)); if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()"); t[nrl][ncl] += NR_END; t[nrl][ncl] -= ndl; for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep; for(i=nrl+1;i<=nrh;i++) { t[i]=t[i-1]+ncol; t[i][ncl]=t[i-1][ncl]+ncol*ndep; for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep; } /* return pointer to array of pointers to rows */ return t; } /* (C) Copr. 1986-92 Numerical Recipes Software 5.){2p491&.#@#Q0JS[. */ void lubksb(double **a, int n, int *indx, double b[]) { int i,ii=0,ip,j; double sum; for (i=1;i<=n;i++) { ip=indx[i]; sum=b[ip]; b[ip]=b[i]; if (ii) for (j=ii;j<=i-1;j++) sum -= a[i][j]*b[j]; else if (sum) ii=i; b[i]=sum; } for (i=n;i>=1;i--) { sum=b[i]; for (j=i+1;j<=n;j++) sum -= a[i][j]*b[j]; b[i]=sum/a[i][i]; } } void ludcmp(double **a, int n, int *indx, double *d) { int i,imax,j,k; double big,dum,sum,temp; double *vv, TINY = 1.0e-20; vv=dvector(1,n); *d=1.0; for (i=1;i<=n;i++) { big=0.0; for (j=1;j<=n;j++) if ((temp=fabs(a[i][j])) > big) big=temp; if (big == 0.0) nrerror("Singular matrix in routine ludcmp"); vv[i]=1.0/big; } for (j=1;j<=n;j++) { for (i=1;i<j;i++) { sum=a[i][j]; for (k=1;k<i;k++) sum -= a[i][k]*a[k][j]; a[i][j]=sum; } big=0.0; for (i=j;i<=n;i++) { sum=a[i][j]; for (k=1;k<j;k++) sum -= a[i][k]*a[k][j]; a[i][j]=sum; if ( (dum=vv[i]*fabs(sum)) >= big) { big=dum; imax=i; } } if (j != imax) { for (k=1;k<=n;k++) { dum=a[imax][k]; a[imax][k]=a[j][k]; a[j][k]=dum; } *d = -(*d); vv[imax]=vv[j]; } indx[j]=imax; if (a[j][j] == 0.0) a[j][j]=TINY; if (j != n) { dum=1.0/(a[j][j]); for (i=j+1;i<=n;i++) a[i][j] *= dum; } } } #define M1 259200 #define IA1 7141 #define IC1 54773 #define RM1 (1.0/M1) #define M2 134456 #define IA2 8121 #define IC2 28411 #define RM2 (1.0/M2) #define M3 243000 #define IA3 4561 #define IC3 51349 double ran1(idum) long *idum; { static long ix1,ix2,ix3; static double r[98]; double temp; static int iff=0; int j; void nrerror(); if (*idum < 0 || iff == 0) { iff=1; ix1=(IC1-(*idum)) % M1; ix1=(IA1*ix1+IC1) % M1; ix2=ix1 % M2; ix1=(IA1*ix1+IC1) % M1; ix3=ix1 % M3; for (j=1;j<=97;j++) { ix1=(IA1*ix1+IC1) % M1; ix2=(IA2*ix2+IC2) % M2; r[j]=(ix1+ix2*RM2)*RM1; } *idum=1; } ix1=(IA1*ix1+IC1) % M1; ix2=(IA2*ix2+IC2) % M2; ix3=(IA3*ix3+IC3) % M3; j=1 + ((97*ix3)/M3); if (j > 97 || j < 1) nrerror("RAN1: This cannot happen."); temp=r[j]; r[j]=(ix1+ix2*RM2)*RM1; return temp; } #undef M1 #undef IA1 #undef IC1 #undef RM1 #undef M2 #undef IA2 #undef IC2 #undef RM2 #undef M3 #undef IA3 #undef IC3 double gasdev(idum) long *idum; { static int iset=0; static double gset; double fac,r,v1,v2; double ran2(); if (iset == 0) { do { v1=2.0*ran2(idum)-1.0; v2=2.0*ran2(idum)-1.0; r=v1*v1+v2*v2; } while (r >= 1.0); fac=sqrt(-2.0*log(r)/r); gset=v1*fac; iset=1; return v2*fac; } else { iset=0; return gset; } } double gamdev(int ia, long *idum) { double ran2(long *idum); void nrerror(char error_text[]); int j; double am,e,s,v1,v2,x,y; if (ia < 1) nrerror("Error in routine gamdev"); if (ia < 6) { x=1.0; for (j=1;j<=ia;j++) x *= ran2(idum); x = -log(x); } else { do { do { do { v1=2.0*ran2(idum)-1.0; v2=2.0*ran2(idum)-1.0; } while (v1*v1+v2*v2 > 1.0); y=v2/v1; am=ia-1; s=sqrt(2.0*am+1.0); x=s*y+am; } while (x <= 0.0); e=(1.0+y*y)*exp(am*log(x/am)-s*y); } while (ran2(idum) > e); } return x; } void tdev(int df, int dim, double *trannum, long *idum) { int i; double Y; Y = gamdev(df/2.0,idum)*2; Y = sqrt(Y/df); for (i=1; i<=dim; i++) trannum[i] = gasdev(idum)/Y; } /********************************************************************* * Returns the value ln(Gamma(xx)) for xx>0. Full accuracy is obtained * for xx > 1. For 0<xx<1, the reflection formula can be used first: * * Gamma(1-z) = pi/Gamma(z)/sin(pi*z) = pi*z/Gamma(1+z)/sin(pi*z) * *********************************************************************/ double gammln(xx) double xx; { double x,tmp,ser; static double cof[6]={76.18009173,-86.50532033,24.01409822, -1.231739516,0.120858003e-2,-0.536382e-5}; int j; x=xx-1.0; tmp=x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.0; for (j=0;j<=5;j++) { x += 1.0; ser += cof[j]/x; } return -tmp+log(2.50662827465*ser); } #define NR_PI 3.141592654 double poidev(xm,idum) double xm; long *idum; { static double sq,alxm,g,oldm=(-1.0); double em,t,y; double ran2(),gammln(); if (xm < 12.0) { if (xm != oldm) { oldm=xm; g=exp(-xm); } em = -1; t=1.0; do { em += 1.0; t *= ran2(idum); } while (t > g); } else { if (xm != oldm) { oldm=xm; sq=sqrt(2.0*xm); alxm=log(xm); g=xm*alxm-gammln(xm+1.0); } do { do { y=tan(NR_PI*ran2(idum)); em=sq*y+xm; } while (em < 0.0); em=floor(em); t=0.9*(1.0+y*y)*exp(em*alxm-gammln(em+1.0)-g); } while (ran2(idum) > t); } return em; } #undef NR_PI #define IM1 2147483563 #define IM2 2147483399 #define AM (1.0/IM1) #define IMM1 (IM1-1) #define IA1 40014 #define IA2 40692 #define IQ1 53668 #define IQ2 52774 #define IR1 12211 #define IR2 3791 #define NTAB 32 #define NDIV (1+IMM1/NTAB) #define EPS 1.2e-7 #define RNMX (1.0-EPS) double ran2(idum) long *idum; { int j; long k; static long idum2=123456789; static long iy=0; static long iv[NTAB]; double temp; if (*idum <= 0) { if (-(*idum) < 1) *idum=1; else *idum = -(*idum); idum2=(*idum); for (j=NTAB+7;j>=0;j--) { k=(*idum)/IQ1; *idum=IA1*(*idum-k*IQ1)-k*IR1; if (*idum < 0) *idum += IM1; if (j < NTAB) iv[j] = *idum; } iy=iv[0]; } k=(*idum)/IQ1; *idum=IA1*(*idum-k*IQ1)-k*IR1; if (*idum < 0) *idum += IM1; k=idum2/IQ2; idum2=IA2*(idum2-k*IQ2)-k*IR2; if (idum2 < 0) idum2 += IM2; j=iy/NDIV; iy=iv[j]-idum2; iv[j] = *idum; if (iy < 1) iy += IMM1; if ((temp=AM*iy) > RNMX) return RNMX; else return temp; } #undef IM1 #undef IM2 #undef AM #undef IMM1 #undef IA1 #undef IA2 #undef IQ1 #undef IQ2 #undef IR1 #undef IR2 #undef NTAB #undef NDIV #undef EPS #undef RNMX /* (C) Copr. 1986-92 Numerical Recipes Software 5.){2p491&.#@#Q0JS[. */ void sort(n,ra) int n; double ra[]; { int l,j,ir,i; double rra; l=(n >> 1)+1; ir=n; for (;;) { if (l > 1) rra=ra[--l]; else { rra=ra[ir]; ra[ir]=ra[1]; if (--ir == 1) { ra[1]=rra; return; } } i=l; j=l << 1; while (j <= ir) { if (j < ir && ra[j] < ra[j+1]) ++j; if (rra < ra[j]) { ra[i]=ra[j]; j += (i=j); } else j=ir+1; } ra[i]=rra; } } void sort2(n,ra,rb) int n; double ra[],rb[]; { int l,j,ir,i; double rrb,rra; l=(n >> 1)+1; ir=n; for (;;) { if (l > 1) { rra=ra[--l]; rrb=rb[l]; } else { rra=ra[ir]; rrb=rb[ir]; ra[ir]=ra[1]; rb[ir]=rb[1]; if (--ir == 1) { ra[1]=rra; rb[1]=rrb; return; } } i=l; j=l << 1; while (j <= ir) { if (j < ir && ra[j] < ra[j+1]) ++j; if (rra < ra[j]) { ra[i]=ra[j]; rb[i]=rb[j]; j += (i=j); } else j=ir+1; } ra[i]=rra; rb[i]=rrb; } } void dmatrix_inv(double **A, double **invA, int n) { double d, *col,**tempA; int i,j,*indx; col=dvector(1,n); indx=ivector(1,n); tempA=dmatrix(1,n,1,n); for (i=1;i<=n ;i++ ) for (j=1;j<=n;j++) tempA[i][j]=A[i][j]; ludcmp(tempA,n,indx,&d); for (j=1;j<=n;j++) { for (i=1;i<=n;i++) col[i]=0.0; col[j]=1.0; lubksb(tempA,n,indx,col); for (i=1;i<=n;i++) invA[i][j]=col[i]; } return; } void choldc(double **a, int n, double *p) /* given a positive-definite symmetric dmatrix a[1..n][1..n]. this routine constructs Cholesky decomposition. A=L * L'. On input, only the upper triangle of a need be given; it is not modified. The Cholesky factor L is returned in the lower triangle of a, except for its diagonal elements which are return in p[1..n] */ { int i,j,k; double sum; for (i=1;i<=n;i++) { for (j=i;j<=n;j++) { for (sum=a[i][j],k=i-1;k>=1;k--) sum -= a[i][k]*a[j][k]; if (i == j) { if (sum <= 0.0) { // printf("choldc failed\n"); flag = 1; } p[i]=sqrt(sum); } else a[j][i]=sum/p[i]; } } } // Quasi-Newton Algorithm #define ITMAX 1000 #define EPS 1.0e-10 void dfpmin(p,n,ftol,iter,fret,func,dfunc) double p[],ftol,*fret,(*func)(); void (*dfunc)(); int n,*iter; { int j,i,its; double fp,fae,fad,fac; double *xi,*g,*dg,*hdg,*dvector(); double **hessin,**dmatrix(); void linmin(),nrerror(); hessin=dmatrix(1,n,1,n); xi=dvector(1,n); g=dvector(1,n); dg=dvector(1,n); hdg=dvector(1,n); fp=(*func)(p); (*dfunc)(p,g); for (i=1;i<=n;i++) { for (j=1;j<=n;j++) hessin[i][j]=0.0; hessin[i][i]=1.0; xi[i] = -g[i]; } for (its=1;its<=ITMAX;its++) { *iter=its; linmin(p,xi,n,fret,func); if (2.0*fabs(*fret-fp) <= ftol*(fabs(*fret)+fabs(fp)+EPS)) { return; } fp=(*fret); for (i=1;i<=n;i++) dg[i]=g[i]; *fret=(*func)(p); (*dfunc)(p,g); for (i=1;i<=n;i++) dg[i]=g[i]-dg[i]; for (i=1;i<=n;i++) { hdg[i]=0.0; for (j=1;j<=n;j++) hdg[i] += hessin[i][j]*dg[j]; } fac=fae=0.0; for (i=1;i<=n;i++) { fac += dg[i]*xi[i]; fae += dg[i]*hdg[i]; } fac=1.0/fac; fad=1.0/fae; for (i=1;i<=n;i++) dg[i]=fac*xi[i]-fad*hdg[i]; for (i=1;i<=n;i++) for (j=1;j<=n;j++) hessin[i][j] += fac*xi[i]*xi[j] -fad*hdg[i]*hdg[j]+fae*dg[i]*dg[j]; for (i=1;i<=n;i++) { xi[i]=0.0; for (j=1;j<=n;j++) xi[i] -= hessin[i][j]*g[j]; } } /* nrerror("Too many iterations in DFPMIN"); */ } #undef ITMAX #undef EPS #define TOL 2.0e-4 int ncom=0; /* defining declarations */ double *pcom=0,*xicom=0,(*nrfunc)(); void linmin(p,xi,n,fret,func) double p[],xi[],*fret,(*func)(); int n; { int j; double xx,xmin,fx,fb,fa,bx,ax; double brent(),f1dim(),*dvector(); void mnbrak(); double maxxi; ncom=n; pcom=dvector(1,n); xicom=dvector(1,n); nrfunc=func; for (j=1;j<=n;j++) { pcom[j]=p[j]; xicom[j]=xi[j]; } ax=0.0; xx=1.0e-3; bx=2.0; mnbrak(&ax,&xx,&bx,&fa,&fx,&fb,f1dim); *fret=brent(ax,xx,bx,f1dim,TOL,&xmin); maxxi = fabs(xi[1]); for (j=2; j<=n; j++) if (fabs(xi[j])>maxxi) maxxi = fabs(xi[j]); for (j=1;j<=n;j++) { xi[j] *= xmin; p[j] += xi[j]; } } #undef TOL #define GOLD 1.618034 #define GLIMIT 100.0 #define TINY 1.0e-20 #define MAX(a,b) ((a) > (b) ? (a) : (b)) //#define SIGN(a,b) ((b) > 0.0 ? fabs(a) : -fabs(a)) #define SHFT(a,b,c,d) (a)=(b);(b)=(c);(c)=(d); void mnbrak(ax,bx,cx,fa,fb,fc,func) double *ax,*bx,*cx,*fa,*fb,*fc; double (*func)(); /* ANSI: double (*func)(double); */ { double ulim,u,r,q,fu,dum; *fa=(*func)(*ax); *fb=(*func)(*bx); if (*fb > *fa) { SHFT(dum,*ax,*bx,dum) SHFT(dum,*fb,*fa,dum) } *cx=(*bx)+GOLD*(*bx-*ax); *fc=(*func)(*cx); while (*fb > *fc) { r=(*bx-*ax)*(*fb-*fc); q=(*bx-*cx)*(*fb-*fa); u=(*bx)-((*bx-*cx)*q-(*bx-*ax)*r)/ (2.0*SIGN(MAX(fabs(q-r),TINY),q-r)); ulim=(*bx)+GLIMIT*(*cx-*bx); if ((*bx-u)*(u-*cx) > 0.0) { fu=(*func)(u); if (fu < *fc) { *ax=(*bx); *bx=u; *fa=(*fb); *fb=fu; return; } else if (fu > *fb) { *cx=u; *fc=fu; return; } u=(*cx)+GOLD*(*cx-*bx); fu=(*func)(u); } else if ((*cx-u)*(u-ulim) > 0.0) { fu=(*func)(u); if (fu < *fc) { SHFT(*bx,*cx,u,*cx+GOLD*(*cx-*bx)) SHFT(*fb,*fc,fu,(*func)(u)) } } else if ((u-ulim)*(ulim-*cx) >= 0.0) { u=ulim; fu=(*func)(u); } else { u=(*cx)+GOLD*(*cx-*bx); fu=(*func)(u); } SHFT(*ax,*bx,*cx,u) SHFT(*fa,*fb,*fc,fu) } } #undef GOLD #undef GLIMIT #undef TINY #undef MAX //#undef SIGN #undef SHFT extern int ncom; /* defined in LINMIN */ extern double *pcom,*xicom,(*nrfunc)(); double f1dim(x) double x; { int j; double f,*xt,*dvector(); xt=dvector(1,ncom); for (j=1;j<=ncom;j++) xt[j]=pcom[j]+x*xicom[j]; f=(*nrfunc)(xt); return f; } #define ITMAX 100 #define CGOLD 0.3819660 #define ZEPS 1.0e-10 //#define SIGN(a,b) ((b) > 0.0 ? fabs(a) : -fabs(a))^M #define SHFT(a,b,c,d) (a)=(b);(b)=(c);(c)=(d); double brent(ax,bx,cx,f,tol,xmin) double ax,bx,cx,tol,*xmin; double (*f)(); /* ANSI: double (*f)(double); */ { int iter; double a,b,d,etemp,fu,fv,fw,fx,p,q,r,tol1,tol2,u,v,w,x,xm; double e=0.0; void nrerror(); a=((ax < cx) ? ax : cx); b=((ax > cx) ? ax : cx); x=w=v=bx; fw=fv=fx=(*f)(x); //printf("fx=%f\n", fx); for (iter=1;iter<=ITMAX;iter++) { xm=0.5*(a+b); tol2=2.0*(tol1=tol*fabs(x)+ZEPS); if (fabs(x-xm) <= (tol2-0.5*(b-a))) { *xmin=x; return fx; } if (fabs(e) > tol1) { r=(x-w)*(fx-fv); q=(x-v)*(fx-fw); p=(x-v)*q-(x-w)*r; q=2.0*(q-r); if (q > 0.0) p = -p; q=fabs(q); etemp=e; e=d; if (fabs(p) >= fabs(0.5*q*etemp) || p <= q*(a-x) || p >= q*(b-x)) d=CGOLD*(e=(x >= xm ? a-x : b-x)); else { d=p/q; u=x+d; if (u-a < tol2 || b-u < tol2) d=SIGN(tol1,xm-x); } } else { d=CGOLD*(e=(x >= xm ? a-x : b-x)); } u=(fabs(d) >= tol1 ? x+d : x+SIGN(tol1,d)); fu=(*f)(u); if (fu <= fx) { if (u >= x) a=x; else b=x; SHFT(v,w,x,u) SHFT(fv,fw,fx,fu) } else { if (u < x) a=u; else b=u; if (fu <= fw || w == x) { v=w; w=u; fv=fw; fw=fu; } else if (fu <= fv || v == x || v == w) { v=u; fv=fu; } } } nrerror("Too many iterations in BRENT"); *xmin=x; return fx; } #undef ITMAX #undef CGOLD #undef ZEPS //#undef SIGN
28.951974
99
0.390888
[ "vector" ]
39957977accd290700dbbfa9e579792db7e6b76f
20,773
c
C
apps/aria_mxt_configure/firmware/src/config/lcc_rgb565_mxt/usb/src/usb_device_endpoint_functions.c
Microchip-MPLAB-Harmony/gfx_apps
54d02e9388cd4e38c6d7cf486725e67bdd0f9844
[ "0BSD" ]
7
2019-03-19T23:00:02.000Z
2021-06-06T15:35:26.000Z
apps/aria_mxt_configure/firmware/src/config/lcc_rgb565_mxt/usb/src/usb_device_endpoint_functions.c
Microchip-MPLAB-Harmony/gfx_apps
54d02e9388cd4e38c6d7cf486725e67bdd0f9844
[ "0BSD" ]
null
null
null
apps/aria_mxt_configure/firmware/src/config/lcc_rgb565_mxt/usb/src/usb_device_endpoint_functions.c
Microchip-MPLAB-Harmony/gfx_apps
54d02e9388cd4e38c6d7cf486725e67bdd0f9844
[ "0BSD" ]
2
2019-08-01T02:39:59.000Z
2020-07-29T19:16:17.000Z
/************************************************************************** USB Device Layer Endpoint Read Write functions Implementation Company: Microchip Technology Inc. File Name: usb_device_endpoint_transfer.c Summary: This file contains implementations of both private and public functions of the USB Device Layer Enadpoint Transfer. Add this file to your project only if the application wants to write data to an Endpoint directly. Example USB Vendor devices. Description: This file contains the USB Device Layer Endpoint Transfer Implementation. **************************************************************************/ // DOM-IGNORE-BEGIN /******************************************************************************* Copyright (c) 2013 released Microchip Technology Inc. All rights reserved. Microchip licenses to you the right to use, modify, copy and distribute Software only when embedded on a Microchip microcontroller or digital signal controller that is integrated into your product or third party product (pursuant to the sublicense terms in the accompanying license agreement). You should refer to the license agreement accompanying this Software for additional information regarding your rights and obligations. SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. *******************************************************************************/ // DOM-IGNORE-END #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #include "configuration.h" #include "usb/src/usb_external_dependencies.h" //#include "system/common/sys_module.h" #include "usb/usb_common.h" #include "usb/usb_chapter_9.h" #include "usb/usb_device.h" #include "usb/src/usb_device_function_driver.h" //#include "system/debug/sys_debug.h" #include "usb/src/usb_device_local.h" /* USB Device Endpoint IRP array. */ USB_DEVICE_IRP gUSBDeviceEndpointIRP[USB_DEVICE_ENDPOINT_QUEUE_DEPTH_COMBINED]; /* Array for tracking Read/Write Queue size for each USB Device instance */ USB_DEVICE_Q_SIZE_ENDPOINT qSizeEndpoint[USB_DEVICE_INSTANCES_NUMBER]; // ***************************************************************************** // ***************************************************************************** // Section: USB Device Layer System Interface functions. // ***************************************************************************** // ***************************************************************************** // ****************************************************************************** /* Function: USB_DEVICE_RESULT USB_DEVICE_EndpointWrite ( USB_DEVICE_HANDLE usbDeviceHandle, USB_DEVICE_TRANSFER_HANDLE * transferHandle, USB_ENDPOINT_ADDRESS endpoint, const void * data, size_t size, USB_DEVICE_TRANSFER_FLAGS flags ) Summary: This function requests a data write to a USB Device Endpoint. Description: Refer to usb_device.h for usage information. Returns: Refer to usb_device.h for usage information. */ USB_DEVICE_RESULT USB_DEVICE_EndpointWrite ( USB_DEVICE_HANDLE usbDeviceHandle, USB_DEVICE_TRANSFER_HANDLE * transferHandle, USB_ENDPOINT_ADDRESS endpoint, const void * data, size_t size, USB_DEVICE_TRANSFER_FLAGS flags ) { int count = 0; USB_DEVICE_OBJ* devClientHandle; USB_ERROR irpSubmitError; SYS_MODULE_INDEX deviceInstanceNumber; USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueueSize; USB_DEVICE_IRP * irp ; OSAL_RESULT osalError; *transferHandle = USB_DEVICE_TRANSFER_HANDLE_INVALID; OSAL_CRITSECT_DATA_TYPE IntState; /* Validate the handle */ devClientHandle = _USB_DEVICE_ClientHandleValidate(usbDeviceHandle); if (devClientHandle == NULL) { SYS_DEBUG(0, "USB Device Layer: Invalid Client Handle"); return(USB_DEVICE_RESULT_ERROR_DEVICE_HANDLE_INVALID); } /* Get Device Instance Number */ deviceInstanceNumber = devClientHandle->usbDevLayerIndex; /* Get Handle to the Endpoint Queue Size structure */ thisEndpointQueueSize = &qSizeEndpoint[deviceInstanceNumber]; /* Make sure that we are with in the queue size for this instance */ if(thisEndpointQueueSize->qSizeCurrentEpWrite >= thisEndpointQueueSize->qSizeMaxEpWrite) { SYS_DEBUG(0, "Write Queue is full"); return(USB_DEVICE_RESULT_ERROR_TRANSFER_QUEUE_FULL); } /*Obtain mutex to get access to a shared resource, check return value*/ osalError = OSAL_MUTEX_Lock(&(devClientHandle->mutexEndpointIRP), OSAL_WAIT_FOREVER); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed lock was not obtained, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } /* Check if the if there is free slot available in queue */ for(count = 0; count < (USB_DEVICE_ENDPOINT_QUEUE_DEPTH_COMBINED) ; count ++ ) { if(gUSBDeviceEndpointIRP[count].status < (USB_DEVICE_IRP_STATUS)USB_DEVICE_IRP_FLAG_DATA_PENDING) { /* This means the IRP is free. Configure the IRP * update the current queue size and then submit */ irp = &gUSBDeviceEndpointIRP[count]; irp->data = (void *)data; irp->size = size; irp->flags = flags; irp->callback = &_USB_DEVICE_EndpointWriteCallBack; irp->userData = (uintptr_t)devClientHandle; (* transferHandle) = ( USB_DEVICE_TRANSFER_HANDLE )irp; /* Prevent other tasks pre-empting this sequence of code */ IntState = OSAL_CRIT_Enter(OSAL_CRIT_TYPE_HIGH); (thisEndpointQueueSize->qSizeCurrentEpWrite)++; OSAL_CRIT_Leave(OSAL_CRIT_TYPE_HIGH, IntState); irpSubmitError = USB_DEVICE_IRPSubmit( (USB_DEVICE_HANDLE)devClientHandle, endpoint, irp); /* If IRP Submit function returned any error, then invalidate the Transfer handle. */ if (irpSubmitError != USB_ERROR_NONE ) { /* Prevent other tasks pre-empting this sequence of code */ IntState = OSAL_CRIT_Enter(OSAL_CRIT_TYPE_HIGH); /* Update the read queue size */ (thisEndpointQueueSize->qSizeCurrentEpWrite)--; OSAL_CRIT_Leave(OSAL_CRIT_TYPE_HIGH, IntState); *transferHandle = USB_DEVICE_TRANSFER_HANDLE_INVALID; } /*Release mutex, done with shared resource*/ osalError = OSAL_MUTEX_Unlock(&(devClientHandle->mutexEndpointIRP)); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed lock was not obtained, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } return(irpSubmitError); } } /*Release mutex, done with shared resource*/ osalError = OSAL_MUTEX_Unlock(&(devClientHandle->mutexEndpointIRP)); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed, unlock was not completed, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } /* We could not find a spare IRP */ SYS_DEBUG(0, "USB Device Endpoint Write: Transfer queue is full"); return USB_DEVICE_RESULT_ERROR_TRANSFER_QUEUE_FULL; } /****************************************************************************** Function: USB_DEVICE_RESULT USB_DEVICE_EndpointRead ( USB_DEVICE_HANDLE usbDeviceHandle, USB_DEVICE_TRANSFER_HANDLE * transferHandle, USB_ENDPOINT_ADDRESS endpoint, void * buffer, size_t bufferSize ); Summary: Reads data received from host on the requested endpoint. Description: Refer to usb_device.h for usage information. Returns: Refer to usb_device.h for usage information. */ USB_DEVICE_RESULT USB_DEVICE_EndpointRead ( USB_DEVICE_HANDLE usbDeviceHandle, USB_DEVICE_TRANSFER_HANDLE * transferHandle, USB_ENDPOINT_ADDRESS endpoint, void * buffer, size_t bufferSize ) { int count = 0; USB_DEVICE_OBJ* devClientHandle; USB_ERROR irpSubmitError; SYS_MODULE_INDEX deviceInstanceNumber; USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueueSize; USB_DEVICE_IRP * irp = gUSBDeviceEndpointIRP; OSAL_RESULT osalError; *transferHandle = USB_DEVICE_TRANSFER_HANDLE_INVALID; OSAL_CRITSECT_DATA_TYPE IntState; /* Validate the handle */ devClientHandle = _USB_DEVICE_ClientHandleValidate(usbDeviceHandle); if (devClientHandle == NULL) { SYS_DEBUG(0, "USB Device Layer: Invalid Client Handle"); return(USB_DEVICE_RESULT_ERROR_DEVICE_HANDLE_INVALID); } /* Get Device Instance Number */ deviceInstanceNumber = devClientHandle->usbDevLayerIndex; /* Get Handle to the Endpoint Queue Size structure */ thisEndpointQueueSize = &qSizeEndpoint[deviceInstanceNumber]; /* Make sure that we are with in the queue size for this instance */ if(thisEndpointQueueSize->qSizeCurrentEpRead >= thisEndpointQueueSize->qSizeMaxEpRead) { SYS_ASSERT(false, "Read Queue is full"); return(USB_DEVICE_RESULT_ERROR_TRANSFER_QUEUE_FULL); } /*Obtain mutex to get access to a shared resource, check return value*/ osalError = OSAL_MUTEX_Lock(&(devClientHandle->mutexEndpointIRP), OSAL_WAIT_FOREVER); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed lock was not obtained, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } /* Check if the if there is free slot available in queue */ for(count = 0; count < (USB_DEVICE_ENDPOINT_QUEUE_DEPTH_COMBINED) ; count ++ ) { if(gUSBDeviceEndpointIRP[count].status < (USB_DEVICE_IRP_STATUS)USB_DEVICE_IRP_FLAG_DATA_PENDING) { /* This means the IRP is free. Configure the IRP * update the current queue size and then submit */ irp = &gUSBDeviceEndpointIRP[count]; irp->data = buffer; irp->size = bufferSize; irp->callback = &_USB_DEVICE_EndpointReadCallBack; irp->userData = (uintptr_t)devClientHandle; (*transferHandle) = (USB_DEVICE_TRANSFER_HANDLE ) irp; /* Prevent other tasks pre-empting this sequence of code */ IntState = OSAL_CRIT_Enter(OSAL_CRIT_TYPE_HIGH); (thisEndpointQueueSize->qSizeCurrentEpRead)++; OSAL_CRIT_Leave(OSAL_CRIT_TYPE_HIGH, IntState); irpSubmitError = USB_DEVICE_IRPSubmit((USB_DEVICE_HANDLE)devClientHandle, endpoint, irp); /* If IRP Submit function returned any error, then invalidate the Transfer handle. */ if (irpSubmitError != USB_ERROR_NONE ) { /* Prevent other tasks pre-empting this sequence of code */ IntState = OSAL_CRIT_Enter(OSAL_CRIT_TYPE_HIGH); /* Update the read queue size */ (thisEndpointQueueSize->qSizeCurrentEpRead)--; OSAL_CRIT_Leave(OSAL_CRIT_TYPE_HIGH, IntState); *transferHandle = USB_DEVICE_TRANSFER_HANDLE_INVALID; } /*Release mutex, done with shared resource*/ osalError = OSAL_MUTEX_Unlock(&(devClientHandle->mutexEndpointIRP)); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed lock was not obtained, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } return(irpSubmitError); } } /*Release mutex, done with shared resource*/ osalError = OSAL_MUTEX_Unlock(&(devClientHandle->mutexEndpointIRP)); if(osalError != OSAL_RESULT_TRUE) { /*Do not proceed, unlock was not complete, or error occurred, let user know about error*/ return (USB_DEVICE_RESULT_ERROR); } /* Could not find a free IRP. */ SYS_DEBUG(0, "USB Device Endpoint Read: Transfer queue is full"); return USB_DEVICE_RESULT_ERROR_TRANSFER_QUEUE_FULL; } /****************************************************************************** Function: USB_DEVICE_RESULT USB_DEVICE_EndpointTransferCancel ( USB_DEVICE_HANDLE usbDeviceHandle, USB_ENDPOINT_ADDRESS endpoint, USB_DEVICE_TRANSFER_HANDLE transferHandle ); Summary: This function cancels a transfer scheduled on an endpoint. Description: Refer to usb_device.h for usage information. Returns: Refer to usb_device.h for usage information. */ USB_DEVICE_RESULT USB_DEVICE_EndpointTransferCancel ( USB_DEVICE_HANDLE usbDeviceHandle, USB_ENDPOINT_ADDRESS endpoint, USB_DEVICE_TRANSFER_HANDLE transferHandle ) { USB_DEVICE_OBJ* devClientHandle; USB_DEVICE_IRP * irp ; USB_ERROR irpCancelError; /* Validate the handle */ devClientHandle = _USB_DEVICE_ClientHandleValidate(usbDeviceHandle); if (devClientHandle == NULL) { SYS_DEBUG(0, "USB Device Layer: Invalid Client Handle"); return(USB_DEVICE_RESULT_ERROR_DEVICE_HANDLE_INVALID); } if (transferHandle == USB_DEVICE_TRANSFER_HANDLE_INVALID) { SYS_DEBUG(0, "USB_Device_Endpoint_Transfer_Cancel: Invalid Transfer Handle"); return USB_DEVICE_RESULT_ERROR; } irp = (USB_DEVICE_IRP*)transferHandle; if (irp->status == USB_DEVICE_IRP_STATUS_PENDING) { irpCancelError = USB_DEVICE_IRPCancelAll((USB_DEVICE_HANDLE)devClientHandle,endpoint ); return irpCancelError; } SYS_DEBUG(0, "USB_Device_Endpoint_Transfer_Cancel: Transfer could not be cancelled"); return USB_DEVICE_RESULT_ERROR; } // ****************************************************************************** /* Function: void _USB_DEVICE_VENDOR_EndpointWriteCallBack( void * irp ) Summary: Endpoint write callback. Description: This function is called when a endpoint write is complete. Remarks: This is a local function and should not be called directly by the application. */ void _USB_DEVICE_EndpointWriteCallBack( USB_DEVICE_IRP * irp ) { /* An endpoint write has completed */ USB_DEVICE_EVENT_DATA_ENDPOINT_WRITE_COMPLETE eventData; SYS_MODULE_INDEX deviceInstanceNumber; USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueueSize; USB_DEVICE_OBJ* devClientHandle; /* Get Handle to the Device Object */ devClientHandle = (USB_DEVICE_OBJ*)irp->userData; /* Get Device instance Number */ deviceInstanceNumber = devClientHandle->usbDevLayerIndex; /* Get Handle to the Endpoint Queue Size */ thisEndpointQueueSize = &qSizeEndpoint[deviceInstanceNumber]; /* Update Queue Size. We have freed one read queue element as we have completed a Transfer */ thisEndpointQueueSize->qSizeCurrentEpWrite --; if( devClientHandle->callBackFunc != NULL ) { /* Get data size received from Host */ eventData.length = irp->size; /* Get Transfer Handle */ eventData.transferHandle = ( USB_DEVICE_TRANSFER_HANDLE )irp; /* Get transfer status */ if ((irp->status == USB_DEVICE_IRP_STATUS_COMPLETED) || (irp->status == USB_DEVICE_IRP_STATUS_COMPLETED_SHORT)) { /* Transfer completed successfully */ eventData.status = USB_DEVICE_RESULT_OK; } else if (irp->status == USB_DEVICE_IRP_STATUS_ABORTED_ENDPOINT_HALT) { /* Transfer canceled due to Endpoint Halt */ eventData.status = USB_DEVICE_RESULT_ERROR_ENDPOINT_HALTED; } else if (irp->status == USB_DEVICE_IRP_STATUS_TERMINATED_BY_HOST) { /* Transfer Canceled by Host (Host sent a Clear feature )*/ eventData.status = USB_DEVICE_RESULT_ERROR_TERMINATED_BY_HOST; } else { /* Transfer was not completed successfully */ eventData.status = USB_DEVICE_RESULT_ERROR; } /* Send an event to application letting it know that a endpoint write * has completed */ devClientHandle->callBackFunc( USB_DEVICE_EVENT_ENDPOINT_WRITE_COMPLETE, &eventData, devClientHandle->context); } } // ****************************************************************************** /* Function: void _USB_DEVICE_VENDOR_EndpointReadCallBack( void * irp ) Summary: Endpoint read callback. Description: This function is called when an endpoint read has completed. Remarks: This is a local function and should not be called directly by the application. */ void _USB_DEVICE_EndpointReadCallBack( USB_DEVICE_IRP * irp ) { USB_DEVICE_EVENT_DATA_ENDPOINT_READ_COMPLETE eventData; SYS_MODULE_INDEX deviceInstanceNumber; USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueueSize; USB_DEVICE_OBJ* devClientHandle; /* Get Handle to the Device Object */ devClientHandle = (USB_DEVICE_OBJ*)irp->userData; /* Get Device instance Number */ deviceInstanceNumber = devClientHandle->usbDevLayerIndex; /* Get Handle to the Endpoint Queue Size */ thisEndpointQueueSize = &qSizeEndpoint[deviceInstanceNumber]; /* Update Queue Size. We have freed one read queue element as we have completed a Transfer */ thisEndpointQueueSize->qSizeCurrentEpRead --; if( devClientHandle->callBackFunc != NULL ) { /* Get data size received from Host */ eventData.length = irp->size; /* Get Transfer Handle */ eventData.transferHandle = ( USB_DEVICE_TRANSFER_HANDLE )irp; /* Get transfer status */ if ((irp->status == USB_DEVICE_IRP_STATUS_COMPLETED) || (irp->status == USB_DEVICE_IRP_STATUS_COMPLETED_SHORT)) { /* Transfer completed successfully */ eventData.status = USB_DEVICE_RESULT_OK; } else if (irp->status == USB_DEVICE_IRP_STATUS_ABORTED_ENDPOINT_HALT) { /* Transfer canceled due to Endpoint Halt */ eventData.status = USB_DEVICE_RESULT_ERROR_ENDPOINT_HALTED; } else if (irp->status == USB_DEVICE_IRP_STATUS_TERMINATED_BY_HOST) { /* Transfer Canceled by Host (Host sent a Clear feature )*/ eventData.status = USB_DEVICE_RESULT_ERROR_TERMINATED_BY_HOST; } else { /* Transfer was not completed successfully */ eventData.status = USB_DEVICE_RESULT_ERROR; } /* Send an event to application letting it know that a endpoint read * has completed */ devClientHandle->callBackFunc( USB_DEVICE_EVENT_ENDPOINT_READ_COMPLETE , &eventData, (uintptr_t)devClientHandle->context ); } } void _USB_DEVICE_Initialize_Endpoint_Q_Size(SYS_MODULE_INDEX index, uint16_t qSizeRead, uint16_t qSizeWrite ) { USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueue = &qSizeEndpoint[index]; thisEndpointQueue->qSizeMaxEpRead = qSizeRead; thisEndpointQueue->qSizeMaxEpWrite = qSizeWrite; thisEndpointQueue->qSizeCurrentEpRead = 0; thisEndpointQueue->qSizeCurrentEpWrite = 0; } void _USB_DEVICE_EndpointQueueSizeReset(SYS_MODULE_INDEX index) { int iEntry; /* This function is called when the device layer receives * a Set Configuration request */ USB_DEVICE_Q_SIZE_ENDPOINT* thisEndpointQueue = &qSizeEndpoint[index]; thisEndpointQueue->qSizeCurrentEpRead = 0; thisEndpointQueue->qSizeCurrentEpWrite = 0; for(iEntry = 0; iEntry < USB_DEVICE_ENDPOINT_QUEUE_DEPTH_COMBINED; iEntry ++) { /* Get back all the IRPs */ gUSBDeviceEndpointIRP[iEntry].status = USB_DEVICE_IRP_STATUS_COMPLETED; } } /********************End of file********************************/
37.361511
109
0.654696
[ "object" ]
3995836083800ba323e302e7578c100192774e6b
26,149
h
C
resources/home/dnanexus/root/include/Math/GenVector/LorentzVector.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
null
null
null
resources/home/dnanexus/root/include/Math/GenVector/LorentzVector.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
null
null
null
resources/home/dnanexus/root/include/Math/GenVector/LorentzVector.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
1
2020-05-28T23:01:44.000Z
2020-05-28T23:01:44.000Z
// @(#)root/mathcore:$Id$ // Authors: W. Brown, M. Fischler, L. Moneta 2005 /********************************************************************** * * * Copyright (c) 2005 , LCG ROOT MathLib Team * * * * * **********************************************************************/ // Header file for class LorentzVector // // Created by: moneta at Tue May 31 17:06:09 2005 // Major mods by: fischler at Wed Jul 20 2005 // // Last update: $Id$ // #ifndef ROOT_Math_GenVector_LorentzVector #define ROOT_Math_GenVector_LorentzVector 1 #include "Math/GenVector/PxPyPzE4D.h" #include "Math/GenVector/DisplacementVector3D.h" #include "Math/GenVector/GenVectorIO.h" #include <cmath> namespace ROOT { namespace Math { //__________________________________________________________________________________________ /** Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system for the spatial vector part. The metric used for the LorentzVector is (-,-,-,+). In the case of LorentzVector we don't distinguish the concepts of points and displacement vectors as in the 3D case, since the main use case for 4D Vectors is to describe the kinematics of relativistic particles. A LorentzVector behaves like a DisplacementVector in 4D. The Minkowski components could be viewed as v and t, or for kinematic 4-vectors, as p and E. @ingroup GenVector */ template< class CoordSystem > class LorentzVector { public: // ------ ctors ------ typedef typename CoordSystem::Scalar Scalar; typedef CoordSystem CoordinateType; /** default constructor of an empty vector (Px = Py = Pz = E = 0 ) */ LorentzVector ( ) : fCoordinates() { } /** generic constructors from four scalar values. The association between values and coordinate depends on the coordinate system. For PxPyPzE4D, \param a scalar value (Px) \param b scalar value (Py) \param c scalar value (Pz) \param d scalar value (E) */ LorentzVector(const Scalar & a, const Scalar & b, const Scalar & c, const Scalar & d) : fCoordinates(a , b, c, d) { } /** constructor from a LorentzVector expressed in different coordinates, or using a different Scalar type */ template< class Coords > explicit LorentzVector(const LorentzVector<Coords> & v ) : fCoordinates( v.Coordinates() ) { } /** Construct from a foreign 4D vector type, for example, HepLorentzVector Precondition: v must implement methods x(), y(), z(), and t() */ template<class ForeignLorentzVector> explicit LorentzVector( const ForeignLorentzVector & v) : fCoordinates(PxPyPzE4D<Scalar>( v.x(), v.y(), v.z(), v.t() ) ) { } #ifdef LATER /** construct from a generic linear algebra vector implementing operator [] and with a size of at least 4. This could be also a C array In this case v[0] is the first data member ( Px for a PxPyPzE4D base) \param v LA vector \param index0 index of first vector element (Px) */ template< class LAVector > explicit LorentzVector(const LAVector & v, size_t index0 ) { fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2], v[index0+3] ); } #endif // ------ assignment ------ /** Assignment operator from a lorentz vector of arbitrary type */ template< class OtherCoords > LorentzVector & operator= ( const LorentzVector<OtherCoords> & v) { fCoordinates = v.Coordinates(); return *this; } /** assignment from any other Lorentz vector implementing x(), y(), z() and t() */ template<class ForeignLorentzVector> LorentzVector & operator = ( const ForeignLorentzVector & v) { SetXYZT( v.x(), v.y(), v.z(), v.t() ); return *this; } #ifdef LATER /** assign from a generic linear algebra vector implementing operator [] and with a size of at least 4 In this case v[0] is the first data member ( Px for a PxPyPzE4D base) \param v LA vector \param index0 index of first vector element (Px) */ template< class LAVector > LorentzVector & AssignFrom(const LAVector & v, size_t index0=0 ) { fCoordinates.SetCoordinates( v[index0], v[index0+1], v[index0+2], v[index0+3] ); return *this; } #endif // ------ Set, Get, and access coordinate data ------ /** Retrieve a const reference to the coordinates object */ const CoordSystem & Coordinates() const { return fCoordinates; } /** Set internal data based on an array of 4 Scalar numbers */ LorentzVector<CoordSystem>& SetCoordinates( const Scalar src[] ) { fCoordinates.SetCoordinates(src); return *this; } /** Set internal data based on 4 Scalar numbers */ LorentzVector<CoordSystem>& SetCoordinates( Scalar a, Scalar b, Scalar c, Scalar d ) { fCoordinates.SetCoordinates(a, b, c, d); return *this; } /** Set internal data based on 4 Scalars at *begin to *end */ //#ifdef NDEBUG //this does not compile in CINT // template< class IT > // LorentzVector<CoordSystem>& SetCoordinates( IT begin, IT /* end */ ) { // #endif template< class IT > #ifndef NDEBUG LorentzVector<CoordSystem>& SetCoordinates( IT begin, IT end ) { #else LorentzVector<CoordSystem>& SetCoordinates( IT begin, IT /* end */ ) { #endif IT a = begin; IT b = ++begin; IT c = ++begin; IT d = ++begin; assert (++begin==end); SetCoordinates (*a,*b,*c,*d); return *this; } /** get internal data into 4 Scalar numbers */ void GetCoordinates( Scalar& a, Scalar& b, Scalar& c, Scalar & d ) const { fCoordinates.GetCoordinates(a, b, c, d); } /** get internal data into an array of 4 Scalar numbers */ void GetCoordinates( Scalar dest[] ) const { fCoordinates.GetCoordinates(dest); } /** get internal data into 4 Scalars at *begin to *end */ template <class IT> #ifndef NDEBUG void GetCoordinates( IT begin, IT end ) const #else void GetCoordinates( IT begin, IT /* end */ ) const #endif { IT a = begin; IT b = ++begin; IT c = ++begin; IT d = ++begin; assert (++begin==end); GetCoordinates (*a,*b,*c,*d); } /** get internal data into 4 Scalars at *begin */ template <class IT> void GetCoordinates( IT begin ) const { Scalar a,b,c,d = 0; GetCoordinates (a,b,c,d); *begin++ = a; *begin++ = b; *begin++ = c; *begin = d; } /** set the values of the vector from the cartesian components (x,y,z,t) (if the vector is held in another coordinates, like (Pt,eta,phi,m) then (x, y, z, t) are converted to that form) */ LorentzVector<CoordSystem>& SetXYZT (Scalar xx, Scalar yy, Scalar zz, Scalar tt) { fCoordinates.SetPxPyPzE(xx,yy,zz,tt); return *this; } LorentzVector<CoordSystem>& SetPxPyPzE (Scalar xx, Scalar yy, Scalar zz, Scalar ee) { fCoordinates.SetPxPyPzE(xx,yy,zz,ee); return *this; } // ------------------- Equality ----------------- /** Exact equality */ bool operator==(const LorentzVector & rhs) const { return fCoordinates==rhs.fCoordinates; } bool operator!= (const LorentzVector & rhs) const { return !(operator==(rhs)); } // ------ Individual element access, in various coordinate systems ------ // individual coordinate accessors in various coordinate systems /** spatial X component */ Scalar Px() const { return fCoordinates.Px(); } Scalar X() const { return fCoordinates.Px(); } /** spatial Y component */ Scalar Py() const { return fCoordinates.Py(); } Scalar Y() const { return fCoordinates.Py(); } /** spatial Z component */ Scalar Pz() const { return fCoordinates.Pz(); } Scalar Z() const { return fCoordinates.Pz(); } /** return 4-th component (time, or energy for a 4-momentum vector) */ Scalar E() const { return fCoordinates.E(); } Scalar T() const { return fCoordinates.E(); } /** return magnitude (mass) squared M2 = T**2 - X**2 - Y**2 - Z**2 (we use -,-,-,+ metric) */ Scalar M2() const { return fCoordinates.M2(); } /** return magnitude (mass) using the (-,-,-,+) metric. If M2 is negative (space-like vector) a GenVector_exception is suggested and if continuing, - sqrt( -M2) is returned */ Scalar M() const { return fCoordinates.M();} /** return the spatial (3D) magnitude ( sqrt(X**2 + Y**2 + Z**2) ) */ Scalar R() const { return fCoordinates.R(); } Scalar P() const { return fCoordinates.R(); } /** return the square of the spatial (3D) magnitude ( X**2 + Y**2 + Z**2 ) */ Scalar P2() const { return P() * P(); } /** return the square of the transverse spatial component ( X**2 + Y**2 ) */ Scalar Perp2( ) const { return fCoordinates.Perp2();} /** return the transverse spatial component sqrt ( X**2 + Y**2 ) */ Scalar Pt() const { return fCoordinates.Pt(); } Scalar Rho() const { return fCoordinates.Pt(); } /** return the transverse mass squared \f[ m_t^2 = E^2 - p{_z}^2 \f] */ Scalar Mt2() const { return fCoordinates.Mt2(); } /** return the transverse mass \f[ \sqrt{ m_t^2 = E^2 - p{_z}^2} X sign(E^ - p{_z}^2) \f] */ Scalar Mt() const { return fCoordinates.Mt(); } /** return the transverse energy squared \f[ e_t = \frac{E^2 p_{\perp}^2 }{ |p|^2 } \f] */ Scalar Et2() const { return fCoordinates.Et2(); } /** return the transverse energy \f[ e_t = \sqrt{ \frac{E^2 p_{\perp}^2 }{ |p|^2 } } X sign(E) \f] */ Scalar Et() const { return fCoordinates.Et(); } /** azimuthal Angle */ Scalar Phi() const { return fCoordinates.Phi();} /** polar Angle */ Scalar Theta() const { return fCoordinates.Theta(); } /** pseudorapidity \f[ \eta = - \ln { \tan { \frac { \theta} {2} } } \f] */ Scalar Eta() const { return fCoordinates.Eta(); } /** get the spatial components of the Vector in a DisplacementVector based on Cartesian Coordinates */ ::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> > Vect() const { return ::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> >( X(), Y(), Z() ); } // ------ Operations combining two Lorentz vectors ------ /** scalar (Dot) product of two LorentzVector vectors (metric is -,-,-,+) Enable the product using any other LorentzVector implementing the x(), y() , y() and t() member functions \param q any LorentzVector implementing the x(), y() , z() and t() member functions \return the result of v.q of type according to the base scalar type of v */ template< class OtherLorentzVector > Scalar Dot(const OtherLorentzVector & q) const { return t()*q.t() - x()*q.x() - y()*q.y() - z()*q.z(); } /** Self addition with another Vector ( v+= q ) Enable the addition with any other LorentzVector \param q any LorentzVector implementing the x(), y() , z() and t() member functions */ template< class OtherLorentzVector > inline LorentzVector & operator += ( const OtherLorentzVector & q) { SetXYZT( x() + q.x(), y() + q.y(), z() + q.z(), t() + q.t() ); return *this; } /** Self subtraction of another Vector from this ( v-= q ) Enable the addition with any other LorentzVector \param q any LorentzVector implementing the x(), y() , z() and t() member functions */ template< class OtherLorentzVector > LorentzVector & operator -= ( const OtherLorentzVector & q) { SetXYZT( x() - q.x(), y() - q.y(), z() - q.z(), t() - q.t() ); return *this; } /** addition of two LorentzVectors (v3 = v1 + v2) Enable the addition with any other LorentzVector \param v2 any LorentzVector implementing the x(), y() , z() and t() member functions \return a new LorentzVector of the same type as v1 */ template<class OtherLorentzVector> LorentzVector operator + ( const OtherLorentzVector & v2) const { LorentzVector<CoordinateType> v3(*this); v3 += v2; return v3; } /** subtraction of two LorentzVectors (v3 = v1 - v2) Enable the subtraction of any other LorentzVector \param v2 any LorentzVector implementing the x(), y() , z() and t() member functions \return a new LorentzVector of the same type as v1 */ template<class OtherLorentzVector> LorentzVector operator - ( const OtherLorentzVector & v2) const { LorentzVector<CoordinateType> v3(*this); v3 -= v2; return v3; } //--- scaling operations ------ /** multiplication by a scalar quantity v *= a */ LorentzVector & operator *= (Scalar a) { fCoordinates.Scale(a); return *this; } /** division by a scalar quantity v /= a */ LorentzVector & operator /= (Scalar a) { fCoordinates.Scale(1/a); return *this; } /** product of a LorentzVector by a scalar quantity \param a scalar quantity of type a \return a new mathcoreLorentzVector q = v * a same type as v */ LorentzVector operator * ( const Scalar & a) const { LorentzVector tmp(*this); tmp *= a; return tmp; } /** Divide a LorentzVector by a scalar quantity \param a scalar quantity of type a \return a new mathcoreLorentzVector q = v / a same type as v */ LorentzVector<CoordSystem> operator / ( const Scalar & a) const { LorentzVector<CoordSystem> tmp(*this); tmp /= a; return tmp; } /** Negative of a LorentzVector (q = - v ) \return a new LorentzVector with opposite direction and time */ LorentzVector operator - () const { //LorentzVector<CoordinateType> v(*this); //v.Negate(); return operator*( Scalar(-1) ); } LorentzVector operator + () const { return *this; } // ---- Relativistic Properties ---- /** Rapidity relative to the Z axis: .5 log [(E+Pz)/(E-Pz)] */ Scalar Rapidity() const { // TODO - It would be good to check that E > Pz and use the Throw() // mechanism or at least load a NAN if not. // We should then move the code to a .cpp file. const Scalar ee = E(); const Scalar ppz = Pz(); return Scalar(0.5) * log((ee + ppz) / (ee - ppz)); } /** Rapidity in the direction of travel: atanh (|P|/E)=.5 log[(E+P)/(E-P)] */ Scalar ColinearRapidity() const { // TODO - It would be good to check that E > P and use the Throw() // mechanism or at least load a NAN if not. const Scalar ee = E(); const Scalar pp = P(); return Scalar(0.5) * log((ee + pp) / (ee - pp)); } /** Determine if momentum-energy can represent a physical massive particle */ bool isTimelike( ) const { Scalar ee = E(); Scalar pp = P(); return ee*ee > pp*pp; } /** Determine if momentum-energy can represent a massless particle */ bool isLightlike( Scalar tolerance = 100*std::numeric_limits<Scalar>::epsilon() ) const { Scalar ee = E(); Scalar pp = P(); Scalar delta = ee-pp; if ( ee==0 ) return pp==0; return delta*delta < tolerance * ee*ee; } /** Determine if momentum-energy is spacelike, and represents a tachyon */ bool isSpacelike( ) const { Scalar ee = E(); Scalar pp = P(); return ee*ee < pp*pp; } typedef DisplacementVector3D< Cartesian3D<Scalar> > BetaVector; /** The beta vector for the boost that would bring this vector into its center of mass frame (zero momentum) */ BetaVector BoostToCM( ) const { if (E() == 0) { if (P() == 0) { return BetaVector(); } else { // TODO - should attempt to Throw with msg about // boostVector computed for LorentzVector with t=0 return -Vect()/E(); } } if (M2() <= 0) { // TODO - should attempt to Throw with msg about // boostVector computed for a non-timelike LorentzVector } return -Vect()/E(); } /** The beta vector for the boost that would bring this vector into its center of mass frame (zero momentum) */ template <class Other4Vector> BetaVector BoostToCM(const Other4Vector& v ) const { Scalar eSum = E() + v.E(); DisplacementVector3D< Cartesian3D<Scalar> > vecSum = Vect() + v.Vect(); if (eSum == 0) { if (vecSum.Mag2() == 0) { return BetaVector(); } else { // TODO - should attempt to Throw with msg about // boostToCM computed for two 4-vectors with combined t=0 return BetaVector(vecSum/eSum); } // TODO - should attempt to Throw with msg about // boostToCM computed for two 4-vectors with combined e=0 } return BetaVector (vecSum * (-1./eSum)); } //beta and gamma /** Return beta scalar value */ Scalar Beta() const { if ( E() == 0 ) { if ( P2() == 0) // to avoid Nan return 0; else { GenVector::Throw ("LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result"); return 1./E(); } } if ( M2() <= 0 ) { GenVector::Throw ("LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless" ); } return P() / E(); } /** Return Gamma scalar value */ Scalar Gamma() const { const Scalar v2 = P2(); const Scalar t2 = pow(E(), 2); if (E() == 0) { if ( P2() == 0) { return 1; } else { GenVector::Throw ("LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result"); } } if ( t2 < v2 ) { GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result"); return 0; } else if ( t2 == v2 ) { GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result"); } return Scalar(1) / sqrt(Scalar(1) - v2 / t2); } /* gamma */ // Method providing limited backward name compatibility with CLHEP ---- Scalar x() const { return fCoordinates.Px(); } Scalar y() const { return fCoordinates.Py(); } Scalar z() const { return fCoordinates.Pz(); } Scalar t() const { return fCoordinates.E(); } Scalar px() const { return fCoordinates.Px(); } Scalar py() const { return fCoordinates.Py(); } Scalar pz() const { return fCoordinates.Pz(); } Scalar e() const { return fCoordinates.E(); } Scalar r() const { return fCoordinates.R(); } Scalar theta() const { return fCoordinates.Theta(); } Scalar phi() const { return fCoordinates.Phi(); } Scalar rho() const { return fCoordinates.Rho(); } Scalar eta() const { return fCoordinates.Eta(); } Scalar pt() const { return fCoordinates.Pt(); } Scalar perp2() const { return fCoordinates.Perp2(); } Scalar mag2() const { return fCoordinates.M2(); } Scalar mag() const { return fCoordinates.M(); } Scalar mt() const { return fCoordinates.Mt(); } Scalar mt2() const { return fCoordinates.Mt2(); } // Methods requested by CMS --- Scalar energy() const { return fCoordinates.E(); } Scalar mass() const { return fCoordinates.M(); } Scalar mass2() const { return fCoordinates.M2(); } /** Methods setting a Single-component Work only if the component is one of which the vector is represented. For example SetE will work for a PxPyPzE Vector but not for a PxPyPzM Vector. */ LorentzVector<CoordSystem>& SetE ( Scalar a ) { fCoordinates.SetE (a); return *this; } LorentzVector<CoordSystem>& SetEta( Scalar a ) { fCoordinates.SetEta(a); return *this; } LorentzVector<CoordSystem>& SetM ( Scalar a ) { fCoordinates.SetM (a); return *this; } LorentzVector<CoordSystem>& SetPhi( Scalar a ) { fCoordinates.SetPhi(a); return *this; } LorentzVector<CoordSystem>& SetPt ( Scalar a ) { fCoordinates.SetPt (a); return *this; } LorentzVector<CoordSystem>& SetPx ( Scalar a ) { fCoordinates.SetPx (a); return *this; } LorentzVector<CoordSystem>& SetPy ( Scalar a ) { fCoordinates.SetPy (a); return *this; } LorentzVector<CoordSystem>& SetPz ( Scalar a ) { fCoordinates.SetPz (a); return *this; } private: CoordSystem fCoordinates; // internal coordinate system }; // LorentzVector<> // global nethods /** Scale of a LorentzVector with a scalar quantity a \param a scalar quantity of typpe a \param v mathcore::LorentzVector based on any coordinate system \return a new mathcoreLorentzVector q = v * a same type as v */ template< class CoordSystem > inline LorentzVector<CoordSystem> operator * ( const typename LorentzVector<CoordSystem>::Scalar & a, const LorentzVector<CoordSystem>& v) { LorentzVector<CoordSystem> tmp(v); tmp *= a; return tmp; } // ------------- I/O to/from streams ------------- template< class char_t, class traits_t, class Coords > inline std::basic_ostream<char_t,traits_t> & operator << ( std::basic_ostream<char_t,traits_t> & os , LorentzVector<Coords> const & v ) { if( !os ) return os; typename Coords::Scalar a, b, c, d; v.GetCoordinates(a, b, c, d); if( detail::get_manip( os, detail::bitforbit ) ) { detail::set_manip( os, detail::bitforbit, '\00' ); // TODO: call MF's bitwise-accurate functions on each of a, b, c, d } else { os << detail::get_manip( os, detail::open ) << a << detail::get_manip( os, detail::sep ) << b << detail::get_manip( os, detail::sep ) << c << detail::get_manip( os, detail::sep ) << d << detail::get_manip( os, detail::close ); } return os; } // op<< <>() template< class char_t, class traits_t, class Coords > inline std::basic_istream<char_t,traits_t> & operator >> ( std::basic_istream<char_t,traits_t> & is , LorentzVector<Coords> & v ) { if( !is ) return is; typename Coords::Scalar a, b, c, d; if( detail::get_manip( is, detail::bitforbit ) ) { detail::set_manip( is, detail::bitforbit, '\00' ); // TODO: call MF's bitwise-accurate functions on each of a, b, c } else { detail::require_delim( is, detail::open ); is >> a; detail::require_delim( is, detail::sep ); is >> b; detail::require_delim( is, detail::sep ); is >> c; detail::require_delim( is, detail::sep ); is >> d; detail::require_delim( is, detail::close ); } if( is ) v.SetCoordinates(a, b, c, d); return is; } // op>> <>() } // end namespace Math } // end namespace ROOT #endif //#include "Math/GenVector/LorentzVectorOperations.h"
34.22644
139
0.53394
[ "object", "vector", "3d" ]
39996a901aab63b2061c59e328950686b7485a7a
1,474
h
C
Source/Common/Util/Public/StringUtils.h
RChehowski/ExcessiveJet
bbb504aa9d56045c6047f50424511459307bd13a
[ "MIT" ]
2
2021-02-17T07:48:02.000Z
2022-01-09T19:53:54.000Z
Source/Common/Util/Public/StringUtils.h
RChehowski/ExcessiveJet
bbb504aa9d56045c6047f50424511459307bd13a
[ "MIT" ]
null
null
null
Source/Common/Util/Public/StringUtils.h
RChehowski/ExcessiveJet
bbb504aa9d56045c6047f50424511459307bd13a
[ "MIT" ]
null
null
null
// // Created by ASUS on 09/04/2021. // #pragma once #include <string> #include <vector> #include <functional> namespace Util { using CString = std::string; class CStringUtils { public: static void ParseIntoVector(const CString& String, const CString& Separator, std::vector<CString>& Result) { using CStringSizeType = CString::size_type; CStringSizeType BeginIndex = 0; CStringSizeType EndIndex = 0; CStringSizeType SeparatorLength = Separator.length(); auto AddSubstring = [&String, &Result](CStringSizeType BeginIndex, CStringSizeType EndIndex) { const CStringSizeType SubstringLen = EndIndex - BeginIndex; if (SubstringLen > 0) { Result.push_back(std::move(String.substr(BeginIndex, SubstringLen))); } }; while ((EndIndex = String.find(Separator, BeginIndex)) != CString::npos) { AddSubstring(BeginIndex, EndIndex); BeginIndex = EndIndex = (EndIndex + SeparatorLength); } AddSubstring(BeginIndex, String.length()); } static std::vector<CString> ParseIntoVector(const CString& String, const CString& Separator) { std::vector<CString> Result; ParseIntoVector(String, Separator, Result); return Result; } }; }
27.296296
114
0.577341
[ "vector" ]
3999d8054b14c31240c557edee8ee6b6711877f3
16,977
h
C
Sources/Internal/Engine/PlatformApiAndroid.h
stinvi/dava.engine
2b396ca49cdf10cdc98ad8a9ffcf7768a05e285e
[ "BSD-3-Clause" ]
26
2018-09-03T08:48:22.000Z
2022-02-14T05:14:50.000Z
Sources/Internal/Engine/PlatformApiAndroid.h
ANHELL-blitz/dava.engine
ed83624326f000866e29166c7f4cccfed1bb41d4
[ "BSD-3-Clause" ]
null
null
null
Sources/Internal/Engine/PlatformApiAndroid.h
ANHELL-blitz/dava.engine
ed83624326f000866e29166c7f4cccfed1bb41d4
[ "BSD-3-Clause" ]
45
2018-05-11T06:47:17.000Z
2022-02-03T11:30:55.000Z
#pragma once /** \defgroup engine_android Engine facilities specific to Android and JNI wrappers */ #if defined(__DAVAENGINE_ANDROID__) #include <jni.h> #include <stdexcept> #include "Base/BaseTypes.h" #include "Debug/DVAssert.h" #include "Engine/Private/Android/JNIDecl.h" #include "Functional/Function.h" #include "Math/Rect.h" #include "Utils/StringFormat.h" #define DAVA_DECLARE_CUSTOM_JNI_TYPE(jnitype, base, signature) \ class dava_custom_jni_type##jnitype : public std::remove_pointer<base>::type {}; \ using jnitype = dava_custom_jni_type##jnitype*; \ template <> struct DAVA::JNI::TypeSignature<jnitype> { static const DAVA::char8* value() { return signature; } } DAVA_DECLARE_CUSTOM_JNI_TYPE(jstringArray, jobjectArray, "[Ljava/lang/String;"); #define DAVA_JNI_EXCEPTION_CHECK() \ do { \ try { \ JNIEnv* env = DAVA::JNI::GetEnv(); \ DAVA::JNI::CheckJavaException(env, true); \ } catch (const DAVA::JNI::Exception& e) { \ DVASSERT(false, e.what()); \ } \ } while (0) namespace DAVA { class Window; namespace PlatformApi { namespace Android { jobject CreateNativeControl(Window* targetWindow, const char8* controlClassName, void* backendPointer); } // namespace Android } // namespace PlatformApi namespace JNI { class Exception : public std::runtime_error { using std::runtime_error::runtime_error; }; JNIEnv* GetEnv(bool abortIfNotAttachedToJVM = true); void AttachCurrentThreadToJVM(); void DetachCurrentThreadFromJVM(); bool CheckJavaException(JNIEnv* env, bool throwJniException = true); String GetJavaExceptionText(JNIEnv* env, jthrowable e); jclass LoadJavaClass(const char8* className, bool throwJniException = false, JNIEnv* env = nullptr); String JavaStringToString(jstring string, JNIEnv* env = nullptr); WideString JavaStringToWideString(jstring string, JNIEnv* env = nullptr); jstring CStrToJavaString(const char* cstr, JNIEnv* env = nullptr); jstring StringToJavaString(const String& string, JNIEnv* env = nullptr); jstring WideStringToJavaString(const WideString& string, JNIEnv* env = nullptr); // Functions left for compatibility Rect V2I(const Rect& rect); inline String ToString(const jstring jniString) { return JavaStringToString(jniString); } inline WideString ToWideString(const jstring jniString) { return JavaStringToWideString(jniString); } inline jstring ToJNIString(const DAVA::WideString& string) { return WideStringToJavaString(string); } /** Template class `ObjectRef` is smart pointer like class that owns and manages JNI jobject and jobject-derived objects. Template parameters are: - T - jobject or jobject-derived type, also can be type registered through `DAVA_DECLARE_CUSTOM_JNI_TYPE` macro - NewRef - method of JNIEnv which creates new reference (can be `NewGlobalRef` or `NewLocalRef`) - DeleteRef - method of JNIEnv which deletes reference (can be `DeleteGlobalRef` or `DeleteLocalRef`) `ObjectRef` is not intended for direct use, instead use `GlobalRef<T>` alias for global references and `LocalRef<T>` for local references. Rules when creating ObjectRef instance or assigning with raw jobject: 1. if ObjectRef is GlobalRef: if jobject is global reference then GlobalRef takes ownership of jobject if jobject is local reference then GlobalRef creates and manages global reference and delete jobject 2. if ObjectRef is LocalRef: if jobject is global reference then LocalRef creates and manages local reference if jobject is local reference then LocalRef takes ownership of jobject Samples: \code GlobalRef<jstring> g1; // Some global jstring object LocalRef<jobject> l1 = ...; // Usually java methods return local references to jobjects, // l1 will take ownership of returned jobject GlobalRef<jobject> g8 = ...; // Java method returns local reference and g8 creates and manages global // reference and deletes returned local reference g1 = l1; // Convert and create new global reference to jstring, local reference will be automatically deleted LocalRef<jobject> l2 = ...; GlobalRef<jstring> g2(std::move(l2)); // Convert and create new global reference to jstring, automatically deleting local reference \endcode */ template <typename T, jobject (JNIEnv::*NewRef)(jobject), void (JNIEnv::*DeleteRef)(jobject)> struct ObjectRef { // clang-format off static_assert(std::is_base_of<std::remove_pointer_t<jobject>, std::remove_pointer_t<T>>::value, "T must be jobject or jobject-based type"); static_assert( (NewRef == &JNIEnv::NewGlobalRef && DeleteRef == &JNIEnv::DeleteGlobalRef) || (NewRef == &JNIEnv::NewLocalRef && DeleteRef == &JNIEnv::DeleteLocalRef), "NewRef and DeleteRef must be consistent"); // clang-format on using Type = T; //<! T, the jobject-related type managed by this `ObjectRef` static const bool isGlobalRef = NewRef == &JNIEnv::NewGlobalRef && DeleteRef == &JNIEnv::DeleteGlobalRef; ObjectRef() = default; /** Constructor that takes ownership of object that is the same type as T. */ ObjectRef(T obj) : object(Assign(obj)) { } /** Constructor that takes ownership of object that is the convertible to T. */ template <typename Other> ObjectRef(Other obj) : ObjectRef(static_cast<T>(obj)) { } /** Constructor that creates new reference to object managed by `other`. */ ObjectRef(const ObjectRef& other) : object(Retain(other.object)) { } /** Constructor that creates new reference to object managed by `other`. */ template <typename Other, jobject (JNIEnv::*NewRefOther)(jobject), void (JNIEnv::*DeleteRefOther)(jobject)> ObjectRef(const ObjectRef<Other, NewRefOther, DeleteRefOther>& other) : object(Retain(other.object)) { } ObjectRef& operator=(const ObjectRef& other) { if (this != &other) { Release(); object = Retain(other.object); } return *this; } template <typename Other, jobject (JNIEnv::*NewRefOther)(jobject), void (JNIEnv::*DeleteRefOther)(jobject)> ObjectRef& operator=(const ObjectRef<Other, NewRefOther, DeleteRefOther>& other) { Release(); object = Retain(other.object); return *this; } ObjectRef(ObjectRef&& other) : object(Retain(other.object)) { other.Release(); } template <typename Other, jobject (JNIEnv::*NewRefOther)(jobject), void (JNIEnv::*DeleteRefOther)(jobject)> ObjectRef(ObjectRef<Other, NewRefOther, DeleteRefOther>&& other) : object(Retain(other.object)) { other.Release(); } ObjectRef& operator=(ObjectRef&& other) { if (this != &other) { Release(); object = Retain(other.object); other.Release(); } return *this; } template <typename Other, jobject (JNIEnv::*NewRefOther)(jobject), void (JNIEnv::*DeleteRefOther)(jobject)> ObjectRef& operator=(ObjectRef<Other, NewRefOther, DeleteRefOther>&& other) { Release(); object = Retain(other.object); other.Release(); return *this; } ~ObjectRef() { Release(); } T Get() const { return object; } ObjectRef& operator=(T obj) { if (object != obj) { Release(); object = Assign(obj); } return *this; } template <typename Other> ObjectRef& operator=(Other obj) { return operator=(static_cast<T>(obj)); } operator T() const { return object; } private: T Assign(T obj) { T result = nullptr; if (obj != nullptr) { jobjectRefType otherType = GetEnv()->GetObjectRefType(obj); DVASSERT(otherType == JNILocalRefType || otherType == JNIGlobalRefType); if (isGlobalRef) { if (otherType == JNILocalRefType) { result = Retain(obj); GetEnv()->DeleteLocalRef(obj); } else if (otherType == JNIGlobalRefType) { result = obj; } } else { if (otherType == JNILocalRefType) { result = obj; } else if (otherType == JNIGlobalRefType) { result = Retain(obj); } } } return result; } template <typename U> T Retain(U obj) { T result = nullptr; if (obj != nullptr) { result = static_cast<T>((GetEnv()->*NewRef)(obj)); } return result; } void Release() { if (object != nullptr) { (GetEnv()->*DeleteRef)(object); object = nullptr; } } T object = nullptr; template <typename, jobject (JNIEnv::*)(jobject), void (JNIEnv::*)(jobject)> friend class ObjectRef; }; template <typename T, jobject (JNIEnv::*NewRef)(jobject), void (JNIEnv::*DeleteRef)(jobject)> bool operator==(const ObjectRef<T, NewRef, DeleteRef>& o, std::nullptr_t) { return o.Get() == nullptr; } template <typename T, jobject (JNIEnv::*NewRef)(jobject), void (JNIEnv::*DeleteRef)(jobject)> bool operator==(std::nullptr_t, const ObjectRef<T, NewRef, DeleteRef>& o) { return o.Get() == nullptr; } template <typename T, jobject (JNIEnv::*NewRef)(jobject), void (JNIEnv::*DeleteRef)(jobject)> bool operator!=(const ObjectRef<T, NewRef, DeleteRef>& o, std::nullptr_t) { return !(o == nullptr); } template <typename T, jobject (JNIEnv::*NewRef)(jobject), void (JNIEnv::*DeleteRef)(jobject)> bool operator!=(std::nullptr_t, const ObjectRef<T, NewRef, DeleteRef>& o) { return !(o == nullptr); } template <typename T> using GlobalRef = ObjectRef<T, &JNIEnv::NewGlobalRef, &JNIEnv::DeleteGlobalRef>; template <typename T> using LocalRef = ObjectRef<T, &JNIEnv::NewLocalRef, &JNIEnv::DeleteLocalRef>; template <typename R> class Field { public: Field() = default; R Get(jobject obj) const { JNIEnv* env = GetEnv(); R r = (env->*TypedMethod<R>::GetField)(obj, fieldID); CheckJavaException(env, true); return r; } void Set(jobject obj, R value) { JNIEnv* env = GetEnv(); (env->*TypedMethod<R>::SetField)(obj, fieldID, value); CheckJavaException(env, true); } private: Field(jfieldID f) : fieldID(f) { } jfieldID fieldID = nullptr; friend class JavaClass; }; template <typename R> class StaticField { public: StaticField() = default; R Get() const { JNIEnv* env = GetEnv(); R r = (env->*TypedMethod<R>::GetStaticField)(clazz, fieldID); CheckJavaException(env, true); return r; } void Set(R value) { JNIEnv* env = GetEnv(); (env->*TypedMethod<R>::SetStaticField)(clazz, fieldID, value); CheckJavaException(env, true); } private: StaticField(const GlobalRef<jclass>& c, jfieldID f) : clazz(c) , fieldID(f) { } GlobalRef<jclass> clazz; jfieldID fieldID = nullptr; friend class JavaClass; }; class JavaClass { public: JavaClass() = default; JavaClass(const char8* className) : clazz(LoadJavaClass(className, true)) { } JavaClass(const String& className) : JavaClass(className.c_str()) { } JavaClass(const JavaClass& other) = default; JavaClass& operator=(const JavaClass& other) = default; JavaClass(JavaClass&& other) = default; JavaClass& operator=(JavaClass&& other) = default; ~JavaClass() = default; operator jclass() const; template <typename R, typename... Args> Function<R(Args...)> GetConstructor() const; template <typename R, typename... Args> Function<R(jobject, Args...)> GetMethod(const char8* name) const; template <typename R, typename... Args> Function<R(Args...)> GetStaticMethod(const char8* name) const; template <typename R> Field<R> GetField(const char8* name) const; template <typename R> StaticField<R> GetStaticField(const char8* name) const; private: template <typename R, typename... Args> struct ConstructorCaller { ConstructorCaller(const GlobalRef<jclass>& c, jmethodID m) : clazz(c) , methodID(m) { } R operator()(Args... args) const { JNIEnv* env = GetEnv(); jobject r = env->NewObject(clazz, methodID, args...); CheckJavaException(env, true); return static_cast<R>(r); } GlobalRef<jclass> clazz; jmethodID methodID = nullptr; }; template <typename R, typename... Args> struct MethodCaller { MethodCaller(jmethodID m) : methodID(m) { } R operator()(jobject object, Args... args) const { JNIEnv* env = GetEnv(); R r = static_cast<R>((env->*TypedMethod<R>::Call)(object, methodID, args...)); CheckJavaException(env, true); return r; } jmethodID methodID = nullptr; }; template <typename... Args> struct MethodCaller<void, Args...> { MethodCaller(jmethodID m) : methodID(m) { } void operator()(jobject object, Args... args) const { JNIEnv* env = GetEnv(); (env->*TypedMethod<void>::Call)(object, methodID, args...); CheckJavaException(env, true); } jmethodID methodID = nullptr; }; template <typename R, typename... Args> struct StaticMethodCaller { StaticMethodCaller(const GlobalRef<jclass>& c, jmethodID m) : clazz(c) , methodID(m) { } R operator()(Args... args) const { JNIEnv* env = GetEnv(); R r = static_cast<R>((env->*TypedMethod<R>::CallStatic)(clazz, methodID, args...)); CheckJavaException(env, true); return r; } GlobalRef<jclass> clazz; jmethodID methodID = nullptr; }; template <typename... Args> struct StaticMethodCaller<void, Args...> { StaticMethodCaller(const GlobalRef<jclass>& c, jmethodID m) : clazz(c) , methodID(m) { } void operator()(Args... args) const { JNIEnv* env = GetEnv(); (env->*TypedMethod<void>::CallStatic)(clazz, methodID, args...); CheckJavaException(env, true); } GlobalRef<jclass> clazz; jmethodID methodID = nullptr; }; private: GlobalRef<jclass> clazz; }; inline JavaClass::operator jclass() const { return clazz; } template <typename R, typename... Args> Function<R(Args...)> JavaClass::GetConstructor() const { static_assert(std::is_base_of<std::remove_pointer_t<jobject>, std::remove_pointer_t<R>>::value, "T must be jobject or jobject-based type"); JNIEnv* env = GetEnv(); jmethodID method = env->GetMethodID(clazz, "<init>", TypeSignature<void(Args...)>::value()); CheckJavaException(env, true); return Function<R(Args...)>(ConstructorCaller<R, Args...>(clazz, method)); } template <typename R, typename... Args> Function<R(jobject, Args...)> JavaClass::GetMethod(const char8* name) const { JNIEnv* env = GetEnv(); jmethodID method = env->GetMethodID(clazz, name, TypeSignature<R(Args...)>::value()); CheckJavaException(env, true); return Function<R(jobject, Args...)>(MethodCaller<R, Args...>(method)); } template <typename R, typename... Args> Function<R(Args...)> JavaClass::GetStaticMethod(const char8* name) const { JNIEnv* env = GetEnv(); jmethodID method = env->GetStaticMethodID(clazz, name, TypeSignature<R(Args...)>::value()); CheckJavaException(env, true); return Function<R(Args...)>(StaticMethodCaller<R, Args...>(clazz, method)); } template <typename R> Field<R> JavaClass::GetField(const char8* name) const { JNIEnv* env = GetEnv(); jfieldID field = env->GetFieldID(clazz, name, TypeSignature<R>::value()); CheckJavaException(env, true); return Field<R>(field); } template <typename R> StaticField<R> JavaClass::GetStaticField(const char8* name) const { JNIEnv* env = GetEnv(); jfieldID field = env->GetStaticFieldID(clazz, name, TypeSignature<R>::value()); CheckJavaException(env, true); return StaticField<R>(clazz, field); } } // namespace JNI } // namespace DAVA #endif // __DAVAENGINE_ANDROID__
29.120069
143
0.620133
[ "object" ]